-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathview-repeater.d-CJ9e48MX.d.ts
executable file
·89 lines (87 loc) · 3.81 KB
/
view-repeater.d-CJ9e48MX.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { IterableChanges, ViewContainerRef, IterableChangeRecord, TemplateRef, InjectionToken } from '@angular/core';
/**
* The context for an embedded view in the repeater's view container.
*
* @template T The type for the embedded view's $implicit property.
*/
interface _ViewRepeaterItemContext<T> {
$implicit?: T;
}
/**
* The arguments needed to construct an embedded view for an item in a view
* container.
*
* @template C The type for the context passed to each embedded view.
*/
interface _ViewRepeaterItemInsertArgs<C> {
templateRef: TemplateRef<C>;
context?: C;
index?: number;
}
/**
* A factory that derives the embedded view context for an item in a view
* container.
*
* @template T The type for the embedded view's $implicit property.
* @template R The type for the item in each IterableDiffer change record.
* @template C The type for the context passed to each embedded view.
*/
type _ViewRepeaterItemContextFactory<T, R, C extends _ViewRepeaterItemContext<T>> = (record: IterableChangeRecord<R>, adjustedPreviousIndex: number | null, currentIndex: number | null) => _ViewRepeaterItemInsertArgs<C>;
/**
* Extracts the value of an item from an {@link IterableChangeRecord}.
*
* @template T The type for the embedded view's $implicit property.
* @template R The type for the item in each IterableDiffer change record.
*/
type _ViewRepeaterItemValueResolver<T, R> = (record: IterableChangeRecord<R>) => T;
/** Indicates how a view was changed by a {@link _ViewRepeater}. */
declare enum _ViewRepeaterOperation {
/** The content of an existing view was replaced with another item. */
REPLACED = 0,
/** A new view was created with `createEmbeddedView`. */
INSERTED = 1,
/** The position of a view changed, but the content remains the same. */
MOVED = 2,
/** A view was detached from the view container. */
REMOVED = 3
}
/**
* Meta data describing the state of a view after it was updated by a
* {@link _ViewRepeater}.
*
* @template R The type for the item in each IterableDiffer change record.
* @template C The type for the context passed to each embedded view.
*/
interface _ViewRepeaterItemChange<R, C> {
/** The view's context after it was changed. */
context?: C;
/** Indicates how the view was changed. */
operation: _ViewRepeaterOperation;
/** The view's corresponding change record. */
record: IterableChangeRecord<R>;
}
/**
* Type for a callback to be executed after a view has changed.
*
* @template R The type for the item in each IterableDiffer change record.
* @template C The type for the context passed to each embedded view.
*/
type _ViewRepeaterItemChanged<R, C> = (change: _ViewRepeaterItemChange<R, C>) => void;
/**
* Describes a strategy for rendering items in a {@link ViewContainerRef}.
*
* @template T The type for the embedded view's $implicit property.
* @template R The type for the item in each IterableDiffer change record.
* @template C The type for the context passed to each embedded view.
*/
interface _ViewRepeater<T, R, C extends _ViewRepeaterItemContext<T>> {
applyChanges(changes: IterableChanges<R>, viewContainerRef: ViewContainerRef, itemContextFactory: _ViewRepeaterItemContextFactory<T, R, C>, itemValueResolver: _ViewRepeaterItemValueResolver<T, R>, itemViewChanged?: _ViewRepeaterItemChanged<R, C>): void;
detach(): void;
}
/**
* Injection token for {@link _ViewRepeater}. This token is for use by Angular Material only.
* @docs-private
*/
declare const _VIEW_REPEATER_STRATEGY: InjectionToken<_ViewRepeater<unknown, unknown, _ViewRepeaterItemContext<unknown>>>;
export { _VIEW_REPEATER_STRATEGY, _ViewRepeaterOperation };
export type { _ViewRepeater, _ViewRepeaterItemChange, _ViewRepeaterItemChanged, _ViewRepeaterItemContext, _ViewRepeaterItemContextFactory, _ViewRepeaterItemInsertArgs, _ViewRepeaterItemValueResolver };