pixel-react 1.9.7 → 1.9.9
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.
- package/lib/components/TableTree/Components/TableCell.d.ts +1 -1
- package/lib/components/TableTree/Components/TableRow.d.ts +1 -1
- package/lib/components/TableTree/types.d.ts +2 -0
- package/lib/index.esm.js +320 -317
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +320 -317
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/TableTree/Components/TableBody.tsx +2 -1
- package/src/components/TableTree/Components/TableCell.tsx +29 -17
- package/src/components/TableTree/Components/TableRow.tsx +2 -0
- package/src/components/TableTree/TableTree.tsx +3 -5
- package/src/components/TableTree/types.ts +2 -0
- package/src/utils/getTreeDetails/getTreeDetails.ts +3 -3
- package/src/utils/handleTreeNodeSelect/handleTreeNodeSelect.ts +0 -3
package/package.json
CHANGED
@@ -19,7 +19,7 @@ const TableBody = React.memo(
|
|
19
19
|
{flattenedTreeData?.map((node, index) => {
|
20
20
|
return (
|
21
21
|
<TableRow
|
22
|
-
key={node.
|
22
|
+
key={node.key}
|
23
23
|
node={node}
|
24
24
|
columnsData={columnsData}
|
25
25
|
selected={selected}
|
@@ -27,6 +27,7 @@ const TableBody = React.memo(
|
|
27
27
|
onRowClick={onRowClick}
|
28
28
|
onToggleExpand={(node) => onToggleExpand(node, index)}
|
29
29
|
onCheckBoxChange={onCheckBoxChange}
|
30
|
+
index={index}
|
30
31
|
/>
|
31
32
|
);
|
32
33
|
})}
|
@@ -5,6 +5,7 @@ import { TableCellProps } from '../types';
|
|
5
5
|
import Arrow from '../../../assets/icons/arrows_down_icon.svg?react';
|
6
6
|
import React from 'react';
|
7
7
|
import { checkEmpty } from '../../../utils/checkEmpty/checkEmpty';
|
8
|
+
import LabelEditTextField from '../../LabelEditTextField';
|
8
9
|
|
9
10
|
const renderSpaces = (
|
10
11
|
level: number,
|
@@ -43,6 +44,7 @@ const TableCell = React.memo(
|
|
43
44
|
select,
|
44
45
|
onCheckBoxChange,
|
45
46
|
onToggleExpand,
|
47
|
+
index,
|
46
48
|
}: TableCellProps) => (
|
47
49
|
<td className={`${col.isTree && node.folder ? 'folder' : ''}`}>
|
48
50
|
{col.isTree &&
|
@@ -69,27 +71,37 @@ const TableCell = React.memo(
|
|
69
71
|
col.isTree && node.folder ? 'folder' : ''
|
70
72
|
}`}
|
71
73
|
>
|
72
|
-
{
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
{!node?.showInput && (
|
75
|
+
<>
|
76
|
+
{col.isTree && select === 'checkbox' && (
|
77
|
+
<Checkbox
|
78
|
+
checked={node?.checked || false}
|
79
|
+
partial={node?.checked === 'partial'}
|
80
|
+
onChange={(e) => onCheckBoxChange(e, node)}
|
81
|
+
/>
|
82
|
+
)}
|
83
|
+
{col.isTree && select === 'radio' && (
|
84
|
+
<RadioButton
|
85
|
+
name={node.title}
|
86
|
+
checked={selected.includes(node.id)}
|
87
|
+
value={node.id}
|
88
|
+
onChange={(e) => onCheckBoxChange(e, node)}
|
89
|
+
/>
|
90
|
+
)}
|
91
|
+
</>
|
77
92
|
)}
|
78
|
-
{
|
79
|
-
<
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
/>
|
93
|
+
{node.showInput && col.isTree ? (
|
94
|
+
<LabelEditTextField isOpen={true} />
|
95
|
+
) : (
|
96
|
+
<span className="tree-table-td-content-text">
|
97
|
+
{prepareData(node, col)}
|
98
|
+
</span>
|
85
99
|
)}
|
86
|
-
<span className="tree-table-td-content-text">
|
87
|
-
{prepareData(node, col)}
|
88
|
-
</span>
|
89
100
|
</span>
|
90
101
|
</div>
|
91
|
-
|
92
|
-
|
102
|
+
|
103
|
+
{col.actions && !node?.showInput && (
|
104
|
+
<div className="table-tree-row-action">{col.actions(node, index)}</div>
|
93
105
|
)}
|
94
106
|
</td>
|
95
107
|
)
|
@@ -11,6 +11,7 @@ const TableRow = React.memo(
|
|
11
11
|
onRowClick,
|
12
12
|
onToggleExpand,
|
13
13
|
onCheckBoxChange,
|
14
|
+
index,
|
14
15
|
}: TableRowProps) => (
|
15
16
|
<tr
|
16
17
|
data-level={node.hierarchy}
|
@@ -26,6 +27,7 @@ const TableRow = React.memo(
|
|
26
27
|
select={select}
|
27
28
|
onCheckBoxChange={onCheckBoxChange}
|
28
29
|
onToggleExpand={onToggleExpand}
|
30
|
+
index={index}
|
29
31
|
/>
|
30
32
|
))}
|
31
33
|
</tr>
|
@@ -4,7 +4,6 @@ import { TreeTableProps } from './types';
|
|
4
4
|
import TableHead from './Components/TableHead';
|
5
5
|
import TableBody from './Components/TableBody';
|
6
6
|
import { useIntersectionObserver } from '../../hooks/useIntersectionObserver';
|
7
|
-
import functionCheck from '../../utils/functionCheck/functionCheck';
|
8
7
|
import { TreeNodeProps } from '../../ComponentProps/TreeNodeProps';
|
9
8
|
|
10
9
|
const TreeTable: React.FC<TreeTableProps> = ({
|
@@ -28,14 +27,13 @@ const TreeTable: React.FC<TreeTableProps> = ({
|
|
28
27
|
threshold: 0.1,
|
29
28
|
onIntersect: (entry) => {
|
30
29
|
if (entry.isIntersecting) {
|
31
|
-
if (
|
32
|
-
let direction = '
|
30
|
+
if (loadMore) {
|
31
|
+
let direction = 'above';
|
33
32
|
if (entry.target.id === 'ff-table-tree-last-node') {
|
34
|
-
direction = '
|
33
|
+
direction = 'below';
|
35
34
|
}
|
36
35
|
loadMore(direction);
|
37
36
|
}
|
38
|
-
console.log('Element in view:', entry.target.id);
|
39
37
|
}
|
40
38
|
},
|
41
39
|
}
|
@@ -10,6 +10,7 @@ export interface TableCellProps {
|
|
10
10
|
select: string | null;
|
11
11
|
onCheckBoxChange: (e: any, node: string[] | any) => void;
|
12
12
|
onToggleExpand: (node: any) => void;
|
13
|
+
index: number;
|
13
14
|
}
|
14
15
|
|
15
16
|
export interface TableHeadProps {
|
@@ -34,6 +35,7 @@ export interface TableRowProps {
|
|
34
35
|
onRowClick: (e: any, node: any) => void;
|
35
36
|
onToggleExpand: (node: TreeNode) => void;
|
36
37
|
onCheckBoxChange: (e: any, node: string[] | any) => void;
|
38
|
+
index: number;
|
37
39
|
}
|
38
40
|
|
39
41
|
export interface Column {
|
@@ -36,9 +36,9 @@ export const getTreeDetails = (
|
|
36
36
|
}
|
37
37
|
break;
|
38
38
|
case 'start':
|
39
|
-
if (
|
40
|
-
root =
|
41
|
-
treeDataList =
|
39
|
+
if (newData.length > 0) {
|
40
|
+
root = newData[0];
|
41
|
+
treeDataList = newData.slice(1);
|
42
42
|
} else {
|
43
43
|
throw new Error('Tree data list is empty, cannot determine root.');
|
44
44
|
}
|
@@ -47,13 +47,10 @@ export const handleTreeNodeSect = (
|
|
47
47
|
}
|
48
48
|
}
|
49
49
|
|
50
|
-
// Find the target node and update its state
|
51
50
|
const targetNode = nodesMap.get(key);
|
52
51
|
if (targetNode) {
|
53
52
|
targetNode.checked = isChecked;
|
54
|
-
// Update children recursively
|
55
53
|
updateChildren(key, isChecked);
|
56
|
-
// Update parents recursively
|
57
54
|
updateParents(key);
|
58
55
|
}
|
59
56
|
|