dcp-design-react 1.11.7 → 1.11.8
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/lib/index.esm.js +1 -1
- package/lib/index.full.js +1 -1
- package/lib/index.js +1 -1
- package/lib/pivot-grid/src/config/index.d.ts +2 -0
- package/lib/pivot-grid/src/grid-layout/Context.d.ts +4 -0
- package/lib/pivot-grid/src/grid-layout/FixedLine.d.ts +6 -0
- package/lib/pivot-grid/src/grid-layout/LeftPanel.d.ts +12 -0
- package/lib/pivot-grid/src/grid-layout/MainPanel.d.ts +12 -0
- package/lib/pivot-grid/src/hooks/use-context-menu.d.ts +2 -1
- package/lib/pivot-grid/src/hooks/use-row-cell.d.ts +7 -0
- package/lib/pivot-grid/src/hooks/use-virtual-list.d.ts +10 -0
- package/lib/pivot-grid/src/utils/index.d.ts +19 -5
- package/lib/pivot-grid/style/grid-layout.less +145 -133
- package/lib/style/index.css +147 -134
- package/lib/style/index.min.css +1 -1
- package/lib/virtual-list/src/core.d.ts +1 -0
- package/lib/virtual-list/src/utils.d.ts +1 -0
- package/package.json +1 -1
|
@@ -9,6 +9,8 @@ export type IGridLayoutContext = {
|
|
|
9
9
|
treeExpandKeys: IRowKey[];
|
|
10
10
|
countMethod: Record<string, string>;
|
|
11
11
|
summationData: Summary;
|
|
12
|
+
checkedColumnKey: string;
|
|
13
|
+
hoverRowKey: IRowKey;
|
|
12
14
|
};
|
|
13
15
|
type IProps = {
|
|
14
16
|
scrollbar: React.RefObject<ScrollbarRef>;
|
|
@@ -21,5 +23,7 @@ export declare const useGridLayoutContext: () => (IGridLayoutContext & {
|
|
|
21
23
|
setTreeExpandKeys: (rowKeys: IRowKey[]) => void;
|
|
22
24
|
setCountMethod: (value: Record<string, string | undefined>) => void;
|
|
23
25
|
setSummationData: (value: Summary) => void;
|
|
26
|
+
setCheckColumnKey: (value: string) => void;
|
|
27
|
+
setHoverRowKey: (value: IRowKey) => void;
|
|
24
28
|
}) | undefined;
|
|
25
29
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { GroupLayout } from '../utils';
|
|
3
|
+
import type { VirtualItem } from '../../../virtual-list/src/useVirtual';
|
|
4
|
+
import type { IColumn, IRecord } from '../../../table/src/table/types';
|
|
5
|
+
type IProps = {
|
|
6
|
+
tbodyColumns: IColumn[];
|
|
7
|
+
layout: GroupLayout[];
|
|
8
|
+
displayList: IRecord[];
|
|
9
|
+
virtualRows: VirtualItem[];
|
|
10
|
+
};
|
|
11
|
+
declare const LeftPanel: React.FC<IProps>;
|
|
12
|
+
export default LeftPanel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { GroupLayout } from '../utils';
|
|
3
|
+
import type { VirtualItem } from '../../../virtual-list/src/useVirtual';
|
|
4
|
+
import type { IColumn, IRecord } from '../../../table/src/table/types';
|
|
5
|
+
type IProps = {
|
|
6
|
+
tbodyColumns: IColumn[];
|
|
7
|
+
layout: GroupLayout[];
|
|
8
|
+
displayList: IRecord[];
|
|
9
|
+
virtualRows: VirtualItem[];
|
|
10
|
+
};
|
|
11
|
+
declare const MainPanel: React.FC<IProps>;
|
|
12
|
+
export default MainPanel;
|
|
@@ -2,9 +2,10 @@ import React from 'react';
|
|
|
2
2
|
type UseContextMenuProps = {
|
|
3
3
|
ref: React.RefObject<HTMLElement>;
|
|
4
4
|
popup: (ev: MouseEvent) => React.ReactNode;
|
|
5
|
+
prevent?: (node: HTMLElement) => boolean;
|
|
5
6
|
enabled?: boolean;
|
|
6
7
|
};
|
|
7
|
-
declare const useContextMenu: ({ ref, popup, enabled }: UseContextMenuProps) => {
|
|
8
|
+
declare const useContextMenu: ({ ref, popup, prevent, enabled }: UseContextMenuProps) => {
|
|
8
9
|
contextMenu: React.JSX.Element;
|
|
9
10
|
closeMenu: () => void;
|
|
10
11
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IColumn, IRecord, IRowKey } from '../../../table/src/table/types';
|
|
3
|
+
declare const useRowCell: (isLeftPanel?: boolean) => {
|
|
4
|
+
renderGroupRow: (columns: IColumn[], row: IRecord, rowKey: IRowKey) => React.JSX.Element;
|
|
5
|
+
renderRow: (columns: IColumn[], row: IRecord, rowIndex: number, rowKey: IRowKey) => React.JSX.Element;
|
|
6
|
+
};
|
|
7
|
+
export default useRowCell;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GroupLayout } from '../utils';
|
|
2
|
+
type IProps = {
|
|
3
|
+
layout: GroupLayout[];
|
|
4
|
+
isGroup: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const useVirtualList: (props: IProps) => {
|
|
7
|
+
rowVirtualizer: import("../../../virtual-list/src/core").Virtualizer<HTMLElement, Element>;
|
|
8
|
+
virtualRows: import("../../../virtual-list/src/core").VirtualItem[];
|
|
9
|
+
};
|
|
10
|
+
export default useVirtualList;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { IRecord, IOrderBy, IColumn } from '../../../table/src/table/types';
|
|
1
|
+
import type { IRecord, IOrderBy, IColumn, IRowKey } from '../../../table/src/table/types';
|
|
2
2
|
export declare const createGridColumns: (columns: IColumn[]) => IColumn[];
|
|
3
3
|
export declare const filterGridColumns: (columns: IColumn[]) => IColumn[];
|
|
4
|
+
export declare const isGroupRecord: (row: IRecord) => boolean;
|
|
5
|
+
export declare const getValByPath: (obj: any, path: string) => any;
|
|
4
6
|
export declare const getStickyLeft: (flattenColumns: IColumn[], fieldName: string) => number;
|
|
5
|
-
export declare const groupMultiData: (records: IRecord[], groupKeys: Record<string, IOrderBy>[] | undefined,
|
|
6
|
-
export declare const
|
|
7
|
+
export declare const groupMultiData: (records: IRecord[], groupKeys: Record<string, IOrderBy>[] | undefined, fn: (row: IRecord, key: string) => string | number) => Record<string, any> | Record<string, any>[];
|
|
8
|
+
export declare const getAllExpandKeys: (data: Record<string, any> | Record<string, any>[], parentKey?: string) => string[];
|
|
7
9
|
export type Subtotal = {
|
|
8
10
|
[key: string]: number;
|
|
9
11
|
};
|
|
@@ -21,13 +23,25 @@ export type FieldCalculations = Record<string, (dataList: number[]) => number>;
|
|
|
21
23
|
*/
|
|
22
24
|
export declare const calculateSummary: (groupData: Record<string, any> | Record<string, any>[], fieldCalculations: Record<string, (data: number[]) => number>) => Summary;
|
|
23
25
|
export declare const calculations: {
|
|
24
|
-
sum: (arr: number[]) =>
|
|
26
|
+
sum: (arr: number[]) => string;
|
|
25
27
|
avg: (arr: number[]) => string | 0;
|
|
26
28
|
max: (arr: number[]) => number | undefined;
|
|
27
29
|
min: (arr: number[]) => number | undefined;
|
|
28
|
-
count: (arr: number[]) =>
|
|
30
|
+
count: (arr: number[]) => string;
|
|
29
31
|
unique: (arr: number[]) => number;
|
|
30
32
|
empty: (arr: number[]) => number;
|
|
31
33
|
notEmpty: (arr: number[]) => number;
|
|
32
34
|
};
|
|
33
35
|
export declare const flattenGroupedData: (groupData: Record<string, any> | Record<string, any>[]) => IRecord[];
|
|
36
|
+
export type GroupLayout = {
|
|
37
|
+
key: IRowKey;
|
|
38
|
+
top: number;
|
|
39
|
+
left: number;
|
|
40
|
+
right: number;
|
|
41
|
+
height: number;
|
|
42
|
+
};
|
|
43
|
+
export type LayoutOpions = {
|
|
44
|
+
getRowKey: (row: IRecord, index: number) => IRowKey;
|
|
45
|
+
rowHeight: number;
|
|
46
|
+
};
|
|
47
|
+
export declare const calculateLayout: (groupData: Record<string, any> | Record<string, any>[], { getRowKey, rowHeight }: LayoutOpions) => GroupLayout[];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: 焦质晔
|
|
3
3
|
* @Date: 2022-03-16 19:05:30
|
|
4
4
|
* @Last Modified by: 焦质晔
|
|
5
|
-
* @Last Modified time: 2024-12-
|
|
5
|
+
* @Last Modified time: 2024-12-21 19:46:45
|
|
6
6
|
*/
|
|
7
7
|
@import '../../style/common';
|
|
8
8
|
|
|
@@ -13,22 +13,20 @@
|
|
|
13
13
|
height: 100%;
|
|
14
14
|
.header,
|
|
15
15
|
.footer {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
}
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
.fixed-left {
|
|
19
|
+
position: sticky;
|
|
20
|
+
left: 0;
|
|
21
|
+
z-index: 1;
|
|
22
|
+
display: flex;
|
|
23
|
+
border-left: 1px solid @--border-color-secondary;
|
|
24
|
+
border-bottom: 1px solid @--border-color-secondary;
|
|
25
|
+
}
|
|
26
|
+
.no-fixed {
|
|
27
|
+
flex: 1 0;
|
|
28
|
+
display: flex;
|
|
29
|
+
border-bottom: 1px solid @--border-color-secondary;
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
.header {
|
|
@@ -36,7 +34,9 @@
|
|
|
36
34
|
top: 0;
|
|
37
35
|
z-index: 2;
|
|
38
36
|
.table-cell {
|
|
37
|
+
position: relative;
|
|
39
38
|
background-color: #d6f2ff !important;
|
|
39
|
+
cursor: pointer;
|
|
40
40
|
}
|
|
41
41
|
.resize-bar {
|
|
42
42
|
position: absolute;
|
|
@@ -49,105 +49,9 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
.body {
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: row;
|
|
52
54
|
min-height: fit-content;
|
|
53
|
-
.group-card {
|
|
54
|
-
margin: 15px 0;
|
|
55
|
-
background-color: #fff;
|
|
56
|
-
border: 1px solid @--border-color-secondary;
|
|
57
|
-
&.inner {
|
|
58
|
-
margin: 0 12px 12px;
|
|
59
|
-
}
|
|
60
|
-
&:has(.inner) > .label-row > .label-cell {
|
|
61
|
-
border-bottom: 0;
|
|
62
|
-
}
|
|
63
|
-
.label-row {
|
|
64
|
-
display: flex;
|
|
65
|
-
align-items: center;
|
|
66
|
-
.label-cell {
|
|
67
|
-
align-self: stretch;
|
|
68
|
-
display: inline-flex;
|
|
69
|
-
align-items: center;
|
|
70
|
-
background-color: #fff;
|
|
71
|
-
border-bottom: 1px solid @--border-color-secondary;
|
|
72
|
-
&.expandable-column {
|
|
73
|
-
justify-content: center;
|
|
74
|
-
.button-icon {
|
|
75
|
-
& > .anticon {
|
|
76
|
-
transition: transform 0.3s ease;
|
|
77
|
-
}
|
|
78
|
-
&.expand > .anticon {
|
|
79
|
-
transform: rotate(90deg);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
&.col--fix-left {
|
|
84
|
-
position: sticky;
|
|
85
|
-
z-index: 1;
|
|
86
|
-
}
|
|
87
|
-
.title {
|
|
88
|
-
flex-shrink: 0;
|
|
89
|
-
margin-right: 20px;
|
|
90
|
-
font-weight: 700;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
.grid-list {
|
|
95
|
-
margin: 0;
|
|
96
|
-
border: 0;
|
|
97
|
-
background: transparent;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
.grid-list {
|
|
101
|
-
margin: 15px 0;
|
|
102
|
-
border: 1px solid @--border-color-secondary;
|
|
103
|
-
.table-row {
|
|
104
|
-
display: flex;
|
|
105
|
-
align-items: center;
|
|
106
|
-
&:hover {
|
|
107
|
-
.table-cell {
|
|
108
|
-
background-color: @--background-color-light;
|
|
109
|
-
.order {
|
|
110
|
-
display: none;
|
|
111
|
-
}
|
|
112
|
-
.checkbox {
|
|
113
|
-
display: inline-flex;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
&.row--selection {
|
|
118
|
-
background-color: @--primary-1;
|
|
119
|
-
.table-cell {
|
|
120
|
-
.order {
|
|
121
|
-
display: none;
|
|
122
|
-
}
|
|
123
|
-
.checkbox {
|
|
124
|
-
display: inline-flex;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
.table-cell {
|
|
129
|
-
align-self: stretch; // 子元素高度和父元素一致
|
|
130
|
-
display: inline-flex;
|
|
131
|
-
align-items: center;
|
|
132
|
-
border-bottom: 1px solid @--border-color-secondary;
|
|
133
|
-
&.active {
|
|
134
|
-
box-shadow: inset 0 0 0 2px @--primary-color;
|
|
135
|
-
background-color: rgba(255, 235, 140, 1);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
.cell--expand {
|
|
139
|
-
display: inline-flex;
|
|
140
|
-
padding: 4px;
|
|
141
|
-
font-size: 13px;
|
|
142
|
-
color: @--text-color-placeholder;
|
|
143
|
-
cursor: pointer;
|
|
144
|
-
transition: transform 0.3s ease;
|
|
145
|
-
&.fold {
|
|
146
|
-
transform: rotate(-90deg);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
55
|
}
|
|
152
56
|
.footer {
|
|
153
57
|
position: sticky;
|
|
@@ -158,11 +62,12 @@
|
|
|
158
62
|
.body,
|
|
159
63
|
.footer {
|
|
160
64
|
.table-cell {
|
|
161
|
-
|
|
65
|
+
align-self: stretch; // 子元素高度和父元素一致
|
|
66
|
+
display: inline-flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
border-top: 1px solid @--border-color-secondary;
|
|
162
69
|
border-right: 1px solid @--border-color-secondary;
|
|
163
|
-
|
|
164
|
-
border-right: 0;
|
|
165
|
-
}
|
|
70
|
+
background-color: #fff;
|
|
166
71
|
&.selection-column {
|
|
167
72
|
justify-content: center;
|
|
168
73
|
border-right-color: transparent;
|
|
@@ -174,20 +79,30 @@
|
|
|
174
79
|
display: none;
|
|
175
80
|
}
|
|
176
81
|
&.col--center {
|
|
177
|
-
text-align: center
|
|
82
|
+
text-align: center;
|
|
178
83
|
justify-content: center;
|
|
179
84
|
}
|
|
180
85
|
&.col--right {
|
|
181
|
-
text-align: right
|
|
86
|
+
text-align: right;
|
|
182
87
|
justify-content: flex-end;
|
|
183
88
|
}
|
|
184
89
|
&.col--fix-left {
|
|
185
90
|
position: sticky;
|
|
186
91
|
z-index: 1;
|
|
187
92
|
}
|
|
93
|
+
&.col--checked {
|
|
94
|
+
background-color: @--primary-1;
|
|
95
|
+
}
|
|
96
|
+
&.active {
|
|
97
|
+
box-shadow: inset 0 0 0 2px @--primary-color;
|
|
98
|
+
background-color: rgba(255, 235, 140, 1);
|
|
99
|
+
}
|
|
188
100
|
.cell {
|
|
189
101
|
.text-overflow-cut();
|
|
190
102
|
padding: 0 @--padding-sm;
|
|
103
|
+
&.indent {
|
|
104
|
+
padding-left: 16px;
|
|
105
|
+
}
|
|
191
106
|
}
|
|
192
107
|
}
|
|
193
108
|
.label-cell,
|
|
@@ -232,28 +147,125 @@
|
|
|
232
147
|
cursor: col-resize;
|
|
233
148
|
z-index: 2;
|
|
234
149
|
}
|
|
150
|
+
.fixed-line {
|
|
151
|
+
position: absolute;
|
|
152
|
+
left: -1px;
|
|
153
|
+
top: 0;
|
|
154
|
+
width: 0;
|
|
155
|
+
height: 100%;
|
|
156
|
+
border-left: 1px solid @--primary-3;
|
|
157
|
+
z-index: 2;
|
|
158
|
+
pointer-events: none;
|
|
159
|
+
}
|
|
160
|
+
// 左侧面板
|
|
161
|
+
.left-panel {
|
|
162
|
+
position: sticky;
|
|
163
|
+
left: 0;
|
|
164
|
+
z-index: 1;
|
|
165
|
+
.group-label {
|
|
166
|
+
border-right: 0 !important;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
.main-panel {
|
|
170
|
+
flex: 1 0;
|
|
171
|
+
z-index: 0;
|
|
172
|
+
.group-label,
|
|
173
|
+
.row-item {
|
|
174
|
+
border-left: 0 !important;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
.container {
|
|
178
|
+
position: relative;
|
|
179
|
+
left: 0;
|
|
180
|
+
top: 0;
|
|
181
|
+
.group-label {
|
|
182
|
+
position: absolute;
|
|
183
|
+
border: 1px solid @--border-color-secondary;
|
|
184
|
+
background-color: #fff;
|
|
185
|
+
.label-row {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
}
|
|
189
|
+
.label-cell {
|
|
190
|
+
align-self: stretch;
|
|
191
|
+
display: inline-flex;
|
|
192
|
+
align-items: center;
|
|
193
|
+
&.expandable-column {
|
|
194
|
+
justify-content: center;
|
|
195
|
+
.button-icon {
|
|
196
|
+
& > .anticon {
|
|
197
|
+
transition: transform 0.3s ease;
|
|
198
|
+
}
|
|
199
|
+
&.expand > .anticon {
|
|
200
|
+
transform: rotate(90deg);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
&.col--fix-left {
|
|
205
|
+
position: sticky;
|
|
206
|
+
z-index: 1;
|
|
207
|
+
}
|
|
208
|
+
.title {
|
|
209
|
+
flex-shrink: 0;
|
|
210
|
+
margin-right: 20px;
|
|
211
|
+
font-weight: 700;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
.row-item {
|
|
216
|
+
position: absolute;
|
|
217
|
+
border-left: 1px solid @--border-color-secondary;
|
|
218
|
+
&.last {
|
|
219
|
+
.table-cell {
|
|
220
|
+
border-bottom: 1px solid @--border-color-secondary;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
.table-row {
|
|
224
|
+
display: flex;
|
|
225
|
+
align-items: center;
|
|
226
|
+
height: inherit;
|
|
227
|
+
&.row--hover,
|
|
228
|
+
&.row--selection {
|
|
229
|
+
.table-cell {
|
|
230
|
+
background-color: @--background-color-light;
|
|
231
|
+
.order {
|
|
232
|
+
display: none;
|
|
233
|
+
}
|
|
234
|
+
.checkbox {
|
|
235
|
+
display: inline-flex;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
.cell--expand {
|
|
240
|
+
display: inline-flex;
|
|
241
|
+
padding: 4px;
|
|
242
|
+
font-size: 13px;
|
|
243
|
+
color: @--text-color-placeholder;
|
|
244
|
+
cursor: pointer;
|
|
245
|
+
transition: transform 0.3s ease;
|
|
246
|
+
&.fold {
|
|
247
|
+
transform: rotate(-90deg);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
235
253
|
// size
|
|
236
254
|
&.small {
|
|
237
|
-
.
|
|
238
|
-
.
|
|
239
|
-
.body .grid-list > li,
|
|
240
|
-
.body .group-card > li {
|
|
255
|
+
.label-row,
|
|
256
|
+
.table-cell {
|
|
241
257
|
height: 26px;
|
|
242
258
|
}
|
|
243
259
|
}
|
|
244
260
|
&.middle {
|
|
245
|
-
.
|
|
246
|
-
.
|
|
247
|
-
.body .grid-list > li,
|
|
248
|
-
.body .group-card > li {
|
|
261
|
+
.label-row,
|
|
262
|
+
.table-cell {
|
|
249
263
|
height: 34px;
|
|
250
264
|
}
|
|
251
265
|
}
|
|
252
266
|
&.large {
|
|
253
|
-
.
|
|
254
|
-
.
|
|
255
|
-
.body .grid-list > li,
|
|
256
|
-
.body .group-card > li {
|
|
267
|
+
.label-row,
|
|
268
|
+
.table-cell {
|
|
257
269
|
height: 42px;
|
|
258
270
|
}
|
|
259
271
|
}
|