ng-virtual-list 18.7.13 → 18.7.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,34 +1,10 @@
1
1
  import { TemplateRef } from '@angular/core';
2
2
  import { IRenderVirtualListItem } from '../models/render-item.model';
3
- import { Id, IRect, ISize } from '../types';
3
+ import { Id, ISize } from '../types';
4
4
  import { BaseVirtualListItemComponent } from '../models/base-virtual-list-item-component';
5
5
  import { NgVirtualListService } from '../ng-virtual-list.service';
6
- import { IRenderVirtualListItemConfig } from '../models/render-item-config.model';
6
+ import { IDisplayObjectConfig, IDisplayObjectMeasures } from '../models';
7
7
  import * as i0 from "@angular/core";
8
- interface IItemConfig extends IRenderVirtualListItemConfig {
9
- /**
10
- * Determines whether the element has focus or not.
11
- */
12
- focus: boolean;
13
- /**
14
- * Determines whether the element is selected or not.
15
- */
16
- selected: boolean;
17
- /**
18
- * Determines whether the element is collapsed or not.
19
- */
20
- collapsed: boolean;
21
- /**
22
- * Selects a list item
23
- * @param selected - If the value is undefined, then the toggle method is executed, if false or true, then the selection/deselection is performed.
24
- */
25
- select: (selected: boolean | undefined) => void;
26
- /**
27
- * Collapse list items
28
- * @param collapsed - If the value is undefined, then the toggle method is executed, if false or true, then the collapse/expand is performed.
29
- */
30
- collapse: (collapsed: boolean | undefined) => void;
31
- }
32
8
  /**
33
9
  * Virtual list item component
34
10
  * @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/components/ng-virtual-list-item.component.ts
@@ -42,14 +18,9 @@ export declare class NgVirtualListItemComponent extends BaseVirtualListItemCompo
42
18
  protected _service: NgVirtualListService;
43
19
  private _isSelected;
44
20
  private _isCollapsed;
45
- config: import("@angular/core").WritableSignal<IItemConfig>;
46
- measures: import("@angular/core").WritableSignal<(IRect & {
47
- /**
48
- * Delta is calculated for Snapping Method.ADVANCED
49
- */
50
- delta: number;
51
- }) | undefined>;
52
- focus: import("@angular/core").WritableSignal<boolean>;
21
+ config: import("@angular/core").WritableSignal<IDisplayObjectConfig>;
22
+ measures: import("@angular/core").WritableSignal<IDisplayObjectMeasures | undefined>;
23
+ focused: import("@angular/core").WritableSignal<boolean>;
53
24
  part: import("@angular/core").WritableSignal<string>;
54
25
  regular: boolean;
55
26
  data: import("@angular/core").WritableSignal<IRenderVirtualListItem<any> | undefined>;
@@ -65,9 +36,11 @@ export declare class NgVirtualListItemComponent extends BaseVirtualListItemCompo
65
36
  get element(): HTMLElement;
66
37
  private _selectHandler;
67
38
  private _collapseHandler;
39
+ private _focusHandler;
68
40
  constructor();
69
41
  private focusNext;
70
42
  private focusPrev;
43
+ private focus;
71
44
  private updateMeasures;
72
45
  private updateConfig;
73
46
  private update;
@@ -79,4 +52,3 @@ export declare class NgVirtualListItemComponent extends BaseVirtualListItemCompo
79
52
  static ɵfac: i0.ɵɵFactoryDeclaration<NgVirtualListItemComponent, never>;
80
53
  static ɵcmp: i0.ɵɵComponentDeclaration<NgVirtualListItemComponent, "ng-virtual-list-item", never, {}, {}, never, never, false, never>;
81
54
  }
82
- export {};
@@ -16,6 +16,7 @@ export declare const DISPLAY_OBJECTS_LENGTH_MESUREMENT_ERROR = 1;
16
16
  export declare const MAX_SCROLL_TO_ITERATIONS = 5;
17
17
  export declare const DEFAULT_SNAPPING_METHOD = SnappingMethods.NORMAL;
18
18
  export declare const DEFAULT_SELECT_METHOD = MethodsForSelecting.NONE;
19
+ export declare const DEFAULT_SCREEN_READER_MESSAGE = "Showing items $1 to $2";
19
20
  export declare const BEHAVIOR_AUTO = "auto";
20
21
  export declare const BEHAVIOR_INSTANT = "instant";
