{ "version": 3, "sources": ["src/app/_single-module/table/_directives/sortable-header.directive.ts"], "sourcesContent": ["import {ChangeDetectorRef, Directive, EventEmitter, inject, Input, OnInit, Output} from \"@angular/core\";\r\n\r\nexport const compare = (v1: string | number, v2: string | number) => (v1 < v2 ? -1 : v1 > v2 ? 1 : 0);\r\nexport type SortColumn = keyof T | '';\r\nexport type SortDirection = 'asc' | 'desc' | '';\r\nconst rotate: { [key: string]: SortDirection } = { asc: 'desc', desc: 'asc', '': 'asc' };\r\n\r\nexport interface SortEvent {\r\n\tcolumn: SortColumn;\r\n\tdirection: SortDirection;\r\n}\r\n\r\n@Directive({\r\n // eslint-disable-next-line @angular-eslint/directive-selector\r\n selector: 'th[sortable]',\r\n host: {\r\n '[class.asc]': 'direction === \"asc\"',\r\n '[class.desc]': 'direction === \"desc\"',\r\n '(click)': 'rotate()',\r\n },\r\n standalone: true,\r\n})\r\n// eslint-disable-next-line @angular-eslint/directive-class-suffix\r\nexport class SortableHeader {\r\n\t@Input() sortable: SortColumn = '';\r\n\t@Input() direction: SortDirection = '';\r\n\t@Output() sort = new EventEmitter>();\r\n\r\n\trotate() {\r\n\t\tthis.direction = rotate[this.direction];\r\n\t\tthis.sort.emit({ column: this.sortable, direction: this.direction });\r\n\t}\r\n}\r\n"], "mappings": "iEAEO,IAAMA,EAAUA,CAACC,EAAqBC,IAAyBD,EAAKC,EAAK,GAAKD,EAAKC,EAAK,EAAI,EAG7FC,EAA2C,CAAEC,IAAK,OAAQC,KAAM,MAAO,GAAI,KAAK,EAkBzEC,GAAc,IAAA,CAArB,MAAOA,CAAc,CAX3BC,aAAA,CAYU,KAAAC,SAA0B,GAC1B,KAAAC,UAA2B,GAC1B,KAAAC,KAAO,IAAIC,EAErBR,QAAM,CACL,KAAKM,UAAYN,EAAO,KAAKM,SAAS,EACtC,KAAKC,KAAKE,KAAK,CAAEC,OAAQ,KAAKL,SAAUC,UAAW,KAAKA,SAAS,CAAE,CACpE,iDARYH,EAAc,CAAA,+BAAdA,EAAcQ,UAAA,CAAA,CAAA,KAAA,WAAA,EAAA,CAAA,EAAAC,SAAA,EAAAC,aAAA,SAAAC,EAAAC,EAAA,CAAAD,EAAA,GAAdE,EAAA,QAAA,UAAA,CAAA,OAAAD,EAAAf,OAAA,CAAQ,CAAA,OAARiB,EAAA,MAAAF,EAAAT,YAAc,KAAK,EAAL,OAAAS,EAAAT,YAAA,MAAM,oGAApBH,CAAc,GAAA", "names": ["compare", "v1", "v2", "rotate", "asc", "desc", "SortableHeader", "constructor", "sortable", "direction", "sort", "EventEmitter", "emit", "column", "selectors", "hostVars", "hostBindings", "rf", "ctx", "\u0275\u0275listener", "\u0275\u0275classProp"] }