dhilt/vscroll

Decreasing/increasing strategy for append/prepend Adapter API

Closed this issue · 0 comments

dhilt commented

In current version of Adapter.append API, indexes increase. Say, there were [1..99] items, there will be [1..100] items after appending 1. What if I need to use decreasing strategy? [1..99] -> [0..99].

The same is for Adapter.prepend: in current version of Adapter.prepend API, indexes decrease. Say, there were [1..99] items, there will be [0..99] items after prepending 1. Increasing strategy would give [1..99] -> [1..100].

Adapter.replace and Adapter.update APIs have fixRight option. Adapter.remove and Adapter.insert have increase and decrease options respectively. All these options allow to manipulate the direction of index transforming. We need to add such options to append/prepend API.

Proposal 1.

  • Adapter.append({ ..., fixRight }), the default value of fixRight is false.
  • Adapter.prepend({ ..., fixRight }), the default value of fixRight is true.

Proposal 2.

  • Adapter.append({ ..., decrease }), the default value of decrease is false.
  • Adapter.prepend({ ..., increase }), the default value of increase is false.

Proposal 3.

  • Adapter.append({ ..., fixRight }), the default value of fixRight is false.
  • Adapter.prepend({ ..., fixLeft }), the default value of fixLeft is false.

Relates to dhilt/ngx-ui-scroll#286.