Skip to content

Commit 8e5ff84

Browse files
Merge pull request #26 from plotly/addSelectionFixtures
Add selection fixtures
1 parent c6ef8e6 commit 8e5ff84

File tree

2 files changed

+87
-3
lines changed

2 files changed

+87
-3
lines changed

packages/dash-table/src/lib/components/computedStyles.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,22 @@ const styles = {
119119
const isAboveExpanded =
120120
collapsable && R.contains(ri, expanded_rows);
121121

122+
let leftEdgeThickness = 1;
123+
if (isActive && !isLeftmost) {
124+
leftEdgeThickness = 2;
125+
}
126+
127+
let topEdgeThickness = 1;
128+
if (isActive && !isTopmost) {
129+
topEdgeThickness = 2;
130+
}
131+
122132
// rules are applied in the order that they are supplied
123133
const boxShadowRules = [
124134
showLeftEdge || isNeighborToExpanded
125-
? doLeft(ACCENT, isActive ? 2 : 1)
135+
? doLeft(ACCENT, leftEdgeThickness)
126136
: null,
127-
showTopEdge ? doTop(ACCENT, isActive ? 2 : 1) : null,
137+
showTopEdge ? doTop(ACCENT, topEdgeThickness) : null,
128138
showInsideBottomEdge ? doBottom(ACCENT, 1) : null,
129139
showInsideRightEdge ? doRight(ACCENT, 1) : null,
130140
isWithinColSelections && isTopmost ? doTop(ACCENT, 1) : null,

packages/dash-table/tests/fixtures.json

+75-1
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,80 @@
258258
{"column-1": 10, "column-2": 20, "column-3": 30}
259259
]
260260
}
261+
},
262+
{
263+
"name": "selection-borders-active-SW",
264+
"props": {
265+
"editable": true,
266+
"selected_cell": [[1, 1], [1, 0], [0, 1], [0, 0]],
267+
"columns": [
268+
{
269+
"name": "Column 1",
270+
"id": "column-1"
271+
},
272+
{
273+
"name": "Column 2",
274+
"id": "column-2"
275+
}
276+
],
277+
"dataframe": [
278+
{"column-1": 1, "column-2": "alpha"},
279+
{"column-1": 2, "column-2": "bravo"}
280+
],
281+
"active_cell": [1, 0]
282+
}
283+
},
284+
{
285+
"name": "selection-borders-active-NE",
286+
"props": {
287+
"editable": true,
288+
"selected_cell": [[1, 1], [1, 0], [0, 1], [0, 0]],
289+
"columns": [
290+
{
291+
"name": "Column 1",
292+
"id": "column-1"
293+
},
294+
{
295+
"name": "Column 2",
296+
"id": "column-2"
297+
}
298+
],
299+
"dataframe": [
300+
{"column-1": 1, "column-2": "alpha"},
301+
{"column-1": 2, "column-2": "bravo"}
302+
],
303+
"active_cell": [0, 1]
304+
}
305+
},
306+
{
307+
"name": "inner-selection",
308+
"props": {
309+
"editable": true,
310+
"selected_cell": [[2, 1], [2, 2], [1, 1], [1, 2]],
311+
"columns": [
312+
{
313+
"name": "Column 1",
314+
"id": "column-1"
315+
},
316+
{
317+
"name": "Column 2",
318+
"id": "column-2"
319+
},
320+
{
321+
"name": "Column 3",
322+
"id": "column-3"
323+
},
324+
{
325+
"name": "Column 4",
326+
"id": "column-4"
327+
}
328+
],
329+
"dataframe": [
330+
{"column-1": 1, "column-2": "alpha", "column-3": 2, "column-4": 1},
331+
{"column-1": 2, "column-2": "bravo", "column-3": 2, "column-4": 1},
332+
{"column-1": 3, "column-2": "charlie", "column-3": 2, "column-4": 1},
333+
{"column-1": 4, "column-2": "delta", "column-3": 2, "column-4": 1}
334+
]
335+
}
261336
}
262-
263337
]

0 commit comments

Comments
 (0)