ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
87 lines • 9.16 kB
JavaScript
/**
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/
import { NgIf, NgTemplateOutlet } from '@angular/common';
import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core';
import { NzIconModule } from 'ng-zorro-antd/icon';
import * as i0 from "@angular/core";
import * as i1 from "ng-zorro-antd/icon";
export class NzTableSortersComponent {
constructor() {
this.sortDirections = ['ascend', 'descend', null];
this.sortOrder = null;
this.contentTemplate = null;
this.isUp = false;
this.isDown = false;
}
ngOnChanges(changes) {
const { sortDirections } = changes;
if (sortDirections) {
this.isUp = this.sortDirections.indexOf('ascend') !== -1;
this.isDown = this.sortDirections.indexOf('descend') !== -1;
}
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzTableSortersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: NzTableSortersComponent, isStandalone: true, selector: "nz-table-sorters", inputs: { sortDirections: "sortDirections", sortOrder: "sortOrder", contentTemplate: "contentTemplate" }, host: { classAttribute: "ant-table-column-sorters" }, usesOnChanges: true, ngImport: i0, template: `
<span class="ant-table-column-title"><ng-template [ngTemplateOutlet]="contentTemplate"></ng-template></span>
<span class="ant-table-column-sorter" [class.ant-table-column-sorter-full]="isDown && isUp">
<span class="ant-table-column-sorter-inner">
<span
nz-icon
nzType="caret-up"
*ngIf="isUp"
class="ant-table-column-sorter-up"
[class.active]="sortOrder === 'ascend'"
></span>
<span
nz-icon
nzType="caret-down"
*ngIf="isDown"
class="ant-table-column-sorter-down"
[class.active]="sortOrder === 'descend'"
></span>
</span>
</span>
`, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzTableSortersComponent, decorators: [{
type: Component,
args: [{
selector: 'nz-table-sorters',
preserveWhitespaces: false,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
template: `
<span class="ant-table-column-title"><ng-template [ngTemplateOutlet]="contentTemplate"></ng-template></span>
<span class="ant-table-column-sorter" [class.ant-table-column-sorter-full]="isDown && isUp">
<span class="ant-table-column-sorter-inner">
<span
nz-icon
nzType="caret-up"
*ngIf="isUp"
class="ant-table-column-sorter-up"
[class.active]="sortOrder === 'ascend'"
></span>
<span
nz-icon
nzType="caret-down"
*ngIf="isDown"
class="ant-table-column-sorter-down"
[class.active]="sortOrder === 'descend'"
></span>
</span>
</span>
`,
host: { class: 'ant-table-column-sorters' },
imports: [NzIconModule, NgTemplateOutlet, NgIf],
standalone: true
}]
}], ctorParameters: () => [], propDecorators: { sortDirections: [{
type: Input
}], sortOrder: [{
type: Input
}], contentTemplate: [{
type: Input
}] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic29ydGVycy5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9jb21wb25lbnRzL3RhYmxlL3NyYy9hZGRvbi9zb3J0ZXJzLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sI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