File
position
|
Type : BackgroundPosition
|
Default value : BackgroundPositionOptions.CENTER_CENTER
|
|
repeat
|
Type : BackgroundRepeat
|
Default value : BackgroundRepeatOptions.NO_REPEAT
|
|
rxap-image-cell
|
Type : string | null
|
Default value : null
|
|
size
|
Type : BackgroundSize
|
Default value : BackgroundSizeOptions.COVER
|
|
import {
ChangeDetectionStrategy,
Component,
Input,
} from '@angular/core';
import {
BackgroundImageDirective,
BackgroundPosition,
BackgroundPositionOptions,
BackgroundRepeat,
BackgroundRepeatOptions,
BackgroundSize,
BackgroundSizeOptions,
} from '@rxap/directives';
import {
NgClass,
NgIf,
} from '@angular/common';
@Component({
// eslint-disable-next-line @angular-eslint/component-selector
selector: 'td[rxap-image-cell]',
templateUrl: './image-cell.component.html',
styleUrls: ['./image-cell.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [NgIf, NgClass, BackgroundImageDirective]
})
export class ImageCellComponent {
@Input()
public preset?: string;
@Input()
public size: BackgroundSize = BackgroundSizeOptions.COVER;
@Input()
public repeat: BackgroundRepeat = BackgroundRepeatOptions.NO_REPEAT;
@Input()
public position: BackgroundPosition = BackgroundPositionOptions.CENTER_CENTER;
@Input('rxap-image-cell')
public value: string | null = null;
}
<div
*ngIf="value"
[ngClass]="[preset]"
[position]="position"
[repeat]="repeat"
[rxapBackgroundImage]="value"
[size]="size"
class="image">
</div>
<ng-content></ng-content>
.image {
width: 40px;
height: 40px;
&.circle {
border-radius: 24px;
}
&.rounded {
border-radius: 8px;
}
}
Legend
Html element with directive