Skip to content

Commit

Permalink
fix(grid): #WIK-16750 the remove icon should be red on hover (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
minlovehua authored Dec 6, 2024
1 parent 7948705 commit 9a4113a
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
@if (menu.type === 'divider') {
<thy-divider [thyStyle]="'solid'"></thy-divider>
} @else {
@let disabled = !!(menu.disabled && menu.disabled(aiTable, field));
@let isRemoveField = menu.type === 'removeField';
<a
thyDropdownMenuItem
href="javascript:;"
[ngClass]="{ 'remove-field': isRemoveField && !disabled }"
(click)="execute(menu)"
[thyDisabled]="!!(menu.disabled && menu.disabled(aiTable, field))"
[thyDisabled]="disabled"
>
<thy-icon [thyIconName]="menu.icon!"></thy-icon>
<span>{{ menu.name! }}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,24 @@ import {
import { ThyIcon } from 'ngx-tethys/icon';
import { AITable } from '../../core';
import { AITableFieldMenuItem } from '../../types/field';
import { NgClass } from '@angular/common';

@Component({
selector: 'field-menu',
templateUrl: './field-menu.component.html',
standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'field-menu'
},
imports: [
ThyIcon,
ThyDivider,
ThyDropdownMenuComponent,
ThyDropdownMenuItemDirective,
ThyDropdownMenuItemNameDirective,
ThyDropdownMenuItemIconDirective
ThyDropdownMenuItemIconDirective,
NgClass
]
})
export class FieldMenu extends ThyDropdownAbstractMenu {
Expand Down
12 changes: 12 additions & 0 deletions packages/grid/src/components/field-menu/field-menu.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@use 'ngx-tethys/styles/variables.scss';

.field-menu {
.remove-field {
&:hover {
.thy-icon {
color: variables.$danger;
}
color: variables.$danger !important;
}
}
}
2 changes: 2 additions & 0 deletions packages/grid/src/styles/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
@use 'ngx-tethys/styles/variables.scss';
@use '../components/cell-editors/cell-editor.scss';
@use '../components/cell-views/select/option.scss';
@use '../components/field-menu/field-menu.scss';

.ai-table-dom-grid {
display: table;
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion src/app/component/table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<a thyDropdownMenuItem href="javascript:;" (click)="addView('copy')">
<span>复制</span>
</a>
<a thyDropdownMenuItem href="javascript:;" (click)="removeView()">
<a thyDropdownMenuItem class="remove-icon" href="javascript:;" (click)="removeView()">
<span>删除</span>
</a>
</thy-dropdown-menu>
Expand Down
7 changes: 7 additions & 0 deletions src/app/component/table.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@use 'ngx-tethys/styles/variables.scss';

.remove-icon {
&:hover {
color: variables.$danger !important;
}
}
5 changes: 3 additions & 2 deletions src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* You can add global styles to this file, and also import other style files */

@import '../packages/grid/src/styles/styles.scss';
@import './app/app.component.scss';
@forward '../packages/grid/src/styles/styles.scss';
@forward './app/app.component.scss';
@forward './app/component/table.scss';

0 comments on commit 9a4113a

Please sign in to comment.