@ztocwst/rc-pro-materials 0.2.23 → 0.2.25

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 (75) 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 +5 -5
  6. package/build/lowcode/view.js +5 -5
  7. package/dist/SCM_Comps.js +3 -3
  8. package/dist/SCM_Comps.js.map +1 -1
  9. package/es/components/z-data-table/components/custom-renderer/index.d.ts +4 -0
  10. package/es/components/{z-templates-data-common → z-data-table}/components/custom-renderer/index.js +28 -18
  11. package/{lib/components/z-templates-data-common → es/components/z-data-table}/components/dim-target/dim-target.helper.d.ts +1 -1
  12. package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/index.js +1 -1
  13. package/es/components/z-data-table/components/link-renderer/index.d.ts +16 -0
  14. package/es/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.js +5 -2
  15. package/es/components/z-data-table/components/table-renderer/index.d.ts +4 -0
  16. package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/index.js +88 -87
  17. package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.d.ts +9 -9
  18. package/es/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.js +1 -1
  19. package/es/components/z-data-table/data-table.d.ts +120 -0
  20. package/es/components/{z-templates-data-common/data-common.helper.js → z-data-table/data-table.helper.js} +1 -1
  21. package/es/components/z-data-table/data-table.js +52 -0
  22. package/es/components/z-data-table/index.d.ts +7 -0
  23. package/es/components/z-data-table/index.js +5 -0
  24. package/es/components/z-templates-data-common/components/chart-renderer/index.d.ts +1 -1
  25. package/es/components/z-templates-data-common/components/chart-renderer/index.js +18 -9
  26. package/es/components/z-templates-data-common/data-common.d.ts +2 -111
  27. package/es/components/z-templates-data-common/data-common.js +10 -11
  28. package/es/index.d.ts +2 -0
  29. package/es/index.js +2 -0
  30. package/es/style.js +4 -4
  31. package/es/utils/props/form.js +5 -2
  32. package/lib/components/z-data-table/components/custom-renderer/index.d.ts +4 -0
  33. package/lib/components/{z-templates-data-common → z-data-table}/components/custom-renderer/index.js +30 -20
  34. package/{es/components/z-templates-data-common → lib/components/z-data-table}/components/dim-target/dim-target.helper.d.ts +1 -1
  35. package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/index.js +3 -3
  36. package/lib/components/z-data-table/components/link-renderer/index.d.ts +16 -0
  37. package/lib/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.js +18 -15
  38. package/lib/components/z-data-table/components/table-renderer/index.d.ts +4 -0
  39. package/lib/components/{z-templates-data-common → z-data-table}/components/table-renderer/index.js +96 -95
  40. package/lib/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.d.ts +9 -9
  41. package/lib/components/{z-templates-data-common → z-data-table}/components/table-renderer/table-renderer.helper.js +12 -12
  42. package/lib/components/z-data-table/data-table.d.ts +120 -0
  43. package/lib/components/{z-templates-data-common/data-common.helper.js → z-data-table/data-table.helper.js} +1 -1
  44. package/lib/components/z-data-table/data-table.js +58 -0
  45. package/lib/components/z-data-table/index.d.ts +7 -0
  46. package/lib/components/z-data-table/index.js +14 -0
  47. package/lib/components/z-templates-data-common/components/chart-renderer/index.d.ts +1 -1
  48. package/lib/components/z-templates-data-common/components/chart-renderer/index.js +24 -15
  49. package/lib/components/z-templates-data-common/data-common.d.ts +2 -111
  50. package/lib/components/z-templates-data-common/data-common.js +10 -10
  51. package/lib/index.d.ts +2 -0
  52. package/lib/index.js +3 -1
  53. package/lib/style.js +2 -2
  54. package/lib/utils/props/form.js +5 -2
  55. package/package.json +3 -3
  56. package/es/components/z-templates-data-common/components/custom-renderer/index.d.ts +0 -13
  57. package/es/components/z-templates-data-common/components/link-renderer/index.d.ts +0 -16
  58. package/es/components/z-templates-data-common/components/table-renderer/index.d.ts +0 -6
  59. package/lib/components/z-templates-data-common/components/custom-renderer/index.d.ts +0 -13
  60. package/lib/components/z-templates-data-common/components/link-renderer/index.d.ts +0 -16
  61. package/lib/components/z-templates-data-common/components/table-renderer/index.d.ts +0 -6
  62. /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/dim-target.helper.js +0 -0
  63. /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/index.d.ts +0 -0
  64. /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/index.less +0 -0
  65. /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/useUpdateEffect.d.ts +0 -0
  66. /package/es/components/{z-templates-data-common → z-data-table}/components/dim-target/useUpdateEffect.js +0 -0
  67. /package/es/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.less +0 -0
  68. /package/es/components/{z-templates-data-common/data-common.helper.d.ts → z-data-table/data-table.helper.d.ts} +0 -0
  69. /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/dim-target.helper.js +0 -0
  70. /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/index.d.ts +0 -0
  71. /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/index.less +0 -0
  72. /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/useUpdateEffect.d.ts +0 -0
  73. /package/lib/components/{z-templates-data-common → z-data-table}/components/dim-target/useUpdateEffect.js +0 -0
  74. /package/lib/components/{z-templates-data-common → z-data-table}/components/link-renderer/index.less +0 -0
  75. /package/lib/components/{z-templates-data-common/data-common.helper.d.ts → z-data-table/data-table.helper.d.ts} +0 -0
