Skip to content

Commit

Permalink
[Table] Support row active and row hover (#1592)
Browse files Browse the repository at this point in the history
* feat(web): table highlight row

* feat(web): table relative

* feat(web): active multiple check

* feat(web): remove focus outline

* feat(web): keyboard selection

* fix(web): style

---------

Co-authored-by: sheepluo <[email protected]>
  • Loading branch information
chaishi and sheepluo authored Sep 11, 2023
1 parent 70dc234 commit d338496
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions js/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ export const ARROW_UP_REG = /ArrowUp/i;
export const ESCAPE_REG = /Escape/i;
export const SPACE_REG = /Space/i;
export const SHIFT_REG = /Shift/i;
export const CLEAR_REG = /KeyC/i;
export const ALL_REG = /(KeyA|KeyL)/i;
20 changes: 18 additions & 2 deletions style/web/components/table/_index.less
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
background-color: @table-bg;
position: relative;

&:focus-visible {
outline: none;
}

/** loading need to be top of fixed columns */
.@{prefix}-loading--full {
z-index: @table-loading-z-index;
Expand Down Expand Up @@ -324,8 +328,7 @@
tr {
transition: background-color @anim-duration-base linear;

&:hover,
&.@{prefix}-table__row--hover:not(&.@{prefix}-table__row--active) {
&:hover {
background-color: @table-highlight-dark-bg-color;
}
}
Expand Down Expand Up @@ -507,6 +510,19 @@
}
}

/** 键盘操作悬浮表格行 */
.@{prefix}-table {
&.@{prefix}-table--row-expandable,
&.@{prefix}-table--row-select,
&.@{prefix}-table__row--active-multiple {
tbody > tr {
&.@{prefix}-table__row--hover:not(&.@{prefix}-table__row--active) {
background-color: @table-highlight-dark-bg-color;
}
}
}
}

// 表头右侧图标设计规范:有边框时,排序图标靠近右侧边框;无边框时,排序图标紧跟标题内容
.@{prefix}-table--bordered {
.@{prefix}-table__cell--sortable,
Expand Down

0 comments on commit d338496

Please sign in to comment.