playbook_ui 13.21.0.pre.alpha.pbntr220improveexpansionspeed2451 → 13.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/ExpansionControlHelpers.tsx +35 -20
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +5 -4
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +9 -15
- data/lib/playbook/version.rb +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6c19fad05505af542ad2b4998d9d9d6f225ad3b46568420e87f7a3d72847cf2
|
4
|
+
data.tar.gz: '05208a0115fc90b97569c6c96c3847211b2136550f95817eb2dd8eb3eac2c90a'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adad3d8a3607b475d9f16c1cc34ee1937fb52b4d2e3af4c7dd481a5a258ba972aa6df89bcbc1c59bb833300b3b9ff9d5988741321bfb5908d6e3706449f7b397
|
7
|
+
data.tar.gz: 1636c11fdc69b49524df0d8c0d17e91dc732f356fe279b78fc90287053bec7c7529377376acd1cb22d2b6903552d1ea448e91e3730c2738b47f62fdc4a15452e
|
@@ -15,27 +15,42 @@ export const updateExpandAndCollapseState = (
|
|
15
15
|
expanded: Record<string, boolean>,
|
16
16
|
targetParent: string
|
17
17
|
) => {
|
18
|
-
const updateExpandedRows: Record<string, boolean> = {}
|
19
|
-
const rows = tableRows.
|
20
|
-
|
21
|
-
let isExpansionConsistent = true
|
22
|
-
const areRowsExpanded = new Set<boolean>()
|
18
|
+
const updateExpandedRows: Record<string, boolean> = {}
|
19
|
+
const rows = tableRows.flatRows
|
20
|
+
// Variable checks if all rows in a section have same expansion state or not
|
21
|
+
let isExpansionConsistent = true
|
22
|
+
const areRowsExpanded = new Set<boolean>()
|
23
23
|
|
24
|
+
// Update isExpansionConsistent variable
|
24
25
|
for (const row of rows) {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
updateExpandedRows[row.id] = !isExpansionConsistent ? true : !isExpanded;
|
32
|
-
|
26
|
+
if (
|
27
|
+
targetParent === undefined
|
28
|
+
? row.depth === 0
|
29
|
+
: targetParent === row.parentId
|
30
|
+
) {
|
31
|
+
areRowsExpanded.add(row.getIsExpanded())
|
33
32
|
if (areRowsExpanded.size > 1) {
|
34
|
-
isExpansionConsistent = false
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
isExpansionConsistent = false
|
34
|
+
break
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
// The if statement runs only for row depth 0, the else statement for the rest
|
40
|
+
if (targetParent === undefined) {
|
41
|
+
rows.forEach(row => {
|
42
|
+
if (row.depth === 0) {
|
43
|
+
updateExpandedRows[row.id] = !isExpansionConsistent
|
44
|
+
? true
|
45
|
+
: !row.getIsExpanded()
|
46
|
+
}
|
47
|
+
})
|
48
|
+
} else {
|
49
|
+
for (const row of rows) {
|
50
|
+
if (targetParent === row.parentId) {
|
51
|
+
updateExpandedRows[row.id] = !isExpansionConsistent
|
52
|
+
? true
|
53
|
+
: !row.getIsExpanded()
|
39
54
|
}
|
40
55
|
}
|
41
56
|
}
|
@@ -43,5 +58,5 @@ export const updateExpandAndCollapseState = (
|
|
43
58
|
return filterExpandableRows({
|
44
59
|
...(expanded as ExpandedStateObject),
|
45
60
|
...updateExpandedRows,
|
46
|
-
})
|
47
|
-
}
|
61
|
+
})
|
62
|
+
}
|
@@ -191,13 +191,14 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
191
191
|
}
|
192
192
|
}, [loading, updateLoadingStateRowCount]);
|
193
193
|
|
194
|
-
const handleExpandOrCollapse =
|
194
|
+
const handleExpandOrCollapse = (row: Row<DataType>) => {
|
195
195
|
onToggleExpansionClick && onToggleExpansionClick(row);
|
196
|
-
|
196
|
+
|
197
197
|
const expandedState = expanded;
|
198
198
|
const targetParent = row?.parentId;
|
199
|
-
|
200
|
-
|
199
|
+
return setExpanded(
|
200
|
+
updateExpandAndCollapseState(tableRows, expandedState, targetParent)
|
201
|
+
);
|
201
202
|
};
|
202
203
|
|
203
204
|
const ariaProps = buildAriaProps(aria);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, {useState} from "react";
|
2
|
-
import { render, screen
|
2
|
+
import { render, screen } from "../utilities/test-utils";
|
3
3
|
|
4
4
|
import { AdvancedTable } from "../";
|
5
5
|
|
@@ -198,7 +198,7 @@ test("Row toggle button exists and toggles subrows open and closed", () => {
|
|
198
198
|
expect(subRow).toBeInTheDocument()
|
199
199
|
});
|
200
200
|
|
201
|
-
test("toggleExpansionAll button exists and toggles subrows open and closed",
|
201
|
+
test("toggleExpansionAll button exists and toggles subrows open and closed", () => {
|
202
202
|
render(
|
203
203
|
<AdvancedTable
|
204
204
|
columnDefinitions={columnDefinitions}
|
@@ -208,21 +208,15 @@ test("toggleExpansionAll button exists and toggles subrows open and closed", asy
|
|
208
208
|
);
|
209
209
|
|
210
210
|
const kit = screen.getByTestId(testId);
|
211
|
-
const toggleButton = kit.querySelector(".gray-icon.toggle-all-icon")
|
212
|
-
expect(toggleButton).toBeInTheDocument()
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
await waitFor(() => {
|
220
|
-
const subRow = kit.querySelector(".bg-white.depth-sub-row-1");
|
221
|
-
expect(subRow).toBeInTheDocument();
|
222
|
-
});
|
211
|
+
const toggleButton = kit.querySelector(".gray-icon.toggle-all-icon")
|
212
|
+
expect(toggleButton).toBeInTheDocument()
|
213
|
+
const subRow1 = kit.querySelector(".bg-white.depth-sub-row-1")
|
214
|
+
expect(subRow1).not.toBeInTheDocument()
|
215
|
+
toggleButton.click()
|
216
|
+
const subRow = kit.querySelector(".bg-white.depth-sub-row-1")
|
217
|
+
expect(subRow).toBeInTheDocument()
|
223
218
|
});
|
224
219
|
|
225
|
-
|
226
220
|
test("loading state + initialLoadingRowCount prop", () => {
|
227
221
|
render(
|
228
222
|
<AdvancedTable
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 13.21.0
|
4
|
+
version: 13.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
8
8
|
- Power Devs
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-03-
|
12
|
+
date: 2024-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -2874,7 +2874,7 @@ homepage: https://playbook.powerapp.cloud/
|
|
2874
2874
|
licenses:
|
2875
2875
|
- ISC
|
2876
2876
|
metadata: {}
|
2877
|
-
post_install_message:
|
2877
|
+
post_install_message:
|
2878
2878
|
rdoc_options: []
|
2879
2879
|
require_paths:
|
2880
2880
|
- lib
|
@@ -2885,12 +2885,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2885
2885
|
version: '0'
|
2886
2886
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2887
2887
|
requirements:
|
2888
|
-
- - "
|
2888
|
+
- - ">="
|
2889
2889
|
- !ruby/object:Gem::Version
|
2890
|
-
version:
|
2890
|
+
version: '0'
|
2891
2891
|
requirements: []
|
2892
2892
|
rubygems_version: 3.3.7
|
2893
|
-
signing_key:
|
2893
|
+
signing_key:
|
2894
2894
|
specification_version: 4
|
2895
2895
|
summary: Playbook Design System
|
2896
2896
|
test_files: []
|