ng-virtual-list 19.10.3 → 19.10.5

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.
@@ -142,7 +142,7 @@ const TRACK_BY_PROPERTY_NAME = 'id';
142
142
  const DEFAULT_DIRECTION = Directions.VERTICAL;
143
143
  const DEFAULT_COLLECTION_MODE = CollectionModes.NORMAL;
144
144
  const DISPLAY_OBJECTS_LENGTH_MESUREMENT_ERROR = 1;
145
- const MAX_SCROLL_TO_ITERATIONS = 7;
145
+ const MAX_SCROLL_TO_ITERATIONS = 5;
146
146
  const DEFAULT_SNAPPING_METHOD = SnappingMethods.NORMAL;
147
147
  const DEFAULT_SELECT_METHOD = MethodsForSelecting.NONE;
148
148
  const DEFAULT_SCREEN_READER_MESSAGE = 'Showing items $1 to $2';
@@ -637,7 +637,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
637
637
  args: ['maxClickDistance']
638
638
  }] } });
639
639
 
640
- const ZEROS_POSITION = -1000, NAVIGATE_TO_ATTEMT = 5, ATTR_AREA_SELECTED = 'area-selected', POSITION = 'position', POSITION_ZERO = '0', ID$1 = 'item-id', KEY_SPACE = ' ', KEY_ARR_LEFT = 'ArrowLeft', KEY_ARR_UP = 'ArrowUp', KEY_ARR_RIGHT = 'ArrowRight', KEY_ARR_DOWN = 'ArrowDown', EVENT_FOCUS_IN = 'focusin', EVENT_FOCUS_OUT = 'focusout', EVENT_KEY_DOWN = 'keydown', CLASS_NAME_SNAPPED = 'snapped', CLASS_NAME_SNAPPED_OUT = 'snapped-out', CLASS_NAME_FOCUS = 'focus';
640
+ const TRANSLATE_3D_HIDDEN = 'translate3d(-1000px,-1000px,0)', NAVIGATE_TO_ATTEMT = 5, ATTR_AREA_SELECTED = 'area-selected', POSITION = 'position', POSITION_ZERO = '0', ID$1 = 'item-id', KEY_SPACE = ' ', KEY_ARR_LEFT = 'ArrowLeft', KEY_ARR_UP = 'ArrowUp', KEY_ARR_RIGHT = 'ArrowRight', KEY_ARR_DOWN = 'ArrowDown', EVENT_FOCUS_IN = 'focusin', EVENT_FOCUS_OUT = 'focusout', EVENT_KEY_DOWN = 'keydown', CLASS_NAME_SNAPPED = 'snapped', CLASS_NAME_SNAPPED_OUT = 'snapped-out', CLASS_NAME_FOCUS = 'focus';
641
641
  /**
642
642
  * Virtual list component.
643
643
  * Maximum performance for extremely large lists.
@@ -986,7 +986,7 @@ class NgVirtualListItemComponent extends BaseVirtualListItemComponent {
986
986
  hide() {
987
987
  const el = this._elementRef.nativeElement, styles = el.style;
988
988
  styles.position = POSITION_ABSOLUTE;
989
- styles.transform = `${TRANSLATE_3D}(${this._data?.config?.isVertical ? 0 : ZEROS_POSITION},${this._data?.config?.isVertical ? 0 : ZEROS_POSITION},0)`;
989
+ styles.transform = TRANSLATE_3D_HIDDEN;
990
990
  styles.zIndex = HIDDEN_ZINDEX;
991
991
  if (this.regular) {
992
992
  if (styles.display === DISPLAY_NONE) {
@@ -1605,8 +1605,6 @@ const bufferInterpolation = (currentBufferValue, array, value, extra) => {
1605
1605
  var TrackBoxEvents;
1606
1606
  (function (TrackBoxEvents) {
1607
1607
  TrackBoxEvents["CHANGE"] = "change";
1608
- TrackBoxEvents["PREPARE"] = "prepare";
1609
- TrackBoxEvents["RESET"] = "reset";
1610
1608
  })(TrackBoxEvents || (TrackBoxEvents = {}));
1611
1609
  var ItemDisplayMethods;
1612
1610
  (function (ItemDisplayMethods) {
@@ -1744,10 +1742,6 @@ class TrackBox extends CacheMap {
1744
1742
  _resetBufferSizeTimeout = DEFAULT_RESET_BUFFER_SIZE_TIMEOUT;
1745
1743
  _resetBufferSizeTimer;
1746
1744
  _isReseted = true;
1747
- _prepared = false;
1748
- _preparedToStart = false;
1749
- _preparedToStartIterations = 2;
1750
- get prepared() { return this._prepared; }
1751
1745
  lifeCircle() {
1752
1746
  this.fireChangeIfNeed();
1753
1747
  this.lifeCircleDo();
@@ -1763,12 +1757,7 @@ class TrackBox extends CacheMap {
1763
1757
  }
1764
1758
  const reseted = ((!this._previousCollection || this._previousCollection.length === 0) &&
1765
1759
  (!!currentCollection && currentCollection.length > 0));
1766
- if (this._isReseted !== reseted && reseted && this._prepared) {
1767
- this._prepared = false;
1768
- this.dispatch(TrackBoxEvents.PREPARE, false);
1769
- }
1770
1760
  this._isReseted = reseted;
1771
- this.dispatch(TrackBoxEvents.RESET, reseted);
1772
1761
  this.updateCache(this._previousCollection, currentCollection, itemSize);
1773
1762
  this._previousCollection = [...(currentCollection || [])];
1774
1763
  }
@@ -1897,7 +1886,7 @@ class TrackBox extends CacheMap {
1897
1886
  updateCollection(items, itemConfigMap, options) {
1898
1887
  const opt = { itemConfigMap, ...options }, dynamicSize = opt.dynamicSize, crudDetected = this._crudDetected, deletedItemsMap = this._deletedItemsMap;
1899
1888
  if (dynamicSize) {
1900
- this.cacheElements();
1889
+ this.cacheElements(opt.isVertical, opt.itemSize);
1901
1890
  }
1902
1891
  this._defaultBufferSize = opt.bufferSize;
1903
1892
  this._maxBufferSize = opt.maxBufferSize;
@@ -1920,16 +1909,6 @@ class TrackBox extends CacheMap {
1920
1909
  }
1921
1910
  this._delta += metrics.delta;
1922
1911
  this.updateAdaptiveBufferParams(metrics, items.length);
1923
- if (!opt.dynamicSize || (this._preparedToStart && !this._prepared && this._previousTotalSize === metrics.totalSize)) {
1924
- this._prepared = true;
1925
- this.dispatch(TrackBoxEvents.PREPARE, true);
1926
- }
1927
- if (this._preparedToStartIterations > 0 && this._previousTotalSize !== metrics.totalSize) {
1928
- this._preparedToStartIterations--;
1929
- }
1930
- if (this._preparedToStartIterations === 0) {
1931
- this._preparedToStart = true;
1932
- }
1933
1912
  this._previousTotalSize = metrics.totalSize;
1934
1913
  this._deletedItemsMap = {};
1935
1914
  if (!dynamicSize) {
@@ -2222,6 +2201,20 @@ class TrackBox extends CacheMap {
2222
2201
  };
2223
2202
  return metrics;
2224
2203
  }
2204
+ resetCache(collection, trackBy, isVertical, itemSize, bounds) {
2205
+ const map = this._map;
2206
+ for (let i = 0, l = collection.length; i < l; i++) {
2207
+ const collectionItem = collection[i], id = collectionItem[trackBy];
2208
+ if (map.has(id)) {
2209
+ const cache = map.get(id), bSize = isVertical ? bounds.height : bounds.width;
2210
+ map.set(id, {
2211
+ ...cache,
2212
+ width: isVertical ? cache.width : (cache.width <= itemSize || cache.width === bSize) ? itemSize : cache.width,
2213
+ height: isVertical ? (cache.height <= itemSize || cache.height === bSize) ? itemSize : cache.height : cache.height
2214
+ });
2215
+ }
2216
+ }
2217
+ }
2225
2218
  clearDeltaDirection() {
2226
2219
  this.clearScrollDirectionCache();
2227
2220
  }
@@ -2492,7 +2485,7 @@ class TrackBox extends CacheMap {
2492
2485
  _debouncedIsScrollStartOff = debounce(() => {
2493
2486
  this._isScrollStart = false;
2494
2487
  });
2495
- cacheElements() {
2488
+ cacheElements(isVertical, itemSize) {
2496
2489
  if (!this._displayComponents) {
2497
2490
  return;
2498
2491
  }
@@ -2502,11 +2495,13 @@ class TrackBox extends CacheMap {
2502
2495
  continue;
2503
2496
  }
2504
2497
  const bounds = component.instance.getBounds();
2505
- if (bounds.width && bounds.height) {
2506
- this.set(itemId, { ...this.get(itemId), ...bounds });
2507
- if (this._isLazy && (this._isScrollStart)) {
2508
- this._debouncedIsScrollStartOff.execute();
2509
- }
2498
+ this.set(itemId, {
2499
+ ...this.get(itemId), ...bounds,
2500
+ width: bounds.width || (isVertical ? 0 : itemSize),
2501
+ height: bounds.height || (isVertical ? itemSize : 0),
2502
+ });
2503
+ if (this._isLazy && (this._isScrollStart)) {
2504
+ this._debouncedIsScrollStartOff.execute();
2510
2505
  }
2511
2506
  }
2512
2507
  }
@@ -2999,7 +2994,7 @@ const easeLinear = (t) => {
2999
2994
  return t + t;
3000
2995
  };
3001
2996
 
3002
- const DEFAULT_ANIMATION_DURATION = 500, ANIMATOR_MIN_TIMESTAMP = 20, MIN_ANIMATED_VALUE = 10;
2997
+ const DEFAULT_ANIMATION_DURATION = 500, ANIMATOR_MIN_TIMESTAMP = 1000 / 30, MIN_ANIMATED_VALUE = 10;
3003
2998
  class Animator {
3004
2999
  _animationId = 0;
3005
3000
  animate(params) {
@@ -3068,7 +3063,7 @@ const calculateDirection = (buffer) => {
3068
3063
  }
3069
3064
  return 1;
3070
3065
  };
3071
- const TOP$1 = 'top', LEFT$1 = 'left', INSTANT$1 = 'instant', AUTO$1 = 'auto', SMOOTH = 'smooth', DURATION = 2000, FRICTION_FORCE = .035, MAX_DURATION = 4000, ANIMATION_DURATION = 50, MASS = .005, MAX_DIST = 12500, MAX_VELOCITY_TIMESTAMP = 100, SPEED_SCALE = 5, OVERSCROLL_START_ITERATION = 2;
3066
+ const TOP$1 = 'top', LEFT$1 = 'left', INSTANT$1 = 'instant', AUTO$1 = 'auto', SMOOTH = 'smooth', DURATION = 2000, FRICTION_FORCE = .035, MAX_DURATION = 4000, ANIMATION_DURATION = 50, MASS = .005, MAX_DIST = 12500, MAX_VELOCITY_TIMESTAMP = 100, SPEED_SCALE = 15, OVERSCROLL_START_ITERATION = 2;
3072
3067
  const SCROLL_EVENT$1 = new Event(SCROLLER_SCROLL), WHEEL_EVENT$1 = new Event(SCROLLER_WHEEL), SCROLLBAR_SCROLL_EVENT$1 = new Event(SCROLLER_SCROLLBAR_SCROLL);
3073
3068
  /**
3074
3069
  * NgScrollView
@@ -3099,6 +3094,9 @@ class NgScrollView {
3099
3094
  }
3100
3095
  _destroyRef = inject(DestroyRef);
3101
3096
  _isMoving = false;
3097
+ get isMoving() {
3098
+ return this._isMoving;
3099
+ }
3102
3100
  _x = 0;
3103
3101
  set x(v) {
3104
3102
  this._x = this._actualX = v;
@@ -3113,7 +3111,7 @@ class NgScrollView {
3113
3111
  set totalSize(v) {
3114
3112
  this._totalSize = v;
3115
3113
  }
3116
- _prevTotalSize = this._totalSize;
3114
+ _startPosition = 0;
3117
3115
  get actualScrollHeight() {
3118
3116
  const { height: viewportHeight } = this.viewportBounds(), totalSize = this._totalSize;
3119
3117
  if (this._inversion) {
@@ -3177,6 +3175,9 @@ class NgScrollView {
3177
3175
  _interactive = true;
3178
3176
  _inversion = inject(SCROLL_VIEW_INVERSION);
3179
3177
  _overscrollIteration = 0;
3178
+ set delta(v) {
3179
+ this._startPosition += v;
3180
+ }
3180
3181
  constructor() {
3181
3182
  this._viewportResizeObserver = new ResizeObserver(this._onResizeViewportHandler);
3182
3183
  this._contentResizeObserver = new ResizeObserver(this._onResizeContentHandler);
@@ -3215,21 +3216,17 @@ class NgScrollView {
3215
3216
  if (target.classList.contains(INTERACTIVE)) {
3216
3217
  return of(undefined);
3217
3218
  }
3218
- this._prevTotalSize = this._totalSize;
3219
3219
  const inversion = this._inversion, isVertical = this.isVertical();
3220
3220
  this._isMoving = true;
3221
3221
  this.grabbing.set(true);
3222
- const startPos = isVertical ? this.y : this.x;
3222
+ this._startPosition = (isVertical ? this.y : this.x);
3223
3223
  let prevClientPosition = 0, startClientPos = isVertical ? e.clientY : e.clientX, offsets = new Array(), velocities = new Array(), startTime = Date.now();
3224
3224
  return fromEvent(window, MOUSE_MOVE, { passive: false }).pipe(takeUntilDestroyed(this._destroyRef), takeUntil$1($mouseDragCancel), tap(e => {
3225
3225
  this.checkOverscroll(e);
3226
3226
  }), switchMap$1(e => {
3227
- startClientPos += (this._totalSize - this._prevTotalSize);
3228
- this._prevTotalSize = this._totalSize;
3229
- const currentPos = (isVertical ? e.clientY : e.clientX), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, delta = (inversion ? -1 : 1) * (startClientPos - currentPos), dp = startPos + delta, position = Math.round(dp < 0 ? 0 : dp > scrollSize ? scrollSize : dp), endTime = Date.now(), timestamp = endTime - startTime, scrollDelta = prevClientPosition === 0 ? 0 : prevClientPosition - currentPos, { v0 } = this.calculateVelocity(offsets, scrollDelta, timestamp);
3230
- this.calculateAcceleration(velocities, v0, timestamp);
3227
+ const { position, currentPos, endTime, scrollDelta } = this.calculatePosition(isVertical, e, inversion, startClientPos, startTime, prevClientPosition, offsets, velocities);
3231
3228
  prevClientPosition = currentPos;
3232
- this.move(isVertical, position, false, true);
3229
+ this.move(isVertical, position, true, true, true);
3233
3230
  startTime = endTime;
3234
3231
  return race([fromEvent(window, MOUSE_UP, { passive: false }), fromEvent(content, MOUSE_UP, { passive: false })]).pipe(takeUntilDestroyed(this._destroyRef), tap(e => {
3235
3232
  this.cancelOverscroll();
@@ -3239,7 +3236,7 @@ class NgScrollView {
3239
3236
  if (this.scrollBehavior() === BEHAVIOR_INSTANT) {
3240
3237
  return;
3241
3238
  }
3242
- this.moveWithAcceleration(isVertical, position, 0, v0, a0);
3239
+ this.moveWithAcceleration(isVertical, position, 0, v0, a0, timestamp);
3243
3240
  }));
3244
3241
  }));
3245
3242
  }));
@@ -3257,21 +3254,17 @@ class NgScrollView {
3257
3254
  if (target.classList.contains(INTERACTIVE)) {
3258
3255
  return of(undefined);
3259
3256
  }
3260
- this._prevTotalSize = this._totalSize;
3261
3257
  const inversion = this._inversion, isVertical = this.isVertical();
3262
3258
  this._isMoving = true;
3263
3259
  this.grabbing.set(true);
3264
- const startPos = isVertical ? this.y : this.x;
3265
- let prevClientPosition = 0, startClientPos = isVertical ? e.touches[e.touches.length - 1].clientY : e.touches[e.touches.length - 1].clientX, offsets = new Array(), velocities = new Array(), startTime = Date.now(), prevTotalSize = this._totalSize;
3260
+ this._startPosition = (isVertical ? this.y : this.x);
3261
+ let prevClientPosition = 0, startClientPos = isVertical ? e.touches[e.touches.length - 1].clientY : e.touches[e.touches.length - 1].clientX, offsets = new Array(), velocities = new Array(), startTime = Date.now();
3266
3262
  return fromEvent(window, TOUCH_MOVE, { passive: false }).pipe(takeUntilDestroyed(this._destroyRef), takeUntil$1($touchCanceler), tap(e => {
3267
3263
  this.checkOverscroll(e);
3268
3264
  }), switchMap$1(e => {
3269
- startClientPos += (this._totalSize - prevTotalSize);
3270
- prevTotalSize = this._totalSize;
3271
- const currentPos = isVertical ? e.touches[e.touches.length - 1].clientY : e.touches[e.touches.length - 1].clientX, scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, delta = (inversion ? -1 : 1) * (startClientPos - currentPos), dp = startPos + delta, position = Math.round(dp < 0 ? 0 : dp > scrollSize ? scrollSize : dp), endTime = Date.now(), timestamp = endTime - startTime, scrollDelta = prevClientPosition === 0 ? 0 : prevClientPosition - currentPos, { v0 } = this.calculateVelocity(offsets, scrollDelta, timestamp);
3272
- this.calculateAcceleration(velocities, v0, timestamp);
3265
+ const { position, currentPos, endTime, scrollDelta } = this.calculatePosition(isVertical, e, inversion, startClientPos, startTime, prevClientPosition, offsets, velocities);
3273
3266
  prevClientPosition = currentPos;
3274
- this.move(isVertical, position, false, true);
3267
+ this.move(isVertical, position, true, true, true);
3275
3268
  startTime = endTime;
3276
3269
  return race([fromEvent(window, TOUCH_END, { passive: false }), fromEvent(content, TOUCH_END, { passive: false })]).pipe(takeUntilDestroyed(this._destroyRef), tap(e => {
3277
3270
  this.cancelOverscroll();
@@ -3281,12 +3274,17 @@ class NgScrollView {
3281
3274
  if (this.scrollBehavior() === BEHAVIOR_INSTANT) {
3282
3275
  return;
3283
3276
  }
3284
- this.moveWithAcceleration(isVertical, position, this._velocity, v0, a0);
3277
+ this.moveWithAcceleration(isVertical, position, this._velocity, v0, a0, timestamp);
3285
3278
  }));
3286
3279
  }));
3287
3280
  }));
3288
3281
  })).subscribe();
3289
3282
  }
3283
+ calculatePosition(isVertical, e, inversion, startClientPos, startTime, prevClientPosition, offsets, velocities) {
3284
+ const currentPos = isVertical ? e.touches?.[e.touches?.length - 1]?.clientY || e.clientY : e.touches?.[e.touches?.length - 1]?.clientX || e.clientX, scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, delta = (inversion ? -1 : 1) * (startClientPos - currentPos), dp = this._startPosition + delta, position = Math.round(dp < 0 ? 0 : dp > scrollSize ? scrollSize : dp), endTime = Date.now(), timestamp = endTime - startTime, scrollDelta = prevClientPosition === 0 ? 0 : prevClientPosition - currentPos, { v0 } = this.calculateVelocity(offsets, scrollDelta, timestamp);
3285
+ this.calculateAcceleration(velocities, v0, timestamp);
3286
+ return { position, currentPos, endTime, scrollDelta };
3287
+ }
3290
3288
  cancelOverscroll() {
3291
3289
  if (!this.overscrollEnabled()) {
3292
3290
  return;
@@ -3355,8 +3353,8 @@ class NgScrollView {
3355
3353
  continue;
3356
3354
  }
3357
3355
  if (v00) {
3358
- const a0 = timestamp < MAX_VELOCITY_TIMESTAMP ? (v00[1] !== 0 ? (lastVSign * Math.abs(Math.abs(v01[0]) - Math.abs(v00[0]))) / Math.abs(v00[1]) : 0) : 0;
3359
- aSum += a0;
3356
+ const a0 = timestamp < MAX_VELOCITY_TIMESTAMP ? (v00[1] !== 0 ? (lastVSign * Math.abs(Math.abs(v01[0]) - Math.abs(v00[0]))) / Math.abs(v00[1]) : 0) : 0.1;
3357
+ aSum = (aSum * MASS) + a0;
3360
3358
  prevV0 = v01;
3361
3359
  }
3362
3360
  prevV0 = v01;
@@ -3370,10 +3368,9 @@ class NgScrollView {
3370
3368
  }
3371
3369
  move(isVertical, position, blending = false, userAction = false, fireUpdate = true) {
3372
3370
  this.scroll({ [isVertical ? TOP$1 : LEFT$1]: position, behavior: INSTANT$1, blending, userAction, fireUpdate });
3373
- this._prevTotalSize = this._totalSize;
3374
3371
  }
3375
- moveWithAcceleration(isVertical, position, v0, v, a0) {
3376
- if (a0 !== 0) {
3372
+ moveWithAcceleration(isVertical, position, v0, v, a0, timestamp) {
3373
+ if (a0 !== 0 && timestamp < MAX_VELOCITY_TIMESTAMP) {
3377
3374
  const dvSign = Math.sign(v), duration = DURATION, maxDuration = MAX_DURATION, maxDistance = dvSign * MAX_DIST, s = (dvSign * Math.abs((a0 * Math.pow(duration, 2)) * .5) / 1000) / MASS, distance = Math.abs(s) < MAX_DIST ? s : maxDistance, positionWithVelocity = position + (this._inversion ? -1 : 1) * distance, vmax = Math.max(Math.abs(v0), Math.abs(v)), ad = Math.abs(vmax !== 0 ? Math.sqrt(vmax) : 0) * 10 / MASS, aDuration = ad < maxDuration ? ad : maxDuration, startPosition = isVertical ? this.y : this.x;
3378
3375
  this.animate(startPosition, Math.round(positionWithVelocity), aDuration, easeOutQuad, true);
3379
3376
  }
@@ -3932,7 +3929,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
3932
3929
  args: ['scrollBar', { read: NgScrollBarComponent }]
3933
3930
  }] } });
3934
3931
 
3935
- const MIN_SCROLL_TO_START_PIXELS = 10, RANGE_DISPLAY_ITEMS_END_OFFSET = 20, MIN_PREPARE_ITERATIONS = 15, EMPTY_SCROLL_STATE_VERSION = '-1', ROLE_LIST = 'list', ROLE_LIST_BOX = 'listbox', ITEM_ID = 'item-id', ITEM_CONTAINER = 'ngvl-item__container', READY_TO_START = 'ready-to-start', WAIT_FOR_PREPARATION = 'wait-for-preparation';
3932
+ const MIN_SCROLL_TO_START_PIXELS = 10, RANGE_DISPLAY_ITEMS_END_OFFSET = 20, MIN_PREPARE_ITERATIONS = 35, PREPARATION_REUPDATE_LENGTH = 15, RESET_CACHE_FRAME_NUMBER = 3, EMPTY_SCROLL_STATE_VERSION = '-1', ROLE_LIST = 'list', ROLE_LIST_BOX = 'listbox', ITEM_ID = 'item-id', ITEM_CONTAINER = 'ngvl-item__container', READY_TO_START = 'ready-to-start', WAIT_FOR_PREPARATION = 'wait-for-preparation';
3936
3933
  const validateScrollIteration = (value) => {
3937
3934
  return Number.isNaN(value) || (value < 0) ? 0 : value > MAX_SCROLL_TO_ITERATIONS ? MAX_SCROLL_TO_ITERATIONS : value;
3938
3935
  }, validateId = (id) => {
@@ -4460,6 +4457,7 @@ class NgVirtualListComponent {
4460
4457
  * to adjust the sizes of the items in the unallocated area.
4461
4458
  */
