index.d.ts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import { Observable } from 'rxjs';
  2. import { D as DataSource } from '../data-source.d-Bblv7Zvh.js';
  3. export { C as CollectionViewer, L as ListRange, i as isDataSource } from '../data-source.d-Bblv7Zvh.js';
  4. import { IterableChanges, ViewContainerRef } from '@angular/core';
  5. import { _ as _ViewRepeaterItemContext, a as _ViewRepeater, b as _ViewRepeaterItemContextFactory, c as _ViewRepeaterItemValueResolver, d as _ViewRepeaterItemChanged } from '../view-repeater.d-BKljR8u8.js';
  6. export { h as _VIEW_REPEATER_STRATEGY, g as _ViewRepeaterItemChange, e as _ViewRepeaterItemInsertArgs, f as _ViewRepeaterOperation } from '../view-repeater.d-BKljR8u8.js';
  7. import { S as SelectionModel } from '../selection-model.d-C_vvNGP-.js';
  8. export { a as SelectionChange, g as getMultipleValuesInSingleSelectionError } from '../selection-model.d-C_vvNGP-.js';
  9. export { U as UniqueSelectionDispatcher, a as UniqueSelectionDispatcherListener } from '../unique-selection-dispatcher.d-DSFqf1MM.js';
  10. /** DataSource wrapper for a native array. */
  11. declare class ArrayDataSource<T> extends DataSource<T> {
  12. private _data;
  13. constructor(_data: readonly T[] | Observable<readonly T[]>);
  14. connect(): Observable<readonly T[]>;
  15. disconnect(): void;
  16. }
  17. /**
  18. * A repeater that destroys views when they are removed from a
  19. * {@link ViewContainerRef}. When new items are inserted into the container,
  20. * the repeater will always construct a new embedded view for each item.
  21. *
  22. * @template T The type for the embedded view's $implicit property.
  23. * @template R The type for the item in each IterableDiffer change record.
  24. * @template C The type for the context passed to each embedded view.
  25. */
  26. declare class _DisposeViewRepeaterStrategy<T, R, C extends _ViewRepeaterItemContext<T>> implements _ViewRepeater<T, R, C> {
  27. applyChanges(changes: IterableChanges<R>, viewContainerRef: ViewContainerRef, itemContextFactory: _ViewRepeaterItemContextFactory<T, R, C>, itemValueResolver: _ViewRepeaterItemValueResolver<T, R>, itemViewChanged?: _ViewRepeaterItemChanged<R, C>): void;
  28. detach(): void;
  29. }
  30. /**
  31. * A repeater that caches views when they are removed from a
  32. * {@link ViewContainerRef}. When new items are inserted into the container,
  33. * the repeater will reuse one of the cached views instead of creating a new
  34. * embedded view. Recycling cached views reduces the quantity of expensive DOM
  35. * inserts.
  36. *
  37. * @template T The type for the embedded view's $implicit property.
  38. * @template R The type for the item in each IterableDiffer change record.
  39. * @template C The type for the context passed to each embedded view.
  40. */
  41. declare class _RecycleViewRepeaterStrategy<T, R, C extends _ViewRepeaterItemContext<T>> implements _ViewRepeater<T, R, C> {
  42. /**
  43. * The size of the cache used to store unused views.
  44. * Setting the cache size to `0` will disable caching. Defaults to 20 views.
  45. */
  46. viewCacheSize: number;
  47. /**
  48. * View cache that stores embedded view instances that have been previously stamped out,
  49. * but don't are not currently rendered. The view repeater will reuse these views rather than
  50. * creating brand new ones.
  51. *
  52. * TODO(michaeljamesparsons) Investigate whether using a linked list would improve performance.
  53. */
  54. private _viewCache;
  55. /** Apply changes to the DOM. */
  56. applyChanges(changes: IterableChanges<R>, viewContainerRef: ViewContainerRef, itemContextFactory: _ViewRepeaterItemContextFactory<T, R, C>, itemValueResolver: _ViewRepeaterItemValueResolver<T, R>, itemViewChanged?: _ViewRepeaterItemChanged<R, C>): void;
  57. detach(): void;
  58. /**
  59. * Inserts a view for a new item, either from the cache or by creating a new
  60. * one. Returns `undefined` if the item was inserted into a cached view.
  61. */
  62. private _insertView;
  63. /** Detaches the view at the given index and inserts into the view cache. */
  64. private _detachAndCacheView;
  65. /** Moves view at the previous index to the current index. */
  66. private _moveView;
  67. /**
  68. * Cache the given detached view. If the cache is full, the view will be
  69. * destroyed.
  70. */
  71. private _maybeCacheView;
  72. /** Inserts a recycled view from the cache at the given index. */
  73. private _insertViewFromCache;
  74. }
  75. /**
  76. * Interface for a class that can flatten hierarchical structured data and re-expand the flattened
  77. * data back into its original structure. Should be used in conjunction with the cdk-tree.
  78. */
  79. interface TreeDataNodeFlattener<T> {
  80. /** Transforms a set of hierarchical structured data into a flattened data array. */
  81. flattenNodes(structuredData: any[]): T[];
  82. /**
  83. * Expands a flattened array of data into its hierarchical form using the provided expansion
  84. * model.
  85. */
  86. expandFlattenedNodes(nodes: T[], expansionModel: SelectionModel<T>): T[];
  87. /**
  88. * Put node descendants of node in array.
  89. * If `onlyExpandable` is true, then only process expandable descendants.
  90. */
  91. nodeDescendents(node: T, nodes: T[], onlyExpandable: boolean): void;
  92. }
  93. export { ArrayDataSource, DataSource, SelectionModel, _DisposeViewRepeaterStrategy, _RecycleViewRepeaterStrategy, _ViewRepeater, _ViewRepeaterItemChanged, _ViewRepeaterItemContext, _ViewRepeaterItemContextFactory, _ViewRepeaterItemValueResolver };
  94. export type { TreeDataNodeFlattener };