ohayolibs
Version:
Ohayo is a set of essential modules for ohayojp.
40 lines (35 loc) • 1.31 kB
text/typescript
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, TemplateRef, ViewEncapsulation } from '@angular/core';
import { BooleanInput, InputBoolean } from '@ohayo/util';
({
selector: 'g2-card',
exportAs: 'g2Card',
templateUrl: './card.component.html',
host: { '[class.g2-card]': 'true' },
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
})
export class G2CardComponent implements OnChanges {
static ngAcceptInputType_bordered: BooleanInput;
static ngAcceptInputType_loading: BooleanInput;
/** 是否显示边框 */
() () bordered = false;
() avatar: string | TemplateRef<void>;
() title: string | TemplateRef<void>;
() action: string | TemplateRef<void>;
() total = '';
_height = 'auto';
_orgHeight: number | string;
()
set contentHeight(value: number | string) {
this._orgHeight = value;
this._height = typeof value === 'number' ? (this._height = `${value}px`) : value;
}
() footer: string | TemplateRef<void>;
/** 是否显示Loading */
() () loading = false;
constructor(private cdr: ChangeDetectorRef) { }
ngOnChanges(): void {
this.cdr.detectChanges();
}
}