diff --git a/demo/app/samples/experimental.component.ts b/demo/app/samples/experimental.component.ts index 596e4dcd..47fafab7 100644 --- a/demo/app/samples/experimental.component.ts +++ b/demo/app/samples/experimental.component.ts @@ -14,6 +14,8 @@ export class ExperimentalComponent { minIndex?: number; maxIndex?: number; updater?: (item: ItemAdapter) => any; + scrollToItem?: (item: ItemAdapter) => boolean; + scrollToItemOpt?: boolean | ScrollIntoViewOptions; }`; } diff --git a/demo/app/samples/experimental/adapter-fix-scrollToItem.component.html b/demo/app/samples/experimental/adapter-fix-scrollToItem.component.html index b7ddcfb9..2e24fa5a 100644 --- a/demo/app/samples/experimental/adapter-fix-scrollToItem.component.html +++ b/demo/app/samples/experimental/adapter-fix-scrollToItem.component.html @@ -1,7 +1,7 @@
-
Available since v1.4.5, undocumented
+
Available since v1.6.2, undocumented
item #
@@ -10,7 +10,18 @@

- Adapter.fix method could be invoked with scrollToItem option + What if we want to scroll to a specific item in the viewport? + This can be done via scrollToItem option of the Adapter.fix method. + This option specifies an item predicate function, and the first item in the Buffer, + that satisfies this predicate, will be the item to which the viewport will scroll. +

+

+ Scrolling is performed via element.scrollIntoView() native DOM Element interface's method. + According to its specification, it accepts 1 optional argument which can be a Boolean parameter or + special Object parameter (details can be found on + MDN). + To provide this option, the Adapter.fix method handles another property of its argument object: + scrollToItemOpt. The demo shows how to use it.

diff --git a/src/component/interfaces/adapter.ts b/src/component/interfaces/adapter.ts index ee346a00..e185371f 100644 --- a/src/component/interfaces/adapter.ts +++ b/src/component/interfaces/adapter.ts @@ -47,7 +47,6 @@ export interface AdapterFixOptions { updater?: ItemsLooper; scrollToItem?: ItemsPredicate; scrollToItemOpt?: boolean | ScrollIntoViewOptions; - safe?: boolean; } export interface IAdapter {