File tree 1 file changed +5
-9
lines changed
packages/components/src/components/hds/advanced-table/models
1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ function getVisibleRows(rows: HdsAdvancedTableRow[]): HdsAdvancedTableRow[] {
23
23
} , [ ] as HdsAdvancedTableRow [ ] ) ;
24
24
}
25
25
26
+ function getChildrenCount ( rows : HdsAdvancedTableRow [ ] ) : number {
27
+ return rows . reduce ( ( acc , row ) => acc + 1 + getChildrenCount ( row . children ) , 0 ) ;
28
+ }
29
+
26
30
export default class HdsAdvancedTableTableModel {
27
31
rows : HdsAdvancedTableRow [ ] = [ ] ;
28
32
@@ -35,15 +39,7 @@ export default class HdsAdvancedTableTableModel {
35
39
}
36
40
37
41
get totalRowCount ( ) : number {
38
- function getChildrenCount ( rows : HdsAdvancedTableRow [ ] ) : number {
39
- return rows . reduce ( ( acc , row ) => {
40
- return acc + 1 + getChildrenCount ( row . children ) ;
41
- } , 0 ) ;
42
- }
43
-
44
- return this . rows . reduce ( ( acc , row ) => {
45
- return acc + 1 + getChildrenCount ( row . children ) ;
46
- } , 0 ) ;
42
+ return getChildrenCount ( this . rows ) ;
47
43
}
48
44
49
45
get flattenedVisibleRows ( ) : HdsAdvancedTableRow [ ] {
You can’t perform that action at this time.
0 commit comments