UNPKG

@progress/kendo-angular-grid

Version:

Kendo UI Grid for Angular - high performance data grid with paging, filtering, virtualization, CRUD, and more.

60 lines (59 loc) 1.56 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ /** * @hidden */ export class ItemMap { count = 0; items = {}; get first() { if (this.count > 0) { let result; this.forEach(item => { result = item; return true; }); return result; } } get last() { if (this.count > 0) { const keys = Object.keys(this.items); return this.items[keys[keys.length - 1]]; } } removeItem(key) { if (this.items[key]) { delete this.items[key]; this.count--; } } setItem(key, item) { if (!this.items[key]) { this.count++; } this.items[key] = item; } getItem(key) { return this.items[key]; } toArray() { const result = []; this.forEach(item => { result.push(item); }); return result; } forEach(callback) { for (const key in this.items) { if (this.items.hasOwnProperty(key) && callback(this.items[key])) { return this.items[key]; } } } find(callback) { return this.forEach(callback); } }