@@ -0,0 +1,120 @@
1
+ import React from 'react';
2
+ import type { linkParamsType } from './components/link-renderer';
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 TypeZDataTableProps {
38
+ /** 标题 */
39
+ title?: string;
40
+ /** 二级页标题 */
41
+ chartTitle?: string;
42
+ /** 自定义渲染 */
43
+ custom?: boolean;
44
+ /** 自定义渲染方法 */
45
+ child?: (p: any) => React.ReactNode;
46
+ /** 维度配置 */
47
+ dimJson?: {
48
+ /** 维度标题 */
49
+ title: string;
50
+ /** 维度项配置 */
51
+ data: Array<Omit<TypeTargetProps, 'amounted' | 'enName' | 'isFilter'>>;
52
+ };
53
+ /** 指标配置 */
54
+ indexJson: {
55
+ title: string;
56
+ /** 指标项配置 */
57
+ data: TypeTargetProps[];
58
+ };
59
+ dataSetName: string;
60
+ /** 自动请求 */
61
+ autoLoad: boolean;
62
+ /** 刷新时间 */
63
+ refreshRate?: number;
64
+ /** 记住勾选 */
65
+ remember?: boolean;
66
+ /** 操作列(表头)配置 */
67
+ actionJson?: {
68
+ /** 表头名称 */
69
+ title: string;
70
+ /** 宽度 */
71
+ width?: number;
72
+ /** 固定列 */
73
+ isFixed: boolean;
74
+ /** 固定到 */
75
+ fixed?: string;
76
+ /** 自定义渲染 */
77
+ custom: boolean;
78
+ /** 自定义渲染方法 */
79
+ render?: (p: any) => React.ReactNode;
80
+ };
81
+ confirmConfig?: {
82
+ name?: string;
83
+ onClick?: () => void;
84
+ };
85
+ /** 导出 */
86
+ exporter?: boolean;
87
+ /** 导出配置 */
88
+ exportConfig?: {
89
+ name: string;
90
+ code: string;
91
+ menuId: string;
92
+ };
93
+ /** 条件格式设置 */
94
+ expressions?: any[] | [];
95
+ linkPageTitle?: string;
96
+ /** 下钻二级页设置 */
97
+ linkPage?: TypeZDataTableProps[];
98
+ /** 数据源参数"键"" 和 查询参数"值" 和 上一级维度(dim)"值" 关系绑定 */
99
+ queryBind?: Array<{
100
+ sourceQueryKey: string;
101
+ currentQueryKey: string;
102
+ parentDimKey: string;
103
+ }>;
104
+ /** chartRef */
105
+ chartRef?: React.Ref<{
106
+ onLink?: (v: linkParamsType) => void;
107
+ queryChart: (v: Record<string, any>, d: string | undefined) => void;
108
+ }>;
109
+ /** 确认 */
110
+ onConfirm?: () => void;
111
+ /** 查询参数转换 */
112
+ formatter?: (v: Record<string, any>) => Record<string, any>;
113
+ /** 当前展示报表唯一标识 */
114
+ currentKey?: string;
115
+ }
116
+ export default class ZDataTableContainer extends React.Component<TypeZDataTableProps, any> {
117
+ chartRef: any;
118
+ constructor(props: TypeZDataTableProps);
119
+ render(): JSX.Element;
120
+ }
@@ -175,7 +175,7 @@ export var handleCondition = function handleCondition(value, handledValue, condi
175
175
  };
