dcp-design-react 1.11.1 → 1.11.3

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 (53) hide show
  1. package/lib/_utils/util.d.ts +2 -2
  2. package/lib/form/style/index.less +3 -1
  3. package/lib/index.d.ts +4 -0
  4. package/lib/index.esm.js +1 -1
  5. package/lib/index.full.js +1 -1
  6. package/lib/index.js +1 -1
  7. package/lib/locale/lang/en.d.ts +4 -4
  8. package/lib/locale/lang/en.js +4 -4
  9. package/lib/locale/lang/zh-cn.d.ts +4 -4
  10. package/lib/locale/lang/zh-cn.js +4 -4
  11. package/lib/pivot-grid/src/config/index.d.ts +2 -5
  12. package/lib/pivot-grid/src/grid-layout/Context.d.ts +5 -2
  13. package/lib/pivot-grid/src/grid-layout/CountPanel.d.ts +2 -0
  14. package/lib/pivot-grid/src/grid-layout/GroupCard.d.ts +2 -1
  15. package/lib/pivot-grid/src/main/Context.d.ts +6 -2
  16. package/lib/pivot-grid/src/utils/index.d.ts +30 -1
  17. package/lib/pivot-grid/style/grid-layout.less +36 -31
  18. package/lib/pivot-grid/style/top-bar.less +34 -3
  19. package/lib/pivot-grid/style/variable.less +0 -2
  20. package/lib/scrollbar/src/scrollbar.d.ts +1 -0
  21. package/lib/scrollbar/style/index.less +1 -0
  22. package/lib/style/index.css +113 -34
  23. package/lib/style/index.less +2 -1
  24. package/lib/style/index.min.css +1 -1
  25. package/lib/table/src/body/DraggableTr.d.ts +2 -1
  26. package/lib/table/src/body/index.d.ts +2 -6
  27. package/lib/table/src/config/index.d.ts +1 -0
  28. package/lib/table/src/context/index.d.ts +3 -8
  29. package/lib/table/src/export/useExport.d.ts +1 -1
  30. package/lib/table/src/footer/index.d.ts +1 -4
  31. package/lib/table/src/header/index.d.ts +1 -3
  32. package/lib/table/src/hooks/useImperativeMethod.d.ts +0 -1
  33. package/lib/table/src/hooks/useTableCore.d.ts +3 -17
  34. package/lib/table/src/hooks/useTableEffect.d.ts +0 -2
  35. package/lib/table/src/hooks/useTableLayout.d.ts +3 -15
  36. package/lib/table/src/hooks/useTableMemo.d.ts +1 -3
  37. package/lib/table/src/hooks/useTableRef.d.ts +4 -33
  38. package/lib/table/src/hooks/useTableState.d.ts +5 -14
  39. package/lib/table/src/hooks/useTableVirtual.d.ts +17 -0
  40. package/lib/table/src/table/props.d.ts +0 -1
  41. package/lib/table/src/table/types.d.ts +3 -2
  42. package/lib/table/style/body.less +103 -103
  43. package/lib/table/style/column-filter.less +5 -5
  44. package/lib/table/style/index.less +31 -31
  45. package/lib/table/style/pivot-grid.less +19 -19
  46. package/lib/virtual-list/index.d.ts +3 -0
  47. package/lib/virtual-list/src/core.d.ts +133 -0
  48. package/lib/virtual-list/src/list-item.d.ts +9 -0
  49. package/lib/virtual-list/src/useVirtual.d.ts +5 -0
  50. package/lib/virtual-list/src/utils.d.ts +12 -0
  51. package/lib/virtual-list/src/virtual-list.d.ts +20 -0
  52. package/lib/virtual-list/style/index.less +21 -0
  53. package/package.json +1 -1
@@ -319,10 +319,10 @@ declare const _default: {
319
319
  queryPrev: string;
320
320
  queryNext: string;
321
321
  };
322
- };
323
- pivotGrid: {
324
- text: string;
325
- settingTitle: string;
322
+ pivotGrid: {
323
+ text: string;
324
+ settingTitle: string;
325
+ };
326
326
  };
327
327
  };
328
328
  };
@@ -324,11 +324,11 @@ export default {
324
324
  clear: 'Clear condition',
325
325
  queryPrev: 'Find previous',
326
326
  queryNext: 'Find next'
327
+ },
328
+ pivotGrid: {
329
+ text: 'Pivot Grid',
330
+ settingTitle: 'Pivot Grid Dashboard'
327
331
  }
328
- },
329
- pivotGrid: {
330
- text: 'Pivot Grid',
331
- settingTitle: 'Pivot Grid Dashboard'
332
332
  }
333
333
  }
334
334
  };