21
22
  export declare const BEHAVIOR_SMOOTH = "smooth";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Focus Alignments.
3
+ * @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/enums/focus-alignments.ts
4
+ * @author Evgenii Grebennikov
5
+ * @email djonnyx@gmail.com
6
+ */
7
+ export declare enum FocusAlignments {
8
+ NONE = "none",
9
+ START = "start",
10
+ CENTER = "center",
11
+ END = "end"
12
+ }
@@ -6,5 +6,6 @@ import { MethodsForSelecting } from "./methods-for-selecting";
6
6
  import { MethodForSelecting } from "./method-for-selecting";
7
7
  import { SnappingMethods } from "./snapping-methods";
8
8
  import { SnappingMethod } from "./snapping-method";
9
- export { CollectionModes, Directions, MethodsForSelecting, SnappingMethods, };
9
+ import { FocusAlignments } from "./focus-alignments";
10
+ export { CollectionModes, Directions, MethodsForSelecting, SnappingMethods, FocusAlignments, };
10
11
  export type { CollectionMode, Direction, MethodForSelecting, SnappingMethod, };
@@ -0,0 +1,35 @@
1
+ import { IRenderVirtualListItemConfig } from "./render-item-config.model";
2
+ /**
3
+ * Display object configuration. A set of `select`, `collapse`, and `focus` methods are also provided.
4
+ * @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/models/display-object-config.model.ts
5
+ * @author Evgenii Grebennikov
6
+ * @email djonnyx@gmail.com
7
+ */
8
+ export interface IDisplayObjectConfig extends IRenderVirtualListItemConfig {
9
+ /**
10
+ * Determines whether the element has focused or not.
11
+ */
12
+ focused: boolean;
13
+ /**
14
+ * Determines whether the element is selected or not.
15
+ */
16
+ selected: boolean;
17
+ /**
18
+ * Determines whether the element is collapsed or not.
19
+ */
20
+ collapsed: boolean;
21
+ /**
22
+ * Focus a list item
23
+ */
24
+ focus: () => void;
25
+ /**
26
+ * Selects a list item
27
+ * @param selected - If the value is undefined, then the toggle method is executed, if false or true, then the selection/deselection is performed.
28
+ */
29
+ select: (selected: boolean | undefined) => void;
30
+ /**
31
+ * Collapse list items
32
+ * @param collapsed - If the value is undefined, then the toggle method is executed, if false or true, then the collapse/expand is performed.
33
+ */
34
+ collapse: (collapsed: boolean | undefined) => void;
35
+ }
@@ -0,0 +1,13 @@
1
+ import { IRect } from "../types";
2
+ /**
3
+ * Display object metrics.
4
+ * @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/models/display-object-measures.model.ts
5
+ * @author Evgenii Grebennikov
6
+ * @email djonnyx@gmail.com
7
+ */
8
+ export interface IDisplayObjectMeasures extends IRect {
9
+ /**
10
+ * Delta is calculated for Snapping Method.ADVANCED
11
+ */
12
+ delta: number;
13
+ }
@@ -4,4 +4,6 @@ import { IVirtualListItem } from './item.model';
4
4
  import { IVirtualListItemConfigMap } from './item-config-map.model';
5
5
  import { IVirtualListCollection } from './collection.model';
6
6
  import { IRenderVirtualListItem } from './render-item.model';
7
- export type { ScrollDirection, IScrollEvent, IVirtualListItem, IVirtualListItemConfigMap, IVirtualListCollection, IRenderVirtualListItem, };
7
+ import { IDisplayObjectConfig } from './display-object-config.model';
8
+ import { IDisplayObjectMeasures } from './display-object-measures.model';
9
+ export type { IDisplayObjectConfig, IDisplayObjectMeasures, IScrollEvent, IVirtualListItem, IVirtualListItemConfigMap, IVirtualListCollection, IRenderVirtualListItem, ScrollDirection, };
@@ -1,7 +1,7 @@
1
1
  import { AfterViewInit, OnDestroy, OnInit, TemplateRef, WritableSignal } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
3
  import { IRenderVirtualListItem, IScrollEvent, IVirtualListCollection, IVirtualListItemConfigMap } from './models';
4
- import { Id, ISize } from './types';
4
+ import { FocusAlignment, Id, ISize } from './types';
5
5
  import { CollectionMode, Direction, Directions, MethodForSelecting, SnappingMethod } from './enums';
6
6
  import * as i0 from "@angular/core";
