UNPKG

igniteui-webcomponents-grids

Version:

Ignite UI Web Components grid components.

54 lines (53 loc) 1.95 kB
import { IgCollection } from "igniteui-webcomponents-core"; import { markType } from "igniteui-webcomponents-core"; import { SyncableObservableCollection$2 } from "igniteui-webcomponents-core"; import { PrimaryKeyValue as PrimaryKeyValue_internal } from './PrimaryKeyValue'; import { IgcPrimaryKeyValue as IgcPrimaryKeyValue } from './igc-primary-key-value'; export class IgcGridSelectedKeysCollection extends IgCollection { constructor(list) { super(); if (!IgcPrimaryKeyValue.$type) { IgcPrimaryKeyValue.$type = markType(IgcPrimaryKeyValue, "IgcPrimaryKeyValue"); } if (list) { for (let i = 0; i < list.length; i++) { this.add(list[i]); } } } _createInnerColl() { if (!IgcPrimaryKeyValue.$type) { IgcPrimaryKeyValue.$type = markType(IgcPrimaryKeyValue, "IgcPrimaryKeyValue"); } let coll = new SyncableObservableCollection$2(IgcPrimaryKeyValue.$type, PrimaryKeyValue_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 IgcPrimaryKeyValue(); if (ext) { if (!int.$type && ext._implementation.setNativeElement) { ext._implementation.setNativeElement(int); } else { ext._implementation = int; } } } return ext; }; return coll; } }