vscroll 1.4.0-alpha → 1.4.0
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.
- package/dist/bundles/vscroll.esm5.js +152 -184
- package/dist/bundles/vscroll.esm5.js.map +1 -1
- package/dist/bundles/vscroll.esm5.min.js +2 -2
- package/dist/bundles/vscroll.esm5.min.js.map +1 -1
- package/dist/bundles/vscroll.esm6.js +140 -173
- package/dist/bundles/vscroll.esm6.js.map +1 -1
- package/dist/bundles/vscroll.esm6.min.js +2 -2
- package/dist/bundles/vscroll.esm6.min.js.map +1 -1
- package/dist/bundles/vscroll.umd.js +153 -185
- package/dist/bundles/vscroll.umd.js.map +1 -1
- package/dist/bundles/vscroll.umd.min.js +2 -2
- package/dist/bundles/vscroll.umd.min.js.map +1 -1
- package/dist/esm2015/classes/buffer/checkCall.js +23 -1
- package/dist/esm2015/classes/buffer/checkCall.js.map +1 -1
- package/dist/esm2015/classes/buffer.js +22 -17
- package/dist/esm2015/classes/buffer.js.map +1 -1
- package/dist/esm2015/classes/state/fetch.js +4 -11
- package/dist/esm2015/classes/state/fetch.js.map +1 -1
- package/dist/esm2015/processes/adapter/append.js +20 -71
- package/dist/esm2015/processes/adapter/append.js.map +1 -1
- package/dist/esm2015/processes/adapter/insert.js +28 -29
- package/dist/esm2015/processes/adapter/insert.js.map +1 -1
- package/dist/esm2015/processes/postFetch.js +0 -1
- package/dist/esm2015/processes/postFetch.js.map +1 -1
- package/dist/esm2015/version.js +1 -1
- package/dist/esm2015/version.js.map +1 -1
- package/dist/esm2015/workflow-transducer.js +6 -6
- package/dist/esm2015/workflow-transducer.js.map +1 -1
- package/dist/esm5/classes/buffer/checkCall.js +25 -1
- package/dist/esm5/classes/buffer/checkCall.js.map +1 -1
- package/dist/esm5/classes/buffer.js +24 -17
- package/dist/esm5/classes/buffer.js.map +1 -1
- package/dist/esm5/classes/state/fetch.js +4 -11
- package/dist/esm5/classes/state/fetch.js.map +1 -1
- package/dist/esm5/processes/adapter/append.js +20 -72
- package/dist/esm5/processes/adapter/append.js.map +1 -1
- package/dist/esm5/processes/adapter/insert.js +28 -31
- package/dist/esm5/processes/adapter/insert.js.map +1 -1
- package/dist/esm5/processes/postFetch.js +0 -1
- package/dist/esm5/processes/postFetch.js.map +1 -1
- package/dist/esm5/version.js +1 -1
- package/dist/esm5/version.js.map +1 -1
- package/dist/esm5/workflow-transducer.js +6 -6
- package/dist/esm5/workflow-transducer.js.map +1 -1
- package/dist/typings/classes/buffer/checkCall.d.ts +4 -1
- package/dist/typings/classes/buffer.d.ts +3 -3
- package/dist/typings/classes/state/fetch.d.ts +1 -3
- package/dist/typings/processes/adapter/append.d.ts +1 -3
- package/dist/typings/processes/adapter/insert.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* vscroll (https://github.com/dhilt/vscroll) FESM2015
|
|
3
|
-
* Version: 1.4.0
|
|
3
|
+
* Version: 1.4.0 (2021-10-01T22:35:16.462Z)
|
|
4
4
|
* Author: Denis Hilt
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -328,7 +328,7 @@ const reactiveConfigStorage = new Map();
|
|
|
328
328
|
|
|
329
329
|
var core = {
|
|
330
330
|
name: 'vscroll',
|
|
331
|
-
version: '1.4.0
|
|
331
|
+
version: '1.4.0'
|
|
332
332
|
};
|
|
333
333
|
|
|
334
334
|
let instanceCount$1 = 0;
|
|
@@ -1535,88 +1535,108 @@ class Update extends BaseAdapterProcessFactory(AdapterProcess.update) {
|
|
|
1535
1535
|
}
|
|
1536
1536
|
}
|
|
1537
1537
|
|
|
1538
|
-
class
|
|
1539
|
-
static run(scroller,
|
|
1540
|
-
const { params } =
|
|
1538
|
+
class Insert extends BaseAdapterProcessFactory(AdapterProcess.insert) {
|
|
1539
|
+
static run(scroller, options) {
|
|
1540
|
+
const { params } = Insert.parseInput(scroller, options);
|
|
1541
1541
|
if (!params) {
|
|
1542
1542
|
return;
|
|
1543
1543
|
}
|
|
1544
|
-
const
|
|
1545
|
-
const { items, bof, eof, increase, decrease } = params;
|
|
1546
|
-
const prepend = process !== AdapterProcess.append;
|
|
1547
|
-
const fixRight = (prepend && !increase) || (!prepend && !!decrease);
|
|
1548
|
-
let next = false;
|
|
1549
|
-
if ((prepend && bof && !buffer.bof.get()) || (!prepend && eof && !buffer.eof.get())) {
|
|
1550
|
-
Append.doVirtual(scroller, items, prepend, fixRight);
|
|
1551
|
-
}
|
|
1552
|
-
else {
|
|
1553
|
-
if (!buffer.size) {
|
|
1554
|
-
next = Append.doEmpty(scroller, items, prepend, fixRight);
|
|
1555
|
-
}
|
|
1556
|
-
else {
|
|
1557
|
-
next = Append.doRegular(scroller, items, prepend, fixRight);
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1544
|
+
const shouldInsert = Insert.doInsert(scroller, params);
|
|
1560
1545
|
scroller.workflow.call({
|
|
1561
|
-
process:
|
|
1562
|
-
status:
|
|
1546
|
+
process: Insert.process,
|
|
1547
|
+
status: shouldInsert ? ProcessStatus.next : ProcessStatus.done
|
|
1563
1548
|
});
|
|
1564
1549
|
}
|
|
1565
|
-
static
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
padding.size += size;
|
|
1572
|
-
if (prepend) {
|
|
1573
|
-
buffer.prependVirtually(items.length, fixRight);
|
|
1574
|
-
scroller.viewport.scrollPosition += size;
|
|
1575
|
-
}
|
|
1576
|
-
else {
|
|
1577
|
-
buffer.appendVirtually(items.length, fixRight);
|
|
1550
|
+
static doInsert(scroller, params) {
|
|
1551
|
+
if (!Insert.insertEmpty(scroller, params)) {
|
|
1552
|
+
if (!Insert.insertInBuffer(scroller, params)) {
|
|
1553
|
+
if (!Insert.insertVirtually(scroller, params)) {
|
|
1554
|
+
return false;
|
|
1555
|
+
}
|
|
1578
1556
|
}
|
|
1579
|
-
scroller.logger.log(() => `buffer.${[absIndexToken]} value is set to ${buffer[absIndexToken]}`);
|
|
1580
|
-
scroller.logger.stat(`after virtual ${prepend ? 'prepend' : 'append'}`);
|
|
1581
1557
|
}
|
|
1558
|
+
return true;
|
|
1582
1559
|
}
|
|
1583
|
-
static
|
|
1584
|
-
const { buffer, state: { fetch } } = scroller;
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
const
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
Array.prototype[prepend ? 'unshift' : 'push'].call(newItems, newItem);
|
|
1594
|
-
index += (prepend ? -1 : 1);
|
|
1595
|
-
});
|
|
1596
|
-
if (bufferLimit !== buffer[absIndexToken]) {
|
|
1597
|
-
buffer[absIndexToken] = bufferLimit;
|
|
1598
|
-
scroller.logger.log(() => `buffer.${absIndexToken} value is set to ${buffer[absIndexToken]}`);
|
|
1599
|
-
}
|
|
1600
|
-
(prepend ? fetch.prepend : fetch.append).call(fetch, newItems);
|
|
1601
|
-
buffer.setItems(newItems);
|
|
1602
|
-
fetch.first.indexBuffer = !isNaN(buffer.firstIndex) ? buffer.firstIndex : index;
|
|
1603
|
-
fetch.last.indexBuffer = !isNaN(buffer.lastIndex) ? buffer.lastIndex : index;
|
|
1604
|
-
fetch.firstVisible.index = startIndex;
|
|
1560
|
+
static insertEmpty(scroller, params) {
|
|
1561
|
+
const { buffer, routines, state: { fetch } } = scroller;
|
|
1562
|
+
if (buffer.size) {
|
|
1563
|
+
return false;
|
|
1564
|
+
}
|
|
1565
|
+
const { beforeIndex, afterIndex, items, decrease } = params;
|
|
1566
|
+
if (!buffer.fillEmpty(items, beforeIndex, afterIndex, !!decrease, (index, data) => new Item(index, data, routines))) {
|
|
1567
|
+
return false;
|
|
1568
|
+
}
|
|
1569
|
+
fetch.fill(buffer.items, buffer.startIndex);
|
|
1605
1570
|
return true;
|
|
1606
1571
|
}
|
|
1607
|
-
static
|
|
1608
|
-
const
|
|
1572
|
+
static insertInBuffer(scroller, params) {
|
|
1573
|
+
const { before, after, beforeIndex, afterIndex, items, decrease } = params;
|
|
1574
|
+
const indexToInsert = scroller.buffer.getIndexToInsert(before || after, beforeIndex, afterIndex);
|
|
1575
|
+
if (isNaN(indexToInsert)) {
|
|
1576
|
+
return false;
|
|
1577
|
+
}
|
|
1578
|
+
const isBackward = Number.isInteger(beforeIndex) || before;
|
|
1609
1579
|
const updateOptions = {
|
|
1610
1580
|
predicate: ({ $index, data }) => {
|
|
1611
|
-
if (
|
|
1612
|
-
return
|
|
1581
|
+
if (indexToInsert === $index) {
|
|
1582
|
+
return isBackward ? [...items, data] : [data, ...items];
|
|
1613
1583
|
}
|
|
1614
1584
|
return true;
|
|
1615
1585
|
},
|
|
1616
|
-
fixRight
|
|
1586
|
+
fixRight: decrease
|
|
1617
1587
|
};
|
|
1618
1588
|
return Update.doUpdate(scroller, updateOptions);
|
|
1619
1589
|
}
|
|
1590
|
+
static insertVirtually(scroller, params) {
|
|
1591
|
+
const { beforeIndex, afterIndex, items, decrease } = params;
|
|
1592
|
+
const { buffer, state: { fetch }, viewport } = scroller;
|
|
1593
|
+
const direction = Number.isInteger(beforeIndex) ? Direction.backward : Direction.forward;
|
|
1594
|
+
const indexToInsert = (direction === Direction.backward ? beforeIndex : afterIndex);
|
|
1595
|
+
if (!buffer.insertVirtually(items, indexToInsert, direction, !!decrease)) {
|
|
1596
|
+
return false;
|
|
1597
|
+
}
|
|
1598
|
+
const { index, diff } = viewport.getEdgeVisibleItem(buffer.items, Direction.backward);
|
|
1599
|
+
fetch.firstVisible.index = index;
|
|
1600
|
+
if (!isNaN(index)) {
|
|
1601
|
+
fetch.simulate = true;
|
|
1602
|
+
fetch.firstVisible.delta = -buffer.getSizeByIndex(index) + diff;
|
|
1603
|
+
}
|
|
1604
|
+
return true;
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
class Append extends BaseAdapterProcessFactory(AdapterProcess.append) {
|
|
1609
|
+
static run(scroller, { process, options }) {
|
|
1610
|
+
const { params } = Append.parseInput(scroller, options, false, process);
|
|
1611
|
+
if (!params) {
|
|
1612
|
+
return;
|
|
1613
|
+
}
|
|
1614
|
+
const shouldAppend = Append.doAppend(scroller, process, params);
|
|
1615
|
+
scroller.workflow.call({
|
|
1616
|
+
process: Append.process,
|
|
1617
|
+
status: shouldAppend ? ProcessStatus.next : ProcessStatus.done
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1620
|
+
static doAppend(scroller, process, params) {
|
|
1621
|
+
const { bof, eof, increase, decrease } = params;
|
|
1622
|
+
const { buffer } = scroller;
|
|
1623
|
+
const prepend = process === AdapterProcess.prepend;
|
|
1624
|
+
const opposite = prepend ? !increase : decrease;
|
|
1625
|
+
let beforeIndex, afterIndex, items = params.items;
|
|
1626
|
+
if (prepend) {
|
|
1627
|
+
beforeIndex = (bof ? buffer.absMinIndex : buffer.minIndex) + (!buffer.size ? 1 : 0);
|
|
1628
|
+
items = [...items].reverse();
|
|
1629
|
+
}
|
|
1630
|
+
else {
|
|
1631
|
+
afterIndex = (eof ? buffer.absMaxIndex : buffer.maxIndex) - (!buffer.size && !opposite ? 1 : 0);
|
|
1632
|
+
}
|
|
1633
|
+
return Insert.doInsert(scroller, {
|
|
1634
|
+
items,
|
|
1635
|
+
beforeIndex,
|
|
1636
|
+
afterIndex,
|
|
1637
|
+
decrease: opposite
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1620
1640
|
}
|
|
1621
1641
|
|
|
1622
1642
|
class Check extends BaseAdapterProcessFactory(AdapterProcess.check) {
|
|
@@ -1762,78 +1782,6 @@ class UserClip extends BaseAdapterProcessFactory(AdapterProcess.clip) {
|
|
|
1762
1782
|
}
|
|
1763
1783
|
}
|
|
1764
1784
|
|
|
1765
|
-
class Insert extends BaseAdapterProcessFactory(AdapterProcess.insert) {
|
|
1766
|
-
static run(scroller, options) {
|
|
1767
|
-
const { params } = Insert.parseInput(scroller, options);
|
|
1768
|
-
if (!params) {
|
|
1769
|
-
return;
|
|
1770
|
-
}
|
|
1771
|
-
const shouldInsert = Insert.doInsert(scroller, params);
|
|
1772
|
-
scroller.workflow.call({
|
|
1773
|
-
process: Insert.process,
|
|
1774
|
-
status: shouldInsert ? ProcessStatus.next : ProcessStatus.done
|
|
1775
|
-
});
|
|
1776
|
-
}
|
|
1777
|
-
static doInsert(scroller, params) {
|
|
1778
|
-
if (!Insert.insertInBuffer(scroller, params)) {
|
|
1779
|
-
if (!Insert.insertVirtually(scroller, params)) {
|
|
1780
|
-
return false;
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
return true;
|
|
1784
|
-
}
|
|
1785
|
-
static insertInBuffer(scroller, params) {
|
|
1786
|
-
const { before, after, beforeIndex, afterIndex, items, decrease } = params;
|
|
1787
|
-
const index = Number.isInteger(beforeIndex) ? beforeIndex : (Number.isInteger(afterIndex) ? afterIndex : NaN);
|
|
1788
|
-
const isBackward = Number.isInteger(beforeIndex) || before;
|
|
1789
|
-
const method = before || after;
|
|
1790
|
-
const found = scroller.buffer.items.find(item => (method && method(item.get())) || (Number.isInteger(index) && index === item.$index));
|
|
1791
|
-
if (!found) {
|
|
1792
|
-
scroller.logger.log('no item to insert in buffer');
|
|
1793
|
-
return false;
|
|
1794
|
-
}
|
|
1795
|
-
const indexToInsert = found.$index;
|
|
1796
|
-
const updateOptions = {
|
|
1797
|
-
predicate: ({ $index, data }) => {
|
|
1798
|
-
if (indexToInsert === $index) {
|
|
1799
|
-
return isBackward ? [...items, data] : [data, ...items];
|
|
1800
|
-
}
|
|
1801
|
-
return true;
|
|
1802
|
-
},
|
|
1803
|
-
fixRight: decrease
|
|
1804
|
-
};
|
|
1805
|
-
return Update.doUpdate(scroller, updateOptions);
|
|
1806
|
-
}
|
|
1807
|
-
static insertVirtually(scroller, params) {
|
|
1808
|
-
const { beforeIndex, afterIndex, items, decrease } = params;
|
|
1809
|
-
const { buffer, state: { fetch }, viewport } = scroller;
|
|
1810
|
-
const direction = Number.isInteger(beforeIndex) ? Direction.backward : Direction.forward;
|
|
1811
|
-
const index = (direction === Direction.backward ? beforeIndex : afterIndex);
|
|
1812
|
-
if (isNaN(fetch.firstVisible.index)) { // if in-buffer insertion did not set firstVisible
|
|
1813
|
-
const { index, diff } = viewport.getEdgeVisibleItem(buffer.items, Direction.backward);
|
|
1814
|
-
fetch.firstVisible.index = index;
|
|
1815
|
-
if (!isNaN(index)) {
|
|
1816
|
-
fetch.firstVisible.delta = -buffer.getSizeByIndex(index) + diff;
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
if (!buffer.insertVirtually(items, index, direction, !!decrease)) {
|
|
1820
|
-
return false;
|
|
1821
|
-
}
|
|
1822
|
-
const { firstVisible } = scroller.state.fetch;
|
|
1823
|
-
if (!isNaN(firstVisible.index)) {
|
|
1824
|
-
let shift = 0;
|
|
1825
|
-
if (index < firstVisible.index && !decrease) {
|
|
1826
|
-
shift = items.length;
|
|
1827
|
-
}
|
|
1828
|
-
else if (index > firstVisible.index && decrease) {
|
|
1829
|
-
shift = -items.length;
|
|
1830
|
-
}
|
|
1831
|
-
firstVisible.index += shift;
|
|
1832
|
-
}
|
|
1833
|
-
return true;
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
1785
|
class Replace extends BaseAdapterProcessFactory(AdapterProcess.replace) {
|
|
1838
1786
|
static run(scroller, options) {
|
|
1839
1787
|
const { params } = Replace.parseInput(scroller, options);
|
|
@@ -2347,7 +2295,6 @@ class PostFetch extends BaseProcessFactory(CommonProcess.postFetch) {
|
|
|
2347
2295
|
}
|
|
2348
2296
|
}
|
|
2349
2297
|
fetch.items = items.map((item, index) => new Item(fetchIndex + index, item, scroller.routines));
|
|
2350
|
-
fetch.isPrepend = !!buffer.items.length && buffer.items[0].$index > fetch.items[fetch.items.length - 1].$index;
|
|
2351
2298
|
return buffer.setItems(fetch.items);
|
|
2352
2299
|
}
|
|
2353
2300
|
}
|
|
@@ -3533,7 +3480,29 @@ class CheckBufferCall {
|
|
|
3533
3480
|
this.context = context;
|
|
3534
3481
|
this.logger = logger;
|
|
3535
3482
|
}
|
|
3536
|
-
|
|
3483
|
+
fillEmpty(items, before, after) {
|
|
3484
|
+
if (!items.length) {
|
|
3485
|
+
this.logger.log('no items to fill the buffer; empty list');
|
|
3486
|
+
return false;
|
|
3487
|
+
}
|
|
3488
|
+
if (!Number.isInteger(before) && !Number.isInteger(after)) {
|
|
3489
|
+
this.logger.log('no items to fill the buffer; wrong indexes');
|
|
3490
|
+
return false;
|
|
3491
|
+
}
|
|
3492
|
+
this.logger.log(() => `going to fill the buffer with ${items.length} item(s)`);
|
|
3493
|
+
return true;
|
|
3494
|
+
}
|
|
3495
|
+
insertInBuffer(predicate, before, after) {
|
|
3496
|
+
const index = Number.isInteger(before) ? before : (Number.isInteger(after) ? after : NaN);
|
|
3497
|
+
const found = this.context.items.find(item => (predicate && predicate(item.get())) ||
|
|
3498
|
+
(Number.isInteger(index) && index === item.$index));
|
|
3499
|
+
if (!found) {
|
|
3500
|
+
this.logger.log('no items to insert in buffer; empty predicate\'s result');
|
|
3501
|
+
return NaN;
|
|
3502
|
+
}
|
|
3503
|
+
return found.$index;
|
|
3504
|
+
}
|
|
3505
|
+
insertVirtual(items, index, direction) {
|
|
3537
3506
|
if (!items.length) {
|
|
3538
3507
|
this.logger.log('no items to insert virtually; empty list');
|
|
3539
3508
|
return false;
|
|
@@ -3700,6 +3669,9 @@ class Buffer {
|
|
|
3700
3669
|
clip() {
|
|
3701
3670
|
this.items = this.items.filter(({ toRemove }) => !toRemove);
|
|
3702
3671
|
}
|
|
3672
|
+
getIndexToInsert(predicate, before, after) {
|
|
3673
|
+
return this.checkCall.insertInBuffer(predicate, before, after);
|
|
3674
|
+
}
|
|
3703
3675
|
shiftExtremum(amount, fixRight) {
|
|
3704
3676
|
if (!fixRight) {
|
|
3705
3677
|
this.absMaxIndex += amount;
|
|
@@ -3715,24 +3687,8 @@ class Buffer {
|
|
|
3715
3687
|
this.startIndex = this.absMinIndex;
|
|
3716
3688
|
}
|
|
3717
3689
|
}
|
|
3718
|
-
appendVirtually(count, fixRight) {
|
|
3719
|
-
if (fixRight) {
|
|
3720
|
-
this.items.forEach(item => item.updateIndex(item.$index - count));
|
|
3721
|
-
this.cache.shiftIndexes(-count);
|
|
3722
|
-
this.items = [...this.items];
|
|
3723
|
-
}
|
|
3724
|
-
this.shiftExtremum(count, fixRight);
|
|
3725
|
-
}
|
|
3726
|
-
prependVirtually(count, fixRight) {
|
|
3727
|
-
if (!fixRight) {
|
|
3728
|
-
this.items.forEach(item => item.updateIndex(item.$index + count));
|
|
3729
|
-
this.cache.shiftIndexes(count);
|
|
3730
|
-
this.items = [...this.items];
|
|
3731
|
-
}
|
|
3732
|
-
this.shiftExtremum(count, fixRight);
|
|
3733
|
-
}
|
|
3734
3690
|
insertVirtually(items, index, direction, fixRight) {
|
|
3735
|
-
if (!this.checkCall.
|
|
3691
|
+
if (!this.checkCall.insertVirtual(items, index, direction)) {
|
|
3736
3692
|
return false;
|
|
3737
3693
|
}
|
|
3738
3694
|
let shift = 0;
|
|
@@ -3767,6 +3723,24 @@ class Buffer {
|
|
|
3767
3723
|
}
|
|
3768
3724
|
this.cache.removeItems(indexes, fixRight);
|
|
3769
3725
|
}
|
|
3726
|
+
fillEmpty(items, beforeIndex, afterIndex, fixRight, generator) {
|
|
3727
|
+
if (!this.checkCall.fillEmpty(items, beforeIndex, afterIndex)) {
|
|
3728
|
+
return false;
|
|
3729
|
+
}
|
|
3730
|
+
const before = Number.isInteger(beforeIndex);
|
|
3731
|
+
const index = (before ? beforeIndex : afterIndex);
|
|
3732
|
+
const shift = (fixRight ? items.length : (before ? 1 : 0));
|
|
3733
|
+
this.items = items.map((data, i) => generator(index + i + (!before ? 1 : 0) - shift, data));
|
|
3734
|
+
this._absMinIndex = this.items[0].$index;
|
|
3735
|
+
this._absMaxIndex = this.items[this.size - 1].$index;
|
|
3736
|
+
if (this.startIndex <= this.absMinIndex) {
|
|
3737
|
+
this.startIndex = this.absMinIndex;
|
|
3738
|
+
}
|
|
3739
|
+
else if (this.startIndex > this.absMaxIndex) {
|
|
3740
|
+
this.startIndex = this.absMaxIndex;
|
|
3741
|
+
}
|
|
3742
|
+
return true;
|
|
3743
|
+
}
|
|
3770
3744
|
updateItems(predicate, generator, indexToTrack, fixRight) {
|
|
3771
3745
|
if (!this.size || Number.isNaN(this.firstIndex)) {
|
|
3772
3746
|
return { trackedIndex: NaN, toRemove: [] };
|
|
@@ -4009,7 +3983,6 @@ class FetchModel {
|
|
|
4009
3983
|
this.direction = null;
|
|
4010
3984
|
this.cancel = null;
|
|
4011
3985
|
this.simulate = false;
|
|
4012
|
-
this.isPrepend = false;
|
|
4013
3986
|
this.isCheck = false;
|
|
4014
3987
|
this.doRemove = false;
|
|
4015
3988
|
}
|
|
@@ -4049,22 +4022,16 @@ class FetchModel {
|
|
|
4049
4022
|
}
|
|
4050
4023
|
stopSimulate() {
|
|
4051
4024
|
this.simulate = false;
|
|
4052
|
-
this.isPrepend = false;
|
|
4053
4025
|
this.isCheck = false;
|
|
4054
4026
|
this.doRemove = false;
|
|
4055
4027
|
}
|
|
4056
|
-
|
|
4028
|
+
fill(items, start) {
|
|
4057
4029
|
this.startSimulate(items);
|
|
4058
|
-
this.last.index = items[items.length - 1].$index;
|
|
4059
4030
|
this.first.index = items[0].$index;
|
|
4031
|
+
this.last.index = items[items.length - 1].$index;
|
|
4060
4032
|
this.direction = Direction.forward;
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
this.startSimulate(items);
|
|
4064
|
-
this.last.index = items[0].$index;
|
|
4065
|
-
this.first.index = items[items.length - 1].$index;
|
|
4066
|
-
this.direction = Direction.backward;
|
|
4067
|
-
this.isPrepend = true;
|
|
4033
|
+
this.firstVisible.index = start;
|
|
4034
|
+
this.firstVisible.delta = 0;
|
|
4068
4035
|
}
|
|
4069
4036
|
check(items) {
|
|
4070
4037
|
this.startSimulate(items);
|
|
@@ -4768,13 +4735,7 @@ const runStateMachine = ({ input: { process, status, payload = {} }, methods: {
|
|
|
4768
4735
|
case CommonProcess.start:
|
|
4769
4736
|
switch (payload.process) {
|
|
4770
4737
|
case AdapterProcess.append:
|
|
4771
|
-
case AdapterProcess.check:
|
|
4772
4738
|
case AdapterProcess.insert:
|
|
4773
|
-
run(Render)();
|
|
4774
|
-
break;
|
|
4775
|
-
case AdapterProcess.remove:
|
|
4776
|
-
run(Adjust)();
|
|
4777
|
-
break;
|
|
4778
4739
|
case AdapterProcess.replace:
|
|
4779
4740
|
case AdapterProcess.update:
|
|
4780
4741
|
if (payload.doRender) {
|
|
@@ -4784,6 +4745,12 @@ const runStateMachine = ({ input: { process, status, payload = {} }, methods: {
|
|
|
4784
4745
|
run(Adjust)();
|
|
4785
4746
|
}
|
|
4786
4747
|
break;
|
|
4748
|
+
case AdapterProcess.check:
|
|
4749
|
+
run(Render)();
|
|
4750
|
+
break;
|
|
4751
|
+
case AdapterProcess.remove:
|
|
4752
|
+
run(Adjust)();
|
|
4753
|
+
break;
|
|
4787
4754
|
default:
|
|
4788
4755
|
run(PreFetch)();
|
|
4789
4756
|
}
|