7
7
  /**
@@ -168,6 +168,15 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
168
168
  * The name of the property by which tracking is performed
169
169
  */
170
170
  trackBy: import("@angular/core").InputSignal<string>;
171
+ private _screenReaderMessageOptions;
172
+ /**
173
+ * Message for screen reader.
174
+ * The message format is: "some text $1 some text $2",
175
+ * where $1 is the number of the first element of the screen collection,
176
+ * $2 is the number of the last element of the screen collection.
177
+ */
178
+ screenReaderMessage: import("@angular/core").InputSignal<string>;
179
+ readonly screenReaderFormattedMessage: WritableSignal<string>;
171
180
  private _isNotSelecting;
172
181
  get isNotSelecting(): boolean;
173
182
  private _isSingleSelecting;
@@ -236,6 +245,10 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
236
245
  * Returns the bounds of an element with a given id
237
246
  */
238
247
  getItemBounds(id: Id): ISize | undefined;
248
+ /**
249
+ * Focus an list item by a given id.
250
+ */
251
+ focus(id: Id, align?: FocusAlignment): void;
239
252
  /**
240
253
  * The method scrolls the list to the element with the given id and returns the value of the scrolled area.
241
254
  * Behavior accepts the values ​​"auto", "instant" and "smooth".
@@ -255,5 +268,5 @@ export declare class NgVirtualListComponent implements AfterViewInit, OnInit, On
255
268
  ngOnDestroy(): void;
256
269
  private dispose;
257
270
  static ɵfac: i0.ɵɵFactoryDeclaration<NgVirtualListComponent, never>;
258
- static ɵcmp: i0.ɵɵComponentDeclaration<NgVirtualListComponent, "ng-virtual-list", never, { "items": { "alias": "items"; "required": true; "isSignal": true; }; "selectedIds": { "alias": "selectedIds"; "required": false; "isSignal": true; }; "collapsedIds": { "alias": "collapsedIds"; "required": false; "isSignal": true; }; "selectByClick": { "alias": "selectByClick"; "required": false; "isSignal": true; }; "collapseByClick": { "alias": "collapseByClick"; "required": false; "isSignal": true; }; "snap": { "alias": "snap"; "required": false; "isSignal": true; }; "enabledBufferOptimization": { "alias": "enabledBufferOptimization"; "required": false; "isSignal": true; }; "itemRenderer": { "alias": "itemRenderer"; "required": true; "isSignal": true; }; "itemConfigMap": { "alias": "itemConfigMap"; "required": false; "isSignal": true; }; "itemSize": { "alias": "itemSize"; "required": false; "isSignal": true; }; "dynamicSize": { "alias": "dynamicSize"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "collectionMode": { "alias": "collectionMode"; "required": false; "isSignal": true; }; "bufferSize": { "alias": "bufferSize"; "required": false; "isSignal": true; }; "maxBufferSize": { "alias": "maxBufferSize"; "required": false; "isSignal": true; }; "snappingMethod": { "alias": "snappingMethod"; "required": false; "isSignal": true; }; "methodForSelecting": { "alias": "methodForSelecting"; "required": false; "isSignal": true; }; "trackBy": { "alias": "trackBy"; "required": false; "isSignal": true; }; }, { "onScroll": "onScroll"; "onScrollEnd": "onScrollEnd"; "onViewportChange": "onViewportChange"; "onItemClick": "onItemClick"; "onSelect": "onSelect"; "onCollapse": "onCollapse"; "onScrollReachStart": "onScrollReachStart"; "onScrollReachEnd": "onScrollReachEnd"; }, never, never, false, never>;
271
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgVirtualListComponent, "ng-virtual-list", never, { "items": { "alias": "items"; "required": true; "isSignal": true; }; "selectedIds": { "alias": "selectedIds"; "required": false; "isSignal": true; }; "collapsedIds": { "alias": "collapsedIds"; "required": false; "isSignal": true; }; "selectByClick": { "alias": "selectByClick"; "required": false; "isSignal": true; }; "collapseByClick": { "alias": "collapseByClick"; "required": false; "isSignal": true; }; "snap": { "alias": "snap"; "required": false; "isSignal": true; }; "enabledBufferOptimization": { "alias": "enabledBufferOptimization"; "required": false; "isSignal": true; }; "itemRenderer": { "alias": "itemRenderer"; "required": true; "isSignal": true; }; "itemConfigMap": { "alias": "itemConfigMap"; "required": false; "isSignal": true; }; "itemSize": { "alias": "itemSize"; "required": false; "isSignal": true; }; "dynamicSize": { "alias": "dynamicSize"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "collectionMode": { "alias": "collectionMode"; "required": false; "isSignal": true; }; "bufferSize": { "alias": "bufferSize"; "required": false; "isSignal": true; }; "maxBufferSize": { "alias": "maxBufferSize"; "required": false; "isSignal": true; }; "snappingMethod": { "alias": "snappingMethod"; "required": false; "isSignal": true; }; "methodForSelecting": { "alias": "methodForSelecting"; "required": false; "isSignal": true; }; "trackBy": { "alias": "trackBy"; "required": false; "isSignal": true; }; "screenReaderMessage": { "alias": "screenReaderMessage"; "required": false; "isSignal": true; }; }, { "onScroll": "onScroll"; "onScrollEnd": "onScrollEnd"; "onViewportChange": "onViewportChange"; "onItemClick": "onItemClick"; "onSelect": "onSelect"; "onCollapse": "onCollapse"; "onScrollReachStart": "onScrollReachStart"; "onScrollReachEnd": "onScrollReachEnd"; }, never, never, false, never>;
259
272
  }
@@ -1,8 +1,8 @@
1
1
  import { TrackBox } from './utils/trackBox';
2
2
  import { IRenderVirtualListItem } from './models';
3
- import { Id } from './types';
4
- import { MethodsForSelectingTypes } from './enums/method-for-selecting-types';
5
3
  import { IRenderVirtualListCollection } from './models/render-collection.model';
4
+ import { MethodsForSelectingTypes } from './enums/method-for-selecting-types';
5
+ import { FocusAlignment, Id } from './types';
6
6
  import * as i0 from "@angular/core";
7
7
  export declare class NgVirtualListService {
8
8
  private _nextComponentId;
@@ -22,7 +22,11 @@ export declare class NgVirtualListService {
22
22
  collapseByClick: boolean;
23
23
  private _trackBox;
24
24
  listElement: HTMLDivElement | null;
25
- collection: IRenderVirtualListCollection;
25
+ private _$displayItems;
26
+ readonly $displayItems: import("rxjs").Observable<IRenderVirtualListCollection>;
27
+ private _collection;
28
+ set collection(v: IRenderVirtualListCollection);
29
+ get collection(): IRenderVirtualListCollection;
26
30
  constructor();
27
31
  setSelectedIds(ids: Array<Id> | Id | undefined): void;
28
32
  setCollapsedIds(ids: Array<Id>): void;
@@ -40,8 +44,8 @@ export declare class NgVirtualListService {
40
44
  * @param collapsed - If the value is undefined, then the toggle method is executed, if false or true, then the collapse/expand is performed.
41
45
  */
