@hsu-react/ui 0.0.8 → 0.0.9
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/es/components/Chart/Bar/index.d.ts +5 -1
- package/es/components/Chart/Bar/index.js +84 -9
- package/es/components/Chart/Line/index.d.ts +5 -1
- package/es/components/Chart/Line/index.js +84 -9
- package/es/components/Chart/_utils/autoSmooth.d.ts +2 -0
- package/es/components/Chart/_utils/autoSmooth.js +12 -2
- package/es/components/Chart/_utils/cartesian.d.ts +11 -0
- package/es/components/Chart/_utils/cartesian.js +19 -0
- package/es/components/Chart/chartUtils/chartTooltipFormatter.d.ts +2 -0
- package/es/components/Chart/chartUtils/chartTooltipFormatter.js +13 -3
- package/es/components/Chart/chartUtils/index.d.ts +5 -2
- package/es/components/Chart/chartUtils/index.js +3 -1
- package/es/components/Chart/chartUtils/useDataZoomWindow.d.ts +19 -0
- package/es/components/Chart/chartUtils/useDataZoomWindow.js +37 -0
- package/es/components/Chart/chartUtils/useLegendSelection.d.ts +14 -0
- package/es/components/Chart/chartUtils/useLegendSelection.js +35 -0
- package/es/components/Modal/index.module.scss +1 -0
- package/es/components/Panel/ListPanel/ListModalPanel/index.js +33 -5
- package/es/components/Panel/ListPanel/ListModalPanel/index.module.scss +17 -2
- package/es/components/Panel/ListPanel/index.module.scss +11 -12
- package/lib/components/Chart/Bar/index.d.ts +5 -1
- package/lib/components/Chart/Bar/index.js +68 -4
- package/lib/components/Chart/Line/index.d.ts +5 -1
- package/lib/components/Chart/Line/index.js +68 -4
- package/lib/components/Chart/_utils/autoSmooth.d.ts +2 -0
- package/lib/components/Chart/_utils/autoSmooth.js +11 -1
- package/lib/components/Chart/_utils/cartesian.d.ts +11 -0
- package/lib/components/Chart/_utils/cartesian.js +21 -1
- package/lib/components/Chart/chartUtils/chartTooltipFormatter.d.ts +2 -0
- package/lib/components/Chart/chartUtils/chartTooltipFormatter.js +5 -3
- package/lib/components/Chart/chartUtils/index.d.ts +5 -2
- package/lib/components/Chart/chartUtils/index.js +14 -0
- package/lib/components/Chart/chartUtils/useDataZoomWindow.d.ts +19 -0
- package/lib/components/Chart/chartUtils/useDataZoomWindow.js +31 -0
- package/lib/components/Chart/chartUtils/useLegendSelection.d.ts +14 -0
- package/lib/components/Chart/chartUtils/useLegendSelection.js +26 -0
- package/lib/components/Modal/index.module.scss +1 -0
- package/lib/components/Panel/ListPanel/ListModalPanel/index.js +21 -2
- package/lib/components/Panel/ListPanel/ListModalPanel/index.module.scss +17 -2
- package/lib/components/Panel/ListPanel/index.module.scss +11 -12
- package/package.json +1 -1
- package/src/components/Chart/Bar/index.tsx +132 -2
- package/src/components/Chart/Line/index.tsx +132 -2
- package/src/components/Chart/_utils/autoSmooth.ts +181 -164
- package/src/components/Chart/_utils/cartesian.ts +28 -0
- package/src/components/Chart/chartUtils/chartTooltipFormatter.ts +11 -2
- package/src/components/Chart/chartUtils/index.ts +53 -37
- package/src/components/Chart/chartUtils/useDataZoomWindow.ts +61 -0
- package/src/components/Chart/chartUtils/useLegendSelection.ts +35 -0
- package/src/components/Modal/index.module.scss +1 -0
- package/src/components/Panel/ListPanel/ListModalPanel/index.module.scss +17 -2
- package/src/components/Panel/ListPanel/ListModalPanel/index.tsx +261 -233
- package/src/components/Panel/ListPanel/index.module.scss +11 -12
|
@@ -1,233 +1,261 @@
|
|
|
1
|
-
import React, { ReactNode, useEffect, useMemo, useState } from "react";
|
|
2
|
-
import Search, {
|
|
3
|
-
SearchModeKeys,
|
|
4
|
-
SearchModePropsMap,
|
|
5
|
-
} from "../../../Search";
|
|
6
|
-
import Table, { ColumnsType, TableProps } from "../../../Table";
|
|
7
|
-
|
|
8
|
-
import { ChakraButtonProps as BasicButtonProps } from "../../../Button";
|
|
9
|
-
import { TabBarProps } from "../../../TabBar";
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
1
|
+
import React, { ReactNode, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import Search, {
|
|
3
|
+
SearchModeKeys,
|
|
4
|
+
SearchModePropsMap,
|
|
5
|
+
} from "../../../Search";
|
|
6
|
+
import Table, { ColumnsType, TableProps } from "../../../Table";
|
|
7
|
+
|
|
8
|
+
import { ChakraButtonProps as BasicButtonProps } from "../../../Button";
|
|
9
|
+
import { TabBarProps } from "../../../TabBar";
|
|
10
|
+
import {
|
|
11
|
+
FullscreenExitOutlined,
|
|
12
|
+
FullscreenOutlined,
|
|
13
|
+
} from "@ant-design/icons";
|
|
14
|
+
import classNames from "classnames";
|
|
15
|
+
import { cloneDeep } from "lodash";
|
|
16
|
+
import styles from "./index.module.scss";
|
|
17
|
+
import usePermissions from "../../../../hooks/usePermissions";
|
|
18
|
+
import Modal, { ModalProps } from "../../../Modal";
|
|
19
|
+
import ToolBar from "../_components/ToolBar";
|
|
20
|
+
import ColumnMgt from "../_components/ColumnMgt";
|
|
21
|
+
|
|
22
|
+
interface ButtonProps extends Omit<BasicButtonProps, "children" | "title"> {
|
|
23
|
+
title?: ReactNode;
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface TableTools {
|
|
28
|
+
onTableRefresh?: () => void;
|
|
29
|
+
columnMgt?: IColumnMgt;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ListModalPanelTabelProps extends Omit<TableProps, "title"> {
|
|
33
|
+
title?: string;
|
|
34
|
+
buttonGroup?: ButtonProps[];
|
|
35
|
+
tabBarProps?: TabBarProps;
|
|
36
|
+
tableTools?: TableTools;
|
|
37
|
+
tableContainerClassName?: string;
|
|
38
|
+
tips?: ReactNode;
|
|
39
|
+
otherTool?: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface ColumnMgtDataSource {
|
|
43
|
+
hidden: boolean;
|
|
44
|
+
title: string;
|
|
45
|
+
dataIndex: string;
|
|
46
|
+
sort: number;
|
|
47
|
+
width?: number;
|
|
48
|
+
ellipsis?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface IColumnMgt {
|
|
52
|
+
columnCount?: {
|
|
53
|
+
max?: number;
|
|
54
|
+
min?: number;
|
|
55
|
+
};
|
|
56
|
+
fixedDisplay?: string[];
|
|
57
|
+
fixedPosition?: string[];
|
|
58
|
+
onSelectionChange?: (
|
|
59
|
+
selectedDataIndexes: string[],
|
|
60
|
+
dataSource: Array<ColumnMgtDataSource>,
|
|
61
|
+
) => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface ListModalPanelProps<
|
|
65
|
+
T extends SearchModeKeys = "Default",
|
|
66
|
+
> extends ModalProps {
|
|
67
|
+
modalClassName?: string;
|
|
68
|
+
className?: string;
|
|
69
|
+
searchProps?: SearchModePropsMap[T];
|
|
70
|
+
/** Search 组件模式:default-基础 | Advanced-高级筛选 | Collapsible-可折叠 | WithFilter-带筛选器 | WithMore-带更多项 | Card-卡片式 */
|
|
71
|
+
searchMode?: T;
|
|
72
|
+
tableProps?: ListModalPanelTabelProps;
|
|
73
|
+
hasPermi?: string[];
|
|
74
|
+
extraContent?: ReactNode;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const ListModalPanel: React.FC<ListModalPanelProps<SearchModeKeys>> = (
|
|
78
|
+
props,
|
|
79
|
+
) => {
|
|
80
|
+
const {
|
|
81
|
+
modalClassName,
|
|
82
|
+
className,
|
|
83
|
+
searchProps,
|
|
84
|
+
searchMode = "Default",
|
|
85
|
+
tableProps = {},
|
|
86
|
+
hasPermi,
|
|
87
|
+
extraContent,
|
|
88
|
+
...modalConfig
|
|
89
|
+
} = props;
|
|
90
|
+
const {
|
|
91
|
+
title,
|
|
92
|
+
buttonGroup,
|
|
93
|
+
className: tableClassName,
|
|
94
|
+
columns,
|
|
95
|
+
tabBarProps,
|
|
96
|
+
tableTools = {},
|
|
97
|
+
tableContainerClassName,
|
|
98
|
+
tips,
|
|
99
|
+
otherTool,
|
|
100
|
+
...tableConfig
|
|
101
|
+
} = tableProps;
|
|
102
|
+
const { columnMgt } = tableTools;
|
|
103
|
+
const { permitted } = usePermissions(hasPermi);
|
|
104
|
+
const [_columns, setColumns] = useState<ColumnsType | undefined>(columns);
|
|
105
|
+
const [showColumnMgt, setShowColumnMgt] = useState<boolean>(false);
|
|
106
|
+
const [isFullscreen, setIsFullscreen] = useState<boolean>(false);
|
|
107
|
+
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (modalConfig.open) {
|
|
110
|
+
setIsFullscreen(false);
|
|
111
|
+
}
|
|
112
|
+
}, [modalConfig.open]);
|
|
113
|
+
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (columnMgt && columns?.length) {
|
|
116
|
+
const _columns = columns?.map((col) => {
|
|
117
|
+
return {
|
|
118
|
+
...col,
|
|
119
|
+
sort: !col?.dataIndex
|
|
120
|
+
? typeof col.sort === "number"
|
|
121
|
+
? col.sort
|
|
122
|
+
: 999
|
|
123
|
+
: 0,
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
setColumns(_columns);
|
|
128
|
+
} else {
|
|
129
|
+
setColumns(columns);
|
|
130
|
+
}
|
|
131
|
+
}, [columnMgt, columns]);
|
|
132
|
+
|
|
133
|
+
// 根据 searchMode 渲染对应的 Search 组件
|
|
134
|
+
const SearchComponent = useMemo(() => {
|
|
135
|
+
const searchClassName = classNames(searchProps?.className, styles.search);
|
|
136
|
+
|
|
137
|
+
switch (searchMode) {
|
|
138
|
+
case "Advanced":
|
|
139
|
+
return (
|
|
140
|
+
<Search.Advanced
|
|
141
|
+
baseWidth={1400}
|
|
142
|
+
{...(searchProps as SearchModePropsMap["Advanced"])}
|
|
143
|
+
className={searchClassName}
|
|
144
|
+
/>
|
|
145
|
+
);
|
|
146
|
+
case "Collapsible":
|
|
147
|
+
return (
|
|
148
|
+
<Search.Collapsible
|
|
149
|
+
baseWidth={1400}
|
|
150
|
+
{...(searchProps as SearchModePropsMap["Collapsible"])}
|
|
151
|
+
className={searchClassName}
|
|
152
|
+
/>
|
|
153
|
+
);
|
|
154
|
+
case "WithFilter":
|
|
155
|
+
return (
|
|
156
|
+
<Search.WithFilter
|
|
157
|
+
baseWidth={1400}
|
|
158
|
+
{...(searchProps as SearchModePropsMap["WithFilter"])}
|
|
159
|
+
className={searchClassName}
|
|
160
|
+
/>
|
|
161
|
+
);
|
|
162
|
+
case "WithMore":
|
|
163
|
+
return (
|
|
164
|
+
<Search.WithMore
|
|
165
|
+
baseWidth={1400}
|
|
166
|
+
{...(searchProps as SearchModePropsMap["WithMore"])}
|
|
167
|
+
className={searchClassName}
|
|
168
|
+
/>
|
|
169
|
+
);
|
|
170
|
+
case "Card":
|
|
171
|
+
return (
|
|
172
|
+
<Search.Card
|
|
173
|
+
{...(searchProps as SearchModePropsMap["Card"])}
|
|
174
|
+
className={searchClassName}
|
|
175
|
+
/>
|
|
176
|
+
);
|
|
177
|
+
default:
|
|
178
|
+
return (
|
|
179
|
+
<Search
|
|
180
|
+
baseWidth={1400}
|
|
181
|
+
{...(searchProps as SearchModePropsMap["Default"])}
|
|
182
|
+
className={searchClassName}
|
|
183
|
+
/>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
}, [searchMode, searchProps]);
|
|
187
|
+
|
|
188
|
+
if (!permitted) {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<>
|
|
194
|
+
<Modal
|
|
195
|
+
{...modalConfig}
|
|
196
|
+
width={isFullscreen ? "100vw" : (modalConfig.width ?? 1400)}
|
|
197
|
+
{...(isFullscreen ? { full: true } : {})}
|
|
198
|
+
className={classNames(styles.modal, modalClassName, {
|
|
199
|
+
[styles.fullscreen]: isFullscreen,
|
|
200
|
+
})}
|
|
201
|
+
titleButtonGroup={[
|
|
202
|
+
{
|
|
203
|
+
type: "text",
|
|
204
|
+
icon: isFullscreen ? (
|
|
205
|
+
<FullscreenExitOutlined />
|
|
206
|
+
) : (
|
|
207
|
+
<FullscreenOutlined />
|
|
208
|
+
),
|
|
209
|
+
title: isFullscreen ? "退出全屏" : "全屏",
|
|
210
|
+
onClick: () => setIsFullscreen((v) => !v),
|
|
211
|
+
},
|
|
212
|
+
...(modalConfig.titleButtonGroup ?? []),
|
|
213
|
+
]}
|
|
214
|
+
>
|
|
215
|
+
<div className={classNames(styles.ListModalPanel, className)}>
|
|
216
|
+
{extraContent}
|
|
217
|
+
{SearchComponent}
|
|
218
|
+
<div
|
|
219
|
+
className={classNames(
|
|
220
|
+
styles.tableContainer,
|
|
221
|
+
tableContainerClassName,
|
|
222
|
+
)}
|
|
223
|
+
>
|
|
224
|
+
<ToolBar
|
|
225
|
+
columns={columns}
|
|
226
|
+
title={title}
|
|
227
|
+
tabBarProps={tabBarProps}
|
|
228
|
+
buttonGroup={buttonGroup}
|
|
229
|
+
tableTools={tableTools}
|
|
230
|
+
setShowColumnMgt={setShowColumnMgt}
|
|
231
|
+
tips={tips}
|
|
232
|
+
otherTool={otherTool}
|
|
233
|
+
/>
|
|
234
|
+
<Table
|
|
235
|
+
className={`${styles.table} ${tableClassName ?? ""}`}
|
|
236
|
+
{...{
|
|
237
|
+
scroll: true,
|
|
238
|
+
serialNumberColumn: true,
|
|
239
|
+
bordered: true,
|
|
240
|
+
fillPanel: true,
|
|
241
|
+
...tableConfig,
|
|
242
|
+
columns: _columns,
|
|
243
|
+
}}
|
|
244
|
+
/>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
</Modal>
|
|
248
|
+
<ColumnMgt
|
|
249
|
+
open={showColumnMgt}
|
|
250
|
+
onClose={() => setShowColumnMgt(false)}
|
|
251
|
+
onOk={(columns) => setColumns(cloneDeep(columns))}
|
|
252
|
+
columns={_columns}
|
|
253
|
+
defaultColumns={columns}
|
|
254
|
+
onSelectionChange={columnMgt?.onSelectionChange}
|
|
255
|
+
{...columnMgt}
|
|
256
|
+
/>
|
|
257
|
+
</>
|
|
258
|
+
);
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export default ListModalPanel;
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
|
|
88
88
|
width: 100%;
|
|
89
89
|
min-height: 0px;
|
|
90
|
-
padding:
|
|
90
|
+
padding: 10px;
|
|
91
91
|
|
|
92
92
|
background: var(--cf-surface);
|
|
93
93
|
|
|
@@ -102,23 +102,22 @@
|
|
|
102
102
|
align-items: center;
|
|
103
103
|
justify-content: space-between;
|
|
104
104
|
column-gap: 10px;
|
|
105
|
+
}
|
|
105
106
|
|
|
106
|
-
|
|
107
|
+
// 页面级页签:无底色容器,页签拆成独立圆角块、块间留空;
|
|
108
|
+
// margin/radius 需 !important 压过 TabBar 内部的连体分段样式(负 margin + 首尾切角)
|
|
109
|
+
.headerTabBar {
|
|
110
|
+
column-gap: 4px;
|
|
107
111
|
|
|
108
|
-
|
|
112
|
+
> div {
|
|
113
|
+
margin-left: 0 !important;
|
|
114
|
+
border-radius: 6px !important;
|
|
109
115
|
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
background: var(--cf-surface);
|
|
117
|
+
}
|
|
112
118
|
}
|
|
113
119
|
|
|
114
120
|
&.hasHeaderTabBar {
|
|
115
|
-
.search {
|
|
116
|
-
padding: 10px;
|
|
117
|
-
margin-top: -10px;
|
|
118
|
-
|
|
119
|
-
border-radius: 0px 0px 8px 8px;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
121
|
&:not(:has(.search)) {
|
|
123
122
|
.headerTabBarContainer {
|
|
124
123
|
border-radius: 8px;
|