UNPKG

@alauda-fe/common

Version:

Alauda frontend team common codes.

55 lines 6.01 kB
import { NgIf } from '@angular/common'; import { ChangeDetectionStrategy, Component, HostBinding, Input, ViewEncapsulation, } from '@angular/core'; import * as i0 from "@angular/core"; function TextEllipsisComponent_span_0_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "span", 2); i0.ɵɵtext(1); i0.ɵɵelementEnd(); } if (rf & 2) { const text_r1 = ctx.ngIf; i0.ɵɵadvance(); i0.ɵɵtextInterpolate(text_r1); } } function TextEllipsisComponent_span_1_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "span", 3); i0.ɵɵtext(1); i0.ɵɵelementEnd(); } if (rf & 2) { const text_r2 = ctx.ngIf; i0.ɵɵadvance(); i0.ɵɵtextInterpolate(text_r2); } } export class TextEllipsisComponent { constructor() { this.tailLength = 0; } get head() { return this.text.slice(0, this.text.length - this.tailLength); } get tail() { return this.text.slice(this.text.length - this.tailLength); } static { this.ɵfac = function TextEllipsisComponent_Factory(t) { return new (t || TextEllipsisComponent)(); }; } static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TextEllipsisComponent, selectors: [["acl-text-ellipsis"]], hostVars: 1, hostBindings: function TextEllipsisComponent_HostBindings(rf, ctx) { if (rf & 2) { i0.ɵɵhostProperty("title", ctx.text); } }, inputs: { text: "text", tailLength: "tailLength" }, standalone: true, features: [i0.ɵɵStandaloneFeature], decls: 2, vars: 2, consts: [["class", "head", 4, "ngIf"], ["class", "tail", 4, "ngIf"], [1, "head"], [1, "tail"]], template: function TextEllipsisComponent_Template(rf, ctx) { if (rf & 1) { i0.ɵɵtemplate(0, TextEllipsisComponent_span_0_Template, 2, 1, "span", 0)(1, TextEllipsisComponent_span_1_Template, 2, 1, "span", 1); } if (rf & 2) { i0.ɵɵproperty("ngIf", ctx.head); i0.ɵɵadvance(); i0.ɵɵproperty("ngIf", ctx.tail); } }, dependencies: [NgIf], styles: ["acl-text-ellipsis{display:inline-flex;max-width:100%;overflow:hidden}acl-text-ellipsis span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}acl-text-ellipsis .tail{flex-shrink:0}\n"], encapsulation: 2, changeDetection: 0 }); } } (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TextEllipsisComponent, [{ type: Component, args: [{ selector: 'acl-text-ellipsis', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [NgIf], standalone: true, template: "<span\n *ngIf=\"head as text\"\n class=\"head\"\n >{{ text }}</span\n><span\n *ngIf=\"tail as text\"\n class=\"tail\"\n >{{ text }}</span\n>\n", styles: ["acl-text-ellipsis{display:inline-flex;max-width:100%;overflow:hidden}acl-text-ellipsis span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}acl-text-ellipsis .tail{flex-shrink:0}\n"] }] }], null, { text: [{ type: HostBinding, args: ['title'] }, { type: Input }], tailLength: [{ type: Input }] }); })(); (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(TextEllipsisComponent, { className: "TextEllipsisComponent" }); })(); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb21tb24vc3JjL3dpZGdldC90ZXh0LWVsbGlwc2lzL2NvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29tbW9uL3NyYy93aWRnZXQvdGV4dC1lbGxpcHNpcy9jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsSUFBSSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDdkMsT0FBTyxFQUNMLHVCQUF1QixFQUN2QixTQUFTLEVBQ1QsV0FBVyxFQUNYLEtBQUssRUFDTCxpQkFBaU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