Skip to content

Commit 29a376c

Browse files
committed
Revert "align table row selection"
This reverts commit 976b568. # Conflicts: # packages/uui-table/lib/uui-table-row.element.ts
1 parent 6726c19 commit 29a376c

File tree

1 file changed

+15
-120
lines changed

1 file changed

+15
-120
lines changed

packages/uui-table/lib/uui-table-row.element.ts

Lines changed: 15 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
} from '@umbraco-ui/uui-base/lib/mixins';
55
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
66
import { css, html, LitElement } from 'lit';
7-
import { ref } from 'lit/directives/ref.js';
87
import { queryAssignedElements } from 'lit/decorators.js';
98

109
import { UUITableCellElement } from './uui-table-cell.element';
@@ -55,30 +54,21 @@ export class UUITableRowElement extends SelectOnlyMixin(
5554
}
5655

5756
private updateChildSelectOnly() {
58-
const slotCellNodes = this.slotCellNodes;
59-
if (slotCellNodes) {
60-
slotCellNodes.forEach(el => {
61-
if (el instanceof UUITableCellElement) {
57+
if (this.slotCellNodes) {
58+
this.slotCellNodes.forEach(el => {
59+
if (this.elementIsTableCell(el)) {
6260
el.disableChildInteraction = this.selectOnly;
6361
}
6462
});
6563
}
6664
}
6765

68-
#selectAreaChanged(selectArea?: Element | undefined) {
69-
this.selectableTarget = selectArea || this;
66+
private elementIsTableCell(element: unknown): element is UUITableCellElement {
67+
return element instanceof UUITableCellElement;
7068
}
7169

7270
render() {
73-
return html`
74-
<slot id="open-part" @slotchanged=${this.updateChildSelectOnly}></slot>
75-
<div id="select-border" ${ref(this.#selectAreaChanged)}>
76-
<div id="select-top"></div>
77-
<div id="select-right"></div>
78-
<div id="select-bottom"></div>
79-
<div id="select-left"></div>
80-
</div>
81-
`;
71+
return html` <slot @slotchanged=${this.updateChildSelectOnly}></slot> `;
8272
}
8373

8474
static styles = [
@@ -89,115 +79,20 @@ export class UUITableRowElement extends SelectOnlyMixin(
8979
outline-offset: -3px;
9080
}
9181
92-
:host(:focus) {
93-
outline: calc(2px * var(--uui-show-focus-outline, 1)) solid
94-
var(--uui-color-focus);
95-
}
96-
97-
:host([selectable]) #select-border {
98-
position: absolute;
99-
top: -1px;
100-
left: -1px;
101-
right: -1px;
102-
bottom: -1px;
103-
pointer-events: none;
104-
opacity: 0;
105-
transition: opacity 120ms;
106-
}
107-
:host([selectable]) #select-border::after {
108-
content: '';
109-
position: absolute;
110-
z-index: 20;
111-
width: 100%;
112-
height: 100%;
113-
box-sizing: border-box;
114-
border: 2px solid var(--uui-color-selected);
115-
border-radius: calc(var(--uui-border-radius) + 2px);
116-
pointer-events: none;
117-
box-shadow:
118-
0 0 4px 0 var(--uui-color-selected),
119-
inset 0 0 2px 0 var(--uui-color-selected);
120-
}
121-
122-
:host([selectable]) #select-border #select-top,
123-
:host([selectable]) #select-border #select-right,
124-
:host([selectable]) #select-border #select-bottom,
125-
:host([selectable]) #select-border #select-left {
126-
position: absolute;
127-
z-index: 2;
128-
top: 1px;
129-
left: 1px;
130-
right: 1px;
131-
bottom: 1px;
82+
:host([selectable]) {
13283
cursor: pointer;
133-
pointer-events: auto;
134-
}
135-
:host([selectable]) #select-border #select-top {
136-
height: var(--uui-size-space-4);
137-
bottom: unset;
138-
}
139-
:host([selectable]) #select-border #select-right {
140-
width: var(--uui-size-space-4);
141-
left: unset;
142-
}
143-
:host([selectable]) #select-border #select-bottom {
144-
height: var(--uui-size-space-4);
145-
top: unset;
146-
}
147-
:host([selectable]) #select-border #select-left {
148-
width: var(--uui-size-space-4);
149-
right: unset;
150-
}
151-
152-
:host([selected]) #select-border {
153-
opacity: 1;
154-
}
155-
:host([selectable]:not([selected]):hover) #select-border {
156-
opacity: 0.33;
157-
}
158-
:host([selectable][selected]:hover) #select-border {
159-
opacity: 0.8;
16084
}
16185
162-
:host([selectable]:not([selected])) #open-part:hover + #select-border {
163-
opacity: 0;
164-
}
165-
:host([selectable][selected]) #open-part:hover + #select-border {
166-
opacity: 1;
167-
}
168-
169-
:host([selectable]:not([selected]):hover) #select-border::after {
170-
animation: not-selected--hover 1.2s infinite;
171-
}
172-
@keyframes not-selected--hover {
173-
0%,
174-
100% {
175-
opacity: 0.66;
176-
}
177-
50% {
178-
opacity: 1;
179-
}
180-
}
181-
182-
:host([selectable][selected]:hover) #select-border::after {
183-
animation: selected--hover 1.4s infinite;
184-
}
185-
@keyframes selected--hover {
186-
0%,
187-
100% {
188-
opacity: 1;
189-
}
190-
50% {
191-
opacity: 0.66;
192-
}
86+
:host(:focus) {
87+
outline: calc(2px * var(--uui-show-focus-outline, 1)) solid
88+
var(--uui-color-focus);
19389
}
194-
:host([selectable]) #open-part:hover + #select-border::after {
195-
animation: none;
90+
:host([selected]) {
91+
outline: 2px solid
92+
var(--uui-table-row-color-selected, var(--uui-color-selected));
19693
}
197-
198-
:host([select-only]) *,
199-
:host([select-only]) ::slotted(*) {
200-
pointer-events: none;
94+
:host([selected]:focus) {
95+
outline-color: var(--uui-color-focus);
20196
}
20297
`,
20398
];

0 commit comments

Comments
 (0)