UNPKG

@taiga-ui/kit

Version:

Taiga UI Angular main components kit

32 lines (28 loc) 1.37 kB
import * as i0 from '@angular/core'; import { inject, signal, computed, untracked, Pipe } from '@angular/core'; import { TUI_COUNTRIES } from '@taiga-ui/kit/tokens'; class TuiSortCountriesPipe { constructor() { this.names = inject(TUI_COUNTRIES); this.countries = signal([]); this.result = computed((names = this.names()) => [...this.countries()].sort((a, b) => names[a].localeCompare(names[b]))); } transform(countries) { untracked(() => this.countries.set(countries)); return this.result(); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: TuiSortCountriesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); } static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.21", ngImport: i0, type: TuiSortCountriesPipe, isStandalone: true, name: "tuiSortCountries", pure: false }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: TuiSortCountriesPipe, decorators: [{ type: Pipe, args: [{ name: 'tuiSortCountries', pure: false, }] }] }); /** * Generated bundle index. Do not edit. */ export { TuiSortCountriesPipe }; //# sourceMappingURL=taiga-ui-kit-pipes-sort-countries.mjs.map