import { Component, EventEmitter, HostBinding, Input, Output } from '@angular/core';
import { SortDirection } from '../../../../data-table.model';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
export class SortComponent {
    constructor() {
        this.showSortIcon = false;
        this.sortEvent = new EventEmitter();
    }
    get canShow() {
        return this.showSortIcon || (this.sortDirection === 'ASC') || (this.sortDirection === 'DESC');
    }
    ngOnInit() {
    }
    sort() {
        switch (this.sortDirection) {
            case SortDirection.ASC:
                this.sortDirection = SortDirection.DESC;
                break;
            case 'DESC':
                this.sortDirection = SortDirection.default;
                break;
            case SortDirection.default:
            default:
                this.sortDirection = SortDirection.ASC;
        }
        this.sortEvent.emit({ direction: this.sortDirection });
    }
}
SortComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SortComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
SortComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: SortComponent, selector: "d-table-sort", inputs: { sortDirection: "sortDirection", showSortIcon: "showSortIcon" }, outputs: { sortEvent: "sortEvent" }, host: { properties: { "class.devui-icon-show": "this.canShow" } }, ngImport: i0, template: "<span (click)=\"sort()\" class=\"sort-clickable\">\n  <i\n    class=\"datatable-svg\"\n    [ngClass]=\"{\n      'sort-icon-default': !sortDirection,\n      'sort-icon-asc': sortDirection === 'ASC',\n      'sort-icon-desc': sortDirection === 'DESC',\n      'sort-icon-default-visible': showSortIcon\n    }\"\n  >\n    <svg\n      width=\"16px\"\n      height=\"16px\"\n      viewBox=\"0 0 16 16\"\n      version=\"1.1\"\n      xmlns=\"http://www.w3.org/2000/svg\"\n      xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n    >\n      <defs>\n        <circle id=\"sort-svg-path-1\" cx=\"8\" cy=\"8\" r=\"8\"></circle>\n        <filter x=\"-34.4%\" y=\"-21.9%\" width=\"168.8%\" height=\"168.8%\" filterUnits=\"objectBoundingBox\" id=\"filter-2\">\n          <feOffset dx=\"0\" dy=\"2\" in=\"SourceAlpha\" result=\"shadowOffsetOuter1\"></feOffset>\n          <feGaussianBlur stdDeviation=\"1.5\" in=\"shadowOffsetOuter1\" result=\"shadowBlurOuter1\"></feGaussianBlur>\n          <feColorMatrix\n            values=\"0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.085309222 0\"\n            type=\"matrix\"\n            in=\"shadowBlurOuter1\"\n          ></feColorMatrix>\n        </filter>\n      </defs>\n      <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n        <use fill-rule=\"evenodd\" xlink:href=\"#sort-svg-path-1\"></use>\n        <polygon points=\"8 4 11 7 5 7\"></polygon>\n        <polygon points=\"8 12 5 9 11 9\"></polygon>\n      </g>\n    </svg>\n  </i>\n</span>\n", styles: [".sort-clickable{cursor:pointer;vertical-align:-.55em}:host{height:20px;line-height:20px;margin-right:4px;margin-left:8px;flex:1;display:none}:host.devui-icon-show{display:block}.sort-icon-default{visibility:hidden}.sort-icon-default>svg g use{fill:#d7d8da;fill:var(--devui-shape-icon-fill, #d7d8da)}.sort-icon-default>svg g polygon{fill:#fff;fill:var(--devui-icon-bg, #ffffff)}.sort-icon-default:hover>svg g use{fill:#babbc0;fill:var(--devui-shape-icon-fill-active, #babbc0)}.sort-icon-default-visible{visibility:visible}.sort-icon-asc>svg g use,.sort-icon-desc>svg g use{fill:#5e7ce0;fill:var(--devui-brand, #5e7ce0)}.sort-icon-asc>svg g polygon,.sort-icon-desc>svg g polygon{fill:#fff;fill:var(--devui-icon-bg, #ffffff)}.sort-icon-asc:hover>svg g use,.sort-icon-desc:hover>svg g use{fill:#5e7ce0;fill:var(--devui-brand, #5e7ce0)}.sort-icon-asc>svg g polygon:last-of-type{opacity:.3}.sort-icon-desc>svg g polygon:first-of-type{opacity:.5}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: SortComponent, decorators: [{
            type: Component,
            args: [{ selector: 'd-table-sort', template: "<span (click)=\"sort()\" class=\"sort-clickable\">\n  <i\n    class=\"datatable-svg\"\n    [ngClass]=\"{\n      'sort-icon-default': !sortDirection,\n      'sort-icon-asc': sortDirection === 'ASC',\n      'sort-icon-desc': sortDirection === 'DESC',\n      'sort-icon-default-visible': showSortIcon\n    }\"\n  >\n    <svg\n      width=\"16px\"\n      height=\"16px\"\n      viewBox=\"0 0 16 16\"\n      version=\"1.1\"\n      xmlns=\"http://www.w3.org/2000/svg\"\n      xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n    >\n      <defs>\n        <circle id=\"sort-svg-path-1\" cx=\"8\" cy=\"8\" r=\"8\"></circle>\n        <filter x=\"-34.4%\" y=\"-21.9%\" width=\"168.8%\" height=\"168.8%\" filterUnits=\"objectBoundingBox\" id=\"filter-2\">\n          <feOffset dx=\"0\" dy=\"2\" in=\"SourceAlpha\" result=\"shadowOffsetOuter1\"></feOffset>\n          <feGaussianBlur stdDeviation=\"1.5\" in=\"shadowOffsetOuter1\" result=\"shadowBlurOuter1\"></feGaussianBlur>\n          <feColorMatrix\n            values=\"0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.085309222 0\"\n            type=\"matrix\"\n            in=\"shadowBlurOuter1\"\n          ></feColorMatrix>\n        </filter>\n      </defs>\n      <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n        <use fill-rule=\"evenodd\" xlink:href=\"#sort-svg-path-1\"></use>\n        <polygon points=\"8 4 11 7 5 7\"></polygon>\n        <polygon points=\"8 12 5 9 11 9\"></polygon>\n      </g>\n    </svg>\n  </i>\n</span>\n", styles: [".sort-clickable{cursor:pointer;vertical-align:-.55em}:host{height:20px;line-height:20px;margin-right:4px;margin-left:8px;flex:1;display:none}:host.devui-icon-show{display:block}.sort-icon-default{visibility:hidden}.sort-icon-default>svg g use{fill:#d7d8da;fill:var(--devui-shape-icon-fill, #d7d8da)}.sort-icon-default>svg g polygon{fill:#fff;fill:var(--devui-icon-bg, #ffffff)}.sort-icon-default:hover>svg g use{fill:#babbc0;fill:var(--devui-shape-icon-fill-active, #babbc0)}.sort-icon-default-visible{visibility:visible}.sort-icon-asc>svg g use,.sort-icon-desc>svg g use{fill:#5e7ce0;fill:var(--devui-brand, #5e7ce0)}.sort-icon-asc>svg g polygon,.sort-icon-desc>svg g polygon{fill:#fff;fill:var(--devui-icon-bg, #ffffff)}.sort-icon-asc:hover>svg g use,.sort-icon-desc:hover>svg g use{fill:#5e7ce0;fill:var(--devui-brand, #5e7ce0)}.sort-icon-asc>svg g polygon:last-of-type{opacity:.3}.sort-icon-desc>svg g polygon:first-of-type{opacity:.5}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { sortDirection: [{
                type: Input
            }], showSortIcon: [{
                type: HostBinding,
                args: ['class.devui-icon-show']
            }, {
                type: Input
            }], sortEvent: [{
                type: Output
            }], canShow: [{
                type: HostBinding,
                args: ['class.devui-icon-show']
            }] } });
//# sourceMappingURL=data:application/json;base64, 