@jiaozhiye/qm-design-react 1.11.15 → 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,8 +38,11 @@ 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;
@@ -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,7 +2,7 @@
2
2
  * @Author: 焦质晔
3
3
  * @Date: 2022-03-16 19:05:30
4
4
  * @Last Modified by: 焦质晔
5
- * @Last Modified time: 2025-01-09 17:14:40
5
+ * @Last Modified time: 2025-01-12 14:23:51
6
6
  */
7
7
  @import '../../style/common';
8
8
 
@@ -10,6 +10,7 @@
10
10
  .reset-container();
11
11
  width: 100%;
12
12
  .@{qm-prefix}-scrollbar__wrap {
13
+ // 调整为 flex 布局
13
14
  display: flex;
14
15
  flex-wrap: nowrap;
15
16
  & > div {
@@ -266,6 +267,11 @@
266
267
  }
267
268
  }
268
269
  }
270
+ &.row--highlight {
271
+ .table-cell {
272
+ background-color: @--primary-1;
273
+ }
274
+ }
269
275
  &.row--hover {
270
276
  .table-cell {
271
277
  .drag-icon,
@@ -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: 2025-01-09 17:14:40
31183
+ * @Last Modified time: 2025-01-12 14:23:51
31184
31184
  */
31185
31185
  .qm-pivot-grid__layout {
31186
31186
  box-sizing: border-box;
@@ -31492,6 +31492,9 @@ body {
31492
31492
  .qm-pivot-grid__layout .container .row-item .table-row.row--selection .table-cell .middle .checkbox {
31493
31493
  display: inline-flex;
31494
31494
  }
31495
+ .qm-pivot-grid__layout .container .row-item .table-row.row--highlight .table-cell {
31496
+ background-color: #e6f7ff;
31497
+ }
31495
31498
  .qm-pivot-grid__layout .container .row-item .table-row.row--hover .table-cell .drag-icon,
31496
31499
  .qm-pivot-grid__layout .container .row-item .table-row.row--hover .table-cell .expand-icon {
31497
31500
  visibility: visible;
@@ -31519,6 +31522,32 @@ body {
31519
31522
  .qm-pivot-grid__layout.large .table-cell {
31520
31523
  height: 42px;
31521
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
+ }
31522
31551
  /*
31523
31552
  * @Author: 焦质晔
31524
31553
  * @Date: 2024-12-02 09:06:20