feat:Text add truncateAt

This commit is contained in:
pengfei.zhou
2020-04-27 18:46:39 +08:00
committed by osborn
parent a23aa8df0f
commit fdff5af3d9
11 changed files with 118 additions and 2 deletions

View File

@@ -1,6 +1,12 @@
import { View } from "../ui/view";
import { Color } from "../util/color";
import { Gravity } from "../util/gravity";
export declare enum TruncateAt {
End = 0,
Middle = 1,
Start = 2,
Clip = 3
}
export declare class Text extends View {
text?: string;
textColor?: Color;
@@ -15,5 +21,6 @@ export declare class Text extends View {
strikethrough?: boolean;
underline?: boolean;
htmlText?: string;
truncateAt?: TruncateAt;
}
export declare function text(config: Partial<Text>): Text;

View File

@@ -26,6 +26,13 @@ import { View, Property } from "../ui/view";
import { Color } from "../util/color";
import { Gravity } from "../util/gravity";
import { layoutConfig } from "../util/layoutconfig";
export var TruncateAt;
(function (TruncateAt) {
TruncateAt[TruncateAt["End"] = 0] = "End";
TruncateAt[TruncateAt["Middle"] = 1] = "Middle";
TruncateAt[TruncateAt["Start"] = 2] = "Start";
TruncateAt[TruncateAt["Clip"] = 3] = "Clip";
})(TruncateAt || (TruncateAt = {}));
export class Text extends View {
}
__decorate([
@@ -80,6 +87,10 @@ __decorate([
Property,
__metadata("design:type", String)
], Text.prototype, "htmlText", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "truncateAt", void 0);
export function text(config) {
const ret = new Text;
ret.layoutConfig = layoutConfig().fit();