Skip to content

Commit

Permalink
[ACS-8498] [ACA] Testing Angular 15 - Toolbar buttons layout is broken (
Browse files Browse the repository at this point in the history
#10026)

* fix icon styles

* auto-fix styles

* fix a bug with icon value resolving

* fix tests
  • Loading branch information
DenysVuika authored Aug 5, 2024
1 parent f508fe4 commit f02aca0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"*.{ts,js}": ["prettier --write", "eslint"],
"*.{css,scss}": ["prettier --write", "stylelint"]
"*.{css,scss}": ["prettier --write", "stylelint --fix"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ describe('DataTable', () => {
});

it('should use special material url scheme', () => {
dataTable.data = new ObjectDataTableAdapter([{}, {}, {}], []);
const column = {} as DataColumn;

const row: any = {
Expand All @@ -955,7 +956,8 @@ describe('DataTable', () => {
});

it('should not use special material url scheme', () => {
const column = {} as DataColumn;
dataTable.data = new ObjectDataTableAdapter([{}, {}, {}], []);
const column = { type: 'image' } as DataColumn;

const row: any = {
getValue: () => 'http://www.google.com'
Expand All @@ -965,7 +967,8 @@ describe('DataTable', () => {
});

it('should parse icon value', () => {
const column = {} as DataColumn;
dataTable.data = new ObjectDataTableAdapter([{}, {}, {}], []);
const column = { type: 'image' } as DataColumn;

const row: any = {
getValue: () => 'material-icons://android'
Expand All @@ -975,7 +978,8 @@ describe('DataTable', () => {
});

it('should not parse icon value', () => {
const column = {} as DataColumn;
dataTable.data = new ObjectDataTableAdapter([{}, {}, {}], []);
const column = { type: 'image' } as DataColumn;

const row: any = {
getValue: () => 'http://www.google.com'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,7 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,
this.keyManager.onKeydown(event);
}

constructor(
private elementRef: ElementRef,
differs: IterableDiffers,
private matIconRegistry: MatIconRegistry,
private sanitizer: DomSanitizer
) {
constructor(private elementRef: ElementRef, differs: IterableDiffers, private matIconRegistry: MatIconRegistry, private sanitizer: DomSanitizer) {
if (differs) {
this.differ = differs.find([]).create(null);
}
Expand Down Expand Up @@ -763,15 +758,15 @@ export class DataTableComponent implements OnInit, AfterContentInit, OnChanges,

isIconValue(row: DataRow, col: DataColumn): boolean {
if (row && col) {
const value = row.getValue(col.key);
const value = this.data.getValue(row, col);
return value?.startsWith('material-icons://');
}
return false;
}

asIconValue(row: DataRow, col: DataColumn): string {
if (this.isIconValue(row, col)) {
const value = row.getValue(col.key) || '';
const value = this.data.getValue(row, col) || '';
return value.replace('material-icons://', '');
}
return null;
Expand Down
4 changes: 0 additions & 4 deletions lib/core/src/lib/icon/icon.component.scss

This file was deleted.

1 change: 0 additions & 1 deletion lib/core/src/lib/icon/icon.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { NgIf } from '@angular/common';
standalone: true,
imports: [MatIconModule, NgIf],
templateUrl: './icon.component.html',
styleUrls: ['./icon.component.scss'],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'adf-icon' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ $adf-info-drawer-icon-size-half: 24px !default;
line-height: 28px;
letter-spacing: 0.15px;
text-align: left;
align-items: start;
align-items: center;
color: var(--adf-theme-foreground-text-color-054);
overflow: hidden;

Expand Down
12 changes: 6 additions & 6 deletions lib/core/src/lib/viewer/components/viewer.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@
text-align: center;
flex: 1 1 auto;
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
display: flex;
flex-direction: row;
align-items: center;

@media screen and (max-width: 1450px) {
@media screen and (width <= 1450px) {
left: 30%;
}
}
Expand All @@ -70,8 +72,7 @@
@extend .adf-full-screen;

position: relative;
overflow-y: hidden;
overflow-x: hidden;
overflow: hidden;
z-index: 1;
background-color: var(--theme-background-color);
display: flex;
Expand All @@ -94,8 +95,7 @@

display: flex;
flex-direction: row;
overflow-y: auto;
overflow-x: hidden;
overflow: hidden auto;
position: relative;
}

Expand Down

0 comments on commit f02aca0

Please sign in to comment.