UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

54 lines (53 loc) 1.97 kB
import { IgCollection } from './IgCollection'; import { markType } from './type'; import { SyncableObservableCollection$2 } from './SyncableObservableCollection$2'; import { FormatSpecifier as FormatSpecifier_internal } from './FormatSpecifier'; import { IgxFormatSpecifier as IgxFormatSpecifier } from './igx-format-specifier'; export class IgxFormatSpecifierCollection extends IgCollection { constructor(list) { super(); if (!IgxFormatSpecifier.$type) { IgxFormatSpecifier.$type = markType(IgxFormatSpecifier, "IgxFormatSpecifier"); } if (list) { for (let i = 0; i < list.length; i++) { this.add(list[i]); } } } _createInnerColl() { if (!IgxFormatSpecifier.$type) { IgxFormatSpecifier.$type = markType(IgxFormatSpecifier, "IgxFormatSpecifier"); } let coll = new SyncableObservableCollection$2(IgxFormatSpecifier.$type, FormatSpecifier_internal.$type, 0); coll.compare = (ext, int) => { let comp = ext; if (comp._implementation) { comp = comp._implementation; } if (comp.equals) { return comp.equals(int); } return comp === int; }; coll.createTo = (ext) => { return ext._implementation; }; coll.createFrom = (int) => { let ext = int.externalObject; if (!ext) { ext = new IgxFormatSpecifier(); if (ext) { if (!int.$type && ext._implementation.setNativeElement) { ext._implementation.setNativeElement(int); } else { ext._implementation = int; } } } return ext; }; return coll; } }