@@ -319,10 +319,10 @@ declare const _default: {
319
319
  queryPrev: string;
320
320
  queryNext: string;
321
321
  };
322
- };
323
- pivotGrid: {
324
- text: string;
325
- settingTitle: string;
322
+ pivotGrid: {
323
+ text: string;
324
+ settingTitle: string;
325
+ };
326
326
  };
327
327
  };
328
328
  };
@@ -324,11 +324,11 @@ export default {
324
324
  clear: '清空条件',
325
325
  queryPrev: '查找上一个',
326
326
  queryNext: '查找下一个'
327
+ },
328
+ pivotGrid: {
329
+ text: '透视表',
330
+ settingTitle: '透视表看板'
327
331
  }
328
- },
329
- pivotGrid: {
330
- text: '透视表',
331
- settingTitle: '透视表看板'
332
332
  }
333
333
  }
334
334
  };
@@ -1,9 +1,6 @@
1
+ import type { IColumn } from '../../../table/src/table/types';
1
2
  declare const _default: {
2
- selectionColumnDefine: {
3
- title: string;
4
- dataIndex: string;
5
- width: number;
6
- };
3
+ selectionColumnDefine: IColumn;
7
4
  indentWidth: number;
8
5
  };
9
6
  export default _default;
@@ -1,11 +1,13 @@
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';
4
5
  export type IGridLayoutContext = {
5
6
  scrollbarRef: React.RefObject<ScrollbarRef>;
6
7
  indentDepth: number;
7
8
  selectionKeys: IRowKey[];
8
- countMethod: Record<string, any>;
9
+ countMethod: Record<string, string>;
10
+ summationData: Summary;
9
11
  };