4462
4459
  itemSize = input(DEFAULT_ITEM_SIZE, { ...this._itemSizeOptions });
4460
+ actualItemSize = signal(this.itemSize());
4463
4461
  _dynamicSizeOptions = {
4464
4462
  transform: (v) => {
4465
4463
  const valid = validateBoolean(v);
@@ -4696,7 +4694,8 @@ class NgVirtualListComponent {
4696
4694
  }
4697
4695
  const scroller = this._scrollerComponent();
4698
4696
  if (!!scroller) {
4699
- scroller.refresh(true, true);
4697
+ const updatebale = this._readyToShow;
4698
+ scroller.refresh(updatebale, updatebale);
4700
4699
  }
4701
4700
  };
4702
4701
  _onListResizeHandler = () => {
@@ -4709,6 +4708,9 @@ class NgVirtualListComponent {
4709
4708
  }
4710
4709
  };
4711
4710
  itemToFocus = (element, position, align = FocusAlignments.CENTER, behavior = BEHAVIOR_AUTO) => {
4711
+ if (!this._readyToShow) {
4712
+ return;
4713
+ }
4712
4714
  const scroller = this._scrollerComponent();
4713
4715
  if (scroller) {
4714
4716
  const { width, height } = this._bounds(), { width: elementWidth, height: elementHeight } = element.getBoundingClientRect(), isVertical = this._isVertical, viewportSize = isVertical ? height : width, elementSize = isVertical ? elementHeight : elementWidth;
@@ -4776,8 +4778,6 @@ class NgVirtualListComponent {
4776
4778
  this._cacheVersion.set(v);
4777
4779
  };
4778
4780
  _cacheVersion = signal(-1);
4779
- _$prepared = new BehaviorSubject$1(false);
4780
- $prepared = this._$prepared.asObservable();
4781
4781
  _$update = new Subject();
4782
4782
  $update = this._$update.asObservable();
4783
4783
  _$isResetedReachStart = new BehaviorSubject$1(true);
@@ -4792,29 +4792,15 @@ class NgVirtualListComponent {
4792
4792
  $fireUpdateNextFrame = this._$fireUpdateNextFrame.asObservable();
4793
4793
  _$snapScrollToEndCanceller = new BehaviorSubject$1(false);
4794
4794
  $snapScrollToEndCanceller = this._$snapScrollToEndCanceller.asObservable();
4795
- _onTrackBoxResetHandler = (v) => {
4796
- if (v && this._scrollerComponent()?.scrollable) {
4797
- this._$isResetedReachStart.next(true);
4798
- const scroller = this._scroller()?.nativeElement;
4799
- if (scroller) {
4800
- const params = {
4801
- [this._isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: 0,
4802
- behavior: BEHAVIOR_INSTANT,
4803
- blending: false,
4804
- fireUpdate: false,
4805
- userAction: false,
4806
- duration: this.animationParams().scrollToItem,
4807
- };
4808
- scroller.scrollTo(params);
4809
- }
4810
- }
4811
- };
4812
- _onPreparedHandler = (v) => {
4813
- this._$prepared.next(v);
4814
- };
4815
4795
  _destroyRef = inject(DestroyRef);
4816
4796
  _updateId;
4817
4797
  _scrollStateUpdateIndex = 0;
4798
+ _readyToShow = false;
4799
+ _isUserScrolling = false;
4800
+ _prevScrollStateVersion = EMPTY_SCROLL_STATE_VERSION;
4801
+ _updateIterations = 0;
4802
+ _$viewInit = new BehaviorSubject$1(false);
4803
+ $viewInit = this._$viewInit.asObservable();
4818
4804
  getScrollStateVersion(totalSize, scrollSize, cacheVersion) {
4819
4805
  if (totalSize < scrollSize) {
4820
4806
  this._scrollStateUpdateIndex = this._scrollStateUpdateIndex === Number.MAX_SAFE_INTEGER ? 0 : this._scrollStateUpdateIndex + 1;
@@ -4826,8 +4812,6 @@ class NgVirtualListComponent {
4826
4812
  NgVirtualListComponent.__nextId = NgVirtualListComponent.__nextId + 1 === Number.MAX_SAFE_INTEGER
4827
4813
  ? 0 : NgVirtualListComponent.__nextId + 1;
4828
4814
  this._id = NgVirtualListComponent.__nextId;
4829
- this._trackBox.addEventListener(TrackBoxEvents.RESET, this._onTrackBoxResetHandler);
4830
- this._trackBox.addEventListener(TrackBoxEvents.PREPARE, this._onPreparedHandler);
4831
4815
  this._service.initialize(this._trackBox);
4832
4816
  this._service.itemToFocus = this.itemToFocus;
4833
4817
  this._trackBox.displayComponents = this._displayComponents;
@@ -4860,34 +4844,36 @@ class NgVirtualListComponent {
4860
4844
  const dist = this.clickDistance();
4861
4845
  this._service.clickDistance = dist;
4862
4846
  });
4863
- let prepared = false, readyToStart = false, isUserScrolling = false;
4864
- let prevScrollStateVersion = EMPTY_SCROLL_STATE_VERSION, updateIterations = 0;
4865
4847
  const $updateComplete = this.$update.pipe(takeUntilDestroyed(), debounceTime(0), switchMap$1((v) => {
4866
- if (((prevScrollStateVersion === EMPTY_SCROLL_STATE_VERSION) || (prevScrollStateVersion !== v)) &&
4867
- (updateIterations < MIN_PREPARE_ITERATIONS)) {
4848
+ if (((this._prevScrollStateVersion === EMPTY_SCROLL_STATE_VERSION) || (this._prevScrollStateVersion !== v)) &&
4849
+ (this._updateIterations < MIN_PREPARE_ITERATIONS)) {
4868
4850
  if (v !== EMPTY_SCROLL_STATE_VERSION) {
4869
- prevScrollStateVersion = v;
4851
+ this._prevScrollStateVersion = v;
4870
4852
  }
4871
4853
  this._trackBox.isScrollEnd = true;
4872
- this.updateToEnd();
4854
+ this._$fireUpdate.next();
4873
4855
  return of(false);
4874
4856
  }
4875
- if (prevScrollStateVersion === v) {
4857
+ if (this._prevScrollStateVersion === v) {
4876
4858
  this._trackBox.isScrollEnd = true;
4877
- if (updateIterations < MIN_PREPARE_ITERATIONS) {
4878
- updateIterations++;
4879
- this.updateToEnd();
4880
- this._$fireUpdateNextFrame.next();
4859
+ if (this._updateIterations === RESET_CACHE_FRAME_NUMBER) {
4860
+ this.refreshActualItemSize(true);
4861
+ }
4862
+ if (this._updateIterations < PREPARATION_REUPDATE_LENGTH) {
4863
+ this._updateIterations++;
4864
+ this._trackBox.isScrollEnd = true;
4865
+ this._$fireUpdate.next();
4881
4866
  return of(false);
4882
4867
  }
4883
4868
  }
4884
- prevScrollStateVersion = v;
4869
+ this._prevScrollStateVersion = v;
4885
4870
  return of(true);
4886
- }), debounceTime(0), filter$1(v => !!v), distinctUntilChanged()), $items = toObservable(this.items).pipe(takeUntilDestroyed(), map(i => !i ? [] : i)), $dynamicSize = toObservable(this.dynamicSize);
4887
- const $snapScrollToBottom = toObservable(this.snapScrollToBottom), $waitForPreparation = toObservable(this.waitForPreparation);
4888
- combineLatest([$dynamicSize, $snapScrollToBottom, $waitForPreparation]).pipe(takeUntilDestroyed(), switchMap$1(([dynamicSize, snapScrollToBottom, waitForPreparation]) => {
4871
+ }), filter$1(v => !!v), distinctUntilChanged()), $items = toObservable(this.items), $dynamicSize = toObservable(this.dynamicSize);
4872
+ const $viewInit = this.$viewInit, $snapScrollToBottom = toObservable(this.snapScrollToBottom), $waitForPreparation = toObservable(this.waitForPreparation);
4873
+ combineLatest([$dynamicSize, $snapScrollToBottom, $waitForPreparation]).pipe(takeUntilDestroyed(this._destroyRef), distinctUntilChanged(), switchMap$1(([dynamicSize, snapScrollToBottom, waitForPreparation]) => {
4889
4874
  if (!dynamicSize || !snapScrollToBottom || !waitForPreparation) {
4890
- prepared = readyToStart = true;
4875
+ this._readyToShow = true;
4876
+ this.refreshActualItemSize(true);
4891
4877
  const scrollerComponent = this._scrollerComponent();
4892
4878
  if (scrollerComponent) {
4893
4879
  scrollerComponent.prepared = true;
@@ -4898,60 +4884,76 @@ class NgVirtualListComponent {
4898
4884
  return of(false);
4899
4885
  }
4900
4886
  if (!!dynamicSize && !!snapScrollToBottom && !!waitForPreparation) {
4901
- return this.$prepared.pipe(takeUntilDestroyed(this._destroyRef), distinctUntilChanged(), switchMap$1(v => {
4887
+ this._$show.next(false);
4888
+ this.cacheClean();
4889
+ this._readyToShow = this._isUserScrolling = false;
4890
+ const scrollerComponent = this._scrollerComponent();
4891
+ if (scrollerComponent) {
4892
+ scrollerComponent.prepared = false;
4893
+ scrollerComponent.stopScrolling();
4894
+ }
4895
+ this.classes.set({ prepared: false, [READY_TO_START]: false, [WAIT_FOR_PREPARATION]: false });
4896
+ return $items.pipe(takeUntilDestroyed(this._destroyRef), debounceTime(0), map(i => (i ?? []).length > 0), distinctUntilChanged(), switchMap$1(v => {
4902
4897
  if (!v) {
4903
- this._$show.next(false);
4904
- readyToStart = isUserScrolling = prepared = false;
4905
4898
  this.cacheClean();
4899
+ this._readyToShow = this._isUserScrolling = false;
4900
+ this.refreshActualItemSize(false);
4901
+ this._trackBox.isScrollEnd = true;
4902
+ this._updateIterations = 0;
4903
+ this._prevScrollStateVersion = EMPTY_SCROLL_STATE_VERSION;
4906
4904
  const scrollerComponent = this._scrollerComponent();
4907
4905
  if (scrollerComponent) {
4908
4906
  scrollerComponent.prepared = false;
4909
4907
  scrollerComponent.stopScrolling();
4910
4908
  }
4911
- this.classes.set({ prepared: v, [READY_TO_START]: false, [WAIT_FOR_PREPARATION]: false });
4912
- this._service.update(true);
4909
+ this.classes.set({ prepared: false, [READY_TO_START]: false, [WAIT_FOR_PREPARATION]: false });
4910
+ this._$show.next(false);
4913
4911
  return of(false);
4914
4912
  }
4915
- return of(true).pipe(takeUntilDestroyed(this._destroyRef), switchMap$1(v => {
4913
+ return of(true).pipe(takeUntilDestroyed(this._destroyRef), switchMap$1(() => {
4916
4914
  const waitForPreparation = this.waitForPreparation();
4917
4915
  if (waitForPreparation) {
4918
- prevScrollStateVersion = EMPTY_SCROLL_STATE_VERSION;
4919
- updateIterations = 0;
4916
+ this.refreshActualItemSize(false);
4920
4917
  return $updateComplete.pipe(takeUntilDestroyed(this._destroyRef), take(1), tap(() => {
4921
- prepared = readyToStart = true;
4918
+ this._readyToShow = true;
4922
4919
  const waitForPreparation = this.waitForPreparation(), scrollerComponent = this._scrollerComponent();
4923
4920
  if (scrollerComponent) {
4924
4921
  scrollerComponent.prepared = true;
4925
4922
  scrollerComponent.stopScrolling();
4926
4923
  }
4927
4924
  this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: waitForPreparation });
4928
- this._service.update(true);
4929
4925
  this._$show.next(true);
4926
+ }), tap(() => {
4927
+ this.refreshActualItemSize(true);
4928
+ this._scrollerComponent()?.refresh(true, true);
4930
4929
  }));
4931
4930
  }
4932
- prepared = readyToStart = true;
4931
+ this._readyToShow = true;
4933
4932
  const scrollerComponent = this._scrollerComponent();
4934
4933
  if (scrollerComponent) {
4935
4934
  scrollerComponent.prepared = true;
4936
4935
  scrollerComponent.stopScrolling();
4937
4936
  }
4938
4937
  this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: waitForPreparation });
4939
- this._service.update(true);
4940
4938
  this._$show.next(true);
4941
4939
  return of(false);
4942
4940
  }));
4943
4941
  }));
4944
4942
  }
4945
- prepared = readyToStart = true;
4946
- const scrollerComponent = this._scrollerComponent();
4947
- if (scrollerComponent) {
4948
- scrollerComponent.prepared = true;
4949
- scrollerComponent.stopScrolling();
4943
+ else {
4944
+ this._readyToShow = true;
4945
+ this.refreshActualItemSize(true);
4946
+ const scrollerComponent = this._scrollerComponent();
4947
+ if (scrollerComponent) {
4948
+ scrollerComponent.prepared = true;
4949
+ scrollerComponent.stopScrolling();
4950
+ }
4951
+ this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: false });
4952
+ this._service.update(true);
4953
+ this._$show.next(true);
4954
+ this._scrollerComponent()?.refresh(true, true);
4955
+ return of(false);
4950
4956
  }
4951
- this.classes.set({ prepared: true, [READY_TO_START]: true, [WAIT_FOR_PREPARATION]: false });
4952
- this._service.update(true);
4953
- this._$show.next(true);
4954
- return of(false);
4955
4957
  })).subscribe();
4956
4958
  this._service.$focusedId.pipe(takeUntilDestroyed(), tap(v => {
4957
4959
  this.focusedElement.set(v ?? undefined);
@@ -4987,7 +4989,7 @@ class NgVirtualListComponent {
4987
4989
  isResetedReachStart = v;
4988
4990
  })).subscribe();
4989
4991
  $isScrollStart.pipe(takeUntilDestroyed(), distinctUntilChanged(), debounceTime(0), tap(v => {
4990
- if (readyToStart && v && !isResetedReachStart && this._scrollerComponent()?.scrollable) {
4992
+ if (this._readyToShow && v && !isResetedReachStart && this._scrollerComponent()?.scrollable) {
4991
4993
  this._trackBox.isScrollStart = true;
4992
4994
  this.onScrollReachStart.emit();
4993
4995
  }
@@ -4995,7 +4997,7 @@ class NgVirtualListComponent {
4995
4997
  })).subscribe();
4996
4998
  $isScrollFinished.pipe(takeUntilDestroyed(), distinctUntilChanged(), debounceTime(0), tap(v => {
4997
4999
  this._trackBox.isScrollEnd = v;
4998
- if (readyToStart && v && this._scrollerComponent()?.scrollable) {
5000
+ if (this._readyToShow && v && this._scrollerComponent()?.scrollable) {
4999
5001
  this.onScrollReachEnd.emit();
5000
5002
  }
5001
5003
  })).subscribe();
@@ -5008,17 +5010,17 @@ class NgVirtualListComponent {
5008
5010
  $trackBy.pipe(takeUntilDestroyed(), tap(v => {
5009
5011
  this._trackBox.trackingPropertyName = v;
5010
5012
  })).subscribe();
5011
- const $bounds = toObservable(this._bounds).pipe(filter$1(b => !!b)), $listBounds = toObservable(this._listBounds).pipe(filter$1(b => !!b)), $scrollSize = toObservable(this._scrollSize), $itemSize = toObservable(this.itemSize).pipe(map(v => v <= 0 ? DEFAULT_ITEM_SIZE : v)), $bufferSize = toObservable(this.bufferSize).pipe(map(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $maxBufferSize = toObservable(this.maxBufferSize).pipe(map(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $itemConfigMap = toObservable(this.itemConfigMap).pipe(map(v => !v ? {} : v)), $snap = toObservable(this.snap), $isLazy = toObservable(this.collectionMode).pipe(map(v => this.getIsLazy(v || DEFAULT_COLLECTION_MODE))), $enabledBufferOptimization = toObservable(this.enabledBufferOptimization), $snappingMethod = toObservable(this.snappingMethod).pipe(map(v => this.getIsSnappingMethodAdvanced(v || DEFAULT_SNAPPING_METHOD))), $methodForSelecting = toObservable(this.methodForSelecting), $selectedIds = toObservable(this.selectedIds), $collapsedIds = toObservable(this.collapsedIds).pipe(map(v => Array.isArray(v) ? v : [])), $collapsedItemIds = toObservable(this._collapsedItemIds).pipe(map(v => Array.isArray(v) ? v : [])), $actualItems = toObservable(this._actualItems), $screenReaderMessage = toObservable(this.screenReaderMessage), $displayItems = this._service.$displayItems, $cacheVersion = toObservable(this._cacheVersion);
5013
+ const $bounds = toObservable(this._bounds).pipe(filter$1(b => !!b)), $listBounds = toObservable(this._listBounds).pipe(filter$1(b => !!b)), $scrollSize = toObservable(this._scrollSize), $itemSize = toObservable(this.actualItemSize).pipe(map(v => v <= 0 ? DEFAULT_ITEM_SIZE : v)), $bufferSize = toObservable(this.bufferSize).pipe(map(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $maxBufferSize = toObservable(this.maxBufferSize).pipe(map(v => v < 0 ? DEFAULT_BUFFER_SIZE : v)), $itemConfigMap = toObservable(this.itemConfigMap).pipe(map(v => !v ? {} : v)), $snap = toObservable(this.snap), $isLazy = toObservable(this.collectionMode).pipe(map(v => this.getIsLazy(v || DEFAULT_COLLECTION_MODE))), $enabledBufferOptimization = toObservable(this.enabledBufferOptimization), $snappingMethod = toObservable(this.snappingMethod).pipe(map(v => this.getIsSnappingMethodAdvanced(v || DEFAULT_SNAPPING_METHOD))), $methodForSelecting = toObservable(this.methodForSelecting), $selectedIds = toObservable(this.selectedIds), $collapsedIds = toObservable(this.collapsedIds).pipe(map(v => Array.isArray(v) ? v : [])), $collapsedItemIds = toObservable(this._collapsedItemIds).pipe(map(v => Array.isArray(v) ? v : [])), $actualItems = toObservable(this._actualItems), $screenReaderMessage = toObservable(this.screenReaderMessage), $displayItems = this._service.$displayItems, $cacheVersion = toObservable(this._cacheVersion);
5012
5014
  combineLatest([$displayItems, $screenReaderMessage, $isVertical, $scrollSize, $bounds]).pipe(takeUntilDestroyed(), distinctUntilChanged(), debounceTime(100), takeUntilDestroyed(), tap(([items, screenReaderMessage, isVertical, scrollSize, bounds]) => {
5013
5015
  this.screenReaderFormattedMessage.set(formatScreenReaderMessage(items, screenReaderMessage, scrollSize, isVertical, bounds));
5014
5016
  })).subscribe();
5015
5017
  $isLazy.pipe(takeUntilDestroyed(), tap(v => {
5016
5018
  this._trackBox.isLazy = v;
5017
5019
  })).subscribe();
5018
- combineLatest([$items, $itemSize]).pipe(takeUntilDestroyed(), map(([items, itemSize]) => ({ items, itemSize })), tap(({ items, itemSize }) => {
5019
- this._trackBox.resetCollection(items, itemSize);
5020
+ $items.pipe(takeUntilDestroyed(), tap(items => {
5021
+ this._trackBox.resetCollection(items, this.actualItemSize());
5020
5022
  })).subscribe();
5021
- combineLatest([$items, $collapsedItemIds, $itemConfigMap, $trackBy]).pipe(takeUntilDestroyed(), tap(([items, collapsedIds, itemConfigMap, trackBy]) => {
5023
+ combineLatest([$items, $collapsedItemIds, $itemConfigMap, $trackBy]).pipe(takeUntilDestroyed(), debounceTime(0), tap(([items, collapsedIds, itemConfigMap, trackBy]) => {
5022
5024
  const hiddenItems = new CMap();
5023
5025
  let isCollapsed = false;
5024
5026
  for (let i = 0, l = items.length; i < l; i++) {
@@ -5082,18 +5084,22 @@ class NgVirtualListComponent {
5082
5084
  })).subscribe();
5083
5085
  const $snapScrollToEndCanceller = this.$snapScrollToEndCanceller;
5084
5086
  $snapScrollToEndCanceller.pipe(takeUntilDestroyed(), filter$1(v => !!v), tap((v) => {
5085
- const scroller = this._scrollerComponent();
5086
- if (scroller) {
5087
- this._trackBox.cancelScrollSnappingToEnd(true);
5087
+ if (this._readyToShow) {
5088
+ const scroller = this._scrollerComponent();
5089
+ if (scroller) {
5090
+ this._trackBox.cancelScrollSnappingToEnd(true);
5091
+ }
5088
5092
  }
5089
5093
  }), tap(() => {
5090
- this._$snapScrollToEndCanceller.next(false);
5094
+ if (this._readyToShow) {
5095
+ this._$snapScrollToEndCanceller.next(false);
5096
+ }
5091
5097
  })).subscribe();
5092
- const update = (params) => {
5098
+ const update = (params, emitable = true) => {
5093
5099
  const { snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion, } = params;
5094
5100
  const scroller = this._scrollerComponent();
5095
5101
  if (scroller) {
5096
- let actualScrollSize = !prepared && snapScrollToBottom ? (isVertical ? scroller.scrollHeight ?? 0 : scroller.scrollWidth ?? 0) :
5102
+ let actualScrollSize = !this._readyToShow && snapScrollToBottom ? (isVertical ? scroller.scrollHeight ?? 0 : scroller.scrollWidth ?? 0) :
5097
5103
  (isVertical ? scroller.scrollTop ?? 0 : scroller.scrollLeft ?? 0), totalSize = 0, displayItems;
5098
5104
  const { width, height, x, y } = bounds, viewportSize = (isVertical ? height : width);
5099
5105
  let scrollLength = Math.round(this._totalSize()) ?? 0, actualScrollLength = Math.round(scrollLength === 0 ? 0 : scrollLength > viewportSize ? scrollLength - viewportSize : scrollLength), roundedMaxPosition = Math.round(actualScrollLength), scrollPosition = Math.round(actualScrollSize);
@@ -5101,7 +5107,7 @@ class NgVirtualListComponent {
5101
5107
  bounds: { width, height, x, y }, dynamicSize, isVertical, itemSize,
5102
5108
  bufferSize, maxBufferSize, scrollSize: actualScrollSize, snap, enabledBufferOptimization,
5103
5109
  };
5104
- if (snapScrollToBottom && !prepared) {
5110
+ if (snapScrollToBottom && !this._readyToShow) {
5105
5111
  const { displayItems: calculatedDisplayItems, totalSize: calculatedTotalSize1 } = this._trackBox.updateCollection(items, itemConfigMap, { ...opts, scrollSize: actualScrollSize });
5106
5112
  displayItems = calculatedDisplayItems;
5107
5113
  totalSize = calculatedTotalSize1;
@@ -5121,8 +5127,8 @@ class NgVirtualListComponent {
5121
5127
  this.resetBoundsSize(isVertical, totalSize);
5122
5128
  this.createDisplayComponentsIfNeed(displayItems);
5123
5129
  this.tracking();
5124
- if (prepared && readyToStart && actualScrollLength > 0) {
5125
- const isScrollStart = isUserScrolling && scrollPosition < MIN_SCROLL_TO_START_PIXELS;
5130
+ if (emitable && this._readyToShow && actualScrollLength > 0) {
5131
+ const isScrollStart = this._isUserScrolling && scrollPosition < MIN_SCROLL_TO_START_PIXELS;
5126
5132
  this._isScrollStart.set(isScrollStart);
5127
5133
  if (isScrollStart) {
5128
5134
  this._isScrollFinished.set(false);
@@ -5131,12 +5137,13 @@ class NgVirtualListComponent {
5131
5137
  this._isScrollFinished.set(scrollPosition >= roundedMaxPosition);
5132
5138
  }
5133
5139
  }
5134
- actualScrollSize = !prepared && snapScrollToBottom ? (isVertical ? scroller.scrollHeight ?? 0 : scroller.scrollWidth ?? 0) :
5140
+ actualScrollSize = !this._readyToShow && snapScrollToBottom ? (isVertical ? scroller.scrollHeight ?? 0 : scroller.scrollWidth ?? 0) :
5135
5141
  (isVertical ? scroller.scrollTop ?? 0 : scroller.scrollLeft ?? 0);
5136
5142
  const delta = this._trackBox.delta, roundedActualScrollSize = Math.round(actualScrollSize), scrollPositionAfterUpdate = actualScrollSize + delta, roundedScrollPositionAfterUpdate = Math.round(scrollPositionAfterUpdate), roundedMaxPositionAfterUpdate = Math.round(totalSize - viewportSize);
5137
5143
  if (this._isSnappingMethodAdvanced) {
5138
5144
  this.updateRegularRenderer();
5139
5145
  }
5146
+ scroller.delta = delta;
5140
5147
  this._trackBox.clearDelta();
5141
5148
  if ((snapScrollToBottom && this._trackBox.isSnappedToEnd) ||
5142
5149
  (snapScrollToBottom && actualScrollSize > 0 &&
@@ -5147,17 +5154,19 @@ class NgVirtualListComponent {
5147
5154
  this._isScrollFinished.set(true);
5148
5155
  }
5149
5156
  this._trackBox.isScrollEnd = true;
5150
- if (prepared && readyToStart) {
5157
+ if (emitable && this._readyToShow) {
5151
5158
  this.emitScrollEvent(true, false);
5152
5159
  }
5153
- if (roundedMaxPositionAfterUpdate > 0) {
5160
+ if (!this._readyToShow || roundedMaxPositionAfterUpdate > 0) {
5154
5161
  const params = {
5155
5162
  [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: roundedMaxPositionAfterUpdate,
5156
5163
  fireUpdate: false, behavior: BEHAVIOR_INSTANT,
5157
5164
  blending: false, duration: this.animationParams().scrollToItem,
5158
5165
  };
5159
5166
  scroller?.scrollTo?.(params);
5160
- this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
5167
+ if (emitable && !this._readyToShow) {
5168
+ this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
5169
+ }
5161
5170
  return;
5162
5171
  }
5163
5172
  }
@@ -5169,43 +5178,51 @@ class NgVirtualListComponent {
5169
5178
  }
5170
5179
  if (this._scrollSize() !== scrollPositionAfterUpdate) {
5171
5180
  const params = {
5172
- [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate, blending: prepared && readyToStart,
5181
+ [isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollPositionAfterUpdate, blending: true,
5173
5182
  fireUpdate: false, behavior: BEHAVIOR_INSTANT, duration: this.animationParams().scrollToItem,
5174
5183
  };
5175
5184
  scroller.scrollTo(params);
5176
- this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
5185
+ if (emitable && !this._readyToShow) {
5186
+ this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
5187
+ }
5177
5188
  return;
5178
5189
  }
5179
5190
  }
5180
- if (!prepared && !readyToStart) {
5191
+ if (emitable && !this._readyToShow) {
5181
5192
  this._$update.next(this.getScrollStateVersion(totalSize, this._isVertical ? scroller.scrollTop : scroller.scrollLeft, cacheVersion));
5182
5193
  }
5183
5194
  }
5184
5195
  };
5185
- combineLatest([$snapScrollToBottom, $bounds, $listBounds, $scrollEndOffset, $actualItems, $itemConfigMap, $scrollSize, $itemSize,
5186
- $bufferSize, $maxBufferSize, $snap, $isVertical, $dynamicSize, $enabledBufferOptimization, $cacheVersion, this.$fireUpdate,
5187
- ]).pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(([snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,]) => {
5188
- update({
5189
- snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize,
5190
- bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,
5191
- });
5196
+ $viewInit.pipe(takeUntilDestroyed(), filter$1(v => !!v), switchMap$1(() => {
5197
+ return combineLatest([$snapScrollToBottom, $bounds, $listBounds, $scrollEndOffset, $actualItems, $itemConfigMap, $scrollSize, $itemSize,
5198
+ $bufferSize, $maxBufferSize, $snap, $isVertical, $dynamicSize, $enabledBufferOptimization, $cacheVersion, this.$fireUpdate,
5199
+ ]).pipe(takeUntilDestroyed(this._destroyRef), distinctUntilChanged(), tap(([snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize, bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,]) => {
5200
+ update({
5201
+ snapScrollToBottom, bounds, listBounds, scrollEndOffset, items, itemConfigMap, scrollSize, itemSize,
5202
+ bufferSize, maxBufferSize, snap, isVertical, dynamicSize, enabledBufferOptimization, cacheVersion,
5203
+ });
5204
+ }));
5192
5205
  })).subscribe();
5193
- combineLatest([$items, $dynamicSize]).pipe(takeUntilDestroyed(), filter$1(([, dynamic]) => !dynamic), delay(0), takeUntilDestroyed(), tap(() => {
5206
+ combineLatest([$items, $dynamicSize]).pipe(takeUntilDestroyed(), debounceTime(0), filter$1(([, dynamic]) => !dynamic), delay(0), takeUntilDestroyed(), tap(() => {
5194
5207
  this._scrollerComponent()?.refresh(true);
5195
5208
  })).subscribe();
5196
5209
  const $scroller = toObservable(this._scroller).pipe(takeUntilDestroyed(), filter$1(v => !!v), map(v => v.nativeElement), take(1)), $scrollerScroll = toObservable(this._scrollerComponent).pipe(takeUntilDestroyed(), filter$1(v => !!v), take(1), switchMap$1(scroller => scroller.$scroll)), $scrollerScrollEnd = toObservable(this._scrollerComponent).pipe(takeUntilDestroyed(), filter$1(v => !!v), take(1), switchMap$1(scroller => scroller.$scrollEnd)), $list = toObservable(this._list).pipe(takeUntilDestroyed(), filter$1(v => !!v), map(v => v.nativeElement), take(1));
5197
5210
  $scroller.pipe(takeUntilDestroyed(), distinctUntilChanged(), switchMap$1(scroller => {
5198
5211
  return fromEvent(scroller, SCROLLER_WHEEL, { passive: true }).pipe(takeUntilDestroyed(this._destroyRef), filter$1(() => {
5199
- return !!this._trackBox.isSnappedToEnd;
5212
+ return !!this._trackBox.isSnappedToEnd && this._readyToShow;
5200
5213
  }), tap(() => {
5201
- this._$snapScrollToEndCanceller.next(true);
5214
+ if (this._readyToShow) {
5215
+ this._$snapScrollToEndCanceller.next(true);
5216
+ }
5202
5217
  }));
5203
5218
  })).subscribe();
5204
5219
  $scroller.pipe(takeUntilDestroyed(), distinctUntilChanged(), switchMap$1(scroller => {
5205
5220
  return fromEvent(scroller, SCROLLER_SCROLLBAR_SCROLL, { passive: true }).pipe(takeUntilDestroyed(this._destroyRef), filter$1(() => {
5206
5221
  return !!this._trackBox.isSnappedToEnd;
5207
5222
  }), tap(() => {
5208
- this._$snapScrollToEndCanceller.next(true);
5223
+ if (this._readyToShow) {
5224
+ this._$snapScrollToEndCanceller.next(true);
5225
+ }
5209
5226
  }));
5210
5227
  })).subscribe();
5211
5228
  const $docPointerUp = fromEvent(document, MOUSE_UP, { passive: true }).pipe(take(1)), $docPointerLeave = fromEvent(document, MOUSE_LEAVE, { passive: true }).pipe(take(1)), $docPointerOut = fromEvent(document, MOUSE_OUT, { passive: true }).pipe(take(1)), $pointerMoveTakeUntil = race([$docPointerUp, $docPointerLeave, $docPointerOut]).pipe(takeUntilDestroyed(), take(1));
@@ -5222,14 +5239,16 @@ class NgVirtualListComponent {
5222
5239
  }
5223
5240
  return 0;
5224
5241
  }), tap(() => {
5225
- this._$snapScrollToEndCanceller.next(true);
5242
+ if (this._readyToShow) {
5243
+ this._$snapScrollToEndCanceller.next(true);
5244
+ }
5226
5245
  }));
5227
5246
  })).subscribe();
5228
5247
  const $docTouchUp = fromEvent(document, TOUCH_END, { passive: true }).pipe(take(1)), $docTouchLeave = fromEvent(document, TOUCH_LEAVE, { passive: true }).pipe(take(1)), $docTouchOut = fromEvent(document, TOUCH_OUT, { passive: true }).pipe(take(1)), $touchMoveTakeUntil = race([$docTouchUp, $docTouchLeave, $docTouchOut]).pipe(takeUntilDestroyed(), take(1));
5229
5248
  $scroller.pipe(takeUntilDestroyed(), distinctUntilChanged(), switchMap$1(scroller => {
5230
5249
  return fromEvent(scroller, TOUCH_START, { passive: true }).pipe(takeUntilDestroyed(this._destroyRef), switchMap$1(e => {
5231
5250
  return $scrollerScroll.pipe(takeUntilDestroyed(this._destroyRef), takeUntil$1($touchMoveTakeUntil), filter$1(() => {
5232
- return !!this._trackBox.isSnappedToEnd;
5251
+ return !!this._trackBox.isSnappedToEnd && this._readyToShow;
5233
5252
  }));
5234
5253
  }), map(e => {
5235
5254
  const scroller = this._scrollerComponent();
@@ -5239,18 +5258,22 @@ class NgVirtualListComponent {
5239
5258
  }
5240
5259
  return 0;
5241
5260
  }), tap(() => {
5242
- this._$snapScrollToEndCanceller.next(true);
5261
+ if (this._readyToShow) {
5262
+ this._$snapScrollToEndCanceller.next(true);
5263
+ }
5243
5264
  }));
5244
5265
  })).subscribe();
5245
5266
  $scroller.pipe(takeUntilDestroyed(), distinctUntilChanged(), switchMap$1(scroller => {
5246
5267
  return $scrollerScroll.pipe(takeUntilDestroyed(this._destroyRef));
5247
5268
  }), tap(userAction => {
5248
- isUserScrolling = userAction;
5269
+ this._isUserScrolling = userAction;
5249
5270
  const scrollerEl = this._scroller()?.nativeElement, scrollerComponent = this._scrollerComponent();
5250
5271
  if (scrollerEl && scrollerComponent) {
5251
- const event = this.emitScrollEvent(false);
5272
+ const event = this.emitScrollEvent(false, this._readyToShow);
5252
5273
  if (userAction) {
5253
- this._$snapScrollToEndCanceller.next(true);
5274
+ if (this._readyToShow) {
5275
+ this._$snapScrollToEndCanceller.next(true);
5276
+ }
5254
5277
  if (!this.dynamicSize()) {
5255
5278
  this._$fireUpdate.next(event);
5256
5279
  }
@@ -5260,12 +5283,14 @@ class NgVirtualListComponent {
5260
5283
  $scroller.pipe(takeUntilDestroyed(), distinctUntilChanged(), switchMap$1(scroller => {
5261
5284
  return $scrollerScrollEnd.pipe(takeUntilDestroyed(this._destroyRef));
5262
5285
  }), tap(userAction => {
5263
- isUserScrolling = userAction;
5286
+ this._isUserScrolling = userAction;
5264
5287
  const scrollerEl = this._scroller()?.nativeElement, scrollerComponent = this._scrollerComponent();
5265
5288
  if (scrollerEl && scrollerComponent) {
5266
- const event = this.emitScrollEvent(true);
5289
+ const event = this.emitScrollEvent(true, this._readyToShow);
5267
5290
  if (userAction) {
5268
- this._$snapScrollToEndCanceller.next(true);
5291
+ if (this._readyToShow) {
5292
+ this._$snapScrollToEndCanceller.next(true);
5293
+ }
5269
5294
  if (!this.dynamicSize()) {
5270
5295
  this._$fireUpdate.next(event);
5271
5296
  }
@@ -5278,9 +5303,11 @@ class NgVirtualListComponent {
5278
5303
  const scroller = this._scrollerComponent();
5279
5304
  if (scroller) {
5280
5305
  const isVertical = this._isVertical, bounds = this._bounds(), listBounds = this._listBounds(), scrollSize = (isVertical ? scroller.scrollTop : scroller.scrollLeft), scrollLength = isVertical ? (listBounds?.height ?? 0) - (bounds?.height ?? 0) : (listBounds?.width ?? 0) - (bounds?.width ?? 0), actualScrollSize = scrollSize;
5281
- if (this._trackBox.isSnappedToEnd) {
5282
- if (scrollSize < scrollLength) {
5283
- this._trackBox.cancelScrollSnappingToEnd();
5306
+ if (this._readyToShow) {
5307
+ if (this._trackBox.isSnappedToEnd) {
5308
+ if (scrollSize < scrollLength) {
5309
+ this._trackBox.cancelScrollSnappingToEnd();
5310
+ }
5284
5311
  }
5285
5312
  }
5286
5313
  this._scrollSize.set(actualScrollSize);
@@ -5304,16 +5331,16 @@ class NgVirtualListComponent {
5304
5331
  })).subscribe();
5305
5332
  const $scrollTo = this.$scrollTo;
5306
5333
  combineLatest([$scroller, $trackBy, $scrollTo]).pipe(takeUntilDestroyed(), filter$1(([scroller]) => scroller !== undefined), map(([scroller, trackBy, event]) => ({ scroller: scroller, trackBy, event })), switchMap$1(({ scroller, trackBy, event }) => {
5307
- if (!prepared || !readyToStart) {
5334
+ if (!this._readyToShow) {
5308
5335
  return of([false]);
5309
5336
  }
5310
5337
  const scrollerComponent = this._scrollerComponent(), { id, iteration = 0, blending = false, isLastIteration = false, scrollCalled = false, cb, } = event;
5311
5338
  if (scrollerComponent) {
5312
5339
  const items = this._actualItems();
5313
5340
  if (items && items.length) {
5314
- const dynamicSize = this.dynamicSize(), itemSize = this.itemSize();
5341
+ const dynamicSize = this.dynamicSize(), itemSize = this.actualItemSize();
5315
5342
  if (dynamicSize) {
5316
- const { width, height, x, y } = this._bounds() || { x: 0, y: 0, width: DEFAULT_LIST_SIZE, height: DEFAULT_LIST_SIZE }, itemConfigMap = this.itemConfigMap(), items = this._actualItems(), isVertical = this._isVertical, currentScollSize = (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft), delta = this._trackBox.delta, opts = {
5343
+ const { width, height, x, y } = this._bounds() || { x: 0, y: 0, width: DEFAULT_LIST_SIZE, height: DEFAULT_LIST_SIZE }, itemConfigMap = this.itemConfigMap(), items = this._actualItems(), isVertical = this._isVertical, currentScrollSize = (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft), delta = this._trackBox.delta, opts = {
5317
5344
  bounds: { width, height, x, y }, collection: items, dynamicSize, isVertical: this._isVertical, itemSize,
5318
5345
  bufferSize: this.bufferSize(), maxBufferSize: this.maxBufferSize(),
5319
5346
  scrollSize: (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft) + delta,
@@ -5341,9 +5368,10 @@ class NgVirtualListComponent {
5341
5368
  return of([true, { id, blending, scroller: scrollerComponent, scrollCalled, cb }]);
5342
5369
  }
5343
5370
  this._$snapScrollToEndCanceller.next(true);
5344
- const notChanged = actualScrollSize === currentScollSize;
5345
- scrollerComponent?.scrollTo?.(params);
5346
- if ((!notChanged && iteration < MAX_SCROLL_TO_ITERATIONS) || iteration < MAX_SCROLL_TO_ITERATIONS) {
5371
+ const notChanged = actualScrollSize === currentScrollSize;
5372
+ if ((!notChanged && iteration < MAX_SCROLL_TO_ITERATIONS) ||
5373
+ (!this.snapScrollToBottom() && iteration < MAX_SCROLL_TO_ITERATIONS)) {
5374
+ scrollerComponent?.scrollTo?.(params);
5347
5375
  this._$scrollTo.next(params);
5348
5376
  return of([false, {
5349
5377
  id, scroller: scrollerComponent, iteration: iteration + 1, blending,
@@ -5358,8 +5386,8 @@ class NgVirtualListComponent {
5358
5386
  else {
5359
5387
  const index = items.findIndex(item => item[trackBy] === id);
5360
5388
  if (index > -1) {
5361
- const isVertical = this._isVertical, currentScollSize = (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft), scrollSize = index * this.itemSize();
5362
- if (currentScollSize !== scrollSize) {
5389
+ const isVertical = this._isVertical, currentScrollSize = (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft), scrollSize = index * this.actualItemSize();
5390
+ if (currentScrollSize !== scrollSize) {
5363
5391
  this._$snapScrollToEndCanceller.next(true);
5364
5392
  const params = {
5365
5393
  [this._isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: scrollSize,
@@ -5377,10 +5405,12 @@ class NgVirtualListComponent {
5377
5405
  if (!finished) {
5378
5406
  if (!!params) {
5379
5407
  this._$scrollTo.next(params);
5408
+ return;
5380
5409
  }
5381
- return;
5382
5410
  }
5383
- this._trackBox.cancelScrollSnappingToEnd(true);
5411
+ if (this._readyToShow) {
5412
+ this._trackBox.cancelScrollSnappingToEnd(true);
5413
+ }
5384
5414
  const p = params;
5385
5415
  if (p.scrollCalled && p.scroller) {
5386
5416
  this._scrollerComponent()?.refresh();
@@ -5440,6 +5470,9 @@ class NgVirtualListComponent {
5440
5470
  $collapsedIds.pipe(takeUntilDestroyed(), distinctUntilChanged(), tap(v => {
5441
5471
  this._service.setCollapsedIds(v);
5442
5472
  })).subscribe();
5473
+ }
5474
+ ngAfterViewInit() {
5475
+ this._$viewInit.next(true);
5443
5476
  this._$fireUpdate.next({
5444
5477
  scrollSize: 0,
5445
5478
  scrollWeight: 0,
@@ -5457,8 +5490,8 @@ class NgVirtualListComponent {
5457
5490
  emitScrollEvent(isScrollEnd = false, update = true) {
5458
5491
  const scrollerEl = this._scroller()?.nativeElement, scrollerComponent = this._scrollerComponent();
5459
5492
  if (scrollerEl && scrollerComponent) {
5460
- const isVertical = this._isVertical, scrollSize = (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft), bounds = this._bounds() || { x: 0, y: 0, width: DEFAULT_LIST_SIZE, height: DEFAULT_LIST_SIZE }, currentScollSize = this._scrollSize();
5461
- this._trackBox.deltaDirection = currentScollSize > scrollSize ? -1 : currentScollSize < scrollSize ? 1 : 0;
5493
+ const isVertical = this._isVertical, scrollSize = (isVertical ? scrollerComponent.scrollTop : scrollerComponent.scrollLeft), bounds = this._bounds() || { x: 0, y: 0, width: DEFAULT_LIST_SIZE, height: DEFAULT_LIST_SIZE }, currentScrollSize = this._scrollSize();
5494
+ this._trackBox.deltaDirection = currentScrollSize > scrollSize ? -1 : currentScrollSize < scrollSize ? 1 : 0;
5462
5495
  const itemsRange = formatActualDisplayItems(this._service.displayItems, this.scrollStartOffset(), this.scrollEndOffset(), scrollSize, isVertical, bounds), event = new ScrollEvent({
5463
5496
  direction: this._trackBox.scrollDirection, container: scrollerEl,
5464
5497
  list: this._list().nativeElement, delta: this._trackBox.delta,
@@ -5490,6 +5523,24 @@ class NgVirtualListComponent {
5490
5523
  }
5491
5524
  }
5492
5525
  }
5526
+ refreshActualItemSize(value) {
5527
+ if (!this.waitForPreparation()) {
5528
+ return;
5529
+ }
5530
+ let size;
5531
+ const bounds = this._bounds();
5532
+ if (value === false) {
5533
+ size = (this._isVertical ?
5534
+ bounds?.height || DEFAULT_LIST_SIZE :
5535
+ bounds?.width || DEFAULT_LIST_SIZE);
5536
+ this.actualItemSize.set(size);
5537
+ }
5538
+ else {
5539
+ size = this.itemSize();
5540
+ this.actualItemSize.set(size);
5541
+ }
5542
+ this._trackBox.resetCache(this._actualItems(), this.trackBy(), this._isVertical, size, bounds);
5543
+ }
5493
5544
  getIsSnappingMethodAdvanced(m) {
5494
5545
  const method = m || this.snappingMethod();
5495
5546
  return isSnappingMethodAdvenced(method);
@@ -5572,17 +5623,6 @@ class NgVirtualListComponent {
5572
5623
  l.nativeElement.style[prop] = `${size}${PX$2}`;
5573
5624
  }
5574
5625
  }
5575
- updateToEnd() {
5576
- const scroller = this._scrollerComponent();
5577
- if (!!scroller) {
5578
- const isVerrtical = this._isVertical, actualScrollSize = isVerrtical ? (scroller?.scrollHeight ?? 0) : (scroller?.scrollWidth ?? 0), params = {
5579
- [isVerrtical ? TOP_PROP_NAME : LEFT_PROP_NAME]: actualScrollSize,
5580
- blending: false, fireUpdate: true, userAction: false, behavior: BEHAVIOR_INSTANT,
5581
- };
5582
- scroller.scrollTo(params);
5583
- scroller.refresh();
5584
- }
5585
- }
5586
5626
  /**
5587
5627
  * Returns the bounds of an element with a given id
5588
5628
  */
@@ -5678,7 +5718,9 @@ class NgVirtualListComponent {
5678
5718
  if (scrollerComponent) {
5679
5719
  scrollerComponent.reset();
5680
5720
  }
5681
- this._$prepared.next(false);
5721
+ if (this._scrollerComponent()?.scrollable) {
5722
+ this._$isResetedReachStart.next(true);
5723
+ }
5682
5724
  }
5683
5725
  /**
5684
5726
  * Stops the list from snapping to the bottom edge.
@@ -5726,13 +5768,13 @@ class NgVirtualListComponent {
5726
5768
  }
5727
5769
  }
5728
5770
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: NgVirtualListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
5729
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", type: NgVirtualListComponent, isStandalone: false, selector: "ng-virtual-list", inputs: { scrollbarTheme: { classPropertyName: "scrollbarTheme", publicName: "scrollbarTheme", isSignal: true, isRequired: false, transformFunction: null }, scrollbarMinSize: { classPropertyName: "scrollbarMinSize", publicName: "scrollbarMinSize", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, waitForPreparation: { classPropertyName: "waitForPreparation", publicName: "waitForPreparation", isSignal: true, isRequired: false, transformFunction: null }, clickDistance: { classPropertyName: "clickDistance", publicName: "clickDistance", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, defaultItemValue: { classPropertyName: "defaultItemValue", publicName: "defaultItemValue", isSignal: true, isRequired: false, transformFunction: null }, selectedIds: { classPropertyName: "selectedIds", publicName: "selectedIds", isSignal: true, isRequired: false, transformFunction: null }, collapsedIds: { classPropertyName: "collapsedIds", publicName: "collapsedIds", isSignal: true, isRequired: false, transformFunction: null }, selectByClick: { classPropertyName: "selectByClick", publicName: "selectByClick", isSignal: true, isRequired: false, transformFunction: null }, collapseByClick: { classPropertyName: "collapseByClick", publicName: "collapseByClick", isSignal: true, isRequired: false, transformFunction: null }, snap: { classPropertyName: "snap", publicName: "snap", isSignal: true, isRequired: false, transformFunction: null }, snapToEndTransitionInstantOffset: { classPropertyName: "snapToEndTransitionInstantOffset", publicName: "snapToEndTransitionInstantOffset", isSignal: true, isRequired: false, transformFunction: null }, scrollStartOffset: { classPropertyName: "scrollStartOffset", publicName: "scrollStartOffset", isSignal: true, isRequired: false, transformFunction: null }, scrollEndOffset: { classPropertyName: "scrollEndOffset", publicName: "scrollEndOffset", isSignal: true, isRequired: false, transformFunction: null }, snapScrollToBottom: { classPropertyName: "snapScrollToBottom", publicName: "snapScrollToBottom", isSignal: true, isRequired: false, transformFunction: null }, scrollbarEnabled: { classPropertyName: "scrollbarEnabled", publicName: "scrollbarEnabled", isSignal: true, isRequired: false, transformFunction: null }, scrollbarInteractive: { classPropertyName: "scrollbarInteractive", publicName: "scrollbarInteractive", isSignal: true, isRequired: false, transformFunction: null }, scrollBehavior: { classPropertyName: "scrollBehavior", publicName: "scrollBehavior", isSignal: true, isRequired: false, transformFunction: null }, animationParams: { classPropertyName: "animationParams", publicName: "animationParams", isSignal: true, isRequired: false, transformFunction: null }, overscrollEnabled: { classPropertyName: "overscrollEnabled", publicName: "overscrollEnabled", isSignal: true, isRequired: false, transformFunction: null }, enabledBufferOptimization: { classPropertyName: "enabledBufferOptimization", publicName: "enabledBufferOptimization", isSignal: true, isRequired: false, transformFunction: null }, itemRenderer: { classPropertyName: "itemRenderer", publicName: "itemRenderer", isSignal: true, isRequired: true, transformFunction: null }, itemConfigMap: { classPropertyName: "itemConfigMap", publicName: "itemConfigMap", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, dynamicSize: { classPropertyName: "dynamicSize", publicName: "dynamicSize", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, collectionMode: { classPropertyName: "collectionMode", publicName: "collectionMode", isSignal: true, isRequired: false, transformFunction: null }, bufferSize: { classPropertyName: "bufferSize", publicName: "bufferSize", isSignal: true, isRequired: false, transformFunction: null }, maxBufferSize: { classPropertyName: "maxBufferSize", publicName: "maxBufferSize", isSignal: true, isRequired: false, transformFunction: null }, snappingMethod: { classPropertyName: "snappingMethod", publicName: "snappingMethod", isSignal: true, isRequired: false, transformFunction: null }, methodForSelecting: { classPropertyName: "methodForSelecting", publicName: "methodForSelecting", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, screenReaderMessage: { classPropertyName: "screenReaderMessage", publicName: "screenReaderMessage", isSignal: true, isRequired: false, transformFunction: null }, langTextDir: { classPropertyName: "langTextDir", publicName: "langTextDir", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd", onViewportChange: "onViewportChange", onItemClick: "onItemClick", onSelect: "onSelect", onCollapse: "onCollapse", onScrollReachStart: "onScrollReachStart", onScrollReachEnd: "onScrollReachEnd" }, host: { styleAttribute: "position: relative;" }, providers: [NgVirtualListService], viewQueries: [{ propertyName: "_scrollerComponent", first: true, predicate: ["scroller"], descendants: true, isSignal: true }, { propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_snapContainerRef", first: true, predicate: ["snapRendererContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div aria-live=\"polite\" aria-atomic=\"true\" class=\"ngvl__screen-reader\">\r\n {{ screenReaderFormattedMessage() }}\r\n</div>\r\n\r\n@if (snap()) {\r\n <div #snappedContainer class=\"ngvl__snapped-container\">\r\n <div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n </div>\r\n </div>\r\n}\r\n<ng-scroller #scroller class=\"ngvl__list-scroller\" [classes]=\"classes()\" [startOffset]=\"scrollStartOffset()\"\r\n [direction]=\"direction()\" [endOffset]=\"scrollEndOffset()\" [scrollbarTheme]=\"scrollbarTheme()\"\r\n [focusedElement]=\"focusedElement()\" [loading]=\"loading()\" [overscrollEnabled]=\"overscrollEnabled()\"\r\n [scrollbarEnabled]=\"scrollbarEnabled()\" [scrollbarInteractive]=\"scrollbarInteractive()\"\r\n [scrollbarMinSize]=\"scrollbarMinSize()\" [scrollBehavior]=\"scrollBehavior()\">\r\n <ng-container #renderersContainer></ng-container>\r\n</ng-scroller>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.vertical){height:320px}.ngvl__snapped-container{position:relative;width:100%}.ngvl__list-snapper{-webkit-tap-highlight-color:transparent;pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list-scroller{-webkit-tap-highlight-color:transparent;position:absolute;left:0;top:0;width:100%;height:100%;z-index:0}.ngvl__screen-reader{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "component", type: NgScrollerComponent, selector: "ng-scroller", inputs: ["scrollbarEnabled", "scrollbarInteractive", "focusedElement", "content", "loading", "classes", "startOffset", "endOffset", "scrollbarTheme", "scrollbarMinSize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
5771
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", type: NgVirtualListComponent, isStandalone: false, selector: "ng-virtual-list", inputs: { scrollbarTheme: { classPropertyName: "scrollbarTheme", publicName: "scrollbarTheme", isSignal: true, isRequired: false, transformFunction: null }, scrollbarMinSize: { classPropertyName: "scrollbarMinSize", publicName: "scrollbarMinSize", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, waitForPreparation: { classPropertyName: "waitForPreparation", publicName: "waitForPreparation", isSignal: true, isRequired: false, transformFunction: null }, clickDistance: { classPropertyName: "clickDistance", publicName: "clickDistance", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, defaultItemValue: { classPropertyName: "defaultItemValue", publicName: "defaultItemValue", isSignal: true, isRequired: false, transformFunction: null }, selectedIds: { classPropertyName: "selectedIds", publicName: "selectedIds", isSignal: true, isRequired: false, transformFunction: null }, collapsedIds: { classPropertyName: "collapsedIds", publicName: "collapsedIds", isSignal: true, isRequired: false, transformFunction: null }, selectByClick: { classPropertyName: "selectByClick", publicName: "selectByClick", isSignal: true, isRequired: false, transformFunction: null }, collapseByClick: { classPropertyName: "collapseByClick", publicName: "collapseByClick", isSignal: true, isRequired: false, transformFunction: null }, snap: { classPropertyName: "snap", publicName: "snap", isSignal: true, isRequired: false, transformFunction: null }, snapToEndTransitionInstantOffset: { classPropertyName: "snapToEndTransitionInstantOffset", publicName: "snapToEndTransitionInstantOffset", isSignal: true, isRequired: false, transformFunction: null }, scrollStartOffset: { classPropertyName: "scrollStartOffset", publicName: "scrollStartOffset", isSignal: true, isRequired: false, transformFunction: null }, scrollEndOffset: { classPropertyName: "scrollEndOffset", publicName: "scrollEndOffset", isSignal: true, isRequired: false, transformFunction: null }, snapScrollToBottom: { classPropertyName: "snapScrollToBottom", publicName: "snapScrollToBottom", isSignal: true, isRequired: false, transformFunction: null }, scrollbarEnabled: { classPropertyName: "scrollbarEnabled", publicName: "scrollbarEnabled", isSignal: true, isRequired: false, transformFunction: null }, scrollbarInteractive: { classPropertyName: "scrollbarInteractive", publicName: "scrollbarInteractive", isSignal: true, isRequired: false, transformFunction: null }, scrollBehavior: { classPropertyName: "scrollBehavior", publicName: "scrollBehavior", isSignal: true, isRequired: false, transformFunction: null }, animationParams: { classPropertyName: "animationParams", publicName: "animationParams", isSignal: true, isRequired: false, transformFunction: null }, overscrollEnabled: { classPropertyName: "overscrollEnabled", publicName: "overscrollEnabled", isSignal: true, isRequired: false, transformFunction: null }, enabledBufferOptimization: { classPropertyName: "enabledBufferOptimization", publicName: "enabledBufferOptimization", isSignal: true, isRequired: false, transformFunction: null }, itemRenderer: { classPropertyName: "itemRenderer", publicName: "itemRenderer", isSignal: true, isRequired: true, transformFunction: null }, itemConfigMap: { classPropertyName: "itemConfigMap", publicName: "itemConfigMap", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, dynamicSize: { classPropertyName: "dynamicSize", publicName: "dynamicSize", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, collectionMode: { classPropertyName: "collectionMode", publicName: "collectionMode", isSignal: true, isRequired: false, transformFunction: null }, bufferSize: { classPropertyName: "bufferSize", publicName: "bufferSize", isSignal: true, isRequired: false, transformFunction: null }, maxBufferSize: { classPropertyName: "maxBufferSize", publicName: "maxBufferSize", isSignal: true, isRequired: false, transformFunction: null }, snappingMethod: { classPropertyName: "snappingMethod", publicName: "snappingMethod", isSignal: true, isRequired: false, transformFunction: null }, methodForSelecting: { classPropertyName: "methodForSelecting", publicName: "methodForSelecting", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, screenReaderMessage: { classPropertyName: "screenReaderMessage", publicName: "screenReaderMessage", isSignal: true, isRequired: false, transformFunction: null }, langTextDir: { classPropertyName: "langTextDir", publicName: "langTextDir", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onScroll: "onScroll", onScrollEnd: "onScrollEnd", onViewportChange: "onViewportChange", onItemClick: "onItemClick", onSelect: "onSelect", onCollapse: "onCollapse", onScrollReachStart: "onScrollReachStart", onScrollReachEnd: "onScrollReachEnd" }, host: { styleAttribute: "position: relative;" }, providers: [NgVirtualListService], viewQueries: [{ propertyName: "_scrollerComponent", first: true, predicate: ["scroller"], descendants: true, isSignal: true }, { propertyName: "_listContainerRef", first: true, predicate: ["renderersContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "_snapContainerRef", first: true, predicate: ["snapRendererContainer"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div aria-live=\"polite\" aria-atomic=\"true\" class=\"ngvl__screen-reader\">\r\n {{ screenReaderFormattedMessage() }}\r\n</div>\r\n\r\n@if (snap()) {\r\n <div #snappedContainer class=\"ngvl__snapped-container\" [ngClass]=\"classes()\">\r\n <div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n </div>\r\n </div>\r\n}\r\n<ng-scroller #scroller class=\"ngvl__list-scroller\" [classes]=\"classes()\" [startOffset]=\"scrollStartOffset()\"\r\n [direction]=\"direction()\" [endOffset]=\"scrollEndOffset()\" [scrollbarTheme]=\"scrollbarTheme()\"\r\n [focusedElement]=\"focusedElement()\" [loading]=\"loading()\" [overscrollEnabled]=\"overscrollEnabled()\"\r\n [scrollbarEnabled]=\"scrollbarEnabled()\" [scrollbarInteractive]=\"scrollbarInteractive()\"\r\n [scrollbarMinSize]=\"scrollbarMinSize()\" [scrollBehavior]=\"scrollBehavior()\">\r\n <ng-container #renderersContainer></ng-container>\r\n</ng-scroller>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.vertical){height:320px}.ngvl__snapped-container{position:relative;width:100%;opacity:0}.ngvl__snapped-container.prepared{opacity:1}.ngvl__list-snapper{-webkit-tap-highlight-color:transparent;pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list-scroller{-webkit-tap-highlight-color:transparent;position:absolute;left:0;top:0;width:100%;height:100%;z-index:0}.ngvl__screen-reader{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: NgScrollerComponent, selector: "ng-scroller", inputs: ["scrollbarEnabled", "scrollbarInteractive", "focusedElement", "content", "loading", "classes", "startOffset", "endOffset", "scrollbarTheme", "scrollbarMinSize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
5730
5772
  }
5731
5773
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: NgVirtualListComponent, decorators: [{
5732
5774
  type: Component,
5733
5775
  args: [{ selector: 'ng-virtual-list', host: {
5734
5776
  'style': 'position: relative;'
5735
- }, standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.ShadowDom, providers: [NgVirtualListService], template: "<div aria-live=\"polite\" aria-atomic=\"true\" class=\"ngvl__screen-reader\">\r\n {{ screenReaderFormattedMessage() }}\r\n</div>\r\n\r\n@if (snap()) {\r\n <div #snappedContainer class=\"ngvl__snapped-container\">\r\n <div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n </div>\r\n </div>\r\n}\r\n<ng-scroller #scroller class=\"ngvl__list-scroller\" [classes]=\"classes()\" [startOffset]=\"scrollStartOffset()\"\r\n [direction]=\"direction()\" [endOffset]=\"scrollEndOffset()\" [scrollbarTheme]=\"scrollbarTheme()\"\r\n [focusedElement]=\"focusedElement()\" [loading]=\"loading()\" [overscrollEnabled]=\"overscrollEnabled()\"\r\n [scrollbarEnabled]=\"scrollbarEnabled()\" [scrollbarInteractive]=\"scrollbarInteractive()\"\r\n [scrollbarMinSize]=\"scrollbarMinSize()\" [scrollBehavior]=\"scrollBehavior()\">\r\n <ng-container #renderersContainer></ng-container>\r\n</ng-scroller>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.vertical){height:320px}.ngvl__snapped-container{position:relative;width:100%}.ngvl__list-snapper{-webkit-tap-highlight-color:transparent;pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list-scroller{-webkit-tap-highlight-color:transparent;position:absolute;left:0;top:0;width:100%;height:100%;z-index:0}.ngvl__screen-reader{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"] }]
5777
+ }, standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.ShadowDom, providers: [NgVirtualListService], template: "<div aria-live=\"polite\" aria-atomic=\"true\" class=\"ngvl__screen-reader\">\r\n {{ screenReaderFormattedMessage() }}\r\n</div>\r\n\r\n@if (snap()) {\r\n <div #snappedContainer class=\"ngvl__snapped-container\" [ngClass]=\"classes()\">\r\n <div #snapped part=\"snapped-item\" class=\"ngvl__list-snapper\">\r\n <ng-container #snapRendererContainer></ng-container>\r\n </div>\r\n </div>\r\n}\r\n<ng-scroller #scroller class=\"ngvl__list-scroller\" [classes]=\"classes()\" [startOffset]=\"scrollStartOffset()\"\r\n [direction]=\"direction()\" [endOffset]=\"scrollEndOffset()\" [scrollbarTheme]=\"scrollbarTheme()\"\r\n [focusedElement]=\"focusedElement()\" [loading]=\"loading()\" [overscrollEnabled]=\"overscrollEnabled()\"\r\n [scrollbarEnabled]=\"scrollbarEnabled()\" [scrollbarInteractive]=\"scrollbarInteractive()\"\r\n [scrollbarMinSize]=\"scrollbarMinSize()\" [scrollBehavior]=\"scrollBehavior()\">\r\n <ng-container #renderersContainer></ng-container>\r\n</ng-scroller>", styles: [":host{position:relative;display:block;width:400px;overflow:hidden}:host(.horizontal){height:48px}:host(.vertical){height:320px}.ngvl__snapped-container{position:relative;width:100%;opacity:0}.ngvl__snapped-container.prepared{opacity:1}.ngvl__list-snapper{-webkit-tap-highlight-color:transparent;pointer-events:none;position:absolute;list-style:none;left:0;top:0;z-index:1}.ngvl__list-scroller{-webkit-tap-highlight-color:transparent;position:absolute;left:0;top:0;width:100%;height:100%;z-index:0}.ngvl__screen-reader{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"] }]
5736
5778
  }], ctorParameters: () => [], propDecorators: { _listContainerRef: [{
5737
5779
  type: ViewChild,
5738
5780
  args: ['renderersContainer', { read: ViewContainerRef }]