dcp-design-react 1.10.19 → 1.11.1

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.
@@ -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,27 @@
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
+ type IProps = {
15
+ openDragSort?: boolean;
16
+ };
17
+ declare const useDragSort: ({ openDragSort }: IProps) => {
18
+ onNodeDragStart: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
19
+ onNodeDragEnter: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
20
+ onNodeDragOver: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
21
+ onNodeDragLeave: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType) => void;
22
+ onNodeDragEnd: (ev: React.DragEvent<HTMLTableRowElement>, node: Nullable<NodeType>, outsideTree?: boolean) => void;
23
+ onNodeDrop: (ev: React.DragEvent<HTMLTableRowElement>, node: NodeType, outsideTree?: boolean) => void;
24
+ indent: number;
25
+ dropOptions: DropOption;
26
+ };
27
+ 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[];
@@ -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>;
@@ -350,7 +350,10 @@ export type ITableProps = {
350
350
  loading?: boolean;
351
351
  resizable?: boolean;
352
352
  uniqueKey?: string;
353
+ /** @deprecated use `className` instead, and it will be deprecated in the next major version */
353
354
  customClass?: string;
355
+ className?: string;
356
+ style?: CSSProperties;
354
357
  showHeader?: boolean;
355
358
  ellipsis?: boolean;
356
359
  dynamicThead?: boolean;
@@ -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-11-28 20:00:14
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": "dcp-design-react",
3
- "version": "1.10.19",
3
+ "version": "1.11.1",
4
4
  "description": "A Component Library for React",
5
5
  "keywords": [
6
6
  "React",