@pepperi-addons/ngx-lib 0.5.0-ng16.3 → 0.5.0-ng16.4
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/esm2022/chips/chips.component.mjs +3 -3
- package/esm2022/list/list.component.mjs +6 -7
- package/esm2022/smart-filters/multi-select-filter/multi-select-filter.component.mjs +11 -9
- package/fesm2022/pepperi-addons-ngx-lib-chips.mjs +2 -2
- package/fesm2022/pepperi-addons-ngx-lib-chips.mjs.map +1 -1
- package/fesm2022/pepperi-addons-ngx-lib-list.mjs +6 -1125
- package/fesm2022/pepperi-addons-ngx-lib-list.mjs.map +1 -1
- package/fesm2022/pepperi-addons-ngx-lib-smart-filters.mjs +10 -8
- package/fesm2022/pepperi-addons-ngx-lib-smart-filters.mjs.map +1 -1
- package/package.json +13 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter,
|
|
2
|
+
import { EventEmitter, Component, Injectable, Input, Output, ElementRef, ViewChild, Pipe, NgModule } from '@angular/core';
|
|
3
3
|
import * as i2 from '@angular/common';
|
|
4
|
-
import {
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
5
|
import { MatCommonModule } from '@angular/material/core';
|
|
6
6
|
import * as i3 from '@angular/material/button';
|
|
7
7
|
import { MatButtonModule } from '@angular/material/button';
|
|
@@ -32,1124 +32,6 @@ import * as tween from '@tweenjs/tween.js';
|
|
|
32
32
|
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
33
33
|
import * as i2$1 from '@ngx-translate/core';
|
|
34
34
|
|
|
35
|
-
function VIRTUAL_SCROLLER_DEFAULT_OPTIONS_FACTORY() {
|
|
36
|
-
return {
|
|
37
|
-
checkResizeInterval: 1000,
|
|
38
|
-
modifyOverflowStyleOfParentScroll: true,
|
|
39
|
-
resizeBypassRefreshThreshold: 5,
|
|
40
|
-
scrollAnimationTime: 750,
|
|
41
|
-
scrollDebounceTime: 0,
|
|
42
|
-
scrollThrottlingTime: 0,
|
|
43
|
-
stripedTable: false
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
class VirtualScrollerComponent {
|
|
47
|
-
element;
|
|
48
|
-
renderer;
|
|
49
|
-
zone;
|
|
50
|
-
changeDetectorRef;
|
|
51
|
-
viewPortItems;
|
|
52
|
-
window = window;
|
|
53
|
-
get viewPortInfo() {
|
|
54
|
-
const pageInfo = this.previousViewPort || {};
|
|
55
|
-
return {
|
|
56
|
-
startIndex: pageInfo.startIndex || 0,
|
|
57
|
-
endIndex: pageInfo.endIndex || 0,
|
|
58
|
-
scrollStartPosition: pageInfo.scrollStartPosition || 0,
|
|
59
|
-
scrollEndPosition: pageInfo.scrollEndPosition || 0,
|
|
60
|
-
scrollDirection: pageInfo.scrollDirection || 'forward',
|
|
61
|
-
maxScrollPosition: pageInfo.maxScrollPosition || 0,
|
|
62
|
-
startIndexWithBuffer: pageInfo.startIndexWithBuffer || 0,
|
|
63
|
-
endIndexWithBuffer: pageInfo.endIndexWithBuffer || 0,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
_disable = false;
|
|
67
|
-
get disable() {
|
|
68
|
-
return this._disable;
|
|
69
|
-
}
|
|
70
|
-
set disable(value) {
|
|
71
|
-
if (this._disable === value) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
this._disable = value;
|
|
75
|
-
if (this._disable) {
|
|
76
|
-
this.removeScrollEventHandlers();
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
this.addScrollEventHandlers();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
executeRefreshOutsideAngularZone = false;
|
|
83
|
-
_enableUnequalChildrenSizes = false;
|
|
84
|
-
get enableUnequalChildrenSizes() {
|
|
85
|
-
return this._enableUnequalChildrenSizes;
|
|
86
|
-
}
|
|
87
|
-
set enableUnequalChildrenSizes(value) {
|
|
88
|
-
if (this._enableUnequalChildrenSizes === value) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
this._enableUnequalChildrenSizes = value;
|
|
92
|
-
this.minMeasuredChildWidth = undefined;
|
|
93
|
-
this.minMeasuredChildHeight = undefined;
|
|
94
|
-
}
|
|
95
|
-
RTL = false;
|
|
96
|
-
useMarginInsteadOfTranslate = false;
|
|
97
|
-
modifyOverflowStyleOfParentScroll;
|
|
98
|
-
stripedTable;
|
|
99
|
-
scrollbarWidth;
|
|
100
|
-
scrollbarHeight;
|
|
101
|
-
childWidth;
|
|
102
|
-
childHeight;
|
|
103
|
-
ssrChildWidth;
|
|
104
|
-
ssrChildHeight;
|
|
105
|
-
ssrViewportWidth = 1920;
|
|
106
|
-
ssrViewportHeight = 1080;
|
|
107
|
-
_bufferAmount;
|
|
108
|
-
get bufferAmount() {
|
|
109
|
-
if (typeof (this._bufferAmount) === 'number' && this._bufferAmount > 0) {
|
|
110
|
-
return this._bufferAmount;
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
return this.enableUnequalChildrenSizes ? 5 : 0;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
set bufferAmount(value) {
|
|
117
|
-
this._bufferAmount = value;
|
|
118
|
-
}
|
|
119
|
-
scrollAnimationTime;
|
|
120
|
-
resizeBypassRefreshThreshold;
|
|
121
|
-
_scrollThrottlingTime;
|
|
122
|
-
get scrollThrottlingTime() {
|
|
123
|
-
return this._scrollThrottlingTime;
|
|
124
|
-
}
|
|
125
|
-
set scrollThrottlingTime(value) {
|
|
126
|
-
this._scrollThrottlingTime = value;
|
|
127
|
-
this.updateOnScrollFunction();
|
|
128
|
-
}
|
|
129
|
-
_scrollDebounceTime;
|
|
130
|
-
get scrollDebounceTime() {
|
|
131
|
-
return this._scrollDebounceTime;
|
|
132
|
-
}
|
|
133
|
-
set scrollDebounceTime(value) {
|
|
134
|
-
this._scrollDebounceTime = value;
|
|
135
|
-
this.updateOnScrollFunction();
|
|
136
|
-
}
|
|
137
|
-
onScroll;
|
|
138
|
-
updateOnScrollFunction() {
|
|
139
|
-
if (this.scrollDebounceTime) {
|
|
140
|
-
this.onScroll = this.debounce(() => {
|
|
141
|
-
this.refresh_internal(false);
|
|
142
|
-
}, this.scrollDebounceTime);
|
|
143
|
-
}
|
|
144
|
-
else if (this.scrollThrottlingTime) {
|
|
145
|
-
this.onScroll = this.throttleTrailing(() => {
|
|
146
|
-
this.refresh_internal(false);
|
|
147
|
-
}, this.scrollThrottlingTime);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
this.onScroll = () => {
|
|
151
|
-
this.refresh_internal(false);
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
checkScrollElementResizedTimer;
|
|
156
|
-
_checkResizeInterval;
|
|
157
|
-
get checkResizeInterval() {
|
|
158
|
-
return this._checkResizeInterval;
|
|
159
|
-
}
|
|
160
|
-
set checkResizeInterval(value) {
|
|
161
|
-
if (this._checkResizeInterval === value) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
this._checkResizeInterval = value;
|
|
165
|
-
this.addScrollEventHandlers();
|
|
166
|
-
}
|
|
167
|
-
_items = [];
|
|
168
|
-
get items() {
|
|
169
|
-
return this._items;
|
|
170
|
-
}
|
|
171
|
-
set items(value) {
|
|
172
|
-
if (value === this._items) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
this._items = value || [];
|
|
176
|
-
this.refresh_internal(true);
|
|
177
|
-
}
|
|
178
|
-
compareItems = (item1, item2) => item1 === item2;
|
|
179
|
-
_horizontal;
|
|
180
|
-
get horizontal() {
|
|
181
|
-
return this._horizontal;
|
|
182
|
-
}
|
|
183
|
-
set horizontal(value) {
|
|
184
|
-
this._horizontal = value;
|
|
185
|
-
this.updateDirection();
|
|
186
|
-
}
|
|
187
|
-
revertParentOverscroll() {
|
|
188
|
-
const scrollElement = this.getScrollElement();
|
|
189
|
-
if (scrollElement && this.oldParentScrollOverflow) {
|
|
190
|
-
scrollElement.style['overflow-y'] = this.oldParentScrollOverflow.y;
|
|
191
|
-
scrollElement.style['overflow-x'] = this.oldParentScrollOverflow.x;
|
|
192
|
-
}
|
|
193
|
-
this.oldParentScrollOverflow = undefined;
|
|
194
|
-
}
|
|
195
|
-
oldParentScrollOverflow;
|
|
196
|
-
_parentScroll;
|
|
197
|
-
get parentScroll() {
|
|
198
|
-
return this._parentScroll;
|
|
199
|
-
}
|
|
200
|
-
set parentScroll(value) {
|
|
201
|
-
if (this._parentScroll === value) {
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
this.revertParentOverscroll();
|
|
205
|
-
this._parentScroll = value;
|
|
206
|
-
this.addScrollEventHandlers();
|
|
207
|
-
const scrollElement = this.getScrollElement();
|
|
208
|
-
if (this.modifyOverflowStyleOfParentScroll && scrollElement !== this.element.nativeElement) {
|
|
209
|
-
this.oldParentScrollOverflow = { x: scrollElement.style['overflow-x'], y: scrollElement.style['overflow-y'] };
|
|
210
|
-
scrollElement.style['overflow-y'] = this.horizontal ? 'visible' : 'auto';
|
|
211
|
-
scrollElement.style['overflow-x'] = this.horizontal ? 'auto' : 'visible';
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
// private _lastChildRect: DOMRect = null;
|
|
215
|
-
vsChildRectChange = new EventEmitter();
|
|
216
|
-
vsUpdate = new EventEmitter();
|
|
217
|
-
vsChange = new EventEmitter();
|
|
218
|
-
vsStart = new EventEmitter();
|
|
219
|
-
vsEnd = new EventEmitter();
|
|
220
|
-
contentElementRef;
|
|
221
|
-
invisiblePaddingElementRef;
|
|
222
|
-
headerElementRef;
|
|
223
|
-
containerElementRef;
|
|
224
|
-
ngOnInit() {
|
|
225
|
-
this.addScrollEventHandlers();
|
|
226
|
-
}
|
|
227
|
-
ngOnDestroy() {
|
|
228
|
-
this.removeScrollEventHandlers();
|
|
229
|
-
this.revertParentOverscroll();
|
|
230
|
-
}
|
|
231
|
-
ngOnChanges(changes) {
|
|
232
|
-
const indexLengthChanged = this.cachedItemsLength !== this.items.length;
|
|
233
|
-
this.cachedItemsLength = this.items.length;
|
|
234
|
-
const firstRun = !changes.items || !changes.items.previousValue || changes.items.previousValue.length === 0;
|
|
235
|
-
this.refresh_internal(indexLengthChanged || firstRun);
|
|
236
|
-
}
|
|
237
|
-
ngDoCheck() {
|
|
238
|
-
if (this.cachedItemsLength !== this.items.length) {
|
|
239
|
-
this.cachedItemsLength = this.items.length;
|
|
240
|
-
this.refresh_internal(true);
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
if (this.previousViewPort && this.viewPortItems && this.viewPortItems.length > 0) {
|
|
244
|
-
let itemsArrayChanged = false;
|
|
245
|
-
for (let i = 0; i < this.viewPortItems.length; ++i) {
|
|
246
|
-
if (!this.compareItems(this.items[this.previousViewPort.startIndexWithBuffer + i], this.viewPortItems[i])) {
|
|
247
|
-
itemsArrayChanged = true;
|
|
248
|
-
break;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
if (itemsArrayChanged) {
|
|
252
|
-
this.refresh_internal(true);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
refresh(refreshCompletedCallback = undefined) {
|
|
257
|
-
this.refresh_internal(true, refreshCompletedCallback);
|
|
258
|
-
}
|
|
259
|
-
invalidateAllCachedMeasurements() {
|
|
260
|
-
this.wrapGroupDimensions = {
|
|
261
|
-
maxChildSizePerWrapGroup: [],
|
|
262
|
-
numberOfKnownWrapGroupChildSizes: 0,
|
|
263
|
-
sumOfKnownWrapGroupChildWidths: 0,
|
|
264
|
-
sumOfKnownWrapGroupChildHeights: 0
|
|
265
|
-
};
|
|
266
|
-
this.minMeasuredChildWidth = undefined;
|
|
267
|
-
this.minMeasuredChildHeight = undefined;
|
|
268
|
-
this.refresh_internal(false);
|
|
269
|
-
}
|
|
270
|
-
invalidateCachedMeasurementForItem(item) {
|
|
271
|
-
if (this.enableUnequalChildrenSizes) {
|
|
272
|
-
const index = this.items && this.items.indexOf(item);
|
|
273
|
-
if (index >= 0) {
|
|
274
|
-
this.invalidateCachedMeasurementAtIndex(index);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
this.minMeasuredChildWidth = undefined;
|
|
279
|
-
this.minMeasuredChildHeight = undefined;
|
|
280
|
-
}
|
|
281
|
-
this.refresh_internal(false);
|
|
282
|
-
}
|
|
283
|
-
invalidateCachedMeasurementAtIndex(index) {
|
|
284
|
-
if (this.enableUnequalChildrenSizes) {
|
|
285
|
-
const cachedMeasurement = this.wrapGroupDimensions.maxChildSizePerWrapGroup[index];
|
|
286
|
-
if (cachedMeasurement) {
|
|
287
|
-
this.wrapGroupDimensions.maxChildSizePerWrapGroup[index] = undefined;
|
|
288
|
-
--this.wrapGroupDimensions.numberOfKnownWrapGroupChildSizes;
|
|
289
|
-
this.wrapGroupDimensions.sumOfKnownWrapGroupChildWidths -= cachedMeasurement.childWidth || 0;
|
|
290
|
-
this.wrapGroupDimensions.sumOfKnownWrapGroupChildHeights -= cachedMeasurement.childHeight || 0;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
294
|
-
this.minMeasuredChildWidth = undefined;
|
|
295
|
-
this.minMeasuredChildHeight = undefined;
|
|
296
|
-
}
|
|
297
|
-
this.refresh_internal(false);
|
|
298
|
-
}
|
|
299
|
-
scrollInto(item, alignToBeginning = true, additionalOffset = 0, animationMilliseconds = undefined, animationCompletedCallback = undefined) {
|
|
300
|
-
const index = this.items.indexOf(item);
|
|
301
|
-
if (index === -1) {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
this.scrollToIndex(index, alignToBeginning, additionalOffset, animationMilliseconds, animationCompletedCallback);
|
|
305
|
-
}
|
|
306
|
-
scrollToIndex(index, alignToBeginning = true, additionalOffset = 0, animationMilliseconds = undefined, animationCompletedCallback = undefined) {
|
|
307
|
-
let maxRetries = 5;
|
|
308
|
-
const retryIfNeeded = () => {
|
|
309
|
-
--maxRetries;
|
|
310
|
-
if (maxRetries <= 0) {
|
|
311
|
-
if (animationCompletedCallback) {
|
|
312
|
-
animationCompletedCallback();
|
|
313
|
-
}
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
const dimensions = this.calculateDimensions();
|
|
317
|
-
const desiredStartIndex = Math.min(Math.max(index, 0), dimensions.itemCount - 1);
|
|
318
|
-
if (this.previousViewPort.startIndex === desiredStartIndex) {
|
|
319
|
-
if (animationCompletedCallback) {
|
|
320
|
-
animationCompletedCallback();
|
|
321
|
-
}
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
this.scrollToIndex_internal(index, alignToBeginning, additionalOffset, 0, retryIfNeeded);
|
|
325
|
-
};
|
|
326
|
-
this.scrollToIndex_internal(index, alignToBeginning, additionalOffset, animationMilliseconds, retryIfNeeded);
|
|
327
|
-
}
|
|
328
|
-
scrollToIndex_internal(index, alignToBeginning = true, additionalOffset = 0, animationMilliseconds = undefined, animationCompletedCallback = undefined) {
|
|
329
|
-
animationMilliseconds = animationMilliseconds === undefined ? this.scrollAnimationTime : animationMilliseconds;
|
|
330
|
-
const dimensions = this.calculateDimensions();
|
|
331
|
-
let scroll = this.calculatePadding(index, dimensions) + additionalOffset;
|
|
332
|
-
if (!alignToBeginning) {
|
|
333
|
-
scroll -= dimensions.wrapGroupsPerPage * dimensions[this._childScrollDim];
|
|
334
|
-
}
|
|
335
|
-
this.scrollToPosition(scroll, animationMilliseconds, animationCompletedCallback);
|
|
336
|
-
}
|
|
337
|
-
scrollToPosition(scrollPosition, animationMilliseconds = undefined, animationCompletedCallback = undefined) {
|
|
338
|
-
scrollPosition += this.getElementsOffset();
|
|
339
|
-
animationMilliseconds = animationMilliseconds === undefined ? this.scrollAnimationTime : animationMilliseconds;
|
|
340
|
-
const scrollElement = this.getScrollElement();
|
|
341
|
-
let animationRequest;
|
|
342
|
-
if (this.currentTween) {
|
|
343
|
-
this.currentTween.stop();
|
|
344
|
-
this.currentTween = undefined;
|
|
345
|
-
}
|
|
346
|
-
if (!animationMilliseconds) {
|
|
347
|
-
this.renderer.setProperty(scrollElement, this._scrollType, scrollPosition);
|
|
348
|
-
this.refresh_internal(false, animationCompletedCallback);
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
const tweenConfigObj = { scrollPosition: scrollElement[this._scrollType] };
|
|
352
|
-
const newTween = new tween.Tween(tweenConfigObj)
|
|
353
|
-
.to({ scrollPosition }, animationMilliseconds)
|
|
354
|
-
.easing(tween.Easing.Quadratic.Out)
|
|
355
|
-
.onUpdate((data) => {
|
|
356
|
-
if (isNaN(data.scrollPosition)) {
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
this.renderer.setProperty(scrollElement, this._scrollType, data.scrollPosition);
|
|
360
|
-
this.refresh_internal(false);
|
|
361
|
-
})
|
|
362
|
-
.onStop(() => {
|
|
363
|
-
cancelAnimationFrame(animationRequest);
|
|
364
|
-
})
|
|
365
|
-
.start();
|
|
366
|
-
const animate = (time) => {
|
|
367
|
-
if (!newTween["isPlaying"]()) {
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
newTween.update(time);
|
|
371
|
-
if (tweenConfigObj.scrollPosition === scrollPosition) {
|
|
372
|
-
this.refresh_internal(false, animationCompletedCallback);
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
this.zone.runOutsideAngular(() => {
|
|
376
|
-
animationRequest = requestAnimationFrame(animate);
|
|
377
|
-
});
|
|
378
|
-
};
|
|
379
|
-
animate();
|
|
380
|
-
this.currentTween = newTween;
|
|
381
|
-
}
|
|
382
|
-
isAngularUniversalSSR;
|
|
383
|
-
constructor(element, renderer, zone, changeDetectorRef, platformId, options) {
|
|
384
|
-
this.element = element;
|
|
385
|
-
this.renderer = renderer;
|
|
386
|
-
this.zone = zone;
|
|
387
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
388
|
-
this.isAngularUniversalSSR = isPlatformServer(platformId);
|
|
389
|
-
const defaultOptions = VIRTUAL_SCROLLER_DEFAULT_OPTIONS_FACTORY();
|
|
390
|
-
this.checkResizeInterval = options?.checkResizeInterval || defaultOptions.checkResizeInterval;
|
|
391
|
-
this.modifyOverflowStyleOfParentScroll = options?.modifyOverflowStyleOfParentScroll || defaultOptions.modifyOverflowStyleOfParentScroll;
|
|
392
|
-
this.resizeBypassRefreshThreshold = options?.resizeBypassRefreshThreshold || defaultOptions.resizeBypassRefreshThreshold;
|
|
393
|
-
this.scrollAnimationTime = options?.scrollAnimationTime || defaultOptions.scrollAnimationTime;
|
|
394
|
-
this.scrollDebounceTime = options?.scrollDebounceTime || defaultOptions.scrollDebounceTime;
|
|
395
|
-
this.scrollThrottlingTime = options?.scrollThrottlingTime || defaultOptions.scrollThrottlingTime;
|
|
396
|
-
this.scrollbarHeight = options?.scrollbarHeight || defaultOptions.scrollbarHeight;
|
|
397
|
-
this.scrollbarWidth = options?.scrollbarWidth || defaultOptions.scrollbarWidth;
|
|
398
|
-
this.stripedTable = options?.stripedTable || defaultOptions.stripedTable;
|
|
399
|
-
this.horizontal = false;
|
|
400
|
-
this.resetWrapGroupDimensions();
|
|
401
|
-
}
|
|
402
|
-
getElementSize(element) {
|
|
403
|
-
const result = element.getBoundingClientRect();
|
|
404
|
-
const styles = getComputedStyle(element);
|
|
405
|
-
const marginTop = parseInt(styles['margin-top'], 10) || 0;
|
|
406
|
-
const marginBottom = parseInt(styles['margin-bottom'], 10) || 0;
|
|
407
|
-
const marginLeft = parseInt(styles['margin-left'], 10) || 0;
|
|
408
|
-
const marginRight = parseInt(styles['margin-right'], 10) || 0;
|
|
409
|
-
return {
|
|
410
|
-
top: result.top + marginTop,
|
|
411
|
-
bottom: result.bottom + marginBottom,
|
|
412
|
-
left: result.left + marginLeft,
|
|
413
|
-
right: result.right + marginRight,
|
|
414
|
-
width: parseFloat((result.width + marginLeft + marginRight).toFixed(3)),
|
|
415
|
-
height: parseFloat((result.height + marginTop + marginBottom).toFixed(3))
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
getContent() {
|
|
419
|
-
const content = (this.containerElementRef && this.containerElementRef.nativeElement) || this.contentElementRef.nativeElement;
|
|
420
|
-
return content;
|
|
421
|
-
}
|
|
422
|
-
previousScrollBoundingRect;
|
|
423
|
-
checkScrollElementResized() {
|
|
424
|
-
const boundingRect = this.getElementSize(this.getScrollElement());
|
|
425
|
-
let sizeChanged;
|
|
426
|
-
if (!this.previousScrollBoundingRect) {
|
|
427
|
-
sizeChanged = true;
|
|
428
|
-
}
|
|
429
|
-
else {
|
|
430
|
-
const widthChange = Math.abs(boundingRect.width - this.previousScrollBoundingRect.width);
|
|
431
|
-
const heightChange = Math.abs(boundingRect.height - this.previousScrollBoundingRect.height);
|
|
432
|
-
sizeChanged = widthChange > this.resizeBypassRefreshThreshold || heightChange > this.resizeBypassRefreshThreshold;
|
|
433
|
-
}
|
|
434
|
-
if (sizeChanged) {
|
|
435
|
-
this.previousScrollBoundingRect = boundingRect;
|
|
436
|
-
if (boundingRect.width > 0 && boundingRect.height > 0) {
|
|
437
|
-
this.refresh_internal(false);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
_invisiblePaddingProperty;
|
|
442
|
-
_offsetType;
|
|
443
|
-
_scrollType;
|
|
444
|
-
_pageOffsetType;
|
|
445
|
-
_childScrollDim;
|
|
446
|
-
_translateDir;
|
|
447
|
-
_marginDir;
|
|
448
|
-
updateDirection() {
|
|
449
|
-
if (this.horizontal) {
|
|
450
|
-
this._childScrollDim = 'childWidth';
|
|
451
|
-
this._invisiblePaddingProperty = 'scaleX';
|
|
452
|
-
this._marginDir = 'margin-left';
|
|
453
|
-
this._offsetType = 'offsetLeft';
|
|
454
|
-
this._pageOffsetType = 'pageXOffset';
|
|
455
|
-
this._scrollType = 'scrollLeft';
|
|
456
|
-
this._translateDir = 'translateX';
|
|
457
|
-
}
|
|
458
|
-
else {
|
|
459
|
-
this._childScrollDim = 'childHeight';
|
|
460
|
-
this._invisiblePaddingProperty = 'scaleY';
|
|
461
|
-
this._marginDir = 'margin-top';
|
|
462
|
-
this._offsetType = 'offsetTop';
|
|
463
|
-
this._pageOffsetType = 'pageYOffset';
|
|
464
|
-
this._scrollType = 'scrollTop';
|
|
465
|
-
this._translateDir = 'translateY';
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
debounce(func, wait, ...args) {
|
|
469
|
-
const throttled = this.throttleTrailing(func, wait);
|
|
470
|
-
const result = function () {
|
|
471
|
-
throttled['cancel']();
|
|
472
|
-
throttled.apply(this, args);
|
|
473
|
-
};
|
|
474
|
-
result['cancel'] = function () {
|
|
475
|
-
throttled['cancel']();
|
|
476
|
-
};
|
|
477
|
-
return result;
|
|
478
|
-
}
|
|
479
|
-
throttleTrailing(func, wait, ...args) {
|
|
480
|
-
let timeout = undefined;
|
|
481
|
-
let _arguments = args;
|
|
482
|
-
const result = function () {
|
|
483
|
-
const _this = this;
|
|
484
|
-
_arguments = args;
|
|
485
|
-
if (timeout) {
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
if (wait <= 0) {
|
|
489
|
-
func.apply(_this, _arguments);
|
|
490
|
-
}
|
|
491
|
-
else {
|
|
492
|
-
timeout = setTimeout(function () {
|
|
493
|
-
timeout = undefined;
|
|
494
|
-
func.apply(_this, _arguments);
|
|
495
|
-
}, wait);
|
|
496
|
-
}
|
|
497
|
-
};
|
|
498
|
-
result['cancel'] = function () {
|
|
499
|
-
if (timeout) {
|
|
500
|
-
clearTimeout(timeout);
|
|
501
|
-
timeout = undefined;
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
return result;
|
|
505
|
-
}
|
|
506
|
-
calculatedScrollbarWidth = 0;
|
|
507
|
-
calculatedScrollbarHeight = 0;
|
|
508
|
-
padding = 0;
|
|
509
|
-
previousViewPort = {};
|
|
510
|
-
currentTween;
|
|
511
|
-
cachedItemsLength;
|
|
512
|
-
disposeScrollHandler;
|
|
513
|
-
disposeResizeHandler;
|
|
514
|
-
refresh_internal(itemsArrayModified, refreshCompletedCallback = undefined, maxRunTimes = 2) {
|
|
515
|
-
//note: maxRunTimes is to force it to keep recalculating if the previous iteration caused a re-render (different sliced items in viewport or scrollPosition changed).
|
|
516
|
-
//The default of 2x max will probably be accurate enough without causing too large a performance bottleneck
|
|
517
|
-
//The code would typically quit out on the 2nd iteration anyways. The main time it'd think more than 2 runs would be necessary would be for vastly different sized child items or if this is the 1st time the items array was initialized.
|
|
518
|
-
//Without maxRunTimes, If the user is actively scrolling this code would become an infinite loop until they stopped scrolling. This would be okay, except each scroll event would start an additional infinte loop. We want to short-circuit it to prevent this.
|
|
519
|
-
if (itemsArrayModified && this.previousViewPort && this.previousViewPort.scrollStartPosition > 0) {
|
|
520
|
-
//if items were prepended, scroll forward to keep same items visible
|
|
521
|
-
const oldViewPort = this.previousViewPort;
|
|
522
|
-
const oldViewPortItems = this.viewPortItems;
|
|
523
|
-
const oldRefreshCompletedCallback = refreshCompletedCallback;
|
|
524
|
-
refreshCompletedCallback = () => {
|
|
525
|
-
const scrollLengthDelta = this.previousViewPort.scrollLength - oldViewPort.scrollLength;
|
|
526
|
-
if (scrollLengthDelta > 0 && this.viewPortItems) {
|
|
527
|
-
const oldStartItem = oldViewPortItems[0];
|
|
528
|
-
const oldStartItemIndex = this.items.findIndex(x => this.compareItems(oldStartItem, x));
|
|
529
|
-
if (oldStartItemIndex > this.previousViewPort.startIndexWithBuffer) {
|
|
530
|
-
let itemOrderChanged = false;
|
|
531
|
-
for (let i = 1; i < this.viewPortItems.length; ++i) {
|
|
532
|
-
if (!this.compareItems(this.items[oldStartItemIndex + i], oldViewPortItems[i])) {
|
|
533
|
-
itemOrderChanged = true;
|
|
534
|
-
break;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
if (!itemOrderChanged) {
|
|
538
|
-
this.scrollToPosition(this.previousViewPort.scrollStartPosition + scrollLengthDelta, 0, oldRefreshCompletedCallback);
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
if (oldRefreshCompletedCallback) {
|
|
544
|
-
oldRefreshCompletedCallback();
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
this.zone.runOutsideAngular(() => {
|
|
549
|
-
requestAnimationFrame(() => {
|
|
550
|
-
if (itemsArrayModified) {
|
|
551
|
-
this.resetWrapGroupDimensions();
|
|
552
|
-
}
|
|
553
|
-
const viewport = this.calculateViewport();
|
|
554
|
-
const startChanged = itemsArrayModified || viewport.startIndex !== this.previousViewPort.startIndex;
|
|
555
|
-
const endChanged = itemsArrayModified || viewport.endIndex !== this.previousViewPort.endIndex;
|
|
556
|
-
const scrollLengthChanged = viewport.scrollLength !== this.previousViewPort.scrollLength;
|
|
557
|
-
const paddingChanged = viewport.padding !== this.previousViewPort.padding;
|
|
558
|
-
const scrollPositionChanged = viewport.scrollStartPosition !== this.previousViewPort.scrollStartPosition || viewport.scrollEndPosition !== this.previousViewPort.scrollEndPosition || viewport.maxScrollPosition !== this.previousViewPort.maxScrollPosition;
|
|
559
|
-
const scrollDirection = this.previousViewPort.endIndex <= viewport.endIndex ? 'forward' : 'backward';
|
|
560
|
-
this.previousViewPort = viewport;
|
|
561
|
-
if (scrollLengthChanged) {
|
|
562
|
-
this.renderer.setStyle(this.invisiblePaddingElementRef.nativeElement, 'transform', `${this._invisiblePaddingProperty}(${viewport.scrollLength})`);
|
|
563
|
-
this.renderer.setStyle(this.invisiblePaddingElementRef.nativeElement, 'webkitTransform', `${this._invisiblePaddingProperty}(${viewport.scrollLength})`);
|
|
564
|
-
}
|
|
565
|
-
if (paddingChanged) {
|
|
566
|
-
if (this.useMarginInsteadOfTranslate) {
|
|
567
|
-
this.renderer.setStyle(this.contentElementRef.nativeElement, this._marginDir, `${viewport.padding}px`);
|
|
568
|
-
}
|
|
569
|
-
else {
|
|
570
|
-
this.renderer.setStyle(this.contentElementRef.nativeElement, 'transform', `${this._translateDir}(${viewport.padding}px)`);
|
|
571
|
-
this.renderer.setStyle(this.contentElementRef.nativeElement, 'webkitTransform', `${this._translateDir}(${viewport.padding}px)`);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
if (this.headerElementRef) {
|
|
575
|
-
const scrollPosition = this.getScrollElement()[this._scrollType];
|
|
576
|
-
const containerOffset = this.getElementsOffset();
|
|
577
|
-
const offset = Math.max(scrollPosition - viewport.padding - containerOffset + this.headerElementRef.nativeElement.clientHeight, 0);
|
|
578
|
-
this.renderer.setStyle(this.headerElementRef.nativeElement, 'transform', `${this._translateDir}(${offset}px)`);
|
|
579
|
-
this.renderer.setStyle(this.headerElementRef.nativeElement, 'webkitTransform', `${this._translateDir}(${offset}px)`);
|
|
580
|
-
}
|
|
581
|
-
const changeEventArg = (startChanged || endChanged) ? {
|
|
582
|
-
startIndex: viewport.startIndex,
|
|
583
|
-
endIndex: viewport.endIndex,
|
|
584
|
-
scrollStartPosition: viewport.scrollStartPosition,
|
|
585
|
-
scrollEndPosition: viewport.scrollEndPosition,
|
|
586
|
-
scrollDirection: scrollDirection,
|
|
587
|
-
startIndexWithBuffer: viewport.startIndexWithBuffer,
|
|
588
|
-
endIndexWithBuffer: viewport.endIndexWithBuffer,
|
|
589
|
-
maxScrollPosition: viewport.maxScrollPosition,
|
|
590
|
-
} : undefined;
|
|
591
|
-
if (startChanged || endChanged || scrollPositionChanged) {
|
|
592
|
-
const handleChanged = () => {
|
|
593
|
-
// update the scroll list to trigger re-render of components in viewport
|
|
594
|
-
this.viewPortItems = viewport.startIndexWithBuffer >= 0 && viewport.endIndexWithBuffer >= 0 ? this.items.slice(viewport.startIndexWithBuffer, viewport.endIndexWithBuffer + 1) : [];
|
|
595
|
-
this.vsUpdate.emit(this.viewPortItems);
|
|
596
|
-
if (startChanged) {
|
|
597
|
-
this.vsStart.emit(changeEventArg);
|
|
598
|
-
}
|
|
599
|
-
if (endChanged) {
|
|
600
|
-
this.vsEnd.emit(changeEventArg);
|
|
601
|
-
}
|
|
602
|
-
if (startChanged || endChanged) {
|
|
603
|
-
this.changeDetectorRef.markForCheck();
|
|
604
|
-
this.vsChange.emit(changeEventArg);
|
|
605
|
-
}
|
|
606
|
-
if (maxRunTimes > 0) {
|
|
607
|
-
this.refresh_internal(false, refreshCompletedCallback, maxRunTimes - 1);
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
if (refreshCompletedCallback) {
|
|
611
|
-
refreshCompletedCallback();
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
if (this.executeRefreshOutsideAngularZone) {
|
|
615
|
-
handleChanged();
|
|
616
|
-
}
|
|
617
|
-
else {
|
|
618
|
-
this.zone.run(handleChanged);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
else {
|
|
622
|
-
if (maxRunTimes > 0 && (scrollLengthChanged || paddingChanged)) {
|
|
623
|
-
this.refresh_internal(false, refreshCompletedCallback, maxRunTimes - 1);
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
if (refreshCompletedCallback) {
|
|
627
|
-
refreshCompletedCallback();
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
});
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
getScrollElement() {
|
|
634
|
-
return this.parentScroll instanceof Window ? document.scrollingElement || document.documentElement || document.body : this.parentScroll || this.element.nativeElement;
|
|
635
|
-
}
|
|
636
|
-
addScrollEventHandlers() {
|
|
637
|
-
if (this.isAngularUniversalSSR) {
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
const scrollElement = this.getScrollElement();
|
|
641
|
-
this.removeScrollEventHandlers();
|
|
642
|
-
this.zone.runOutsideAngular(() => {
|
|
643
|
-
if (this.parentScroll instanceof Window) {
|
|
644
|
-
this.disposeScrollHandler = this.renderer.listen('window', 'scroll', this.onScroll);
|
|
645
|
-
this.disposeResizeHandler = this.renderer.listen('window', 'resize', this.onScroll);
|
|
646
|
-
}
|
|
647
|
-
else {
|
|
648
|
-
this.disposeScrollHandler = this.renderer.listen(scrollElement, 'scroll', this.onScroll);
|
|
649
|
-
if (this._checkResizeInterval > 0) {
|
|
650
|
-
this.checkScrollElementResizedTimer = setInterval(() => { this.checkScrollElementResized(); }, this._checkResizeInterval);
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
});
|
|
654
|
-
}
|
|
655
|
-
removeScrollEventHandlers() {
|
|
656
|
-
if (this.checkScrollElementResizedTimer) {
|
|
657
|
-
clearInterval(this.checkScrollElementResizedTimer);
|
|
658
|
-
}
|
|
659
|
-
if (this.disposeScrollHandler) {
|
|
660
|
-
this.disposeScrollHandler();
|
|
661
|
-
this.disposeScrollHandler = undefined;
|
|
662
|
-
}
|
|
663
|
-
if (this.disposeResizeHandler) {
|
|
664
|
-
this.disposeResizeHandler();
|
|
665
|
-
this.disposeResizeHandler = undefined;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
getElementsOffset() {
|
|
669
|
-
if (this.isAngularUniversalSSR) {
|
|
670
|
-
return 0;
|
|
671
|
-
}
|
|
672
|
-
let offset = 0;
|
|
673
|
-
if (this.containerElementRef && this.containerElementRef.nativeElement) {
|
|
674
|
-
offset += this.containerElementRef.nativeElement[this._offsetType];
|
|
675
|
-
}
|
|
676
|
-
if (this.parentScroll) {
|
|
677
|
-
const scrollElement = this.getScrollElement();
|
|
678
|
-
const elementClientRect = this.getElementSize(this.element.nativeElement);
|
|
679
|
-
const scrollClientRect = this.getElementSize(scrollElement);
|
|
680
|
-
if (this.horizontal) {
|
|
681
|
-
offset += elementClientRect.left - scrollClientRect.left;
|
|
682
|
-
}
|
|
683
|
-
else {
|
|
684
|
-
offset += elementClientRect.top - scrollClientRect.top;
|
|
685
|
-
}
|
|
686
|
-
if (!(this.parentScroll instanceof Window)) {
|
|
687
|
-
offset += scrollElement[this._scrollType];
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
return offset;
|
|
691
|
-
}
|
|
692
|
-
countItemsPerWrapGroup() {
|
|
693
|
-
if (this.isAngularUniversalSSR) {
|
|
694
|
-
return Math.round(this.horizontal ? this.ssrViewportHeight / this.ssrChildHeight : this.ssrViewportWidth / this.ssrChildWidth);
|
|
695
|
-
}
|
|
696
|
-
const propertyName = this.horizontal ? 'offsetLeft' : 'offsetTop';
|
|
697
|
-
const children = this.getContent().children;
|
|
698
|
-
const childrenLength = children ? children.length : 0;
|
|
699
|
-
if (childrenLength === 0) {
|
|
700
|
-
return 1;
|
|
701
|
-
}
|
|
702
|
-
const firstOffset = children[0][propertyName];
|
|
703
|
-
let result = 1;
|
|
704
|
-
while (result < childrenLength && firstOffset === children[result][propertyName]) {
|
|
705
|
-
++result;
|
|
706
|
-
}
|
|
707
|
-
return result;
|
|
708
|
-
}
|
|
709
|
-
getScrollStartPosition() {
|
|
710
|
-
let windowScrollValue = undefined;
|
|
711
|
-
if (this.parentScroll instanceof Window) {
|
|
712
|
-
windowScrollValue = window[this._pageOffsetType];
|
|
713
|
-
}
|
|
714
|
-
return windowScrollValue || this.getScrollElement()[this._scrollType] || 0;
|
|
715
|
-
}
|
|
716
|
-
minMeasuredChildWidth;
|
|
717
|
-
minMeasuredChildHeight;
|
|
718
|
-
wrapGroupDimensions;
|
|
719
|
-
resetWrapGroupDimensions() {
|
|
720
|
-
const oldWrapGroupDimensions = this.wrapGroupDimensions;
|
|
721
|
-
this.invalidateAllCachedMeasurements();
|
|
722
|
-
if (!this.enableUnequalChildrenSizes || !oldWrapGroupDimensions || oldWrapGroupDimensions.numberOfKnownWrapGroupChildSizes === 0) {
|
|
723
|
-
return;
|
|
724
|
-
}
|
|
725
|
-
const itemsPerWrapGroup = this.countItemsPerWrapGroup();
|
|
726
|
-
for (let wrapGroupIndex = 0; wrapGroupIndex < oldWrapGroupDimensions.maxChildSizePerWrapGroup.length; ++wrapGroupIndex) {
|
|
727
|
-
const oldWrapGroupDimension = oldWrapGroupDimensions.maxChildSizePerWrapGroup[wrapGroupIndex];
|
|
728
|
-
if (!oldWrapGroupDimension || !oldWrapGroupDimension.items || !oldWrapGroupDimension.items.length) {
|
|
729
|
-
continue;
|
|
730
|
-
}
|
|
731
|
-
if (oldWrapGroupDimension.items.length !== itemsPerWrapGroup) {
|
|
732
|
-
return;
|
|
733
|
-
}
|
|
734
|
-
let itemsChanged = false;
|
|
735
|
-
const arrayStartIndex = itemsPerWrapGroup * wrapGroupIndex;
|
|
736
|
-
for (let i = 0; i < itemsPerWrapGroup; ++i) {
|
|
737
|
-
if (!this.compareItems(oldWrapGroupDimension.items[i], this.items[arrayStartIndex + i])) {
|
|
738
|
-
itemsChanged = true;
|
|
739
|
-
break;
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
if (!itemsChanged) {
|
|
743
|
-
++this.wrapGroupDimensions.numberOfKnownWrapGroupChildSizes;
|
|
744
|
-
this.wrapGroupDimensions.sumOfKnownWrapGroupChildWidths += oldWrapGroupDimension.childWidth || 0;
|
|
745
|
-
this.wrapGroupDimensions.sumOfKnownWrapGroupChildHeights += oldWrapGroupDimension.childHeight || 0;
|
|
746
|
-
this.wrapGroupDimensions.maxChildSizePerWrapGroup[wrapGroupIndex] = oldWrapGroupDimension;
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
calculateDimensions() {
|
|
751
|
-
const scrollElement = this.getScrollElement();
|
|
752
|
-
const maxCalculatedScrollBarSize = 25; // Note: Formula to auto-calculate doesn't work for ParentScroll, so we default to this if not set by consuming application
|
|
753
|
-
this.calculatedScrollbarHeight = Math.max(Math.min(scrollElement.offsetHeight - scrollElement.clientHeight, maxCalculatedScrollBarSize), this.calculatedScrollbarHeight);
|
|
754
|
-
this.calculatedScrollbarWidth = Math.max(Math.min(scrollElement.offsetWidth - scrollElement.clientWidth, maxCalculatedScrollBarSize), this.calculatedScrollbarWidth);
|
|
755
|
-
let viewportWidth = scrollElement.offsetWidth - (this.scrollbarWidth || this.calculatedScrollbarWidth || (this.horizontal ? 0 : maxCalculatedScrollBarSize));
|
|
756
|
-
let viewportHeight = scrollElement.offsetHeight - (this.scrollbarHeight || this.calculatedScrollbarHeight || (this.horizontal ? maxCalculatedScrollBarSize : 0));
|
|
757
|
-
const content = this.getContent();
|
|
758
|
-
const itemsPerWrapGroup = this.countItemsPerWrapGroup();
|
|
759
|
-
let wrapGroupsPerPage;
|
|
760
|
-
let defaultChildWidth;
|
|
761
|
-
let defaultChildHeight;
|
|
762
|
-
if (this.isAngularUniversalSSR) {
|
|
763
|
-
viewportWidth = this.ssrViewportWidth;
|
|
764
|
-
viewportHeight = this.ssrViewportHeight;
|
|
765
|
-
defaultChildWidth = this.ssrChildWidth;
|
|
766
|
-
defaultChildHeight = this.ssrChildHeight;
|
|
767
|
-
const itemsPerRow = Math.max(Math.ceil(viewportWidth / defaultChildWidth), 1);
|
|
768
|
-
const itemsPerCol = Math.max(Math.ceil(viewportHeight / defaultChildHeight), 1);
|
|
769
|
-
wrapGroupsPerPage = this.horizontal ? itemsPerRow : itemsPerCol;
|
|
770
|
-
}
|
|
771
|
-
else if (!this.enableUnequalChildrenSizes) {
|
|
772
|
-
if (content.children.length > 0) {
|
|
773
|
-
if (!this.childWidth || !this.childHeight) {
|
|
774
|
-
if (!this.minMeasuredChildWidth && viewportWidth > 0) {
|
|
775
|
-
this.minMeasuredChildWidth = viewportWidth;
|
|
776
|
-
}
|
|
777
|
-
if (!this.minMeasuredChildHeight && viewportHeight > 0) {
|
|
778
|
-
this.minMeasuredChildHeight = viewportHeight;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
const child = content.children[0];
|
|
782
|
-
const clientRect = this.getElementSize(child);
|
|
783
|
-
this.minMeasuredChildWidth = Math.min(this.minMeasuredChildWidth, clientRect.width);
|
|
784
|
-
this.minMeasuredChildHeight = Math.min(this.minMeasuredChildHeight, clientRect.height);
|
|
785
|
-
// Added for getting the child height (for card view, return all the clientRect object).
|
|
786
|
-
// if (this._lastChildRect === null ||
|
|
787
|
-
// (clientRect?.height !== 0 && (
|
|
788
|
-
// Math.round(this._lastChildRect?.height) !== Math.round(clientRect?.height) ||
|
|
789
|
-
// Math.round(this._lastChildRect?.width) !== Math.round(clientRect?.width))
|
|
790
|
-
// )) {
|
|
791
|
-
// this._lastChildRect = clientRect;
|
|
792
|
-
// this.vsChildRectChange.emit(clientRect);
|
|
793
|
-
// }
|
|
794
|
-
}
|
|
795
|
-
defaultChildWidth = this.childWidth || this.minMeasuredChildWidth || viewportWidth;
|
|
796
|
-
defaultChildHeight = this.childHeight || this.minMeasuredChildHeight || viewportHeight;
|
|
797
|
-
const itemsPerRow = Math.max(Math.ceil(viewportWidth / defaultChildWidth), 1);
|
|
798
|
-
const itemsPerCol = Math.max(Math.ceil(viewportHeight / defaultChildHeight), 1);
|
|
799
|
-
wrapGroupsPerPage = this.horizontal ? itemsPerRow : itemsPerCol;
|
|
800
|
-
}
|
|
801
|
-
else {
|
|
802
|
-
let scrollOffset = scrollElement[this._scrollType] - (this.previousViewPort ? this.previousViewPort.padding : 0);
|
|
803
|
-
let arrayStartIndex = this.previousViewPort.startIndexWithBuffer || 0;
|
|
804
|
-
let wrapGroupIndex = Math.ceil(arrayStartIndex / itemsPerWrapGroup);
|
|
805
|
-
let maxWidthForWrapGroup = 0;
|
|
806
|
-
let maxHeightForWrapGroup = 0;
|
|
807
|
-
let sumOfVisibleMaxWidths = 0;
|
|
808
|
-
let sumOfVisibleMaxHeights = 0;
|
|
809
|
-
wrapGroupsPerPage = 0;
|
|
810
|
-
for (let i = 0; i < content.children.length; ++i) {
|
|
811
|
-
++arrayStartIndex;
|
|
812
|
-
const child = content.children[i];
|
|
813
|
-
const clientRect = this.getElementSize(child);
|
|
814
|
-
maxWidthForWrapGroup = Math.max(maxWidthForWrapGroup, clientRect.width);
|
|
815
|
-
maxHeightForWrapGroup = Math.max(maxHeightForWrapGroup, clientRect.height);
|
|
816
|
-
if (arrayStartIndex % itemsPerWrapGroup === 0) {
|
|
817
|
-
const oldValue = this.wrapGroupDimensions.maxChildSizePerWrapGroup[wrapGroupIndex];
|
|
818
|
-
if (oldValue) {
|
|
819
|
-
--this.wrapGroupDimensions.numberOfKnownWrapGroupChildSizes;
|
|
820
|
-
this.wrapGroupDimensions.sumOfKnownWrapGroupChildWidths -= oldValue.childWidth || 0;
|
|
821
|
-
this.wrapGroupDimensions.sumOfKnownWrapGroupChildHeights -= oldValue.childHeight || 0;
|
|
822
|
-
}
|
|
823
|
-
++this.wrapGroupDimensions.numberOfKnownWrapGroupChildSizes;
|
|
824
|
-
const items = this.items.slice(arrayStartIndex - itemsPerWrapGroup, arrayStartIndex);
|
|
825
|
-
this.wrapGroupDimensions.maxChildSizePerWrapGroup[wrapGroupIndex] = {
|
|
826
|
-
childWidth: maxWidthForWrapGroup,
|
|
827
|
-
childHeight: maxHeightForWrapGroup,
|
|
828
|
-
items: items
|
|
829
|
-
};
|
|
830
|
-
this.wrapGroupDimensions.sumOfKnownWrapGroupChildWidths += maxWidthForWrapGroup;
|
|
831
|
-
this.wrapGroupDimensions.sumOfKnownWrapGroupChildHeights += maxHeightForWrapGroup;
|
|
832
|
-
if (this.horizontal) {
|
|
833
|
-
let maxVisibleWidthForWrapGroup = Math.min(maxWidthForWrapGroup, Math.max(viewportWidth - sumOfVisibleMaxWidths, 0));
|
|
834
|
-
if (scrollOffset > 0) {
|
|
835
|
-
const scrollOffsetToRemove = Math.min(scrollOffset, maxVisibleWidthForWrapGroup);
|
|
836
|
-
maxVisibleWidthForWrapGroup -= scrollOffsetToRemove;
|
|
837
|
-
scrollOffset -= scrollOffsetToRemove;
|
|
838
|
-
}
|
|
839
|
-
sumOfVisibleMaxWidths += maxVisibleWidthForWrapGroup;
|
|
840
|
-
if (maxVisibleWidthForWrapGroup > 0 && viewportWidth >= sumOfVisibleMaxWidths) {
|
|
841
|
-
++wrapGroupsPerPage;
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
else {
|
|
845
|
-
let maxVisibleHeightForWrapGroup = Math.min(maxHeightForWrapGroup, Math.max(viewportHeight - sumOfVisibleMaxHeights, 0));
|
|
846
|
-
if (scrollOffset > 0) {
|
|
847
|
-
const scrollOffsetToRemove = Math.min(scrollOffset, maxVisibleHeightForWrapGroup);
|
|
848
|
-
maxVisibleHeightForWrapGroup -= scrollOffsetToRemove;
|
|
849
|
-
scrollOffset -= scrollOffsetToRemove;
|
|
850
|
-
}
|
|
851
|
-
sumOfVisibleMaxHeights += maxVisibleHeightForWrapGroup;
|
|
852
|
-
if (maxVisibleHeightForWrapGroup > 0 && viewportHeight >= sumOfVisibleMaxHeights) {
|
|
853
|
-
++wrapGroupsPerPage;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
++wrapGroupIndex;
|
|
857
|
-
maxWidthForWrapGroup = 0;
|
|
858
|
-
maxHeightForWrapGroup = 0;
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
const averageChildWidth = this.wrapGroupDimensions.sumOfKnownWrapGroupChildWidths / this.wrapGroupDimensions.numberOfKnownWrapGroupChildSizes;
|
|
862
|
-
const averageChildHeight = this.wrapGroupDimensions.sumOfKnownWrapGroupChildHeights / this.wrapGroupDimensions.numberOfKnownWrapGroupChildSizes;
|
|
863
|
-
defaultChildWidth = this.childWidth || averageChildWidth || viewportWidth;
|
|
864
|
-
defaultChildHeight = this.childHeight || averageChildHeight || viewportHeight;
|
|
865
|
-
if (this.horizontal) {
|
|
866
|
-
if (viewportWidth > sumOfVisibleMaxWidths) {
|
|
867
|
-
wrapGroupsPerPage += Math.ceil((viewportWidth - sumOfVisibleMaxWidths) / defaultChildWidth);
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
else {
|
|
871
|
-
if (viewportHeight > sumOfVisibleMaxHeights) {
|
|
872
|
-
wrapGroupsPerPage += Math.ceil((viewportHeight - sumOfVisibleMaxHeights) / defaultChildHeight);
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
const itemCount = this.items.length;
|
|
877
|
-
const itemsPerPage = itemsPerWrapGroup * wrapGroupsPerPage;
|
|
878
|
-
const pageCount_fractional = itemCount / itemsPerPage;
|
|
879
|
-
const numberOfWrapGroups = Math.ceil(itemCount / itemsPerWrapGroup);
|
|
880
|
-
let scrollLength = 0;
|
|
881
|
-
const defaultScrollLengthPerWrapGroup = this.horizontal ? defaultChildWidth : defaultChildHeight;
|
|
882
|
-
if (this.enableUnequalChildrenSizes) {
|
|
883
|
-
let numUnknownChildSizes = 0;
|
|
884
|
-
for (let i = 0; i < numberOfWrapGroups; ++i) {
|
|
885
|
-
const childSize = this.wrapGroupDimensions.maxChildSizePerWrapGroup[i] && this.wrapGroupDimensions.maxChildSizePerWrapGroup[i][this._childScrollDim];
|
|
886
|
-
if (childSize) {
|
|
887
|
-
scrollLength += childSize;
|
|
888
|
-
}
|
|
889
|
-
else {
|
|
890
|
-
++numUnknownChildSizes;
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
scrollLength += Math.round(numUnknownChildSizes * defaultScrollLengthPerWrapGroup);
|
|
894
|
-
}
|
|
895
|
-
else {
|
|
896
|
-
scrollLength = numberOfWrapGroups * defaultScrollLengthPerWrapGroup;
|
|
897
|
-
}
|
|
898
|
-
if (this.headerElementRef) {
|
|
899
|
-
scrollLength += this.headerElementRef.nativeElement.clientHeight;
|
|
900
|
-
}
|
|
901
|
-
const viewportLength = this.horizontal ? viewportWidth : viewportHeight;
|
|
902
|
-
const maxScrollPosition = Math.max(scrollLength - viewportLength, 0);
|
|
903
|
-
return {
|
|
904
|
-
childHeight: defaultChildHeight,
|
|
905
|
-
childWidth: defaultChildWidth,
|
|
906
|
-
itemCount: itemCount,
|
|
907
|
-
itemsPerPage: itemsPerPage,
|
|
908
|
-
itemsPerWrapGroup: itemsPerWrapGroup,
|
|
909
|
-
maxScrollPosition: maxScrollPosition,
|
|
910
|
-
pageCount_fractional: pageCount_fractional,
|
|
911
|
-
scrollLength: scrollLength,
|
|
912
|
-
viewportLength: viewportLength,
|
|
913
|
-
wrapGroupsPerPage: wrapGroupsPerPage,
|
|
914
|
-
};
|
|
915
|
-
}
|
|
916
|
-
cachedPageSize = 0;
|
|
917
|
-
previousScrollNumberElements = 0;
|
|
918
|
-
calculatePadding(arrayStartIndexWithBuffer, dimensions) {
|
|
919
|
-
if (dimensions.itemCount === 0) {
|
|
920
|
-
return 0;
|
|
921
|
-
}
|
|
922
|
-
const defaultScrollLengthPerWrapGroup = dimensions[this._childScrollDim];
|
|
923
|
-
const startingWrapGroupIndex = Math.floor(arrayStartIndexWithBuffer / dimensions.itemsPerWrapGroup) || 0;
|
|
924
|
-
if (!this.enableUnequalChildrenSizes) {
|
|
925
|
-
return defaultScrollLengthPerWrapGroup * startingWrapGroupIndex;
|
|
926
|
-
}
|
|
927
|
-
let numUnknownChildSizes = 0;
|
|
928
|
-
let result = 0;
|
|
929
|
-
for (let i = 0; i < startingWrapGroupIndex; ++i) {
|
|
930
|
-
const childSize = this.wrapGroupDimensions.maxChildSizePerWrapGroup[i] && this.wrapGroupDimensions.maxChildSizePerWrapGroup[i][this._childScrollDim];
|
|
931
|
-
if (childSize) {
|
|
932
|
-
result += childSize;
|
|
933
|
-
}
|
|
934
|
-
else {
|
|
935
|
-
++numUnknownChildSizes;
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
result += Math.round(numUnknownChildSizes * defaultScrollLengthPerWrapGroup);
|
|
939
|
-
return result;
|
|
940
|
-
}
|
|
941
|
-
calculatePageInfo(scrollPosition, dimensions) {
|
|
942
|
-
let scrollPercentage = 0;
|
|
943
|
-
if (this.enableUnequalChildrenSizes) {
|
|
944
|
-
const numberOfWrapGroups = Math.ceil(dimensions.itemCount / dimensions.itemsPerWrapGroup);
|
|
945
|
-
let totalScrolledLength = 0;
|
|
946
|
-
const defaultScrollLengthPerWrapGroup = dimensions[this._childScrollDim];
|
|
947
|
-
for (let i = 0; i < numberOfWrapGroups; ++i) {
|
|
948
|
-
const childSize = this.wrapGroupDimensions.maxChildSizePerWrapGroup[i] && this.wrapGroupDimensions.maxChildSizePerWrapGroup[i][this._childScrollDim];
|
|
949
|
-
if (childSize) {
|
|
950
|
-
totalScrolledLength += childSize;
|
|
951
|
-
}
|
|
952
|
-
else {
|
|
953
|
-
totalScrolledLength += defaultScrollLengthPerWrapGroup;
|
|
954
|
-
}
|
|
955
|
-
if (scrollPosition < totalScrolledLength) {
|
|
956
|
-
scrollPercentage = i / numberOfWrapGroups;
|
|
957
|
-
break;
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
else {
|
|
962
|
-
scrollPercentage = scrollPosition / dimensions.scrollLength;
|
|
963
|
-
}
|
|
964
|
-
const startingArrayIndex_fractional = Math.min(Math.max(scrollPercentage * dimensions.pageCount_fractional, 0), dimensions.pageCount_fractional) * dimensions.itemsPerPage;
|
|
965
|
-
const maxStart = dimensions.itemCount - dimensions.itemsPerPage - 1;
|
|
966
|
-
let arrayStartIndex = Math.min(Math.floor(startingArrayIndex_fractional), maxStart);
|
|
967
|
-
arrayStartIndex -= arrayStartIndex % dimensions.itemsPerWrapGroup; // round down to start of wrapGroup
|
|
968
|
-
if (this.stripedTable) {
|
|
969
|
-
const bufferBoundary = 2 * dimensions.itemsPerWrapGroup;
|
|
970
|
-
if (arrayStartIndex % bufferBoundary !== 0) {
|
|
971
|
-
arrayStartIndex = Math.max(arrayStartIndex - arrayStartIndex % bufferBoundary, 0);
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
let arrayEndIndex = Math.ceil(startingArrayIndex_fractional) + dimensions.itemsPerPage - 1;
|
|
975
|
-
const endIndexWithinWrapGroup = (arrayEndIndex + 1) % dimensions.itemsPerWrapGroup;
|
|
976
|
-
if (endIndexWithinWrapGroup > 0) {
|
|
977
|
-
arrayEndIndex += dimensions.itemsPerWrapGroup - endIndexWithinWrapGroup; // round up to end of wrapGroup
|
|
978
|
-
}
|
|
979
|
-
if (isNaN(arrayStartIndex)) {
|
|
980
|
-
arrayStartIndex = 0;
|
|
981
|
-
}
|
|
982
|
-
if (isNaN(arrayEndIndex)) {
|
|
983
|
-
arrayEndIndex = 0;
|
|
984
|
-
}
|
|
985
|
-
arrayStartIndex = Math.min(Math.max(arrayStartIndex, 0), dimensions.itemCount - 1);
|
|
986
|
-
arrayEndIndex = Math.min(Math.max(arrayEndIndex, 0), dimensions.itemCount - 1);
|
|
987
|
-
const bufferSize = this.bufferAmount * dimensions.itemsPerWrapGroup;
|
|
988
|
-
const startIndexWithBuffer = Math.min(Math.max(arrayStartIndex - bufferSize, 0), dimensions.itemCount - 1);
|
|
989
|
-
const endIndexWithBuffer = Math.min(Math.max(arrayEndIndex + bufferSize, 0), dimensions.itemCount - 1);
|
|
990
|
-
return {
|
|
991
|
-
startIndex: arrayStartIndex,
|
|
992
|
-
endIndex: arrayEndIndex,
|
|
993
|
-
startIndexWithBuffer: startIndexWithBuffer,
|
|
994
|
-
endIndexWithBuffer: endIndexWithBuffer,
|
|
995
|
-
scrollStartPosition: scrollPosition,
|
|
996
|
-
scrollEndPosition: scrollPosition + dimensions.viewportLength,
|
|
997
|
-
maxScrollPosition: dimensions.maxScrollPosition
|
|
998
|
-
};
|
|
999
|
-
}
|
|
1000
|
-
calculateViewport() {
|
|
1001
|
-
const dimensions = this.calculateDimensions();
|
|
1002
|
-
const offset = this.getElementsOffset();
|
|
1003
|
-
let scrollStartPosition = this.getScrollStartPosition();
|
|
1004
|
-
if (scrollStartPosition > (dimensions.scrollLength + offset) && !(this.parentScroll instanceof Window)) {
|
|
1005
|
-
scrollStartPosition = dimensions.scrollLength;
|
|
1006
|
-
}
|
|
1007
|
-
else {
|
|
1008
|
-
scrollStartPosition -= offset;
|
|
1009
|
-
}
|
|
1010
|
-
scrollStartPosition = Math.max(0, scrollStartPosition);
|
|
1011
|
-
const pageInfo = this.calculatePageInfo(scrollStartPosition, dimensions);
|
|
1012
|
-
const newPadding = this.calculatePadding(pageInfo.startIndexWithBuffer, dimensions);
|
|
1013
|
-
const newScrollLength = dimensions.scrollLength;
|
|
1014
|
-
return {
|
|
1015
|
-
startIndex: pageInfo.startIndex,
|
|
1016
|
-
endIndex: pageInfo.endIndex,
|
|
1017
|
-
startIndexWithBuffer: pageInfo.startIndexWithBuffer,
|
|
1018
|
-
endIndexWithBuffer: pageInfo.endIndexWithBuffer,
|
|
1019
|
-
padding: Math.round(newPadding),
|
|
1020
|
-
scrollLength: Math.round(newScrollLength),
|
|
1021
|
-
scrollStartPosition: pageInfo.scrollStartPosition,
|
|
1022
|
-
scrollEndPosition: pageInfo.scrollEndPosition,
|
|
1023
|
-
maxScrollPosition: pageInfo.maxScrollPosition
|
|
1024
|
-
};
|
|
1025
|
-
}
|
|
1026
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VirtualScrollerComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: PLATFORM_ID }, { token: 'virtual-scroller-default-options', optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1027
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: VirtualScrollerComponent, selector: "virtual-scroller,[virtualScroller]", inputs: { disable: "disable", executeRefreshOutsideAngularZone: "executeRefreshOutsideAngularZone", enableUnequalChildrenSizes: "enableUnequalChildrenSizes", RTL: "RTL", useMarginInsteadOfTranslate: "useMarginInsteadOfTranslate", modifyOverflowStyleOfParentScroll: "modifyOverflowStyleOfParentScroll", stripedTable: "stripedTable", scrollbarWidth: "scrollbarWidth", scrollbarHeight: "scrollbarHeight", childWidth: "childWidth", childHeight: "childHeight", ssrChildWidth: "ssrChildWidth", ssrChildHeight: "ssrChildHeight", ssrViewportWidth: "ssrViewportWidth", ssrViewportHeight: "ssrViewportHeight", bufferAmount: "bufferAmount", scrollAnimationTime: "scrollAnimationTime", resizeBypassRefreshThreshold: "resizeBypassRefreshThreshold", scrollThrottlingTime: "scrollThrottlingTime", scrollDebounceTime: "scrollDebounceTime", checkResizeInterval: "checkResizeInterval", items: "items", compareItems: "compareItems", horizontal: "horizontal", parentScroll: "parentScroll" }, outputs: { vsChildRectChange: "vsChildRectChange", vsUpdate: "vsUpdate", vsChange: "vsChange", vsStart: "vsStart", vsEnd: "vsEnd" }, host: { properties: { "class.horizontal": "horizontal", "class.vertical": "!horizontal", "class.selfScroll": "!parentScroll", "class.rtl": "RTL" } }, queries: [{ propertyName: "headerElementRef", first: true, predicate: ["header"], descendants: true, read: ElementRef }, { propertyName: "containerElementRef", first: true, predicate: ["container"], descendants: true, read: ElementRef }], viewQueries: [{ propertyName: "contentElementRef", first: true, predicate: ["content"], descendants: true, read: ElementRef, static: true }, { propertyName: "invisiblePaddingElementRef", first: true, predicate: ["invisiblePadding"], descendants: true, read: ElementRef, static: true }], exportAs: ["virtualScroller"], usesOnChanges: true, ngImport: i0, template: `
|
|
1028
|
-
<div class="total-padding" #invisiblePadding></div>
|
|
1029
|
-
<div class="scrollable-content" #content>
|
|
1030
|
-
<ng-content></ng-content>
|
|
1031
|
-
</div>
|
|
1032
|
-
`, isInline: true, styles: [":host{position:relative;display:block;-webkit-overflow-scrolling:touch}:host.horizontal.selfScroll{overflow-y:visible;overflow-x:auto}:host.horizontal.selfScroll.rtl{transform:scaleX(-1)}:host.vertical.selfScroll{overflow-y:auto;overflow-x:visible}.scrollable-content{top:0;left:0;width:100%;height:100%;max-width:100vw;max-height:100vh;position:absolute}.scrollable-content ::ng-deep>*{box-sizing:border-box}:host.horizontal{white-space:nowrap}:host.horizontal .scrollable-content{display:flex}:host.horizontal .scrollable-content ::ng-deep>*{flex-shrink:0;flex-grow:0;white-space:initial}:host.horizontal.rtl .scrollable-content ::ng-deep>*{transform:scaleX(-1)}.total-padding{position:absolute;top:0;left:0;height:1px;width:1px;transform-origin:0 0;opacity:0}:host.horizontal .total-padding{height:100%}\n"] });
|
|
1033
|
-
}
|
|
1034
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VirtualScrollerComponent, decorators: [{
|
|
1035
|
-
type: Component,
|
|
1036
|
-
args: [{ selector: 'virtual-scroller,[virtualScroller]', exportAs: 'virtualScroller', template: `
|
|
1037
|
-
<div class="total-padding" #invisiblePadding></div>
|
|
1038
|
-
<div class="scrollable-content" #content>
|
|
1039
|
-
<ng-content></ng-content>
|
|
1040
|
-
</div>
|
|
1041
|
-
`, host: {
|
|
1042
|
-
'[class.horizontal]': "horizontal",
|
|
1043
|
-
'[class.vertical]': "!horizontal",
|
|
1044
|
-
'[class.selfScroll]': "!parentScroll",
|
|
1045
|
-
'[class.rtl]': "RTL"
|
|
1046
|
-
}, styles: [":host{position:relative;display:block;-webkit-overflow-scrolling:touch}:host.horizontal.selfScroll{overflow-y:visible;overflow-x:auto}:host.horizontal.selfScroll.rtl{transform:scaleX(-1)}:host.vertical.selfScroll{overflow-y:auto;overflow-x:visible}.scrollable-content{top:0;left:0;width:100%;height:100%;max-width:100vw;max-height:100vh;position:absolute}.scrollable-content ::ng-deep>*{box-sizing:border-box}:host.horizontal{white-space:nowrap}:host.horizontal .scrollable-content{display:flex}:host.horizontal .scrollable-content ::ng-deep>*{flex-shrink:0;flex-grow:0;white-space:initial}:host.horizontal.rtl .scrollable-content ::ng-deep>*{transform:scaleX(-1)}.total-padding{position:absolute;top:0;left:0;height:1px;width:1px;transform-origin:0 0;opacity:0}:host.horizontal .total-padding{height:100%}\n"] }]
|
|
1047
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
1048
|
-
type: Inject,
|
|
1049
|
-
args: [PLATFORM_ID]
|
|
1050
|
-
}] }, { type: undefined, decorators: [{
|
|
1051
|
-
type: Optional
|
|
1052
|
-
}, {
|
|
1053
|
-
type: Inject,
|
|
1054
|
-
args: ['virtual-scroller-default-options']
|
|
1055
|
-
}] }]; }, propDecorators: { disable: [{
|
|
1056
|
-
type: Input
|
|
1057
|
-
}], executeRefreshOutsideAngularZone: [{
|
|
1058
|
-
type: Input
|
|
1059
|
-
}], enableUnequalChildrenSizes: [{
|
|
1060
|
-
type: Input
|
|
1061
|
-
}], RTL: [{
|
|
1062
|
-
type: Input
|
|
1063
|
-
}], useMarginInsteadOfTranslate: [{
|
|
1064
|
-
type: Input
|
|
1065
|
-
}], modifyOverflowStyleOfParentScroll: [{
|
|
1066
|
-
type: Input
|
|
1067
|
-
}], stripedTable: [{
|
|
1068
|
-
type: Input
|
|
1069
|
-
}], scrollbarWidth: [{
|
|
1070
|
-
type: Input
|
|
1071
|
-
}], scrollbarHeight: [{
|
|
1072
|
-
type: Input
|
|
1073
|
-
}], childWidth: [{
|
|
1074
|
-
type: Input
|
|
1075
|
-
}], childHeight: [{
|
|
1076
|
-
type: Input
|
|
1077
|
-
}], ssrChildWidth: [{
|
|
1078
|
-
type: Input
|
|
1079
|
-
}], ssrChildHeight: [{
|
|
1080
|
-
type: Input
|
|
1081
|
-
}], ssrViewportWidth: [{
|
|
1082
|
-
type: Input
|
|
1083
|
-
}], ssrViewportHeight: [{
|
|
1084
|
-
type: Input
|
|
1085
|
-
}], bufferAmount: [{
|
|
1086
|
-
type: Input
|
|
1087
|
-
}], scrollAnimationTime: [{
|
|
1088
|
-
type: Input
|
|
1089
|
-
}], resizeBypassRefreshThreshold: [{
|
|
1090
|
-
type: Input
|
|
1091
|
-
}], scrollThrottlingTime: [{
|
|
1092
|
-
type: Input
|
|
1093
|
-
}], scrollDebounceTime: [{
|
|
1094
|
-
type: Input
|
|
1095
|
-
}], checkResizeInterval: [{
|
|
1096
|
-
type: Input
|
|
1097
|
-
}], items: [{
|
|
1098
|
-
type: Input
|
|
1099
|
-
}], compareItems: [{
|
|
1100
|
-
type: Input
|
|
1101
|
-
}], horizontal: [{
|
|
1102
|
-
type: Input
|
|
1103
|
-
}], parentScroll: [{
|
|
1104
|
-
type: Input
|
|
1105
|
-
}], vsChildRectChange: [{
|
|
1106
|
-
type: Output
|
|
1107
|
-
}], vsUpdate: [{
|
|
1108
|
-
type: Output
|
|
1109
|
-
}], vsChange: [{
|
|
1110
|
-
type: Output
|
|
1111
|
-
}], vsStart: [{
|
|
1112
|
-
type: Output
|
|
1113
|
-
}], vsEnd: [{
|
|
1114
|
-
type: Output
|
|
1115
|
-
}], contentElementRef: [{
|
|
1116
|
-
type: ViewChild,
|
|
1117
|
-
args: ['content', { read: ElementRef, static: true }]
|
|
1118
|
-
}], invisiblePaddingElementRef: [{
|
|
1119
|
-
type: ViewChild,
|
|
1120
|
-
args: ['invisiblePadding', { read: ElementRef, static: true }]
|
|
1121
|
-
}], headerElementRef: [{
|
|
1122
|
-
type: ContentChild,
|
|
1123
|
-
args: ['header', { read: ElementRef, static: false }]
|
|
1124
|
-
}], containerElementRef: [{
|
|
1125
|
-
type: ContentChild,
|
|
1126
|
-
args: ['container', { read: ElementRef, static: false }]
|
|
1127
|
-
}] } });
|
|
1128
|
-
class VirtualScrollerModule {
|
|
1129
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VirtualScrollerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1130
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: VirtualScrollerModule, declarations: [VirtualScrollerComponent], imports: [CommonModule], exports: [VirtualScrollerComponent] });
|
|
1131
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VirtualScrollerModule, providers: [
|
|
1132
|
-
{
|
|
1133
|
-
provide: 'virtual-scroller-default-options',
|
|
1134
|
-
useFactory: VIRTUAL_SCROLLER_DEFAULT_OPTIONS_FACTORY
|
|
1135
|
-
}
|
|
1136
|
-
], imports: [CommonModule] });
|
|
1137
|
-
}
|
|
1138
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VirtualScrollerModule, decorators: [{
|
|
1139
|
-
type: NgModule,
|
|
1140
|
-
args: [{
|
|
1141
|
-
exports: [VirtualScrollerComponent],
|
|
1142
|
-
declarations: [VirtualScrollerComponent],
|
|
1143
|
-
imports: [CommonModule],
|
|
1144
|
-
providers: [
|
|
1145
|
-
{
|
|
1146
|
-
provide: 'virtual-scroller-default-options',
|
|
1147
|
-
useFactory: VIRTUAL_SCROLLER_DEFAULT_OPTIONS_FACTORY
|
|
1148
|
-
}
|
|
1149
|
-
]
|
|
1150
|
-
}]
|
|
1151
|
-
}] });
|
|
1152
|
-
|
|
1153
35
|
class PepSelectionData {
|
|
1154
36
|
selectionType;
|
|
1155
37
|
rows;
|
|
@@ -1377,7 +259,9 @@ class PepListComponent {
|
|
|
1377
259
|
loadItems = new EventEmitter();
|
|
1378
260
|
loadPage = new EventEmitter();
|
|
1379
261
|
startIndexChange = new EventEmitter();
|
|
1380
|
-
|
|
262
|
+
// TODO Avner: Remove this when the virtual scroller is implemented
|
|
263
|
+
// @ViewChild(VirtualScrollerComponent) private virtualScroller: VirtualScrollerComponent;
|
|
264
|
+
virtualScroller = undefined;
|
|
1381
265
|
selectAllCB;
|
|
1382
266
|
_layout = null;
|
|
1383
267
|
get layout() {
|
|
@@ -2550,7 +1434,7 @@ class PepListComponent {
|
|
|
2550
1434
|
return false;
|
|
2551
1435
|
}
|
|
2552
1436
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PepListComponent, deps: [{ token: i0.ElementRef }, { token: i1.PepLayoutService }, { token: i1.PepSessionService }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
2553
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PepListComponent, selector: "pep-list", inputs: { sorting: "sorting", cacheSize: "cacheSize", noDataFoundMsg: "noDataFoundMsg", selectionTypeForActions: "selectionTypeForActions", showCardSelection: "showCardSelection", hideAllSelectionInMulti: "hideAllSelectionInMulti", cardSize: "cardSize", tableViewType: "tableViewType", viewType: "viewType", firstFieldAsLink: "firstFieldAsLink", supportSorting: "supportSorting", supportSortingFields: "supportSortingFields", supportResizing: "supportResizing", parentScroll: "parentScroll", disabled: "disabled", lockEvents: "lockEvents", lockItemInnerEvents: "lockItemInnerEvents", printMode: "printMode", isReport: "isReport", zebraStripes: "zebraStripes", totalsRow: "totalsRow", pagerType: "pagerType", pageSize: "pageSize", pageIndex: "pageIndex", bufferAmount: "bufferAmount", scrollAnimationTime: "scrollAnimationTime", scrollDebounceTime: "scrollDebounceTime", scrollThrottlingTime: "scrollThrottlingTime", SEPARATOR: "SEPARATOR", useAsWebComponent: "useAsWebComponent" }, outputs: { itemClick: "itemClick", fieldClick: "fieldClick", valueChange: "valueChange", sortingChange: "sortingChange", selectedItemsChange: "selectedItemsChange", selectedItemChange: "selectedItemChange", selectAllClick: "selectAllClick", listLoad: "listLoad", loadItems: "loadItems", loadPage: "loadPage", startIndexChange: "startIndexChange" }, host: { listeners: { "window:resize": "onWinResize($event)" } }, viewQueries: [{ propertyName: "listContainerResizableElementRef", first: true, predicate: ["listContainerResizable"], descendants: true, read: ElementRef }, { propertyName: "virtualScroller", first: true, predicate: VirtualScrollerComponent, descendants: true }, { propertyName: "selectAllCB", first: true, predicate: ["selectAllCB"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"totalRows == 0\">\n <ng-container *ngIf=\"noDataFoundMsg; then noDataMsgInputBlock; else noDataMsgDefaultBlock\"></ng-container>\n <ng-template #noDataMsgInputBlock>\n <div class=\"pep-border-bottom\">\n <p class=\"title-xl no-data\">\n {{ noDataFoundMsg }}\n </p>\n </div>\n </ng-template>\n <ng-template #noDataMsgDefaultBlock>\n <div class=\"pep-border-bottom\">\n <p class=\"title-xl no-data\">\n {{ 'LIST.NO_DATA_FOUND' | translate}}\n </p>\n </div>\n <div class=\"no-data-suggestions\">\n <p class=\"suggestions-title title-lg\">\n {{ 'LIST.NO_DATA_FOUND_SUGGESTIONS_TITLE' | translate}}\n </p>\n <ul class=\"suggestions-list body-lg\" [innerHtml]=\"'LIST.NO_DATA_FOUND_SUGGESTIONS_LIST' | translate\"></ul>\n </div>\n </ng-template>\n</ng-container>\n<ng-container *ngIf=\"totalRows > 0\">\n <div class=\"list-container\">\n <div #listContainerResizable class=\"list-container-resizable\">\n <ng-container *ngTemplateOutlet=\"tableHeader\"></ng-container>\n\n <!-- (vsChildRectChange)=\"onChildRectChange($event)\" -->\n <!-- <virtual-scroller #scroller [items]=\"pagerType === 'pages' ? currentPageItems : items\"\n [scrollDebounceTime]=\"scrollDebounceTime\" [scrollThrottlingTime]=\"scrollThrottlingTime\"\n [bufferAmount]=\"printMode ? totalRows : bufferAmount\" [parentScroll]=\"parentScroll\" [disable]=\"loadingItemsFromApi\"\n class=\"virtual-scroller\" [ngClass]=\"{ 'table-body': isTable, 'cards-body': !isTable }\"\n (vsChange)=\"onVirtualScrollerChange($event)\" >\n <ng-container *ngFor=\"let item of scroller.viewPortItems; let index = index; let isFirst = first;\">\n <ng-container *ngTemplateOutlet=\"listData; context: {item: item, index:index}\"></ng-container>\n </ng-container>\n </virtual-scroller> -->\n \n <ng-container *ngTemplateOutlet=\"tableTotal\"></ng-container>\n </div>\n </div>\n <pep-list-pager *ngIf=\"pagerType === 'pages'\" class=\" list-pager\" [disabled]=\"loadingItemsFromApi\"\n [length]=\"totalRows\" [pageSize]=\"pageSize\" [pageIndex]=\"pageIndex\" (pagerChange)=\"onPagerChange($event)\">\n </pep-list-pager>\n</ng-container>\n\n<ng-template #listData let-item=\"item\" let-index=\"index\">\n <ng-container *ngIf=\"isTable\">\n <!-- getIsItemSelected(item) -> item | isItemSelected: selectionTypeForActions : selectedItemId : isAllSelected : selectedItems : unSelectedItems -->\n <div class=\"table-row\" (mouseenter)=\"onTableRowMouseEnter($event, item?.UID, item?.Type)\" (keydown)=\"onTabKeydown($event, item?.UID, item?.Type)\"\n (mouseleave)=\"onTableRowMouseLeave($event, item?.UID, item?.Type)\" [ngClass]=\"{\n 'compact-view': tableViewType === 'compact',\n even: zebraStripes && index % 2 !== 0,\n selected: getIsItemSelected(item),\n highlighted: item?.UID + SEPARATOR + item?.Type === selectedItemId}\" [ngStyle]=\"{ visibility: !loadingItemsFromApi || item ? 'visible' : 'hidden' }\">\n <fieldset class=\"table-row-fieldset\" [ngStyle]=\"{ 'background-color': item?.BackgroundColor }\">\n <mat-checkbox *ngIf=\"selectionTypeForActions == 'multi'\" type=\"checkbox\"\n class=\"pull-left flip row-selection\" [ngClass]=\"{ 'md': tableViewType === 'compact' }\"\n [disabled]=\"false && getisItemDisabled(item)\" [ngStyle]=\"{\n visibility: !deviceHasMouse ||\n item?.UID + SEPARATOR + item?.Type === hoveredItemId || isAllSelected || selectedItems.size > 0 ? 'visible' : 'hidden'\n }\" [checked]=\"getIsItemSelected(item)\"\n (change)=\"selectItemForActions($event, item?.UID, item?.IsSelectableForActions, item?.Type)\">\n </mat-checkbox>\n <mat-radio-button *ngIf=\"selectionTypeForActions == 'single'\" name=\"selection\"\n class=\"pull-left flip row-selection pep-radio-button\" [ngClass]=\"{ 'md': tableViewType === 'compact' }\"\n [disabled]=\"getisItemDisabled(item)\"\n [checked]=\"getIsItemSelected(item)\"\n (change)=\"selectItemForActions($event, item?.UID, item?.IsSelectableForActions, item?.Type)\">\n </mat-radio-button>\n <pep-form [layoutType]=\"'table'\" [checkForChanges]=\"checkForChanges\" [layout]=\"layout\"\n [firstFieldAsLink]=\"firstFieldAsLink\" [data]=\"item\" [canEditObject]=\"!disabled\"\n [lockEvents]=\"lockItemInnerEvents || printMode\" [isReport]=\"isReport\" [isActive]=\"\n (item?.UID + SEPARATOR + item?.Type === selectedItemId ||\n item?.UID + SEPARATOR + item?.Type === hoveredItemId) && deviceHasMouse\n \" (valueChange)=\"onValueChanged($event)\" (fieldClick)=\"onCustomizeFieldClick($event)\"\n (click)=\"itemClicked($event, item)\">\n </pep-form>\n </fieldset>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!isTable\">\n <div (mouseenter)=\"onCardMouseEnter($event, item?.UID, item?.Type)\"\n (mouseleave)=\"onCardMouseLeave($event, item?.UID, item?.Type)\" [ngClass]=\"{\n selected: getIsItemSelected(item),\n highlighted: item?.UID + SEPARATOR + item?.Type === selectedItemId,\n 'line-view': viewType === 'lines',\n 'card-view': viewType === 'cards',\n 'small-card': cardSize === 'sm'\n }\" class=\"pull-left flip\"\n [ngStyle]=\"{ height: calculatedObjectHeight, visibility: !loadingItemsFromApi || item ? 'visible' : 'hidden' }\">\n <mat-checkbox *ngIf=\"showCardSelection\" class=\"pull-left flip card-selection\"\n [disabled]=\"getisItemDisabled(item)\" [checked]=\"getIsItemSelected(item)\"\n (change)=\"selectItemForActions($event, item?.UID, item?.IsSelectableForActions, item?.Type)\">\n </mat-checkbox>\n <pep-form [layoutType]=\"'card'\" [firstFieldAsLink]=\"firstFieldAsLink\" [checkForChanges]=\"checkForChanges\"\n [layout]=\"layout\" [data]=\"item\" [canEditObject]=\"!disabled\"\n [lockEvents]=\"lockItemInnerEvents || printMode\" [isActive]=\"\n (item?.UID + SEPARATOR + item?.Type === selectedItemId ||\n item?.UID + SEPARATOR + item?.Type === hoveredItemId) && deviceHasMouse\n \" (valueChange)=\"onValueChanged($event)\" (fieldClick)=\"onCustomizeFieldClick($event)\"\n (click)=\"itemClicked($event, item)\">\n </pep-form>\n </div>\n </ng-container>\n</ng-template>\n\n<ng-template #tableHeader>\n <div *ngIf=\"isTable\" class=\"table-header\" (mouseup)=\"onListResizeEnd($event)\"\n (mouseenter)=\"onListHeaderMouseEnter($event)\" (mouseleave)=\"onListHeaderMouseLeave($event)\"\n (mousemove)=\"onListResize($event)\">\n\n <div class=\"table-header-padding-top\"></div>\n <fieldset class=\"table-header-fieldset\">\n <mat-checkbox *ngIf=\"selectionTypeForActions !== 'none'\" #selectAllCB class=\"pull-left flip row-selection\" [ngClass]=\"{ 'md': tableViewType === 'compact' }\"\n type=\"checkbox\" [ngStyle]=\"{\n visibility:\n selectionTypeForActions == 'single' || \n (selectionTypeForActions == 'multi' && hideAllSelectionInMulti) ? 'hidden' : 'visible'\n }\"\n [indeterminate]=\"isAllSelected ? unSelectedItems.size > 0 && unSelectedItems.size < totalRows : (selectedItems.size > 0 && !getIsAllSelectedForActions())\"\n [disabled]=\"disabled || selectionTypeForActions === 'single'\" [checked]=\"getIsAllSelectedForActions()\"\n (change)=\"selectAllItemsForActions($event)\"></mat-checkbox>\n <fieldset>\n <div *ngFor=\"let field of layout?.ControlFields; let j = index\" class=\"header-column pull-left flip\"\n [ngStyle]=\"{ width: field.calcTitleColumnWidthString }\" [ngClass]=\"{\n 'compact-view': tableViewType === 'compact',\n 'support-sorting': isSortableColumn(field.ApiName),\n 'has-sorting': field.ApiName === sortBy,\n 'is-resizing': field.ApiName === pressedColumn,\n 'is-first': j === 0 && selectionTypeForActions !== 'multi',\n 'is-last': j === layout?.ControlFields?.length - 1\n }\"\n (click)=\"isSortableColumn(field.ApiName) ? (onListSortingChange(field.ApiName, sortBy !== null && sortBy != field.ApiName ? true : !isAsc, $event)) : false\">\n\n <label id=\"{{ field.ApiName }}\"\n class=\"header-label body-sm pull-left flip text-align-{{ field.Layout.XAlignment }}\"\n title=\"{{ field.Title }}\">\n <span *ngIf=\"field.Mandatory\" class=\"mandatory\">\n <pep-icon name=\"system_must\"></pep-icon>\n </span>\n {{ field.Title != '' ? field.Title : ' '}}\n </label>\n\n <div *ngIf=\"supportResizing\" class=\"resize-box pull-right flip\"\n (mousedown)=\"onListResizeStart($event, field.ApiName, j)\">\n <div class=\"splitter\"></div>\n </div>\n\n <div *ngIf=\"isSortableColumn(field.ApiName)\" class=\"sorting-box pull-left flip\"\n [ngClass]=\"{ 'has-sorting': field.ApiName === sortBy }\">\n <mat-icon *ngIf=\"field.ApiName !== sortBy\">\n <pep-icon name=\"arrow_either\" class=\"asc\"></pep-icon>\n </mat-icon>\n <ng-container *ngIf=\"field.ApiName === sortBy\">\n <mat-icon *ngIf=\"!isAsc\" [ngClass]=\"{ 'sort-by': field.ApiName === sortBy && isAsc }\"\n title=\"{{ 'LIST.SORT_ASC' | translate }}\">\n <pep-icon name=\"arrow_up\" class=\"asc\"></pep-icon>\n </mat-icon>\n <mat-icon *ngIf=\"isAsc\" [ngClass]=\"{ 'sort-by': field.ApiName === sortBy && !isAsc }\"\n title=\"{{ 'LIST.SORT_DESC' | translate }}\">\n <pep-icon name=\"arrow_down\" class=\"desc\"></pep-icon>\n </mat-icon>\n </ng-container>\n </div>\n </div>\n </fieldset>\n </fieldset>\n </div>\n</ng-template>\n\n<ng-template #tableTotal>\n <div *ngIf=\"isTable && totalsRow?.length > 0 && totalsRow.length <= layout?.ControlFields.length\"\n class=\"table-total\">\n <fieldset class=\"table-header-fieldset\">\n <div *ngFor=\"let field of layout?.ControlFields; let j = index\" class=\"total-column pull-left flip\"\n [ngStyle]=\"{ width: field.calcTitleColumnWidthString }\">\n <label class=\"total-label body-sm text-align-{{ field.Layout.XAlignment }}\">\n {{ totalsRow[j] }}\n </label>\n </div>\n </fieldset>\n </div>\n</ng-template>", styles: [":host{width:100%;height:inherit;display:flex;flex-direction:column}:host .list-container{display:flex;flex-direction:column;height:inherit;width:100%;overflow:auto}:host .list-container .list-container-resizable{display:flex;flex-direction:column;height:inherit}.no-data{margin:var(--pep-spacing-2xl, 2rem) 0}.no-data-suggestions .suggestions-title{margin:var(--pep-spacing-lg, 1rem) 0 var(--pep-spacing-sm, .5rem)}.no-data-suggestions .suggestions-list{margin:0;padding:0;padding-inline-start:var(--pep-spacing-2xl, 2rem)}.virtual-scroller{min-height:5rem;height:inherit}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i4$1.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5.PepIconComponent, selector: "pep-icon", inputs: ["spin", "name", "fill"] }, { kind: "component", type: i7.PepFormComponent, selector: "pep-form", inputs: ["isInternal", "isReport", "layout", "lockEvents", "canEditObject", "data", "lockFields", "isActive", "layoutType", "objectId", "parentId", "searchCode", "showTitle", "firstFieldAsLink", "checkForChanges"], outputs: ["valueChange", "formValidationChange", "fieldClick", "internalFormFieldClick", "internalFormFieldChange"] }, { kind: "component", type: PepListPagerComponent, selector: "pep-list-pager", inputs: ["disabled", "pageIndex", "length", "pageSize"], outputs: ["pagerChange"] }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }] });
|
|
1437
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PepListComponent, selector: "pep-list", inputs: { sorting: "sorting", cacheSize: "cacheSize", noDataFoundMsg: "noDataFoundMsg", selectionTypeForActions: "selectionTypeForActions", showCardSelection: "showCardSelection", hideAllSelectionInMulti: "hideAllSelectionInMulti", cardSize: "cardSize", tableViewType: "tableViewType", viewType: "viewType", firstFieldAsLink: "firstFieldAsLink", supportSorting: "supportSorting", supportSortingFields: "supportSortingFields", supportResizing: "supportResizing", parentScroll: "parentScroll", disabled: "disabled", lockEvents: "lockEvents", lockItemInnerEvents: "lockItemInnerEvents", printMode: "printMode", isReport: "isReport", zebraStripes: "zebraStripes", totalsRow: "totalsRow", pagerType: "pagerType", pageSize: "pageSize", pageIndex: "pageIndex", bufferAmount: "bufferAmount", scrollAnimationTime: "scrollAnimationTime", scrollDebounceTime: "scrollDebounceTime", scrollThrottlingTime: "scrollThrottlingTime", SEPARATOR: "SEPARATOR", useAsWebComponent: "useAsWebComponent" }, outputs: { itemClick: "itemClick", fieldClick: "fieldClick", valueChange: "valueChange", sortingChange: "sortingChange", selectedItemsChange: "selectedItemsChange", selectedItemChange: "selectedItemChange", selectAllClick: "selectAllClick", listLoad: "listLoad", loadItems: "loadItems", loadPage: "loadPage", startIndexChange: "startIndexChange" }, host: { listeners: { "window:resize": "onWinResize($event)" } }, viewQueries: [{ propertyName: "listContainerResizableElementRef", first: true, predicate: ["listContainerResizable"], descendants: true, read: ElementRef }, { propertyName: "selectAllCB", first: true, predicate: ["selectAllCB"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"totalRows == 0\">\n <ng-container *ngIf=\"noDataFoundMsg; then noDataMsgInputBlock; else noDataMsgDefaultBlock\"></ng-container>\n <ng-template #noDataMsgInputBlock>\n <div class=\"pep-border-bottom\">\n <p class=\"title-xl no-data\">\n {{ noDataFoundMsg }}\n </p>\n </div>\n </ng-template>\n <ng-template #noDataMsgDefaultBlock>\n <div class=\"pep-border-bottom\">\n <p class=\"title-xl no-data\">\n {{ 'LIST.NO_DATA_FOUND' | translate}}\n </p>\n </div>\n <div class=\"no-data-suggestions\">\n <p class=\"suggestions-title title-lg\">\n {{ 'LIST.NO_DATA_FOUND_SUGGESTIONS_TITLE' | translate}}\n </p>\n <ul class=\"suggestions-list body-lg\" [innerHtml]=\"'LIST.NO_DATA_FOUND_SUGGESTIONS_LIST' | translate\"></ul>\n </div>\n </ng-template>\n</ng-container>\n<ng-container *ngIf=\"totalRows > 0\">\n <div class=\"list-container\">\n <div #listContainerResizable class=\"list-container-resizable\">\n <ng-container *ngTemplateOutlet=\"tableHeader\"></ng-container>\n\n <!-- (vsChildRectChange)=\"onChildRectChange($event)\" -->\n <!-- <virtual-scroller #scroller [items]=\"pagerType === 'pages' ? currentPageItems : items\"\n [scrollDebounceTime]=\"scrollDebounceTime\" [scrollThrottlingTime]=\"scrollThrottlingTime\"\n [bufferAmount]=\"printMode ? totalRows : bufferAmount\" [parentScroll]=\"parentScroll\" [disable]=\"loadingItemsFromApi\"\n class=\"virtual-scroller\" [ngClass]=\"{ 'table-body': isTable, 'cards-body': !isTable }\"\n (vsChange)=\"onVirtualScrollerChange($event)\" >\n <ng-container *ngFor=\"let item of scroller.viewPortItems; let index = index; let isFirst = first;\">\n <ng-container *ngTemplateOutlet=\"listData; context: {item: item, index:index}\"></ng-container>\n </ng-container>\n </virtual-scroller> -->\n \n <ng-container *ngTemplateOutlet=\"tableTotal\"></ng-container>\n </div>\n </div>\n <pep-list-pager *ngIf=\"pagerType === 'pages'\" class=\" list-pager\" [disabled]=\"loadingItemsFromApi\"\n [length]=\"totalRows\" [pageSize]=\"pageSize\" [pageIndex]=\"pageIndex\" (pagerChange)=\"onPagerChange($event)\">\n </pep-list-pager>\n</ng-container>\n\n<ng-template #listData let-item=\"item\" let-index=\"index\">\n <ng-container *ngIf=\"isTable\">\n <!-- getIsItemSelected(item) -> item | isItemSelected: selectionTypeForActions : selectedItemId : isAllSelected : selectedItems : unSelectedItems -->\n <div class=\"table-row\" (mouseenter)=\"onTableRowMouseEnter($event, item?.UID, item?.Type)\" (keydown)=\"onTabKeydown($event, item?.UID, item?.Type)\"\n (mouseleave)=\"onTableRowMouseLeave($event, item?.UID, item?.Type)\" [ngClass]=\"{\n 'compact-view': tableViewType === 'compact',\n even: zebraStripes && index % 2 !== 0,\n selected: getIsItemSelected(item),\n highlighted: item?.UID + SEPARATOR + item?.Type === selectedItemId}\" [ngStyle]=\"{ visibility: !loadingItemsFromApi || item ? 'visible' : 'hidden' }\">\n <fieldset class=\"table-row-fieldset\" [ngStyle]=\"{ 'background-color': item?.BackgroundColor }\">\n <mat-checkbox *ngIf=\"selectionTypeForActions == 'multi'\" type=\"checkbox\"\n class=\"pull-left flip row-selection\" [ngClass]=\"{ 'md': tableViewType === 'compact' }\"\n [disabled]=\"false && getisItemDisabled(item)\" [ngStyle]=\"{\n visibility: !deviceHasMouse ||\n item?.UID + SEPARATOR + item?.Type === hoveredItemId || isAllSelected || selectedItems.size > 0 ? 'visible' : 'hidden'\n }\" [checked]=\"getIsItemSelected(item)\"\n (change)=\"selectItemForActions($event, item?.UID, item?.IsSelectableForActions, item?.Type)\">\n </mat-checkbox>\n <mat-radio-button *ngIf=\"selectionTypeForActions == 'single'\" name=\"selection\"\n class=\"pull-left flip row-selection pep-radio-button\" [ngClass]=\"{ 'md': tableViewType === 'compact' }\"\n [disabled]=\"getisItemDisabled(item)\"\n [checked]=\"getIsItemSelected(item)\"\n (change)=\"selectItemForActions($event, item?.UID, item?.IsSelectableForActions, item?.Type)\">\n </mat-radio-button>\n <pep-form [layoutType]=\"'table'\" [checkForChanges]=\"checkForChanges\" [layout]=\"layout\"\n [firstFieldAsLink]=\"firstFieldAsLink\" [data]=\"item\" [canEditObject]=\"!disabled\"\n [lockEvents]=\"lockItemInnerEvents || printMode\" [isReport]=\"isReport\" [isActive]=\"\n (item?.UID + SEPARATOR + item?.Type === selectedItemId ||\n item?.UID + SEPARATOR + item?.Type === hoveredItemId) && deviceHasMouse\n \" (valueChange)=\"onValueChanged($event)\" (fieldClick)=\"onCustomizeFieldClick($event)\"\n (click)=\"itemClicked($event, item)\">\n </pep-form>\n </fieldset>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!isTable\">\n <div (mouseenter)=\"onCardMouseEnter($event, item?.UID, item?.Type)\"\n (mouseleave)=\"onCardMouseLeave($event, item?.UID, item?.Type)\" [ngClass]=\"{\n selected: getIsItemSelected(item),\n highlighted: item?.UID + SEPARATOR + item?.Type === selectedItemId,\n 'line-view': viewType === 'lines',\n 'card-view': viewType === 'cards',\n 'small-card': cardSize === 'sm'\n }\" class=\"pull-left flip\"\n [ngStyle]=\"{ height: calculatedObjectHeight, visibility: !loadingItemsFromApi || item ? 'visible' : 'hidden' }\">\n <mat-checkbox *ngIf=\"showCardSelection\" class=\"pull-left flip card-selection\"\n [disabled]=\"getisItemDisabled(item)\" [checked]=\"getIsItemSelected(item)\"\n (change)=\"selectItemForActions($event, item?.UID, item?.IsSelectableForActions, item?.Type)\">\n </mat-checkbox>\n <pep-form [layoutType]=\"'card'\" [firstFieldAsLink]=\"firstFieldAsLink\" [checkForChanges]=\"checkForChanges\"\n [layout]=\"layout\" [data]=\"item\" [canEditObject]=\"!disabled\"\n [lockEvents]=\"lockItemInnerEvents || printMode\" [isActive]=\"\n (item?.UID + SEPARATOR + item?.Type === selectedItemId ||\n item?.UID + SEPARATOR + item?.Type === hoveredItemId) && deviceHasMouse\n \" (valueChange)=\"onValueChanged($event)\" (fieldClick)=\"onCustomizeFieldClick($event)\"\n (click)=\"itemClicked($event, item)\">\n </pep-form>\n </div>\n </ng-container>\n</ng-template>\n\n<ng-template #tableHeader>\n <div *ngIf=\"isTable\" class=\"table-header\" (mouseup)=\"onListResizeEnd($event)\"\n (mouseenter)=\"onListHeaderMouseEnter($event)\" (mouseleave)=\"onListHeaderMouseLeave($event)\"\n (mousemove)=\"onListResize($event)\">\n\n <div class=\"table-header-padding-top\"></div>\n <fieldset class=\"table-header-fieldset\">\n <mat-checkbox *ngIf=\"selectionTypeForActions !== 'none'\" #selectAllCB class=\"pull-left flip row-selection\" [ngClass]=\"{ 'md': tableViewType === 'compact' }\"\n type=\"checkbox\" [ngStyle]=\"{\n visibility:\n selectionTypeForActions == 'single' || \n (selectionTypeForActions == 'multi' && hideAllSelectionInMulti) ? 'hidden' : 'visible'\n }\"\n [indeterminate]=\"isAllSelected ? unSelectedItems.size > 0 && unSelectedItems.size < totalRows : (selectedItems.size > 0 && !getIsAllSelectedForActions())\"\n [disabled]=\"disabled || selectionTypeForActions === 'single'\" [checked]=\"getIsAllSelectedForActions()\"\n (change)=\"selectAllItemsForActions($event)\"></mat-checkbox>\n <fieldset>\n <div *ngFor=\"let field of layout?.ControlFields; let j = index\" class=\"header-column pull-left flip\"\n [ngStyle]=\"{ width: field.calcTitleColumnWidthString }\" [ngClass]=\"{\n 'compact-view': tableViewType === 'compact',\n 'support-sorting': isSortableColumn(field.ApiName),\n 'has-sorting': field.ApiName === sortBy,\n 'is-resizing': field.ApiName === pressedColumn,\n 'is-first': j === 0 && selectionTypeForActions !== 'multi',\n 'is-last': j === layout?.ControlFields?.length - 1\n }\"\n (click)=\"isSortableColumn(field.ApiName) ? (onListSortingChange(field.ApiName, sortBy !== null && sortBy != field.ApiName ? true : !isAsc, $event)) : false\">\n\n <label id=\"{{ field.ApiName }}\"\n class=\"header-label body-sm pull-left flip text-align-{{ field.Layout.XAlignment }}\"\n title=\"{{ field.Title }}\">\n <span *ngIf=\"field.Mandatory\" class=\"mandatory\">\n <pep-icon name=\"system_must\"></pep-icon>\n </span>\n {{ field.Title != '' ? field.Title : ' '}}\n </label>\n\n <div *ngIf=\"supportResizing\" class=\"resize-box pull-right flip\"\n (mousedown)=\"onListResizeStart($event, field.ApiName, j)\">\n <div class=\"splitter\"></div>\n </div>\n\n <div *ngIf=\"isSortableColumn(field.ApiName)\" class=\"sorting-box pull-left flip\"\n [ngClass]=\"{ 'has-sorting': field.ApiName === sortBy }\">\n <mat-icon *ngIf=\"field.ApiName !== sortBy\">\n <pep-icon name=\"arrow_either\" class=\"asc\"></pep-icon>\n </mat-icon>\n <ng-container *ngIf=\"field.ApiName === sortBy\">\n <mat-icon *ngIf=\"!isAsc\" [ngClass]=\"{ 'sort-by': field.ApiName === sortBy && isAsc }\"\n title=\"{{ 'LIST.SORT_ASC' | translate }}\">\n <pep-icon name=\"arrow_up\" class=\"asc\"></pep-icon>\n </mat-icon>\n <mat-icon *ngIf=\"isAsc\" [ngClass]=\"{ 'sort-by': field.ApiName === sortBy && !isAsc }\"\n title=\"{{ 'LIST.SORT_DESC' | translate }}\">\n <pep-icon name=\"arrow_down\" class=\"desc\"></pep-icon>\n </mat-icon>\n </ng-container>\n </div>\n </div>\n </fieldset>\n </fieldset>\n </div>\n</ng-template>\n\n<ng-template #tableTotal>\n <div *ngIf=\"isTable && totalsRow?.length > 0 && totalsRow.length <= layout?.ControlFields.length\"\n class=\"table-total\">\n <fieldset class=\"table-header-fieldset\">\n <div *ngFor=\"let field of layout?.ControlFields; let j = index\" class=\"total-column pull-left flip\"\n [ngStyle]=\"{ width: field.calcTitleColumnWidthString }\">\n <label class=\"total-label body-sm text-align-{{ field.Layout.XAlignment }}\">\n {{ totalsRow[j] }}\n </label>\n </div>\n </fieldset>\n </div>\n</ng-template>", styles: [":host{width:100%;height:inherit;display:flex;flex-direction:column}:host .list-container{display:flex;flex-direction:column;height:inherit;width:100%;overflow:auto}:host .list-container .list-container-resizable{display:flex;flex-direction:column;height:inherit}.no-data{margin:var(--pep-spacing-2xl, 2rem) 0}.no-data-suggestions .suggestions-title{margin:var(--pep-spacing-lg, 1rem) 0 var(--pep-spacing-sm, .5rem)}.no-data-suggestions .suggestions-list{margin:0;padding:0;padding-inline-start:var(--pep-spacing-2xl, 2rem)}.virtual-scroller{min-height:5rem;height:inherit}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i4$1.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5.PepIconComponent, selector: "pep-icon", inputs: ["spin", "name", "fill"] }, { kind: "component", type: i7.PepFormComponent, selector: "pep-form", inputs: ["isInternal", "isReport", "layout", "lockEvents", "canEditObject", "data", "lockFields", "isActive", "layoutType", "objectId", "parentId", "searchCode", "showTitle", "firstFieldAsLink", "checkForChanges"], outputs: ["valueChange", "formValidationChange", "fieldClick", "internalFormFieldClick", "internalFormFieldChange"] }, { kind: "component", type: PepListPagerComponent, selector: "pep-list-pager", inputs: ["disabled", "pageIndex", "length", "pageSize"], outputs: ["pagerChange"] }, { kind: "pipe", type: i2$1.TranslatePipe, name: "translate" }] });
|
|
2554
1438
|
}
|
|
2555
1439
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PepListComponent, decorators: [{
|
|
2556
1440
|
type: Component,
|
|
@@ -2642,9 +1526,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
2642
1526
|
type: Output
|
|
2643
1527
|
}], startIndexChange: [{
|
|
2644
1528
|
type: Output
|
|
2645
|
-
}], virtualScroller: [{
|
|
2646
|
-
type: ViewChild,
|
|
2647
|
-
args: [VirtualScrollerComponent]
|
|
2648
1529
|
}], selectAllCB: [{
|
|
2649
1530
|
type: ViewChild,
|
|
2650
1531
|
args: ['selectAllCB']
|