176
176
 
177
177
  // mock
178
- var token = 'scm:tenant:token:2:104:4EE94781916163519F3A5744296BAD40';
178
+ var token = 'scm:tenant:token:2:104:7c454641-c65c-4459-b5a3-d4be9fb16ffd';
179
179
 
180
180
  /** 获取维度指标 */
181
181
  export var getDimTarget = /*#__PURE__*/function () {
@@ -0,0 +1,52 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import React, { useRef, useImperativeHandle } from 'react';
4
+ import TableRenderer from "./components/table-renderer";
5
+ import CustomRenderer from "./components/custom-renderer";
6
+
7
+ /** 指标配置 */
8
+
9
+ /** 表格相关配置 */
10
+
11
+ var ZDataTable = /*#__PURE__*/React.forwardRef(function (props, ref) {
12
+ // console.log(props)
13
+
14
+ var chartRef = useRef();
15
+ var onLink = function onLink(values) {
16
+ var _chartRef$current, _chartRef$current$onL;
17
+ return (_chartRef$current = chartRef.current) === null || _chartRef$current === void 0 ? void 0 : (_chartRef$current$onL = _chartRef$current.onLink) === null || _chartRef$current$onL === void 0 ? void 0 : _chartRef$current$onL.call(_chartRef$current, values);
18
+ };
19
+ var queryChart = function queryChart(values) {
20
+ var _chartRef$current2, _chartRef$current2$qu;
21
+ return (_chartRef$current2 = chartRef.current) === null || _chartRef$current2 === void 0 ? void 0 : (_chartRef$current2$qu = _chartRef$current2.queryChart) === null || _chartRef$current2$qu === void 0 ? void 0 : _chartRef$current2$qu.call(_chartRef$current2, values);
22
+ };
23
+ useImperativeHandle(ref, function () {
24
+ return {
25
+ onLink: onLink,
26
+ queryChart: queryChart
27
+ };
28
+ });
29
+ return props !== null && props !== void 0 && props.custom ? /*#__PURE__*/React.createElement(CustomRenderer, _extends({
30
+ chartRef: chartRef
31
+ }, props)) : /*#__PURE__*/React.createElement(TableRenderer, _extends({
32
+ chartRef: chartRef
33
+ }, props));
34
+ });
35
+ var ZDataTableContainer = /*#__PURE__*/function (_React$Component) {
36
+ _inheritsLoose(ZDataTableContainer, _React$Component);
37
+ function ZDataTableContainer(props) {
38
+ var _this;
39
+ _this = _React$Component.call(this, props) || this;
40
+ _this.chartRef = void 0;
41
+ _this.chartRef = /*#__PURE__*/React.createRef();
42
+ return _this;
43
+ }
44
+ var _proto = ZDataTableContainer.prototype;
45
+ _proto.render = function render() {
46
+ return /*#__PURE__*/React.createElement(ZDataTable, _extends({}, this.props, {
47
+ ref: this.chartRef
48
+ }));
49
+ };
50
+ return ZDataTableContainer;
51
+ }(React.Component);
52
+ export { ZDataTableContainer as default };
@@ -0,0 +1,7 @@
1
+ import ZDataTable from './data-table';
2
+ export type { TypeZDataTableProps } from './data-table';
3
+ export type { linkParamsType } from './components/link-renderer';
4
+ export { default as TableRenderer } from './components/table-renderer';
5
+ export { default as CustomRenderer } from './components/custom-renderer';
6
+ export { default as LinkRenderer } from './components/link-renderer';
7
+ export default ZDataTable;
@@ -0,0 +1,5 @@
1
+ import ZDataTable from "./data-table";
2
+ export { default as TableRenderer } from "./components/table-renderer";
3
+ export { default as CustomRenderer } from "./components/custom-renderer";
4
+ export { default as LinkRenderer } from "./components/link-renderer";
5
+ export default ZDataTable;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { TypeZTemplatesDataCommonProps } from '../../data-common';
3
- import type { linkParamsType } from '../link-renderer';
3
+ import type { linkParamsType } from '../../../z-data-table';
4
4
  export interface ChartRendererProps {
5
5
  chartSetting?: Pick<TypeZTemplatesDataCommonProps, 'chartSetting'>;
6
6
  chartRenderRef?: React.Ref<{
@@ -1,9 +1,8 @@
1
1
  import _Tabs from "antd/es/tabs";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
4
- import { separator } from "../../data-common.helper";
5
- import TableRenderer from "../table-renderer";
6
- import CustomRenderer from "../custom-renderer";
4
+ import { separator } from "../../../z-data-table/data-table.helper";
5
+ import { TableRenderer, CustomRenderer } from "../../../z-data-table";
7
6
  var ChartRenderer = function ChartRenderer(_ref) {
8
7
  var chartRenderRef = _ref.chartRenderRef,
9
8
  chartSetting = _ref.chartSetting,
@@ -30,6 +29,9 @@ var ChartRenderer = function ChartRenderer(_ref) {
30
29
  (_chartRef$current$act3 = _chartRef.current[activeKey]) === null || _chartRef$current$act3 === void 0 ? void 0 : (_chartRef$current$act4 = _chartRef$current$act3.queryChart) === null || _chartRef$current$act4 === void 0 ? void 0 : _chartRef$current$act4.call(_chartRef$current$act3, values);
31
30
  }
32
31
  };
32
+ var getCurrentKey = function getCurrentKey() {
33
+ return activeKey;
34
+ };
33
35
  useEffect(function () {
34
36
  if (isObject && ! /*#__PURE__*/React.isValidElement(chartSetting)) {
35
37
  setActiveKey(chartSetting === null || chartSetting === void 0 ? void 0 : chartSetting.dataSetName);
@@ -50,7 +52,8 @@ var ChartRenderer = function ChartRenderer(_ref) {
50
52
  useImperativeHandle(chartRenderRef, function () {
51
53
  return {
52
54
  onLink: onLink,
53
- queryChart: queryChart
55
+ queryChart: queryChart,
56
+ getCurrentKey: getCurrentKey
54
57
  };
55
58
  });
56
59
 
@@ -68,8 +71,14 @@ var ChartRenderer = function ChartRenderer(_ref) {
68
71
 
69
72
  // 普通列表json对象
70
73
  if (isObject) {
71
- return /*#__PURE__*/React.createElement(TableRenderer, _extends({}, chartSetting, {
72
- activeKey: activeKey,
74
+ return chartSetting !== null && chartSetting !== void 0 && chartSetting.custom ? /*#__PURE__*/React.createElement(CustomRenderer, _extends({}, chartSetting, {
75
+ currentKey: activeKey,
76
+ chartRef: function chartRef(ref) {
77
+ _chartRef.current[chartSetting === null || chartSetting === void 0 ? void 0 : chartSetting.dataSetName] = ref;
78
+ },
79
+ onConfirm: onConfirm
80
+ })) : /*#__PURE__*/React.createElement(TableRenderer, _extends({}, chartSetting, {
81
+ currentKey: activeKey,
73
82
  chartRef: function chartRef(ref) {
74
83
  _chartRef.current[chartSetting === null || chartSetting === void 0 ? void 0 : chartSetting.dataSetName] = ref;
75
84
  },
@@ -84,18 +93,18 @@ var ChartRenderer = function ChartRenderer(_ref) {
84
93
  return /*#__PURE__*/React.createElement(_Tabs, {
85
94
  activeKey: activeKey,
86
95
  onChange: handleTabsChange
87
- }, chartSetting.map(function (e, i) {
96
+ }, chartSetting === null || chartSetting === void 0 ? void 0 : chartSetting.map(function (e, i) {
88
97
  return /*#__PURE__*/React.createElement(_Tabs.TabPane, {
89
98
  tab: "" + ((e === null || e === void 0 ? void 0 : e.title) || ''),
90
99
  key: "" + (e === null || e === void 0 ? void 0 : e.dataSetName) + separator + i.toString()
91
100
  }, e !== null && e !== void 0 && e.custom ? /*#__PURE__*/React.createElement(CustomRenderer, _extends({}, e, {
92
- activeKey: activeKey,
101
+ currentKey: activeKey,
93
102
  chartRef: function chartRef(ref) {
94
103
  _chartRef.current["" + (e === null || e === void 0 ? void 0 : e.dataSetName) + separator + i] = ref;
95
104
  },
96
105
  onConfirm: onConfirm
97
106
  })) : /*#__PURE__*/React.createElement(TableRenderer, _extends({}, e, {
98
- activeKey: activeKey,
107
+ currentKey: activeKey,
99
108
  chartRef: function chartRef(ref) {
100
109
  _chartRef.current["" + (e === null || e === void 0 ? void 0 : e.dataSetName) + separator + i] = ref;
101
110
  },
@@ -1,120 +1,11 @@
1
1
  import React from 'react';
2
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
- chartTitle?: string;
40
- /** 自定义渲染 */
41
- custom?: boolean;
42
- /** 自定义渲染方法 */
43
- child?: (p: any) => React.ReactNode;
44
- /** 标题 */
45
- title?: string;
46
- /** 维度配置 */
47
- dimJson?: {
48
- /** 维度标题 */
49
- title: string;
50
- /** 维度项配置 */
51
- data: Array<Omit<TypeTargetProps, 'amounted' | 'enName' | 'isFilter'>>;
52
- };
53
- /** 指标配置 */
54
- indexJson: {
55
- title: string;
56
- /** 指标项配置 */
57
- data: TypeTargetProps[];
58
- };
59
- dataSetName: string;
60
- /** 自动请求 */
61
- autoLoad: boolean;
62
- /** 刷新时间 */
63
- refreshRate?: number;
64
- /** 记住勾选 */
65
- remember?: boolean;
66
- /** 导出 */
67
- exporter?: boolean;
68
- /** 操作列(表头)配置 */
69
- actionJson?: {
70
- /** 表头名称 */
71
- title: string;
72
- /** 宽度 */
73
- width?: number;
74
- /** 固定列 */
75
- isFixed: boolean;
76
- /** 固定到 */
77
- fixed?: string;
78
- /** 自定义渲染 */
79
- custom: boolean;
80
- /** 自定义渲染方法 */
81
- render?: (p: any) => React.ReactNode;
82
- };
83
- /** 导出配置 */
84
- exportConfig?: {
85
- name: string;
86
- code: string;
87
- menuId: string;
88
- };
89
- /** 条件格式设置 */
90
- expressions?: any[] | [];
91
- linkPageTitle?: string;
92
- /** 下钻二级页设置 */
93
- linkPage?: TypeChartSettingProps[];
94
- /** 数据源参数"键"" 和 查询参数"值" 和 上一级维度(dim)"值" 关系绑定 */
95
- queryBind?: Array<{
96
- sourceQueryKey: string;
97
- currentQueryKey: string;
98
- parentDimKey: string;
99
- }>;
100
- /** chartRef */
101
- chartRef?: React.Ref<{
102
- queryChart: (v: Record<string, any>, d: string | undefined) => void;
103
- }>;
104
- /** 确认 */
105
- onConfirm?: () => void;
106
- /** 查询参数转换 */
107
- formatter?: (v: Record<string, any>) => Record<string, any>;
108
- }
3
+ import type { TypeZDataTableProps } from '../z-data-table';
109
4
  export interface TypeZTemplatesDataCommonProps {
110
5
  /** 查询表单配置 */
111
6
  querySetting: ProFormRenderProps;
112
7
  /** 内容区配置 */
113
- chartSetting: TypeChartSettingProps | Array<TypeChartSettingProps & {
114
- custom: boolean;
115
- child: (p: any) => React.ReactNode;
116
- title: string;
117
- }> | React.ReactNode;
8
+ chartSetting: TypeZDataTableProps | TypeZDataTableProps[] | React.ReactNode;
118
9
  _unsafe_MixedSetter_chartSetting_select?: any;
119
10
  }
120
11
  export default class ZTemplatesDataCommonContainer extends React.Component<TypeZTemplatesDataCommonProps, any> {
@@ -7,15 +7,10 @@ import React, { useRef, useImperativeHandle } from 'react';
7
7
  import { ProFormRender } from '@ztocwst/rc-pro';
8
8
  import ChartRenderer from "./components/chart-renderer";
9
9
  import { processFormProps } from "../../utils";
10
-
11
- /** 指标配置 */
12
-
13
- /** 表格相关配置 */
14
-
15
10
  var ZTemplatesDataCommon = /*#__PURE__*/React.forwardRef(function (props, ref) {
16
11
  var querySetting = props.querySetting,
12
+ chartSetting = props.chartSetting,
17
13
  _unsafe_MixedSetter_chartSetting_select = props._unsafe_MixedSetter_chartSetting_select;
18
- var chartSetting = props.chartSetting;
19
14
  var formRef = useRef();
20
15
  var chartRenderRef = useRef();
21
16
  // todo 不知道meta里是哪里配置有问题,出现_unsafe_MixedSetter...
@@ -63,6 +58,10 @@ var ZTemplatesDataCommon = /*#__PURE__*/React.forwardRef(function (props, ref) {
63
58
  return _ref2.apply(this, arguments);
64
59
  };
65
60
  }();
61
+ var getCurrentKey = function getCurrentKey() {
62
+ var _chartRenderRef$curre, _chartRenderRef$curre2;
63
+ return (_chartRenderRef$curre = chartRenderRef.current) === null || _chartRenderRef$curre === void 0 ? void 0 : (_chartRenderRef$curre2 = _chartRenderRef$curre.getCurrentKey) === null || _chartRenderRef$curre2 === void 0 ? void 0 : _chartRenderRef$curre2.call(_chartRenderRef$curre);
64
+ };
66
65
  var onConfirm = /*#__PURE__*/function () {
67
66
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
68
67
  var values;
@@ -92,22 +91,22 @@ var ZTemplatesDataCommon = /*#__PURE__*/React.forwardRef(function (props, ref) {
92
91
  };
93
92
  }();
94
93
  var onLink = function onLink(values) {
95
- var _chartRenderRef$curre, _chartRenderRef$curre2;
96
- return (_chartRenderRef$curre = chartRenderRef.current) === null || _chartRenderRef$curre === void 0 ? void 0 : (_chartRenderRef$curre2 = _chartRenderRef$curre.onLink) === null || _chartRenderRef$curre2 === void 0 ? void 0 : _chartRenderRef$curre2.call(_chartRenderRef$curre, values);
94
+ var _chartRenderRef$curre3, _chartRenderRef$curre4;
95
+ return (_chartRenderRef$curre3 = chartRenderRef.current) === null || _chartRenderRef$curre3 === void 0 ? void 0 : (_chartRenderRef$curre4 = _chartRenderRef$curre3.onLink) === null || _chartRenderRef$curre4 === void 0 ? void 0 : _chartRenderRef$curre4.call(_chartRenderRef$curre3, values);
97
96
  };
98
97
  useImperativeHandle(ref, function () {
99
98
  return {
100
99
  formRef: formRef,
101
100
  onLink: onLink,
102
101
  onQueryValues: onQueryValues,
103
- onQueryFormatValues: onQueryFormatValues
102
+ onQueryFormatValues: onQueryFormatValues,
103
+ getCurrentKey: getCurrentKey
104
104
  };
105
105
  });
106
106
  var formProps = processFormProps(querySetting);
107
- console.log("formProps", formProps);
107
+ // console.log(`formProps`, formProps);
108
108
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ProFormRender, _extends({}, formProps, {
109
109
  formRef: formRef,
110
- onValuesChange: function onValuesChange(changeValues) {},
111
110
  onFinish: /*#__PURE__*/function () {
112
111
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(formatData) {
113
112
  var _formProps$onFinish;
package/es/index.d.ts CHANGED
@@ -34,6 +34,8 @@ export { default as ZPointerBlock } from './components/z-pointer-block';
34
34
  export type { TypeZPointerBlockProps } from './components/z-pointer-block';
35
35
  export { default as ZAggBlock } from './components/z-agg-block';
36
36
  export type { TypeAggBlockProps } from './components/z-agg-block';
37
+ export { default as ZDataTable } from './components/z-data-table';
38
+ export type { TypeZDataTableProps } from './components/z-data-table';
37
39
  export { default as ZTemplatesDataCommon } from './components/z-templates-data-common';
38
40
  export type { TypeZTemplatesDataCommonProps } from './components/z-templates-data-common';
39
41
  export { default as ZSlick } from './components/z-slick';
package/es/index.js CHANGED
@@ -22,6 +22,8 @@ export { default as ZOperationRecords } from "./components/z-operation-records";
22
22
  export { default as ZPointerBlock } from "./components/z-pointer-block";
23
23
  // 聚合指标
24
24
  export { default as ZAggBlock } from "./components/z-agg-block";
25
+ // 数据表格
26
+ export { default as ZDataTable } from "./components/z-data-table";
25
27
  export { default as ZTemplatesDataCommon } from "./components/z-templates-data-common";
26
28
  export { default as ZSlick } from "./components/z-slick";
27
29
 
package/es/style.js CHANGED
@@ -6,11 +6,11 @@ import 'antd/lib/config-provider/style';
6
6
  import 'antd/es/config-provider/style';
7
7
  import 'antd/lib/row/style';
8
8
  import 'antd/lib/col/style';
9
- import 'antd/lib/message/style';
10
- import 'antd/lib/tabs/style';
11
9
  import 'antd/lib/checkbox/style';
12
10
  import 'antd/lib/spin/style';
13
11
  import 'antd/lib/radio/style';
12
+ import 'antd/lib/message/style';
13
+ import 'antd/lib/tabs/style';
14
14
  import 'antd/lib/carousel/style';
15
15
  import 'antd/es/statistic/style';
16
16
  import 'antd/es/progress/style';
@@ -18,10 +18,10 @@ import 'antd/es/table/style';
18
18
  import 'antd/es/typography/style';
19
19
  import 'antd/es/row/style';
20
20
  import 'antd/es/col/style';
21
- import 'antd/es/message/style';
22
- import 'antd/es/tabs/style';
23
21
  import 'antd/es/checkbox/style';
24
22
  import 'antd/es/spin/style';
25
23
  import 'antd/es/radio/style';
24
+ import 'antd/es/message/style';
25
+ import 'antd/es/tabs/style';
26
26
  import 'antd/es/carousel/style';
27
27
  import './index.scss';
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutP
3
3
  var _excluded = ["fieldProps", "formItemProps", "dependencyColumns", "required", "initialValue"],
4
4
  _excluded2 = ["restFieldProps", "renderItemSlot"],
5
5
  _excluded3 = ["restFormProps"],
6
- _excluded4 = ["fieldProps"],
6
+ _excluded4 = ["fieldProps", "hideInDependency"],
7
7
  _excluded5 = ["requestOptions"],
8
8
  _excluded6 = ["columns", "switchGroup"];
9
9
  /**
@@ -62,10 +62,13 @@ var processInitialValue = function processInitialValue(e) {
62
62
  }
63
63
  var childRest = processInitialValue(child);
64
64
  var childFieldProps = childRest.fieldProps,
65
+ hideInDependency = childRest.hideInDependency,
65
66
  childItemRest = _objectWithoutPropertiesLoose(childRest, _excluded4);
66
67
  var requestOptions = childFieldProps.requestOptions,
67
68
  childRestFieldProps = _objectWithoutPropertiesLoose(childFieldProps, _excluded5);
68
- return _extends({}, childItemRest, {
69
+ return _extends({}, hideInDependency ? {
70
+ hideInForm: !hideInDependency(obj)
71
+ } : {}, childItemRest, {
69
72
  fieldProps: _extends({}, childRestFieldProps, (childRest === null || childRest === void 0 ? void 0 : childRest.valueType) === 'asyncSelect' &&
70
73
  // 接口请求前置校验, 通过请求 asyncSelect 接口
71
74
  requestOptionsCheck(childRestFieldProps === null || childRestFieldProps === void 0 ? void 0 : childRestFieldProps.requestOptionsCheck, obj) ? {
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type { TypeZDataTableProps } from '../../data-table';
3
+ declare const CustomRenderer: (props: TypeZDataTableProps) => import("react").JSX.Element;
4
+ export default CustomRenderer;
@@ -9,7 +9,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _react = require("react");
11
11
  var _rcPro = require("@ztocwst/rc-pro");
12
- var _dataCommon = require("../../data-common.helper");
12
+ var _dataTable = require("../../data-table.helper");
13
13
  var _linkRenderer = _interopRequireDefault(require("../link-renderer"));
14
14
  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."); }
15
15
  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); }
@@ -17,7 +17,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
17
17
  var CustomRenderer = function CustomRenderer(props) {
18
18
  var _props$child;
19
19
  var _ref = props || {},
20
- activeKey = _ref.activeKey,
20
+ currentKey = _ref.currentKey,
21
21
  autoLoad = _ref.autoLoad,
22
22
  refreshRate = _ref.refreshRate,
23
23
  dataSetName = _ref.dataSetName,
@@ -25,6 +25,7 @@ var CustomRenderer = function CustomRenderer(props) {
25
25
  indexJson = _ref.indexJson,
26
26
  linkPage = _ref.linkPage,
27
27
  linkPageTitle = _ref.linkPageTitle,
28
+ chartRef = _ref.chartRef,
28
29
  onConfirm = _ref.onConfirm,
29
30
  formatter = _ref.formatter;
30
31
  var rcProContext = (0, _react.useContext)(_rcPro.RcConfigContext);
@@ -65,7 +66,7 @@ var CustomRenderer = function CustomRenderer(props) {
65
66
  });
66
67
  }
67
68
  }
68
- queryParams = (0, _dataCommon.handleQueryParams)(query);
69
+ queryParams = (0, _dataTable.handleQueryParams)(query);
69
70
  data = {
70
71
  target: target,
71
72
  queryParams: queryParams,
@@ -73,7 +74,7 @@ var CustomRenderer = function CustomRenderer(props) {
73
74
  };
74
75
  setLoading(true);
75
76
  _context.next = 9;
76
- return (0, _dataCommon.getReportData)(rcProContext, formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data);
77
+ return (0, _dataTable.getReportData)(rcProContext, formatter ? formatter === null || formatter === void 0 ? void 0 : formatter(data) : data);
77
78
  case 9:
78
79
  res = _context.sent;
79
80
  setLoading(false);
@@ -126,28 +127,37 @@ var CustomRenderer = function CustomRenderer(props) {
126
127
  timer = null;
127
128
  }
128
129
  };
129
- (0, _react.useEffect)(function () {
130
- var _ref4 = (activeKey === null || activeKey === void 0 ? void 0 : activeKey.split(_dataCommon.separator)) || [],
131
- currentKey = _ref4[0];
132
- if (currentKey === dataSetName) {
133
- if (autoLoad) {
134
- if (refreshRate) {
135
- handleClearInterval();
136
- timer = window.setInterval(function () {
137
- return onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
138
- }, refreshRate * _dataCommon.timeUnit);
139
- } else {
140
- onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
141
- }
130
+ var onload = function onload() {
131
+ if (autoLoad) {
132
+ if (refreshRate) {
133
+ handleClearInterval();
134
+ timer = window.setInterval(function () {
135
+ return onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
136
+ }, refreshRate * _dataTable.timeUnit);
137
+ } else {
138
+ onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
142
139
  }
143
140
  } else {
144
141
  handleClearInterval();
145
142
  }
143
+ };
144
+ (0, _react.useEffect)(function () {
145
+ if (currentKey) {
146
+ var _ref4 = currentKey.split(_dataTable.separator) || [],
147
+ curDataSetName = _ref4[0];
148
+ if (curDataSetName === dataSetName) {
149
+ onload();
150
+ } else {
151
+ handleClearInterval();
152
+ }
153
+ } else {
154
+ onload();
155
+ }
146
156
  return function () {
147
157
  handleClearInterval();
148
158
  };
149
- }, [activeKey, autoLoad]);
150
- (0, _react.useImperativeHandle)(props.chartRef, function () {
159
+ }, [currentKey, autoLoad]);
160
+ (0, _react.useImperativeHandle)(chartRef, function () {
151
161
  return {
152
162
  onLink: onLink,
153
163
  queryChart: queryChart
@@ -159,7 +169,7 @@ var CustomRenderer = function CustomRenderer(props) {
159
169
  }
160
170
  }, /*#__PURE__*/React.createElement(_spin["default"], {
161
171
  spinning: loading
162
- }, (_props$child = props.child) === null || _props$child === void 0 ? void 0 : _props$child.call(props, result))), /*#__PURE__*/React.createElement("div", {
172
+ }, props === null || props === void 0 ? void 0 : (_props$child = props.child) === null || _props$child === void 0 ? void 0 : _props$child.call(props, result))), /*#__PURE__*/React.createElement("div", {
163
173
  style: {
164
174
  display: isLink ? 'block' : 'none'
165
175
  }
@@ -1,5 +1,5 @@
1
1
  import type { CheckboxValueType } from 'antd/es/checkbox/Group';
2
- import { TypeTargetProps } from '../../data-common';
2
+ import { TypeTargetProps } from '../../data-table';
3
3
  /**
4
4
  * 维度状态
5
5
  */