UNPKG

ng-zorro-antd-yj

Version:

An enterprise-class UI components based on Ant Design and Angular

154 lines 13.1 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import * as tslib_1 from "tslib"; import { ChangeDetectionStrategy, Component, ElementRef, Input, TemplateRef, ViewEncapsulation } from '@angular/core'; import { NzUpdateHostClassService } from '../core/services/update-host-class.service'; import { InputBoolean } from '../core/util/convert'; var NzListComponent = /** @class */ (function () { // #endregion function NzListComponent(el, updateHostClassService) { this.el = el; this.updateHostClassService = updateHostClassService; this.nzBordered = false; this.nzItemLayout = 'horizontal'; this.nzLoading = false; this.nzSize = 'default'; this.nzSplit = true; // #endregion // #region styles this.prefixCls = 'ant-list'; } /** * @private * @return {?} */ NzListComponent.prototype._setClassMap = /** * @private * @return {?} */ function () { var _a; /** @type {?} */ var classMap = (_a = {}, _a[this.prefixCls] = true, _a[this.prefixCls + "-vertical"] = this.nzItemLayout === 'vertical', _a[this.prefixCls + "-lg"] = this.nzSize === 'large', _a[this.prefixCls + "-sm"] = this.nzSize === 'small', _a[this.prefixCls + "-split"] = this.nzSplit, _a[this.prefixCls + "-bordered"] = this.nzBordered, _a[this.prefixCls + "-loading"] = this.nzLoading, _a[this.prefixCls + "-grid"] = this.nzGrid, _a[this.prefixCls + "-something-after-last-item"] = !!(this.nzLoadMore || this.nzPagination || this.nzFooter), _a); this.updateHostClassService.updateHostClass(this.el.nativeElement, classMap); }; /** * @return {?} */ NzListComponent.prototype.ngOnInit = /** * @return {?} */ function () { this._setClassMap(); }; /** * @return {?} */ NzListComponent.prototype.ngOnChanges = /** * @return {?} */ function () { this._setClassMap(); }; NzListComponent.decorators = [ { type: Component, args: [{ selector: 'nz-list', template: "<ng-template #itemsTpl>\n <ng-container *ngFor=\"let item of nzDataSource; let index = index\">\n <ng-template [ngTemplateOutlet]=\"nzRenderItem\" [ngTemplateOutletContext]=\"{ $implicit: item, index: index }\"></ng-template>\n </ng-container>\n</ng-template>\n<div *ngIf=\"nzHeader\" class=\"ant-list-header\">\n <ng-container *nzStringTemplateOutlet=\"nzHeader\">{{ nzHeader }}</ng-container>\n</div>\n<nz-spin [nzSpinning]=\"nzLoading\">\n <ng-container *ngIf=\"nzDataSource\">\n <div *ngIf=\"nzLoading && nzDataSource.length === 0\" [style.min-height.px]=\"53\"></div>\n <div *ngIf=\"nzGrid; else itemsTpl\" nz-row [nzGutter]=\"nzGrid.gutter\">\n <div nz-col [nzSpan]=\"nzGrid.span\" [nzXs]=\"nzGrid.xs\" [nzSm]=\"nzGrid.sm\" [nzMd]=\"nzGrid.md\" [nzLg]=\"nzGrid.lg\" [nzXl]=\"nzGrid.xl\"\n [nzXXl]=\"nzGrid.xxl\" *ngFor=\"let item of nzDataSource; let index = index\">\n <ng-template [ngTemplateOutlet]=\"nzRenderItem\" [ngTemplateOutletContext]=\"{ $implicit: item, index: index }\"></ng-template>\n </div>\n </div>\n <div *ngIf=\"!nzLoading && nzDataSource.length === 0\" class=\"ant-list-empty-text\">\n <nz-embed-empty [nzComponentName]=\"'list'\" [specificContent]=\"nzNoResult\"></nz-embed-empty>\n </div>\n </ng-container>\n <ng-content></ng-content>\n</nz-spin>\n<div *ngIf=\"nzFooter\" class=\"ant-list-footer\">\n <ng-container *nzStringTemplateOutlet=\"nzFooter\">{{ nzFooter }}</ng-container>\n</div>\n<ng-template [ngTemplateOutlet]=\"nzLoadMore\"></ng-template>\n<div *ngIf=\"nzPagination\" class=\"ant-list-pagination\">\n <ng-template [ngTemplateOutlet]=\"nzPagination\"></ng-template>\n</div>", providers: [NzUpdateHostClassService], preserveWhitespaces: false, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["\n nz-list,\n nz-list nz-spin {\n display: block;\n }\n "] }] } ]; /** @nocollapse */ NzListComponent.ctorParameters = function () { return [ { type: ElementRef }, { type: NzUpdateHostClassService } ]; }; NzListComponent.propDecorators = { nzDataSource: [{ type: Input }], nzBordered: [{ type: Input }], nzGrid: [{ type: Input }], nzHeader: [{ type: Input }], nzFooter: [{ type: Input }], nzItemLayout: [{ type: Input }], nzRenderItem: [{ type: Input }], nzLoading: [{ type: Input }], nzLoadMore: [{ type: Input }], nzPagination: [{ type: Input }], nzSize: [{ type: Input }], nzSplit: [{ type: Input }], nzNoResult: [{ type: Input }] }; tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzListComponent.prototype, "nzBordered", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzListComponent.prototype, "nzLoading", void 0); tslib_1.__decorate([ InputBoolean(), tslib_1.__metadata("design:type", Object) ], NzListComponent.prototype, "nzSplit", void 0); return NzListComponent; }()); export { NzListComponent }; if (false) { /** @type {?} */ NzListComponent.prototype.nzDataSource; /** @type {?} */ NzListComponent.prototype.nzBordered; /** @type {?} */ NzListComponent.prototype.nzGrid; /** @type {?} */ NzListComponent.prototype.nzHeader; /** @type {?} */ NzListComponent.prototype.nzFooter; /** @type {?} */ NzListComponent.prototype.nzItemLayout; /** @type {?} */ NzListComponent.prototype.nzRenderItem; /** @type {?} */ NzListComponent.prototype.nzLoading; /** @type {?} */ NzListComponent.prototype.nzLoadMore; /** @type {?} */ NzListComponent.prototype.nzPagination; /** @type {?} */ NzListComponent.prototype.nzSize; /** @type {?} */ NzListComponent.prototype.nzSplit; /** @type {?} */ NzListComponent.prototype.nzNoResult; /** * @type {?} * @private */ NzListComponent.prototype.prefixCls; /** * @type {?} * @private */ NzListComponent.prototype.el; /** * @type {?} * @private */ NzListComponent.prototype.updateHostClassService; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotbGlzdC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZy16b3Jyby1hbnRkLXlqLyIsInNvdXJjZXMiOlsibGlzdC9uei1saXN0LmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hc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