42
46
  collapse(data: IRenderVirtualListItem | undefined, collapsed?: boolean | undefined): void;
43
- itemToFocus: ((element: HTMLElement, position: number) => void) | undefined;
44
- focus(element: HTMLElement): void;
47
+ itemToFocus: ((element: HTMLElement, position: number, align: FocusAlignment) => void) | undefined;
48
+ focus(element: HTMLElement, align?: FocusAlignment): void;
45
49
  areaFocus(id: Id | null): void;
46
50
  initialize(trackBox: TrackBox): void;
47
51
  generateComponentId(): number;
@@ -0,0 +1,8 @@
1
+ import { FocusAlignments } from "../enums";
2
+ /**
3
+ * Focus Alignment
4
+ * @link https://github.com/DjonnyX/ng-virtual-list/blob/18.x/projects/ng-virtual-list/src/lib/types/focus-alignment.ts
5
+ * @author Evgenii Grebennikov
6
+ * @email djonnyx@gmail.com
7
+ */
8
+ export type FocusAlignment = FocusAlignments | 'none' | 'start' | 'center' | 'end';
@@ -1,4 +1,5 @@
1
1
  import { Id } from './id';
2
2
  import { ISize } from './size';
3
3
  import { IRect } from './rect';
4
- export type { Id, ISize, IRect, };
4
+ import { FocusAlignment } from './focus-alignment';
5
+ export type { Id, ISize, IRect, FocusAlignment, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-virtual-list",
3
- "version": "18.7.13",
3
+ "version": "18.7.15",
4
4
  "author": {
5
5
  "name": "Evgenii Grebennikov",
6
6
  "email": "djonnyx@gmail.com"