10
12
  type IProps = {
11
13
  scrollbar: React.RefObject<ScrollbarRef>;
@@ -15,6 +17,7 @@ export declare const GridLayoutProvider: React.FC<IProps>;
15
17
  export declare const useGridLayoutContext: () => (IGridLayoutContext & {
16
18
  setContext: (data: Partial<IGridLayoutContext>) => void;
17
19
  setSelectionKeys: (rowKeys: IRowKey[]) => void;
18
- setCountMethod: (value: IGridLayoutContext[`countMethod`]) => void;
20
+ setCountMethod: (value: Record<string, string | undefined>) => void;
21
+ setSummationData: (value: Summary) => void;
19
22
  }) | undefined;
20
23
  export {};
@@ -2,6 +2,8 @@ import React from 'react';
2
2
  import type { IColumn } from '../../../table/src/table/types';
3
3
  type IProps = {
4
4
  column: IColumn;
5
+ keyPath: string;
6
+ type: 'total' | 'subtotal';
5
7
  };
6
8
  declare const CountPanel: React.FC<IProps>;
7
9
  export default CountPanel;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  type IProps = {
3
- labelKey: string;
3
+ dataKey: string;
4
+ dataKeyPath: string;
4
5
  depth: number;
5
6
  className?: string;
6
7
  style?: React.CSSProperties;
@@ -15,7 +15,9 @@ export type IPivotGridContext = {
15
15
  viewMode: IPivotMode;
16
16
  size: ComponentSize;
17
17
  columns: IColumn[];
18
- tableData: IRecord[];
18
+ gridData: IRecord[];
19
+ originGridData: IRecord[];
20
+ groupGridData: Record<string, any> | Record<string, any>[];
19
21
  groupList: GroupItem[];
20
22
  filterList: ISuperFilter[];
21
23
  sorterList: SorterItem[];
@@ -23,6 +25,7 @@ export type IPivotGridContext = {
23
25
  };
24
26
  type IProps = {
25
27
  prefixCls: string;
28
+ tableData: IRecord[];
26
29
  flatColumns: IColumn[];
27
30
  children?: React.ReactNode;
28
31
  };
@@ -30,7 +33,8 @@ export declare const PivotGridProvider: React.FC<IProps>;
30
33
  export declare const usePivotGridContext: () => (IPivotGridContext & {
31
34
  setContext: (data: Partial<IPivotGridContext>) => void;
32
35
  setColumns: (items: IColumn[]) => void;
33
- setTableData: (records: IRecord[]) => void;
36
+ setGridData: (items: IRecord[]) => void;
37
+ setGroupGridData: (data: Record<string, any> | Record<string, any>[]) => void;
34
38
  setGroupList: (items: GroupItem[]) => void;
35
39
  setFilterList: (items: ISuperFilter[]) => void;
36
40
  setSorterList: (items: SorterItem[]) => void;
@@ -1,2 +1,31 @@
1
- import type { IRecord, IOrderBy } from '../../../table/src/table/types';
1
+ import type { IRecord, IOrderBy, IColumn } from '../../../table/src/table/types';
2
+ export declare const createGridColumns: (columns: IColumn[]) => IColumn[];
3
+ export declare const getStickyLeft: (flattenColumns: IColumn[], fieldName: string) => number;
2
4
  export declare const groupMultiData: (records: IRecord[], groupKeys: Record<string, IOrderBy>[] | undefined, fn: (row: IRecord, key: string) => string | number) => any;
5
+ export declare const getAllKeys: (data: Record<string, any> | Record<string, any>[], parentKey?: string) => string[];
6
+ export type Subtotal = {
7
+ [key: string]: number;
8
+ };
9
+ export type GroupSummary = {
10
+ subtotal: Subtotal;
11
+ };
12
+ export type Summary = {
13
+ [key: string]: GroupSummary | Subtotal;
14
+ };
15
+ export type FieldCalculations = Record<string, (dataList: number[]) => number>;
16
+ /**
17
+ * 递归计算分组数据
18
+ * @param {Object} group - 当前分组数据
19
+ * @returns {Object} - 计算后的结果
20
+ */
21
+ export declare const calculateSummary: (groupData: Record<string, any> | Record<string, any>[], fieldCalculations: Record<string, (data: number[]) => number>) => Summary;
22
+ export declare const calculations: {
23
+ sum: (arr: number[]) => number;
24
+ avg: (arr: number[]) => string | 0;
25
+ max: (arr: number[]) => number | undefined;
26
+ min: (arr: number[]) => number | undefined;
27
+ count: (arr: number[]) => number;
28
+ unique: (arr: number[]) => number;
29
+ empty: (arr: number[]) => number;
30
+ notEmpty: (arr: number[]) => number;
31
+ };
@@ -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-11-29 13:20:19
5
+ * @Last Modified time: 2024-12-02 20:51:13
6
6
  */
7
7
  @import '../../style/common';
8
8
 
@@ -11,10 +11,7 @@
11
11
  height: 100%;
12
12
  .header,
13
13
  .footer {
14
- overflow: hidden;
15
- background-color: #fff;
16
14
  border: 1px solid @--border-color-secondary;
17
- border-radius: @pivot-border-radius;
18
15
  .table {
19
16
  table-layout: fixed;
20
17
  display: contents;
@@ -35,7 +32,7 @@
35
32
  .header {
36
33
  position: sticky;
37
34
  top: 0;
38
- z-index: 1;
35
+ z-index: 2;
39
36
  .resize-bar {
40
37
  position: absolute;
41
38
  top: 0;
@@ -50,9 +47,8 @@
50
47
  min-height: fit-content;
51
48
  .group-card {
52
49
  margin: 15px 0;
53
- border: 1px solid @--border-color-secondary;
54
- border-radius: @pivot-border-radius;
55
50
  background-color: #fff;
51
+ border: 1px solid @--border-color-secondary;
56
52
  &.inner {
57
53
  margin: 0 12px 12px;
58
54
  }
@@ -66,6 +62,7 @@
66
62
  align-self: stretch;
67
63
  display: inline-flex;
68
64
  align-items: center;
65
+ background-color: #fff;
69
66
  border-bottom: 1px solid @--border-color-secondary;
70
67
  &.expandable-column {
71
68
  justify-content: center;
@@ -78,26 +75,31 @@
78
75
  }
79
76
  }
80
77
  }
78
+ &.col--fix-left {
79
+ position: sticky;
80
+ z-index: 1;
81
+ }
82
+ .title {
83
+ flex-shrink: 0;
84
+ margin-right: 20px;
85
+ }
81
86
  }
82
87
  }
83
88
  .grid-list {
84
89
  margin: 0;
85
90
  border: 0;
86
- border-radius: 0;
87
91
  background: transparent;
88
92
  }
89
93
  }
90
94
  .grid-list {
91
95
  margin: 15px 0;
92
96
  border: 1px solid @--border-color-secondary;
93
- border-radius: @pivot-border-radius;
94
- background-color: #fff;
95
97
  .table-row {
96
98
  display: flex;
97
99
  align-items: center;
98
100
  &:hover {
99
- background-color: @--background-color-light;
100
101
  .table-cell {
102
+ background-color: @--background-color-light;
101
103
  .order {
102
104
  display: none;
103
105
  }
@@ -121,26 +123,7 @@
121
123
  align-self: stretch; // 子元素高度和父元素一致
122
124
  display: inline-flex;
123
125
  align-items: center;
124
- border-right: 1px solid @--border-color-secondary;
125
126
  border-bottom: 1px solid @--border-color-secondary;
126
- &:last-child {
127
- border-right: 0;
128
- }
129
- &.selection-column {
130
- justify-content: center;
131
- border-right-color: transparent;
132
- }
133
- .order {
134
- display: inline-block;
135
- }
136
- .checkbox {
137
- display: none;
138
- }
139
- }
140
- &:last-child {
141
- .table-cell {
142
- border-bottom: 0;
143
- }
144
127
  }
145
128
  }
146
129
  }
@@ -148,12 +131,27 @@
148
131
  .footer {
149
132
  position: sticky;
150
133
  bottom: 0;
151
- z-index: 1;
134
+ z-index: 2;
152
135
  }
153
136
  .header,
154
137
  .body,
155
138
  .footer {
156
139
  .table-cell {
140
+ background-color: #fff;
141
+ border-right: 1px solid @--border-color-secondary;
142
+ &:last-child {
143
+ border-right: 0;
144
+ }
145
+ &.selection-column {
146
+ justify-content: center;
147
+ border-right-color: transparent;
148
+ }
149
+ .order {
150
+ display: inline-block;
151
+ }
152
+ .checkbox {
153
+ display: none;
154
+ }
157
155
  &.col--center {
158
156
  text-align: center !important;
159
157
  justify-content: center;
@@ -162,10 +160,17 @@
162
160
  text-align: right !important;
163
161
  justify-content: flex-end;
164
162
  }
163
+ &.col--fix-left {
164
+ position: sticky;
165
+ z-index: 1;
166
+ }
165
167
  .cell {
166
168
  .text-overflow-cut();
167
169
  padding: 0 @--padding-sm;
168
170
  }
171
+ }
172
+ .label-cell,
173
+ .table-cell {
169
174
  &:hover {
170
175
  .count-select {
171
176
  visibility: visible;
@@ -2,19 +2,19 @@
2
2
  * @Author: 焦质晔
3
3
  * @Date: 2022-03-16 19:05:30
4
4
  * @Last Modified by: 焦质晔
5
- * @Last Modified time: 2024-11-29 10:34:35
5
+ * @Last Modified time: 2024-12-04 09:17:17
6
6
  */
7
7
  @import '../../style/common';
8
8
 
9
9
  .button-icon {
10
- display: inline-block;
10
+ display: inline-flex;
11
11
  text-align: center;
12
12
  text-transform: none;
13
13
  text-decoration: none;
14
14
  background: transparent;
15
15
  border: 0;
16
16
  outline: 0;
17
- line-height: 0;
17
+ line-height: 1;
18
18
  padding: 5px;
19
19
  color: @--text-color-placeholder;
20
20
  border-radius: @--border-radius-lg;
@@ -28,6 +28,10 @@
28
28
  .@{prefix-pivot-grid}__popper {
29
29
  .container {
30
30
  padding: 6px 15px;
31
+ &.scroll-y {
32
+ overflow-y: auto;
33
+ max-height: calc(100vh - 10px);
34
+ }
31
35
  & > .label {
32
36
  display: flex;
33
37
  justify-content: space-between;
@@ -70,6 +74,33 @@
70
74
  display: none;
71
75
  }
72
76
  }
77
+ li.sort-item {
78
+ display: flex;
79
+ align-items: center;
80
+ border-radius: @--border-radius-lg;
81
+ transition: none;
82
+ .handle {
83
+ padding: 5px 6px 5px 2px;
84
+ color: @--text-color-placeholder;
85
+ cursor: s-resize;
86
+ }
87
+ .label {
88
+ flex: 1 0;
89
+ display: inline-flex;
90
+ align-items: center;
91
+ .title {
92
+ flex: 1 0;
93
+ }
94
+ }
95
+ }
96
+ li.divider {
97
+ padding: 6px;
98
+ &::after {
99
+ content: '';
100
+ display: block;
101
+ border-top: 1px solid @--border-color-secondary;
102
+ }
103
+ }
73
104
  }
74
105
  & > .add-record {
75
106
  display: flex;
@@ -5,5 +5,3 @@
5
5
  * @Last Modified time: 2024-11-28 20:04:56
6
6
  */
7
7
  @prefix-pivot-grid: ~'@{qm-prefix}-pivot-grid';
8
-
9
- @pivot-border-radius: 6px;
@@ -9,6 +9,7 @@ type IProps = {
9
9
  style?: CSSProperties;
10
10
  wrapClassName?: string;
11
11
  wrapStyle?: CSSProperties;
12
+ innerStyle?: CSSProperties;
12
13
  barWidth?: number;
13
14
  showTopScrollbar?: boolean;
14
15
  always?: boolean;
@@ -13,6 +13,7 @@
13
13
  &__wrap {
14
14
  display: grid;
15
15
  height: 100%;
16
+ max-height: inherit;
16
17
  overflow: auto;
17
18
  &--hidden {
18
19
  scrollbar-width: none;