@jiaozhiye/qm-design-react 1.10.18 → 1.11.0

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 (54) hide show
  1. package/lib/form/src/form.d.ts +2 -1
  2. package/lib/form/src/types.d.ts +5 -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 -0
  8. package/lib/locale/lang/en.js +5 -1
  9. package/lib/locale/lang/zh-cn.d.ts +4 -0
  10. package/lib/locale/lang/zh-cn.js +5 -1
  11. package/lib/pivot-grid/index.d.ts +3 -0
  12. package/lib/pivot-grid/src/config/index.d.ts +9 -0
  13. package/lib/pivot-grid/src/grid-layout/Body.d.ts +3 -0
  14. package/lib/pivot-grid/src/grid-layout/Context.d.ts +20 -0
  15. package/lib/pivot-grid/src/grid-layout/CountPanel.d.ts +7 -0
  16. package/lib/pivot-grid/src/grid-layout/Footer.d.ts +3 -0
  17. package/lib/pivot-grid/src/grid-layout/GroupCard.d.ts +10 -0
  18. package/lib/pivot-grid/src/grid-layout/Header.d.ts +3 -0
  19. package/lib/pivot-grid/src/grid-layout/List.d.ts +7 -0
  20. package/lib/pivot-grid/src/grid-layout/ResizeBar.d.ts +7 -0
  21. package/lib/pivot-grid/src/grid-layout/index.d.ts +3 -0
  22. package/lib/pivot-grid/src/main/Context.d.ts +39 -0
  23. package/lib/pivot-grid/src/main/index.d.ts +3 -0
  24. package/lib/pivot-grid/src/main/types.d.ts +8 -0
  25. package/lib/pivot-grid/src/top-bar/FieldsPanel.d.ts +3 -0
  26. package/lib/pivot-grid/src/top-bar/FilterPanel.d.ts +3 -0
  27. package/lib/pivot-grid/src/top-bar/GroupPanel.d.ts +3 -0
  28. package/lib/pivot-grid/src/top-bar/LineHeightPanel.d.ts +3 -0
  29. package/lib/pivot-grid/src/top-bar/SearchPanel.d.ts +3 -0
  30. package/lib/pivot-grid/src/top-bar/SorterPanel.d.ts +3 -0
  31. package/lib/pivot-grid/src/top-bar/ViewMode.d.ts +3 -0
  32. package/lib/pivot-grid/src/top-bar/index.d.ts +3 -0
  33. package/lib/pivot-grid/src/utils/index.d.ts +2 -0
  34. package/lib/pivot-grid/style/grid-layout.less +234 -0
  35. package/lib/pivot-grid/style/index.less +10 -0
  36. package/lib/pivot-grid/style/main.less +43 -0
  37. package/lib/pivot-grid/style/top-bar.less +105 -0
  38. package/lib/pivot-grid/style/variable.less +9 -0
  39. package/lib/style/index.css +436 -3
  40. package/lib/style/index.less +2 -1
  41. package/lib/style/index.min.css +1 -1
  42. package/lib/table/src/body/DraggableTr.d.ts +26 -0
  43. package/lib/table/src/body/dragUtils.d.ts +43 -0
  44. package/lib/table/src/body/useDragSort.d.ts +24 -0
  45. package/lib/table/src/context/index.d.ts +1 -0
  46. package/lib/table/src/hooks/useTableMemo.d.ts +1 -0
  47. package/lib/table/src/pivot-grid/index.d.ts +7 -0
  48. package/lib/table/src/table/props.d.ts +3 -1
  49. package/lib/table/src/table/types.d.ts +6 -1
  50. package/lib/table/src/toolbox/index.d.ts +1 -0
  51. package/lib/table/style/body.less +103 -77
  52. package/lib/table/style/index.less +31 -30
  53. package/lib/table/style/pivot-grid.less +19 -0
  54. package/package.json +1 -1
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import type { DropOption } from './useDragSort';
3
+ import type { IRecord, IRowKey } from '../table/types';
4
+ export type IProps = {
5
+ rowKey: IRowKey;
6
+ row: IRecord;
7
+ className: string;
8
+ style?: React.CSSProperties;
9
+ indent: number;
10
+ filter?: string;
11
+ dropOption: DropOption;
12
+ onNodeDragStart: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
13
+ onNodeDragEnter: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
14
+ onNodeDragOver: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
15
+ onNodeDragLeave: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
16
+ onNodeDragEnd: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
17
+ onNodeDrop: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
18
+ children?: React.ReactNode;
19
+ };
20
+ export type NodeType = {
21
+ eventKey: IRowKey;
22
+ data: IRecord;
23
+ props: IProps;
24
+ };
25
+ declare const DraggableTr: React.FC<IProps>;
26
+ export default DraggableTr;
@@ -0,0 +1,43 @@
1
+ import type { Nullable } from '../../../_utils/types';
2
+ import type { IRecord, IRowKey } from '../table/types';
3
+ import type { NodeType } from './DraggableTr';
4
+ export type KeyEntity = {
5
+ index: number;
6
+ key: IRowKey;
7
+ level: number;
8
+ node: IRecord;
9
+ nodes: IRecord[];
10
+ parent: Nullable<KeyEntity>;
11
+ pos: string;
12
+ children?: KeyEntity[];
13
+ };
14
+ export declare const calcDropPosition: (event: React.MouseEvent, dragNode: NodeType, targetNode: NodeType, indent: number, startMousePosition: {
15
+ x: number;
16
+ y: number;
17
+ }, allowDrop: (option: any) => boolean, flattenedKeys: IRowKey[], keyEntities: Record<string, KeyEntity>, expandKeys: IRowKey[], forbidTree: boolean) => {
18
+ dropPosition: -1 | 0 | 1;
19
+ dropLevelOffset: number;
20
+ dropTargetKey: IRowKey;
21
+ dropTargetPos: string;
22
+ dropContainerKey: Nullable<IRowKey>;
23
+ dragOverNodeKey: IRowKey;
24
+ dropAllowed: boolean;
25
+ };
26
+ export declare const getEntity: (keyEntities: Record<string, KeyEntity>, key: IRowKey) => KeyEntity;
27
+ export declare const arrDel: (list: IRowKey[], value: IRowKey) => (string | number)[];
28
+ export declare const arrAdd: (list: IRowKey[], value: IRowKey) => (string | number)[];
29
+ export declare const posToArr: (pos: string) => string[];
30
+ export declare const isLastChild: (treeNodeEntity: KeyEntity) => boolean;
31
+ export declare const isFirstChild: (treeNodeEntity: KeyEntity) => boolean;
32
+ export declare const getDragChildrenKeys: (dragNodeKey: IRowKey, keyEntities: Record<string, KeyEntity>) => (string | number)[];
33
+ export declare const getTreeNodeProps: (key: IRowKey, { dragOverNodeKey, dropPosition, keyEntities }: {
34
+ dragOverNodeKey: any;
35
+ dropPosition: any;
36
+ keyEntities: any;
37
+ }) => {
38
+ eventKey: string | number;
39
+ pos: string;
40
+ dragOver: boolean;
41
+ dragOverGapTop: boolean;
42
+ dragOverGapBottom: boolean;
43
+ };
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import type { Nullable } from '../../../_utils/types';
3
+ import type { IRowKey } from '../table/types';
4
+ import type { NodeType } from './DraggableTr';
5
+ export type DropOption = {
6
+ dropPosition: -1 | 0 | 1 | null;
7
+ dropLevelOffset: number | null;
8
+ dropContainerKey: IRowKey | null;
9
+ dropTargetKey: IRowKey | null;
10
+ dropTargetPos: string | null;
11
+ dropAllowed: boolean;
12
+ dragOverNodeKey: IRowKey | null;
13
+ };
14
+ declare const useDragSort: () => {
15
+ onNodeDragStart: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
16
+ onNodeDragEnter: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
17
+ onNodeDragOver: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
18
+ onNodeDragLeave: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
19
+ onNodeDragEnd: (ev: React.DragEvent<HTMLTableRowElement>, node: Nullable<NodeType>, outsideTree?: boolean) => void;
20
+ onNodeDrop: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType, outsideTree?: boolean) => void;
21
+ indent: number;
22
+ dropOptions: DropOption;
23
+ };
24
+ export default useDragSort;
@@ -7,6 +7,7 @@ export type ITableContext = {
7
7
  getRowKey: (row: IRecord, index: number) => IRowKey;
8
8
  tableRef: React.MutableRefObject<ITableRef>;
9
9
  tableBodyRef: React.RefObject<TableBodyRef>;
10
+ prefixCls: string;
10
11
  $size: ComponentSize;
11
12
  flattenColumns: IColumn[];
12
13
  editableColumns: IColumn[];
@@ -39,6 +39,7 @@ declare const useTableMemo: <T extends ITableProps>(props: T, extra: IExtra) =>
39
39
  isTableClipboard: boolean;
40
40
  isSuperSearch: boolean;
41
41
  isFastSearch: boolean;
42
+ isPivotGrid: boolean;
42
43
  isGroupSummary: boolean;
43
44
  isGroupSubtotal: boolean;
44
45
  isTreeTable: boolean;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { ToolMethodRef } from '../table/types';
3
+ type IFastSearchProps = {
4
+ open?: boolean;
5
+ };
6
+ declare const PivotGrid: React.ForwardRefExoticComponent<IFastSearchProps & React.RefAttributes<ToolMethodRef>>;
7
+ export default PivotGrid;
@@ -137,7 +137,8 @@ export declare const propTypes: {
137
137
  loading: PropTypes.Requireable<boolean>;
138
138
  resizable: PropTypes.Requireable<boolean>;
139
139
  uniqueKey: PropTypes.Requireable<string>;
140
- customClass: PropTypes.Requireable<string>;
140
+ className: PropTypes.Requireable<string>;
141
+ style: PropTypes.Requireable<object>;
141
142
  showHeader: PropTypes.Requireable<boolean>;
142
143
  ellipsis: PropTypes.Requireable<boolean>;
143
144
  dynamicThead: PropTypes.Requireable<boolean>;
@@ -270,6 +271,7 @@ export declare const propTypes: {
270
271
  showToolBox: PropTypes.Requireable<boolean>;
271
272
  showColumnDefine: PropTypes.Requireable<boolean>;
272
273
  showTableInfo: PropTypes.Requireable<boolean>;
274
+ showPivotGrid: PropTypes.Requireable<boolean>;
273
275
  onlyShowIcon: PropTypes.Requireable<boolean>;
274
276
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
275
277
  onDataChange: PropTypes.Requireable<(...args: any[]) => any>;
@@ -9,6 +9,7 @@ export type InsertMode = 'before' | 'after';
9
9
  export type IFilterType = 'text' | 'textarea' | 'checkbox' | 'radio' | 'number' | 'date' | 'tree';
10
10
  export type ICheckStrategy = 'SHOW_ALL' | 'SHOW_PARENT' | 'SHOW_CHILD';
11
11
  export type IEditerType = 'text' | 'textarea' | 'number' | 'select' | 'select-multiple' | 'checkbox' | 'switch' | 'search-helper' | 'search-helper-multiple' | 'tree-helper' | 'tree-helper-multiple' | 'date' | 'datetime' | 'time' | 'month' | 'year' | 'custom';
12
+ export type IOrderBy = 'ascend' | 'descend';
12
13
  export type ISelectionType = 'checkbox' | 'radio';
13
14
  export type IRecord<T = any> = {
14
15
  [key: string]: T;
@@ -86,7 +87,7 @@ export type ISuperFilter = {
86
87
  bracketLeft: string;
87
88
  fieldName: string;
88
89
  expression: string;
89
- value: unknown;
90
+ value: any;
90
91
  bracketRight: string;
91
92
  logic: string;
92
93
  };
@@ -349,7 +350,10 @@ export type ITableProps = {
349
350
  loading?: boolean;
350
351
  resizable?: boolean;
351
352
  uniqueKey?: string;
353
+ /** @deprecated use `className` instead, and it will be deprecated in the next major version */
352
354
  customClass?: string;
355
+ className?: string;
356
+ style?: CSSProperties;
353
357
  showHeader?: boolean;
354
358
  ellipsis?: boolean;
355
359
  dynamicThead?: boolean;
@@ -402,6 +406,7 @@ export type ITableProps = {
402
406
  showToolBox?: boolean;
403
407
  showColumnDefine?: boolean;
404
408
  showTableInfo?: boolean;
409
+ showPivotGrid?: boolean;
405
410
  children?: React.ReactNode;
406
411
  onlyShowIcon?: boolean;
407
412
  onChange?: (pagination: IPagination, filters: IFilter, sorter: ISorter, superFilters: ISuperFilter[], extra: {
@@ -11,6 +11,7 @@ type IToolBoxProps = {
11
11
  showCollection?: boolean;
12
12
  showFastSearch?: boolean;
13
13
  showSuperSearch?: boolean;
14
+ showPivotGrid?: boolean;
14
15
  showGroupSummary?: boolean;
15
16
  showToolBox?: boolean;
16
17
  };
@@ -1,77 +1,103 @@
1
- /*
2
- * @Author: 焦质晔
3
- * @Date: 2020-02-28 22:13:54
4
- * @Last Modified by: 焦质晔
5
- * @Last Modified time: 2023-10-15 12:47:18
6
- */
7
- .body--column {
8
- .cell--edit {
9
- margin: 0 -1 * (@v-module-distance - 1px);
10
- // placeholder
11
- input::placeholder {
12
- text-align: left;
13
- }
14
- // search
15
- .ant-input-search {
16
- width: calc(100% + 1px);
17
- & > .ant-input-group > .ant-input-group-addon {
18
- line-height: 1;
19
- }
20
- }
21
- // search-helper-multiple
22
- .search-helper-multiple {
23
- .ant-input-group > .ant-select:first-child {
24
- z-index: 1;
25
- .ant-select-selector {
26
- border-top-right-radius: 0;
27
- border-bottom-right-radius: 0;
28
- }
29
- }
30
- .ant-select-multiple {
31
- .ant-select-selection-overflow-item-rest {
32
- pointer-events: none;
33
- }
34
- }
35
- }
36
- // textArea
37
- textarea[class='ant-input'] {
38
- resize: none;
39
- }
40
- &.is-error {
41
- position: relative;
42
- .ant-input,
43
- .ant-input-affix-wrapper {
44
- border-color: @v-danger-color;
45
- box-shadow: none;
46
- z-index: 1;
47
- }
48
- .ant-input-search {
49
- & + .cell-error {
50
- right: 38px;
51
- }
52
- }
53
- .cell-error {
54
- position: absolute;
55
- top: calc(50% - 9px);
56
- font-size: @v-font-size-small;
57
- color: @v-danger-color;
58
- right: 8px;
59
- pointer-events: none;
60
- z-index: 1;
61
- }
62
- }
63
- }
64
- &.col--center {
65
- .cell--edit .ant-input {
66
- text-align: center;
67
- }
68
- }
69
- &.col--right {
70
- .cell--edit .ant-input {
71
- text-align: right;
72
- }
73
- }
74
- &.selected {
75
- background-color: @v-table-row-selected-background-color !important;
76
- }
77
- }
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2020-02-28 22:13:54
4
+ * @Last Modified by: 焦质晔
5
+ * @Last Modified time: 2024-12-01 18:48:00
6
+ */
7
+ .body--row {
8
+ &-draggable {
9
+ position: relative;
10
+ .drop-indicator {
11
+ position: absolute;
12
+ right: 0;
13
+ bottom: 0;
14
+ z-index: 5;
15
+ height: 2px;
16
+ background-color: @v-primary-color;
17
+ border-radius: 1px;
18
+ pointer-events: none;
19
+ &::after {
20
+ position: absolute;
21
+ top: -3px;
22
+ left: 0;
23
+ width: 8px;
24
+ height: 8px;
25
+ background-color: #fff;
26
+ border: 2px solid @v-primary-color;
27
+ border-radius: 50%;
28
+ content: '';
29
+ }
30
+ }
31
+ }
32
+ }
33
+ .body--column {
34
+ .cell--edit {
35
+ margin: 0 -1 * (@v-module-distance - 1px);
36
+ // placeholder
37
+ input::placeholder {
38
+ text-align: left;
39
+ }
40
+ // search
41
+ .ant-input-search {
42
+ width: calc(100% + 1px);
43
+ & > .ant-input-group > .ant-input-group-addon {
44
+ line-height: 1;
45
+ }
46
+ }
47
+ // search-helper-multiple
48
+ .search-helper-multiple {
49
+ .ant-input-group > .ant-select:first-child {
50
+ z-index: 1;
51
+ .ant-select-selector {
52
+ border-top-right-radius: 0;
53
+ border-bottom-right-radius: 0;
54
+ }
55
+ }
56
+ .ant-select-multiple {
57
+ .ant-select-selection-overflow-item-rest {
58
+ pointer-events: none;
59
+ }
60
+ }
61
+ }
62
+ // textArea
63
+ textarea[class='ant-input'] {
64
+ resize: none;
65
+ }
66
+ &.is-error {
67
+ position: relative;
68
+ .ant-input,
69
+ .ant-input-affix-wrapper {
70
+ border-color: @v-danger-color;
71
+ box-shadow: none;
72
+ z-index: 1;
73
+ }
74
+ .ant-input-search {
75
+ & + .cell-error {
76
+ right: 38px;
77
+ }
78
+ }
79
+ .cell-error {
80
+ position: absolute;
81
+ top: calc(50% - 9px);
82
+ font-size: @v-font-size-small;
83
+ color: @v-danger-color;
84
+ right: 8px;
85
+ pointer-events: none;
86
+ z-index: 1;
87
+ }
88
+ }
89
+ }
90
+ &.col--center {
91
+ .cell--edit .ant-input {
92
+ text-align: center;
93
+ }
94
+ }
95
+ &.col--right {
96
+ .cell--edit .ant-input {
97
+ text-align: right;
98
+ }
99
+ }
100
+ &.selected {
101
+ background-color: @v-table-row-selected-background-color !important;
102
+ }
103
+ }
@@ -1,30 +1,31 @@
1
- /*
2
- * @Author: 焦质晔
3
- * @Date: 2021-07-23 19:05:57
4
- * @Last Modified by: 焦质晔
5
- * @Last Modified time: 2024-07-23 09:28:50
6
- */
7
- @import './variable.less';
8
- @import './toper.less';
9
- @import './alert.less';
10
- @import './full-screen.less';
11
- @import './reload.less';
12
- @import './print.less';
13
- @import './import.less';
14
- @import './export.less';
15
- @import './clipboard.less';
16
- @import './tollbox.less';
17
- @import './select-collection.less';
18
- @import './group-summary.less';
19
- @import './super-search.less';
20
- @import './fast-search.less';
21
- @import './column-filter.less';
22
- @import './table.less';
23
- @import './header.less';
24
- @import './body.less';
25
- @import './footer.less';
26
- @import './area-select.less';
27
- @import './pager.less';
28
- @import './empty.less';
29
- @import './expandable.less';
30
- @import './size.less';
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2021-07-23 19:05:57
4
+ * @Last Modified by: 焦质晔
5
+ * @Last Modified time: 2024-12-01 14:16:57
6
+ */
7
+ @import './variable.less';
8
+ @import './toper.less';
9
+ @import './alert.less';
10
+ @import './full-screen.less';
11
+ @import './reload.less';
12
+ @import './print.less';
13
+ @import './import.less';
14
+ @import './export.less';
15
+ @import './clipboard.less';
16
+ @import './tollbox.less';
17
+ @import './select-collection.less';
18
+ @import './group-summary.less';
19
+ @import './super-search.less';
20
+ @import './fast-search.less';
21
+ @import './pivot-grid.less';
22
+ @import './column-filter.less';
23
+ @import './table.less';
24
+ @import './header.less';
25
+ @import './body.less';
26
+ @import './footer.less';
27
+ @import './area-select.less';
28
+ @import './pager.less';
29
+ @import './empty.less';
30
+ @import './expandable.less';
31
+ @import './size.less';
@@ -0,0 +1,19 @@
1
+ /*
2
+ * @Author: 焦质晔
3
+ * @Date: 2024-12-01 14:16:05
4
+ * @Last Modified by: 焦质晔
5
+ * @Last Modified time: 2024-12-01 14:16:28
6
+ */
7
+ .@{prefix-table}-pivot-grid {
8
+ display: inline-block;
9
+ padding: 5px 3px;
10
+ line-height: 1;
11
+ cursor: pointer;
12
+ transition: all 0.3s ease;
13
+ .icon {
14
+ font-size: 1.05em;
15
+ }
16
+ &:hover {
17
+ color: @v-primary-color;
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jiaozhiye/qm-design-react",
3
- "version": "1.10.18",
3
+ "version": "1.11.0",
4
4
  "description": "A Component Library for React",
5
5
  "keywords": [
6
6
  "React",