1 | {"version":3,"file":"Selection.types.js","sourceRoot":"../src/","sources":["selection/Selection.types.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,IAAM,gBAAgB,GAAG,QAAQ,CAAC;AACzC,MAAM,CAAC,IAAM,sBAAsB,GAAG,cAAc,CAAC;AAErD;;GAEG;AACH,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,iDAAQ,CAAA;IACR,qDAAU,CAAA;IACV,yDAAY,CAAA;AACd,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AA0DD;;GAEG;AACH,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,uEAAc,CAAA;IACd,mEAAY,CAAA;AACd,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B","sourcesContent":["/**\n * {@docCategory Selection}\n */\nexport interface IObjectWithKey {\n key?: string | number;\n}\n\nexport const SELECTION_CHANGE = 'change';\nexport const SELECTION_ITEMS_CHANGE = 'items-change';\n\n/**\n * {@docCategory Selection}\n */\nexport enum SelectionMode {\n none = 0,\n single = 1,\n multiple = 2,\n}\n\n/**\n * {@docCategory Selection}\n */\nexport interface ISelection<TItem = IObjectWithKey> {\n count: number;\n mode: SelectionMode;\n\n canSelectItem: (item: TItem, index?: number) => boolean;\n\n // Obesrvable methods.\n setChangeEvents(isEnabled: boolean, suppressChange?: boolean): void;\n\n // Initialization methods.\n\n setItems(items: TItem[], shouldClear: boolean): void;\n getItems(): TItem[];\n\n // Item utility methods.\n getItemIndex?(key: string): number;\n\n // Read selection methods.\n\n getSelection(): TItem[];\n getSelectedIndices(): number[];\n getSelectedCount(): number;\n isRangeSelected(fromIndex: number, count: number): boolean;\n\n isAllSelected(): boolean;\n isKeySelected(key: string): boolean;\n isIndexSelected(index: number): boolean;\n\n isModal?(): boolean;\n\n // Write selection methods.\n\n setAllSelected(isAllSelected: boolean): void;\n setKeySelected(key: string, isSelected: boolean, shouldAnchor: boolean): void;\n setIndexSelected(index: number, isSelected: boolean, shouldAnchor: boolean): void;\n setRangeSelected?(fromIndex: number, count: number, isSelected: boolean, shouldAnchor: boolean): void;\n\n setModal?(isModal: boolean): void; // TODO make non-optional on next breaking change\n\n // Write range selection methods.\n\n selectToKey(key: string, clearSelection?: boolean): void;\n selectToIndex(index: number, clearSelection?: boolean): void;\n selectToRange?(index: number, count: number, clearSelection?: boolean): void;\n\n // Toggle helpers.\n\n toggleAllSelected(): void;\n toggleKeySelected(key: string): void;\n toggleIndexSelected(index: number): void;\n toggleRangeSelected(fromIndex: number, count: number): void;\n}\n\n/**\n * {@docCategory Selection}\n */\nexport enum SelectionDirection {\n horizontal = 0,\n vertical = 1,\n}\n"]} |