dcp-design-react 1.11.14 → 1.11.16

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.
@@ -1,17 +1,16 @@
1
1
  import React from 'react';
2
2
  import type { IRowKey } from '../../../table/src/table/types';
3
3
  import type { ScrollbarRef } from '../../../scrollbar';
4
- import type { Summary } from '../utils';
5
4
  export type IGridLayoutContext = {
6
5
  scrollbarRef: React.RefObject<ScrollbarRef>;
7
6
  indentDepth: number;
8
7
  selectionKeys: IRowKey[];
9
8
  treeExpandKeys: IRowKey[];
10
- countMethod: Record<string, string>;
11
- summationData: Summary;
9
+ highlightKey: IRowKey;
12
10
  checkedColumnKey: string;
13
11
  hoverRowKey: IRowKey;
14
12
  updateLayout: number;
13
+ clicked: [IRowKey, string] | [];
15
14
  };
16
15
  type IProps = {
17
16
  scrollbar: React.RefObject<ScrollbarRef>;
@@ -22,11 +21,12 @@ export declare const useGridLayoutContext: () => (IGridLayoutContext & {
22
21
  setContext: (data: Partial<IGridLayoutContext>) => void;
23
22
  setSelectionKeys: (rowKeys: IRowKey[]) => void;
24
23
  setTreeExpandKeys: (rowKeys: IRowKey[]) => void;
25
- setCountMethod: (value: Record<string, string | undefined>) => void;
26
- setSummationData: (value: Summary) => void;
24
+ setHighlightKey: (value: IRowKey) => void;
27
25
  setCheckColumnKey: (value: string) => void;
28
26
  setHoverRowKey: (value: IRowKey) => void;
29
27
  forceUpdateLayout: () => void;
30
28
  updateColumnsWidth: () => void;
29
+ setClicked: (value: [IRowKey, string] | [
30
+ ]) => void;
31
31
  }) | undefined;
32
32
  export {};
@@ -4,9 +4,10 @@ type UseContextMenuProps = {
4
4
  popup: (ev: MouseEvent) => React.ReactNode;
5
5
  getTriggerContainer?: (el: HTMLElement | null) => HTMLElement | null;
6
6
  prevent?: (node: HTMLElement) => boolean;
7
+ prefixCls?: string;
7
8
  enabled?: boolean;
8
9
  };
9
- declare const useContextMenu: ({ ref, popup, getTriggerContainer, prevent, enabled }: UseContextMenuProps) => {
10
+ declare const useContextMenu: ({ ref, popup, getTriggerContainer, prevent, prefixCls, enabled }: UseContextMenuProps) => {
10
11
  contextMenu: React.JSX.Element;
11
12
  closeMenu: () => void;
12
13
  };
@@ -0,0 +1,3 @@
1
+ import type { GroupLayout } from '../utils';
2
+ declare const useKeyboardEvent: (layout: GroupLayout[]) => void;
3
+ export default useKeyboardEvent;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
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;
3
+ declare const useRowCell: (columns: IColumn[], isLeftPanel?: boolean) => {
4
+ renderGroupRow: (row: IRecord, rowKey: IRowKey) => React.JSX.Element;
5
+ renderRow: (row: IRecord, rowIndex: number, rowKey: IRowKey) => React.JSX.Element;
6
6
  };
7
7
  export default useRowCell;
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
2
  import type { IColumn, IOrderBy, IRecord, IRowKey, ISuperFilter } from '../../../table/src/table/types';
3
3
  import type { ComponentSize, ValueOf } from '../../../_utils/types';
4
- import type { IGridLayoutContext } from '../grid-layout/Context';
5
- import type { PivotGridProps } from './types';
6
- export type IPivotMode = 'table' | 'gantt' | 'card';
4
+ import type { PivotGridProps, IPivotMode, ICountFn } from './types';
5
+ import type { Summary } from '../utils';
7
6
  export type GroupItem = {
8
7
  fieldName: string;
9
8
  order: IOrderBy;
@@ -32,7 +31,6 @@ export type PivotRef = {
32
31
  flatGroupData: IRecord[];
33
32
  isTree: boolean;
34
33
  keyRecordMap: Map<IRowKey, IRecord>;
35
- gridLayoutContext: Partial<IGridLayoutContext>;
36
34
  };
37
35
  export type IPivotGridContext = {
38
36
  pivotRef: React.MutableRefObject<PivotRef>;
@@ -50,6 +48,8 @@ export type IPivotGridContext = {
50
48
  searchResults: SearchResult[];
51
49
  switchIndex: number;
52
50
  fillColorCells: Map<string, string>;
51
+ countMethod: Record<string, ICountFn>;
52
+ summationData: Summary;
53
53
  };
54
54
  type IProps = {
55
55
  prefixCls: string;
@@ -76,5 +76,7 @@ export declare const usePivotGridContext: () => (IPivotGridContext & {
76
76
  setSearchResults: (value: SearchResult[]) => void;
77
77
  setSwitchIndex: (value: number) => void;
78
78
  setFillColor: (items: FillColorCell[]) => void;
79
+ setCountMethod: (value: Record<string, ICountFn | undefined>) => void;
80
+ setSummationData: (value: Summary) => void;
79
81
  }) | undefined;
80
82
  export {};
@@ -1,8 +1,11 @@
1
1
  /// <reference types="react" />
2
- import type { IColumn, IRecord, IRowKey, ISuperFilter } from '../../../table/src/table/types';
2
+ import type { IColumn, IRecord, IRowHighlight, IRowKey, ISelectionType, ISuperFilter } from '../../../table/src/table/types';
3
3
  import type { ComponentSize } from '../../../_utils/types';
4
4
  import type { GroupItem, SorterItem } from './Context';
5
+ export type IPivotMode = 'table' | 'gantt' | 'card';
6
+ export type ICountFn = 'count' | 'unique' | 'empty' | 'notEmpty' | 'sum' | 'max' | 'min' | 'avg';
5
7
  export type RowSelectType = {
8
+ type?: ISelectionType;
6
9
  defaultSelectedRowKeys?: IRowKey[];
7
10
  selectedRowKeys?: IRowKey[];
8
11
  checkStrictly?: boolean;
@@ -14,6 +17,14 @@ export type TreeExpandType = {
14
17
  onChange?: (rowKeys: IRowKey[]) => void;
15
18
  onExpand?: (expanded: boolean, record: IRecord) => void;
16
19
  };
20
+ export type CxtMenuItem = {
21
+ key: string | number;
22
+ label: React.ReactNode;
23
+ disabled?: (row: IRecord, column: IColumn) => boolean;
24
+ prefix?: React.ReactNode;
25
+ suffix?: React.ReactNode;
26
+ onClick?: (row: IRecord, column: IColumn) => void;
27
+ };
17
28
  export type PivotGridRef = {};
18
29
  export type PivotGridProps = {
19
30
  fromTable?: boolean;
@@ -27,12 +38,16 @@ export type PivotGridProps = {
27
38
  className?: string;
28
39
  style?: React.CSSProperties;
29
40
  rowSelection?: RowSelectType;
41
+ rowHighlight?: IRowHighlight;
30
42
  treeExpandable?: TreeExpandType;
31
43
  initialGroup?: GroupItem[];
44
+ initialCount?: Record<string, ICountFn>;
45
+ contextMenues?: CxtMenuItem[];
32
46
  onDataChange?: (records: IRecord[]) => void;
33
47
  onColumnsChange?: (columns: IColumn[]) => void;
34
48
  onGroupChange?: (group: GroupItem[]) => void;
35
49
  onFilterChange?: (filter: ISuperFilter[]) => void;
36
50
  onSorterChange?: (sorter: SorterItem[]) => void;
51
+ onRowEdit?: (record: IRecord, index: number) => void;
37
52
  onRowClick?: (row: IRecord, column: IColumn, event: React.MouseEvent<HTMLDivElement>) => void;
38
53
  };
@@ -0,0 +1,28 @@
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2025-01-11 18:31:17
4
+ * @Last Modified by: 焦质晔
5
+ * @Last Modified time: 2025-01-12 13:18:56
6
+ */
7
+ @import '../../style/common';
8
+
9
+ .@{prefix-pivot-grid}__context-menu {
10
+ min-width: 150px;
11
+ .ant-dropdown-menu-item {
12
+ display: flex;
13
+ align-items: center;
14
+ padding-left: @--padding-md;
15
+ padding-right: @--padding-md;
16
+ border-radius: @--border-radius-lg;
17
+ .label {
18
+ flex: auto;
19
+ }
20
+ .prefix {
21
+ margin-right: 5px;
22
+ }
23
+ .suffix {
24
+ margin-left: 4px;
25
+ color: @--text-color-placeholder;
26
+ }
27
+ }
28
+ }
@@ -2,15 +2,21 @@
2
2
  * @Author: 焦质晔
3
3
  * @Date: 2022-03-16 19:05:30
4
4
  * @Last Modified by: 焦质晔
5
- * @Last Modified time: 2024-12-25 11:07:14
5
+ * @Last Modified time: 2025-01-12 14:23:51
6
6
  */
7
7
  @import '../../style/common';
8
8
 
9
9
  .@{prefix-pivot-grid}__layout {
10
10
  .reset-container();
11
11
  width: 100%;
12
- display: flex;
13
- flex-wrap: nowrap;
12
+ .@{qm-prefix}-scrollbar__wrap {
13
+ // 调整为 flex 布局
14
+ display: flex;
15
+ flex-wrap: nowrap;
16
+ & > div {
17
+ height: fit-content;
18
+ }
19
+ }
14
20
  .header,
15
21
  .footer {
16
22
  display: flex;
@@ -72,11 +78,34 @@
72
78
  justify-content: center;
73
79
  border-right-color: transparent;
74
80
  }
75
- .order {
76
- display: inline-block;
77
- }
78
- .checkbox {
79
- display: none;
81
+ .action {
82
+ display: inline-flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ .drag-icon,
86
+ .expand-icon {
87
+ display: inline-flex;
88
+ align-items: center;
89
+ justify-content: center;
90
+ width: 20px;
91
+ height: 20px;
92
+ color: @--text-color-placeholder;
93
+ visibility: hidden;
94
+ }
95
+ .expand-icon:hover {
96
+ color: @--primary-color;
97
+ }
98
+ .middle {
99
+ text-align: center;
100
+ width: 16px;
101
+ margin: 0 2px;
102
+ .order {
103
+ display: inline-block;
104
+ }
105
+ .checkbox {
106
+ display: none;
107
+ }
108
+ }
80
109
  }
81
110
  &.col--center {
82
111
  text-align: center;
@@ -228,11 +257,26 @@
228
257
  &.row--selection {
229
258
  .table-cell {
230
259
  background-color: @--background-color-light;
231
- .order {
232
- display: none;
260
+ .middle {
261
+ .order {
262
+ display: none;
263
+ }
264
+ .checkbox {
265
+ display: inline-flex;
266
+ }
233
267
  }
234
- .checkbox {
235
- display: inline-flex;
268
+ }
269
+ }
270
+ &.row--highlight {
271
+ .table-cell {
272
+ background-color: @--primary-1;
273
+ }
274
+ }
275
+ &.row--hover {
276
+ .table-cell {
277
+ .drag-icon,
278
+ .expand-icon {
279
+ visibility: visible;
236
280
  }
237
281
  }
238
282
  }
@@ -1,10 +1,11 @@
1
- /*
2
- * @Author: 焦质晔
3
- * @Date: 2024-11-28 19:27:58
4
- * @Last Modified by: 焦质晔
5
- * @Last Modified time: 2024-11-28 20:04:56
6
- */
7
- @import './variable.less';
8
- @import './main.less';
9
- @import './top-bar.less';
10
- @import './grid-layout.less';
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2024-11-28 19:27:58
4
+ * @Last Modified by: 焦质晔
5
+ * @Last Modified time: 2025-01-11 18:32:54
6
+ */
7
+ @import './variable.less';
8
+ @import './main.less';
9
+ @import './top-bar.less';
10
+ @import './grid-layout.less';
11
+ @import './context-menu.less';
@@ -30967,7 +30967,7 @@ body {
30967
30967
  * @Author: 焦质晔
30968
30968
  * @Date: 2024-11-28 19:27:58
30969
30969
  * @Last Modified by: 焦质晔
30970
- * @Last Modified time: 2024-11-28 20:04:56
30970
+ * @Last Modified time: 2025-01-11 18:32:54
30971
30971
  */
30972
30972
  /*
30973
30973
  * @Author: 焦质晔
@@ -31180,7 +31180,7 @@ body {
31180
31180
  * @Author: 焦质晔
31181
31181
  * @Date: 2022-03-16 19:05:30
31182
31182
  * @Last Modified by: 焦质晔
31183
- * @Last Modified time: 2024-12-25 11:07:14
31183
+ * @Last Modified time: 2025-01-12 14:23:51
31184
31184
  */
31185
31185
  .qm-pivot-grid__layout {
31186
31186
  box-sizing: border-box;
@@ -31192,9 +31192,15 @@ body {
31192
31192
  list-style: none;
31193
31193
  font-feature-settings: 'tnum';
31194
31194
  width: 100%;
31195
+ }
31196
+ .qm-pivot-grid__layout .qm-scrollbar__wrap {
31195
31197
  display: flex;
31196
31198
  flex-wrap: nowrap;
31197
31199
  }
31200
+ .qm-pivot-grid__layout .qm-scrollbar__wrap > div {
31201
+ height: -moz-fit-content;
31202
+ height: fit-content;
31203
+ }
31198
31204
  .qm-pivot-grid__layout .header,
31199
31205
  .qm-pivot-grid__layout .footer {
31200
31206
  display: flex;
@@ -31261,14 +31267,47 @@ body {
31261
31267
  justify-content: center;
31262
31268
  border-right-color: transparent;
31263
31269
  }
31264
- .qm-pivot-grid__layout .header .table-cell .order,
31265
- .qm-pivot-grid__layout .body .table-cell .order,
31266
- .qm-pivot-grid__layout .footer .table-cell .order {
31270
+ .qm-pivot-grid__layout .header .table-cell .action,
31271
+ .qm-pivot-grid__layout .body .table-cell .action,
31272
+ .qm-pivot-grid__layout .footer .table-cell .action {
31273
+ display: inline-flex;
31274
+ align-items: center;
31275
+ justify-content: center;
31276
+ }
31277
+ .qm-pivot-grid__layout .header .table-cell .action .drag-icon,
31278
+ .qm-pivot-grid__layout .body .table-cell .action .drag-icon,
31279
+ .qm-pivot-grid__layout .footer .table-cell .action .drag-icon,
31280
+ .qm-pivot-grid__layout .header .table-cell .action .expand-icon,
31281
+ .qm-pivot-grid__layout .body .table-cell .action .expand-icon,
31282
+ .qm-pivot-grid__layout .footer .table-cell .action .expand-icon {
31283
+ display: inline-flex;
31284
+ align-items: center;
31285
+ justify-content: center;
31286
+ width: 20px;
31287
+ height: 20px;
31288
+ color: rgba(0, 0, 0, 0.45);
31289
+ visibility: hidden;
31290
+ }
31291
+ .qm-pivot-grid__layout .header .table-cell .action .expand-icon:hover,
31292
+ .qm-pivot-grid__layout .body .table-cell .action .expand-icon:hover,
31293
+ .qm-pivot-grid__layout .footer .table-cell .action .expand-icon:hover {
31294
+ color: #1890ff;
31295
+ }
31296
+ .qm-pivot-grid__layout .header .table-cell .action .middle,
31297
+ .qm-pivot-grid__layout .body .table-cell .action .middle,
31298
+ .qm-pivot-grid__layout .footer .table-cell .action .middle {
31299
+ text-align: center;
31300
+ width: 16px;
31301
+ margin: 0 2px;
31302
+ }
31303
+ .qm-pivot-grid__layout .header .table-cell .action .middle .order,
31304
+ .qm-pivot-grid__layout .body .table-cell .action .middle .order,
31305
+ .qm-pivot-grid__layout .footer .table-cell .action .middle .order {
31267
31306
  display: inline-block;
31268
31307
  }
31269
- .qm-pivot-grid__layout .header .table-cell .checkbox,
31270
- .qm-pivot-grid__layout .body .table-cell .checkbox,
31271
- .qm-pivot-grid__layout .footer .table-cell .checkbox {
31308
+ .qm-pivot-grid__layout .header .table-cell .action .middle .checkbox,
31309
+ .qm-pivot-grid__layout .body .table-cell .action .middle .checkbox,
31310
+ .qm-pivot-grid__layout .footer .table-cell .action .middle .checkbox {
31272
31311
  display: none;
31273
31312
  }
31274
31313
  .qm-pivot-grid__layout .header .table-cell.col--center,
@@ -31445,14 +31484,21 @@ body {
31445
31484
  .qm-pivot-grid__layout .container .row-item .table-row.row--selection .table-cell {
31446
31485
  background-color: #f5f5f5;
31447
31486
  }
31448
- .qm-pivot-grid__layout .container .row-item .table-row.row--hover .table-cell .order,
31449
- .qm-pivot-grid__layout .container .row-item .table-row.row--selection .table-cell .order {
31487
+ .qm-pivot-grid__layout .container .row-item .table-row.row--hover .table-cell .middle .order,
31488
+ .qm-pivot-grid__layout .container .row-item .table-row.row--selection .table-cell .middle .order {
31450
31489
  display: none;
31451
31490
  }
31452
- .qm-pivot-grid__layout .container .row-item .table-row.row--hover .table-cell .checkbox,
31453
- .qm-pivot-grid__layout .container .row-item .table-row.row--selection .table-cell .checkbox {
31491
+ .qm-pivot-grid__layout .container .row-item .table-row.row--hover .table-cell .middle .checkbox,
31492
+ .qm-pivot-grid__layout .container .row-item .table-row.row--selection .table-cell .middle .checkbox {
31454
31493
  display: inline-flex;
31455
31494
  }
31495
+ .qm-pivot-grid__layout .container .row-item .table-row.row--highlight .table-cell {
31496
+ background-color: #e6f7ff;
31497
+ }
31498
+ .qm-pivot-grid__layout .container .row-item .table-row.row--hover .table-cell .drag-icon,
31499
+ .qm-pivot-grid__layout .container .row-item .table-row.row--hover .table-cell .expand-icon {
31500
+ visibility: visible;
31501
+ }
31456
31502
  .qm-pivot-grid__layout .container .row-item .table-row .cell--expand {
31457
31503
  display: inline-flex;
31458
31504
  padding: 4px;
@@ -31476,6 +31522,32 @@ body {
31476
31522
  .qm-pivot-grid__layout.large .table-cell {
31477
31523
  height: 42px;
31478
31524
  }
31525
+ /*
31526
+ * @Author: 焦质晔
31527
+ * @Date: 2025-01-11 18:31:17
31528
+ * @Last Modified by: 焦质晔
31529
+ * @Last Modified time: 2025-01-12 13:18:56
31530
+ */
31531
+ .qm-pivot-grid__context-menu {
31532
+ min-width: 150px;
31533
+ }
31534
+ .qm-pivot-grid__context-menu .ant-dropdown-menu-item {
31535
+ display: flex;
31536
+ align-items: center;
31537
+ padding-left: 10px;
31538
+ padding-right: 10px;
31539
+ border-radius: 4px;
31540
+ }
31541
+ .qm-pivot-grid__context-menu .ant-dropdown-menu-item .label {
31542
+ flex: auto;
31543
+ }
31544
+ .qm-pivot-grid__context-menu .ant-dropdown-menu-item .prefix {
31545
+ margin-right: 5px;
31546
+ }
31547
+ .qm-pivot-grid__context-menu .ant-dropdown-menu-item .suffix {
31548
+ margin-left: 4px;
31549
+ color: rgba(0, 0, 0, 0.45);
31550
+ }
31479
31551
  /*
31480
31552
  * @Author: 焦质晔
31481
31553
  * @Date: 2024-12-02 09:06:20