UNPKG

@duoduo-oba/ng-devui

Version:

DevUI components based on Angular

177 lines (170 loc) 7.11 kB
import { EventEmitter, Component, Input, ContentChild, TemplateRef, Output, NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; /** * @fileoverview added by tsickle * Generated from: tags.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class TagsComponent { constructor() { /** * 【必选】记录输入的标签 */ this.tags = []; /** * 【可选】使用的属性名 */ this.displayProperty = ''; this.deletable = false; this.titleProperty = ''; /** * tag被删除后触发 */ this.tagDelete = new EventEmitter(); } /** * @param {?} tag * @param {?} index * @return {?} */ removeTag(tag, index) { this.tagDelete.emit({ tag: tag, index: index }); } } TagsComponent.decorators = [ { type: Component, args: [{ selector: 'd-tags', template: "<div class=\"devui-tags\">\r\n <d-tag\r\n *ngFor=\"let tag of tags; let index = index\"\r\n [tag]=\"displayProperty ? tag[displayProperty] : tag\"\r\n [deletable]=\"deletable\"\r\n [labelStyle]=\"tag['labelStyle']\"\r\n [titleContent]=\"titleProperty ? tag[titleProperty] : displayProperty ? tag[displayProperty] : tag\"\r\n [customViewTemplate]=\"customViewTemplate\"\r\n (tagDelete)=\"removeTag(tag, index)\"\r\n >\r\n </d-tag>\r\n</div>\r\n", exportAs: 'Tags', styles: [".devui-tags{padding:2px;overflow:hidden;word-wrap:break-word;height:100%}"] }] } ]; TagsComponent.propDecorators = { tags: [{ type: Input }], displayProperty: [{ type: Input }], deletable: [{ type: Input }], titleProperty: [{ type: Input }], customViewTemplate: [{ type: ContentChild, args: [TemplateRef, { static: false },] }], tagDelete: [{ type: Output }] }; if (false) { /** * 【必选】记录输入的标签 * @type {?} */ TagsComponent.prototype.tags; /** * 【可选】使用的属性名 * @type {?} */ TagsComponent.prototype.displayProperty; /** @type {?} */ TagsComponent.prototype.deletable; /** @type {?} */ TagsComponent.prototype.titleProperty; /** @type {?} */ TagsComponent.prototype.customViewTemplate; /** * tag被删除后触发 * @type {?} */ TagsComponent.prototype.tagDelete; } /** * @fileoverview added by tsickle * Generated from: tag.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class TagComponent { constructor() { this.labelStyle = ''; this.deletable = false; /** * tag被删除后触发 */ this.tagDelete = new EventEmitter(); this.deleteTag = false; } /** * @param {?} tag * @return {?} */ removeTag(tag) { this.deleteTag = true; this.tagDelete.emit({ tag: tag }); } } TagComponent.decorators = [ { type: Component, args: [{ selector: 'd-tag', template: "<span class=\"devui-tag-item {{ labelStyle }}\" [style.display]=\"deleteTag ? 'none' : 'inline-block'\">\r\n <span *ngIf=\"!customViewTemplate\" title=\"{{ titleContent ? titleContent : tag }}\">{{ tag }}</span>\r\n <ng-template *ngIf=\"customViewTemplate\" [ngTemplateOutlet]=\"customViewTemplate\" [ngTemplateOutletContext]=\"{ tag: tag }\"></ng-template>\r\n <a class=\"remove-button\" *ngIf=\"deletable\" (click)=\"removeTag(tag)\">\u00D7</a>\r\n</span>\r\n", exportAs: 'Tag', styles: [":host{display:inline-block}.devui-tag-item{display:inline-block;margin:2px;padding:0 5px;min-height:20px;font-size:14px;line-height:20px;color:#252b3a;background-color:#eef0f5;border-radius:1px;border:0 solid;border-color:inherit}.devui-tag-item .remove-button{margin-left:5px;font-size:16px;color:#252b3a;line-height:20px;vertical-align:top;cursor:pointer}.devui-tag-item .remove-button:hover{text-decoration:none}.blue-w98{color:#3383ff;background-color:#fbfdff;border-width:thin;border-color:#e1edff}.green-w98{color:#00b679;background-color:#fafefc;border-width:thin;border-color:#d9f4eb}.yellow-w98{color:#ffab05;background-color:#fffdfa;border-width:thin;border-color:#fff3da}.orange-w98{color:#ff7452;background-color:#fffcfc;border-width:thin;border-color:#ffeae5}.pink-w98{color:#ff8cc3;background-color:#fefcff;border-width:thin;border-color:#f5e8fd}.purple-w98{color:#bc67f0;background-color:#fffdfe;border-width:thin;border-color:#ffeef6}.turquoise-w98{color:#00c1de;background-color:#fafefe;border-width:thin;border-color:#d9f6fa}.olivine-w98{color:#89ba3e;background-color:#fdfefb;border-width:thin;border-color:#eef5e2}"] }] } ]; TagComponent.propDecorators = { tag: [{ type: Input }], labelStyle: [{ type: Input }], deletable: [{ type: Input }], titleContent: [{ type: Input }], customViewTemplate: [{ type: Input }], tagDelete: [{ type: Output }] }; if (false) { /** * 【必选】记录输入的标签 * @type {?} */ TagComponent.prototype.tag; /** @type {?} */ TagComponent.prototype.labelStyle; /** @type {?} */ TagComponent.prototype.deletable; /** @type {?} */ TagComponent.prototype.titleContent; /** @type {?} */ TagComponent.prototype.customViewTemplate; /** * tag被删除后触发 * @type {?} */ TagComponent.prototype.tagDelete; /** @type {?} */ TagComponent.prototype.deleteTag; } /** * @fileoverview added by tsickle * Generated from: tags.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class TagsModule { } TagsModule.decorators = [ { type: NgModule, args: [{ imports: [ CommonModule, FormsModule ], exports: [ TagsComponent, TagComponent ], declarations: [ TagsComponent, TagComponent ] },] } ]; /** * @fileoverview added by tsickle * Generated from: public-api.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * Generated from: ng-devui-tags.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { TagComponent, TagsComponent, TagsModule }; //# sourceMappingURL=ng-devui-tags.js.map