UNPKG

@progress/kendo-angular-grid

Version:

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

79 lines (78 loc) 2.8 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ /** * @hidden * * Quick look-up structure for combinations of keys or single keys. * Similar to the native JS Set, however, working with single keys or a couple of keys. * Supports both primitive keys and object keys (compared by reference). */ export declare class PairSet { /** * Symbol used internally to represent "no Y key" when storing single X keys. */ private static readonly SINGLE_KEY_SYMBOL; /** * Gets the total number of key entries (both single keys and key pairs). */ get size(): number; /** * Holds a set of Y keys for each defined X key. * Each X key creates a map which holds a set of Y keys. * For single keys, the Y value is the SINGLE_KEY_SYMBOL. * * Map { 'foo' => Set { Symbol(SINGLE_KEY) } } // single key: {x: 'foo'} * Map { 'foo2' => Set { 'bar', 'baz' } } // pairs: {x: 'foo2', y: 'bar'}, {x: 'foo2', y: 'baz'} */ private keysX; /** * Count each added or deleted key manually to avoid iterating over all items when calling `this.size`. */ private totalKeysCount; constructor(items?: any[], keyXField?: string, keyYField?: string); /** * Adds a single key entry. */ addSingle(keyX: any): void; /** * Adds a couple of items identified as a combination. */ add(keyX: any, keyY: any): void; /** * Deletes a single key entry. */ deleteSingle(keyX: any): void; /** * Deletes a combination of a couple of items identified together. */ delete(keyX: any, keyY: any): void; /** * Checks whether a single key is stored. */ hasSingle(keyX: any): boolean; /** * Checks whether the defined combination is stored. */ has(keyX: any, keyY: any): boolean; /** * Checks whether any entry exists for the given X key (single or paired). */ hasX(keyX: any): boolean; /** * Gets all Y keys for a given X key, excluding single key entries. */ getYKeys(keyX: any): any[]; /** * Clears all key combinations and single keys. */ clear(): void; /** * Converts the persisted data structure to an array of objects, * using the provided field names for the object props. * Single keys will only have the keyXField property. * Pair keys will have both keyXField and keyYField properties. */ toArray(keyXField: string, keyYField?: string): any[]; }