@pepperi/lib
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.1.
943 lines (937 loc) • 138 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/material/core'), require('@angular/material/checkbox'), require('@angular/material/radio'), require('@angular/material/icon'), require('@pepperi/lib'), require('@pepperi/lib/icon'), require('@pepperi/lib/form'), require('@tweenjs/tween.js'), require('rxjs/operators'), require('disable-scroll'), require('jquery'), require('@ngx-translate/core')) :
typeof define === 'function' && define.amd ? define('@pepperi/lib/list', ['exports', '@angular/core', '@angular/common', '@angular/material/core', '@angular/material/checkbox', '@angular/material/radio', '@angular/material/icon', '@pepperi/lib', '@pepperi/lib/icon', '@pepperi/lib/form', '@tweenjs/tween.js', 'rxjs/operators', 'disable-scroll', 'jquery', '@ngx-translate/core'], factory) :
(global = global || self, factory((global.pepperi = global.pepperi || {}, global.pepperi.lib = global.pepperi.lib || {}, global.pepperi.lib.list = {}), global.ng.core, global.ng.common, global.ng.material.core, global.ng.material.checkbox, global.ng.material.radio, global.ng.material.icon, global.pepperi.lib, global.pepperi.lib.icon, global.pepperi.lib.form, global.tween, global.rxjs.operators, global['disable-scroll'], global.jquery, global.translate));
}(this, (function (exports, i0, i2, core, i3, i8, i4, i1, i1$1, i7, tween, operators, disableScroll, $, i9) { 'use strict';
disableScroll = disableScroll && Object.prototype.hasOwnProperty.call(disableScroll, 'default') ? disableScroll['default'] : disableScroll;
var _c0 = ["container"];
var _c1 = ["content"];
var _c2 = ["shim"];
var _c3 = ["*"];
var VirtualScrollComponent = /** @class */ (function () {
function VirtualScrollComponent(element, renderer, zone) {
var _this = this;
this.element = element;
this.renderer = renderer;
this.zone = zone;
//@Input()
//items: any[] = [];
this.totalRows = 0;
this.bufferAmount = 0;
this.scrollAnimationTime = 1500;
this.doNotCheckAngularZone = false;
this.refreshHandler = function () {
_this.refresh(true);
};
this.isTable = false;
//@Output()
//update: EventEmitter<any[]> = new EventEmitter<any[]>();
//viewPortItems: any[];
this.change = new i0.EventEmitter();
this.load = new i0.EventEmitter();
this.start = new i0.EventEmitter();
this.end = new i0.EventEmitter();
this.startupLoop = true;
/** Cache of the last scroll height to prevent setting CSS when not needed. */
this.lastScrollHeight = -1;
/** Cache of the last top padding to prevent setting CSS when not needed. */
this.lastTopPadding = -1;
}
Object.defineProperty(VirtualScrollComponent.prototype, "parentScroll", {
get: function () {
return this._parentScroll;
},
set: function (element) {
if (this._parentScroll === element) {
return;
}
this._parentScroll = element;
this.addParentEventHandlers(this._parentScroll);
},
enumerable: false,
configurable: true
});
VirtualScrollComponent.prototype.ngOnInit = function () {
this.scrollbarWidth = 0; // this.element.nativeElement.offsetWidth - this.element.nativeElement.clientWidth;
this.scrollbarHeight = 0; // this.element.nativeElement.offsetHeight - this.element.nativeElement.clientHeight;
if (!this.parentScroll) {
this.addParentEventHandlers(this.element.nativeElement);
}
};
VirtualScrollComponent.prototype.ngOnDestroy = function () {
this.removeParentEventHandlers();
};
VirtualScrollComponent.prototype.ngOnChanges = function (changes) {
this.previousStart = undefined;
this.previousEnd = undefined;
var totalRows = changes.totalRows || {};
if ((changes.totalRows !== undefined && totalRows.previousValue === undefined) ||
totalRows.previousValue !== undefined) {
this.startupLoop = true;
}
var ieVer = this.detectIE();
var headerRowHeight = '34px';
// Set padding top for the table view because the header row.
//this.renderer.setStyle(this.contentElementRef.nativeElement, 'padding-top', this.isTable ? headerRowHeight : '0');
if (!ieVer || ieVer >= 16) {
// not IE and version < 16
this.renderer.setStyle(this.element.nativeElement, 'top', '0');
}
else {
this.renderer.setStyle(this.element.nativeElement, 'top', headerRowHeight);
}
//Only for IE browsers
/* let ua = navigator.userAgent;
if (this.isTable && (ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0 || ua.indexOf('Edge/') >= 0)) {
this.renderer.setStyle(this.element.nativeElement, 'top', headerRowHeight);
}
else {
this.renderer.setStyle(this.element.nativeElement, 'top', '0');
}*/
this.refresh();
};
VirtualScrollComponent.prototype.detectIE = function () {
var ua = window.navigator.userAgent;
// Test values; Uncomment to check result …
// IE 10
// ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';
// IE 11
// ua = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko';
// Edge 12 (Spartan)
// ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0';
// Edge 13
// ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586';
var msie = ua.indexOf('MSIE ');
if (msie > 0) {
// IE 10 or older => return version number
return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
}
var trident = ua.indexOf('Trident/');
if (trident > 0) {
// IE 11 => return version number
var rv = ua.indexOf('rv:');
return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
}
var edge = ua.indexOf('Edge/');
if (edge > 0) {
// Edge (IE 12+) => return version number
return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
}
// other browser
return false;
};
VirtualScrollComponent.prototype.refresh = function (forceViewportUpdate) {
var _this = this;
if (forceViewportUpdate === void 0) { forceViewportUpdate = false; }
this.zone.runOutsideAngular(function () {
requestAnimationFrame(function () { return _this.calculateItems(forceViewportUpdate); });
});
};
VirtualScrollComponent.prototype.scrollInto = function (index) {
var _this = this;
var el = this.parentScroll instanceof Window ? document.body : this.parentScroll || this.element.nativeElement;
var offsetTop = this.getElementsOffset();
//let index: number = (this.items || []).indexOf(item);
if (index < 0 || index >= this.totalRows)
return;
var d = this.calculateDimensions();
var scrollTop = Math.floor(index / d.itemsPerRow) * d.childHeight - d.childHeight * Math.min(index, this.bufferAmount);
var animationRequest;
if (this.currentTween !== undefined) {
this.currentTween.stop();
}
// totally disable animate
if (!this.scrollAnimationTime) {
el.scrollTop = scrollTop;
return;
}
this.currentTween = new tween.Tween({ scrollTop: el.scrollTop })
.to({ scrollTop: scrollTop }, this.scrollAnimationTime)
.easing(tween.Easing.Quadratic.Out)
.onUpdate(function (data) {
if (isNaN(data.scrollTop)) {
return;
}
_this.renderer.setProperty(el, 'scrollTop', data.scrollTop);
_this.refresh(true);
})
.onStop(function () {
cancelAnimationFrame(animationRequest);
})
.start();
var animate = function (time) {
_this.currentTween.update(time);
if (_this.currentTween._object.scrollTop !== scrollTop) {
_this.zone.runOutsideAngular(function () {
animationRequest = requestAnimationFrame(animate);
});
}
};
animate();
};
VirtualScrollComponent.prototype.addParentEventHandlers = function (parentScroll) {
var _this = this;
this.removeParentEventHandlers();
if (parentScroll) {
this.zone.runOutsideAngular(function () {
_this.disposeScrollHandler = _this.renderer.listen(parentScroll, 'mousewheel', _.throttle(_this.refreshHandler, 20, { leading: false, trailing: true }));
_this.renderer.listen(parentScroll, 'scroll', _.debounce(_this.refreshHandler, 150));
//this.renderer.listen(parentScroll, 'scroll', _.debounce(_.throttle(this.refreshHandler, 150), 50));
if (parentScroll instanceof Window) {
_this.disposeScrollHandler = _this.renderer.listen('window', 'resize', _.debounce(_this.refreshHandler, 250));
}
});
}
};
VirtualScrollComponent.prototype.removeParentEventHandlers = function () {
if (this.disposeScrollHandler) {
this.disposeScrollHandler();
this.disposeScrollHandler = undefined;
}
if (this.disposeResizeHandler) {
this.disposeResizeHandler();
this.disposeResizeHandler = undefined;
}
};
VirtualScrollComponent.prototype.countItemsPerRow = function () {
var offsetTop;
var itemsPerRow;
var children = this.contentElementRef.nativeElement.children;
for (itemsPerRow = 0; itemsPerRow < children.length; itemsPerRow++) {
if (offsetTop != undefined && offsetTop !== children[itemsPerRow].offsetTop)
break;
offsetTop = children[itemsPerRow].offsetTop;
}
return itemsPerRow;
};
VirtualScrollComponent.prototype.getElementsOffset = function () {
var offsetTop = 0;
if (this.containerElementRef && this.containerElementRef.nativeElement) {
offsetTop += this.containerElementRef.nativeElement.offsetTop;
}
if (this.parentScroll) {
offsetTop += this.element.nativeElement.offsetTop;
}
return offsetTop;
};
VirtualScrollComponent.prototype.calculateDimensions = function () {
var el = this.parentScroll instanceof Window ? document.body : this.parentScroll || this.element.nativeElement;
var itemCount = this.totalRows;
var viewWidth = el.clientWidth - this.scrollbarWidth;
var viewHeight = el.clientHeight - this.scrollbarHeight;
var contentDimensions;
if (this.childWidth == undefined || this.childHeight == undefined) {
var content = this.contentElementRef.nativeElement;
if (this.containerElementRef && this.containerElementRef.nativeElement) {
content = this.containerElementRef.nativeElement;
}
contentDimensions = content.children[0]
? content.children[0].getBoundingClientRect()
: {
width: viewWidth,
height: viewHeight
};
}
var childWidth = this.childWidth || contentDimensions.width;
var childHeight = this.childHeight || contentDimensions.height;
var itemsPerRow = Math.max(1, this.countItemsPerRow());
var itemsPerRowByCalc = Math.max(1, Math.floor(viewWidth / childWidth));
var itemsPerCol = Math.max(1, Math.floor(viewHeight / childHeight));
var elScrollTop = this.parentScroll instanceof Window ? window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0 : el.scrollTop;
var scrollTop = Math.max(0, elScrollTop);
var scrollHeight = childHeight * Math.floor(itemCount / itemsPerRow) + (itemCount % itemsPerRow != 0 ? childHeight : 0);
var ua = navigator.userAgent;
/*if (this.isTable && (ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0 || ua.indexOf('Edge/') >= 0)) {
scrollHeight += 34;
}*/
if (itemsPerCol === 1 && Math.floor((scrollTop / scrollHeight) * itemCount) + itemsPerRowByCalc >= itemCount) {
itemsPerRow = itemsPerRowByCalc;
}
if (scrollHeight !== this.lastScrollHeight) {
this.renderer.setStyle(this.shimElementRef.nativeElement, 'height', scrollHeight + "px");
this.lastScrollHeight = scrollHeight;
}
return {
itemCount: itemCount,
viewWidth: viewWidth,
viewHeight: viewHeight,
childWidth: childWidth,
childHeight: childHeight,
itemsPerRow: itemsPerRow,
itemsPerCol: itemsPerCol,
itemsPerRowByCalc: itemsPerRowByCalc,
scrollHeight: scrollHeight
};
};
VirtualScrollComponent.prototype.calculateItems = function (forceViewportUpdate) {
var _this = this;
if (forceViewportUpdate === void 0) { forceViewportUpdate = false; }
if (!this.doNotCheckAngularZone) {
i0.NgZone.assertNotInAngularZone();
}
var el = this.parentScroll instanceof Window ? document.body : this.parentScroll || this.element.nativeElement;
var d = this.calculateDimensions();
//let items = this.items || [];
var offsetTop = this.getElementsOffset();
var elScrollTop = this.parentScroll instanceof Window ? window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0 : el.scrollTop;
if (elScrollTop > d.scrollHeight) {
elScrollTop = d.scrollHeight + offsetTop;
}
var scrollTop = Math.max(0, elScrollTop - offsetTop);
var indexByScrollTop = ((scrollTop / d.scrollHeight) * d.itemCount) / d.itemsPerRow;
var end = Math.min(d.itemCount, Math.ceil(indexByScrollTop) * d.itemsPerRow + d.itemsPerRow * (d.itemsPerCol + 1));
var maxStartEnd = end;
var modEnd = end % d.itemsPerRow;
if (modEnd) {
maxStartEnd = end + d.itemsPerRow - modEnd;
}
var maxStart = Math.max(0, maxStartEnd - d.itemsPerCol * d.itemsPerRow - d.itemsPerRow);
var start = Math.min(maxStart, Math.floor(indexByScrollTop) * d.itemsPerRow);
var startRow = Math.ceil(start / d.itemsPerRow);
var topPadding = this.totalRows === 0 ? 0 : d.childHeight * startRow - d.childHeight * Math.min(startRow, this.bufferAmount);
if (topPadding !== this.lastTopPadding) {
this.renderer.setStyle(this.contentElementRef.nativeElement, 'transform', "translateY(" + topPadding + "px)");
this.renderer.setStyle(this.contentElementRef.nativeElement, 'webkitTransform', "translateY(" + topPadding + "px)");
this.lastTopPadding = topPadding;
}
var buffer = this.bufferAmount * d.itemsPerRow;
start = !isNaN(start) ? start : -1;
end = !isNaN(end) ? end : -1;
start -= buffer;
start = Math.max(0, start);
end += buffer;
end = Math.min(this.totalRows, end);
if (start !== this.previousStart || end !== this.previousEnd || forceViewportUpdate === true) {
this.zone.run(function () {
// update the scroll list
end = end >= 0 ? end : 0; // To prevent from accidentally selecting the entire array with a negative 1 (-1) in the end position.
//this.viewPortItems = this.items.slice(start, end);
//this.update.emit(this.viewPortItems);
// emit 'start' event
//if (start !== this.previousStart && this.startupLoop === false) {
// this.start.emit({ start, end });
//}
// emit 'end' event
//if (end !== this.previousEnd && this.startupLoop === false) {
// this.end.emit({ start, end });
//}
// To know if to add at the start of the list or at the end.
var addAtStart = _this.previousEnd >= end;
_this.previousStart = start;
_this.previousEnd = end;
if (_this.startupLoop === true) {
_this.refresh();
}
else {
var calculatedChildHeight = d.childHeight;
_this.change.emit({ start: start, end: end, addAtStart: addAtStart, calculatedChildHeight: calculatedChildHeight });
}
});
}
else if (this.startupLoop === true) {
this.startupLoop = false;
// Added to know when the scroll is ready (UI elements are displayed already).
this.load.emit();
this.refresh();
}
};
return VirtualScrollComponent;
}());
VirtualScrollComponent.ɵfac = function VirtualScrollComponent_Factory(t) { return new (t || VirtualScrollComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.NgZone)); };
VirtualScrollComponent.ɵcmp = i0.ɵɵdefineComponent({ type: VirtualScrollComponent, selectors: [["virtual-scroll"], ["", "virtualScroll", ""]], contentQueries: function VirtualScrollComponent_ContentQueries(rf, ctx, dirIndex) {
if (rf & 1) {
i0.ɵɵcontentQuery(dirIndex, _c0, true);
}
if (rf & 2) {
var _t;
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.containerElementRef = _t.first);
}
}, viewQuery: function VirtualScrollComponent_Query(rf, ctx) {
if (rf & 1) {
i0.ɵɵviewQuery(_c1, true, i0.ElementRef);
i0.ɵɵviewQuery(_c2, true, i0.ElementRef);
}
if (rf & 2) {
var _t;
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.contentElementRef = _t.first);
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.shimElementRef = _t.first);
}
}, hostVars: 2, hostBindings: function VirtualScrollComponent_HostBindings(rf, ctx) {
if (rf & 2) {
i0.ɵɵstyleProp("overflow-y", ctx.parentScroll ? "hidden" : "auto");
}
}, inputs: { totalRows: "totalRows", scrollbarWidth: "scrollbarWidth", scrollbarHeight: "scrollbarHeight", childWidth: "childWidth", childHeight: "childHeight", bufferAmount: "bufferAmount", scrollAnimationTime: "scrollAnimationTime", doNotCheckAngularZone: "doNotCheckAngularZone", parentScroll: "parentScroll", isTable: "isTable" }, outputs: { change: "change", load: "load", start: "start", end: "end" }, exportAs: ["virtualScroll"], features: [i0.ɵɵNgOnChangesFeature], ngContentSelectors: _c3, decls: 5, vars: 0, consts: [[1, "total-padding"], ["shim", ""], [1, "scrollable-content"], ["content", ""]], template: function VirtualScrollComponent_Template(rf, ctx) {
if (rf & 1) {
i0.ɵɵprojectionDef();
i0.ɵɵelement(0, "div", 0, 1);
i0.ɵɵelementStart(2, "div", 2, 3);
i0.ɵɵprojection(4);
i0.ɵɵelementEnd();
}
}, styles: ["[_nghost-%COMP%] {\n overflow: hidden;\n position: relative;\n display: block;\n -webkit-overflow-scrolling: touch;\n }\n .scrollable-content[_ngcontent-%COMP%] {\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n position: absolute;\n // z-index:495;\n }\n .total-padding[_ngcontent-%COMP%] {\n width: 1px;\n opacity: 0;\n }\n\n .rtl[_ngcontent-%COMP%] {\n .scrollable-content {\n left: unset;\n right: 0;\n }\n }"] });
/*@__PURE__*/ (function () {
i0.ɵsetClassMetadata(VirtualScrollComponent, [{
type: i0.Component,
args: [{
selector: 'virtual-scroll,[virtualScroll]',
exportAs: 'virtualScroll',
template: "\n <div class=\"total-padding\" #shim></div>\n <div class=\"scrollable-content\" #content>\n <ng-content></ng-content>\n </div>\n ",
host: {
'[style.overflow-y]': "parentScroll ? 'hidden' : 'auto'"
},
styles: [
"\n :host {\n overflow: hidden;\n position: relative;\n display: block;\n -webkit-overflow-scrolling: touch;\n }\n .scrollable-content {\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n position: absolute;\n // z-index:495;\n }\n .total-padding {\n width: 1px;\n opacity: 0;\n }\n\n .rtl {\n .scrollable-content {\n left: unset;\n right: 0;\n }\n }\n "
]
}]
}], function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; }, { totalRows: [{
type: i0.Input
}], scrollbarWidth: [{
type: i0.Input
}], scrollbarHeight: [{
type: i0.Input
}], childWidth: [{
type: i0.Input
}], childHeight: [{
type: i0.Input
}], bufferAmount: [{
type: i0.Input
}], scrollAnimationTime: [{
type: i0.Input
}], doNotCheckAngularZone: [{
type: i0.Input
}], parentScroll: [{
type: i0.Input
}], isTable: [{
type: i0.Input
}], change: [{
type: i0.Output
}], load: [{
type: i0.Output
}], start: [{
type: i0.Output
}], end: [{
type: i0.Output
}], contentElementRef: [{
type: i0.ViewChild,
args: ['content', { read: i0.ElementRef }]
}], shimElementRef: [{
type: i0.ViewChild,
args: ['shim', { read: i0.ElementRef }]
}], containerElementRef: [{
type: i0.ContentChild,
args: ['container']
}] });
})();
var VirtualScrollModule = /** @class */ (function () {
function VirtualScrollModule() {
}
return VirtualScrollModule;
}());
VirtualScrollModule.ɵmod = i0.ɵɵdefineNgModule({ type: VirtualScrollModule });
VirtualScrollModule.ɵinj = i0.ɵɵdefineInjector({ factory: function VirtualScrollModule_Factory(t) { return new (t || VirtualScrollModule)(); } });
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(VirtualScrollModule, { declarations: [VirtualScrollComponent], exports: [VirtualScrollComponent] }); })();
/*@__PURE__*/ (function () {
i0.ɵsetClassMetadata(VirtualScrollModule, [{
type: i0.NgModule,
args: [{
exports: [VirtualScrollComponent],
declarations: [VirtualScrollComponent]
}]
}], null, null);
})();
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b)
if (Object.prototype.hasOwnProperty.call(b, p))
d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function () {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); };
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try {
step(generator.next(value));
}
catch (e) {
reject(e);
} }
function rejected(value) { try {
step(generator["throw"](value));
}
catch (e) {
reject(e);
} }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function () { if (t[0] & 1)
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f)
throw new TypeError("Generator is already executing.");
while (_)
try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
return t;
if (y = 0, t)
op = [op[0] & 2, t.value];
switch (op[0]) {
case 0:
case 1:
t = op;
break;
case 4:
_.label++;
return { value: op[1], done: false };
case 5:
_.label++;
y = op[1];
op = [0];
continue;
case 7:
op = _.ops.pop();
_.trys.pop();
continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
_ = 0;
continue;
}
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
_.label = op[1];
break;
}
if (op[0] === 6 && _.label < t[1]) {
_.label = t[1];
t = op;
break;
}
if (t && _.label < t[2]) {
_.label = t[2];
_.ops.push(op);
break;
}
if (t[2])
_.ops.pop();
_.trys.pop();
continue;
}
op = body.call(thisArg, _);
}
catch (e) {
op = [6, e];
y = 0;
}
finally {
f = t = 0;
}
if (op[0] & 5)
throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
}
var __createBinding = Object.create ? (function (o, m, k, k2) {
if (k2 === undefined)
k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
}) : (function (o, m, k, k2) {
if (k2 === undefined)
k2 = k;
o[k2] = m[k];
});
function __exportStar(m, o) {
for (var p in m)
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
__createBinding(o, m, p);
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m)
return m.call(o);
if (o && typeof o.length === "number")
return {
next: function () {
if (o && i >= o.length)
o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m)
return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
ar.push(r.value);
}
catch (error) {
e = { error: error };
}
finally {
try {
if (r && !r.done && (m = i["return"]))
m.call(i);
}
finally {
if (e)
throw e.error;
}
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
;
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n])
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try {
step(g[n](v));
}
catch (e) {
settle(q[0][3], e);
} }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length)
resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) {
Object.defineProperty(cooked, "raw", { value: raw });
}
else {
cooked.raw = raw;
}
return cooked;
}
;
var __setModuleDefault = Object.create ? (function (o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function (o, v) {
o["default"] = v;
};
function __importStar(mod) {
if (mod && mod.__esModule)
return mod;
var result = {};
if (mod != null)
for (var k in mod)
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
__createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
}
function __classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
}
var _c0$1 = ["noVirtualScrollCont"];
var _c1$1 = ["tableHeader"];
var _c2$1 = ["selectAllCB"];
function PepperiListComponent_ng_container_0_Template(rf, ctx) {
if (rf & 1) {
i0.ɵɵelementContainerStart(0);
i0.ɵɵelementStart(1, "div", 3);
i0.ɵɵtext(2);
i0.ɵɵelementEnd();
i0.ɵɵelementContainerEnd();
}
if (rf & 2) {
var ctx_r0 = i0.ɵɵnextContext();
i0.ɵɵadvance(2);
i0.ɵɵtextInterpolate(ctx_r0.noDataFoundMsg);
}
}
var _c3$1 = function (a0) { return { visibility: a0 }; };
function PepperiListComponent_ng_container_1_div_1_mat_checkbox_3_Template(rf, ctx) {
if (rf & 1) {
var _r15_1 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "mat-checkbox", 13, 14);
i0.ɵɵlistener("change", function PepperiListComponent_ng_container_1_div_1_mat_checkbox_3_Template_mat_checkbox_change_0_listener($event) { i0.ɵɵrestoreView(_r15_1); var ctx_r14 = i0.ɵɵnextContext(3); return ctx_r14.selectAllItemsForActions($event); });
i0.ɵɵelementEnd();
}
if (rf & 2) {
var ctx_r11 = i0.ɵɵnextContext(3);
i0.ɵɵproperty("ngStyle", i0.ɵɵpureFunction1(4, _c3$1, ctx_r11.selectionTypeForActions == ctx_r11.SELECTION_TYPE_FOR_ACTIONS.Single || ctx_r11.selectionTypeForActions == ctx_r11.SELECTION_TYPE_FOR_ACTIONS.Multi && ctx_r11.hideAllSelectionInMulti ? "hidden" : "visible"))("indeterminate", ctx_r11.isAllSelected ? ctx_r11.unSelectedItems.size > 0 && ctx_r11.unSelectedItems.size < ctx_r11.totalRows : ctx_r11.selectedItems.size > 0 && !ctx_r11.getIsAllSelectedForActions())("disabled", ctx_r11.disabled || ctx_r11.selectionTypeForActions === ctx_r11.SELECTION_TYPE_FOR_ACTIONS.Single)("checked", ctx_r11.getIsAllSelectedForActions());
}
}
function PepperiListComponent_ng_container_1_div_1_div_5_label_1_Template(rf, ctx) {
if (rf & 1) {
i0.ɵɵelementStart(0, "label", 20);
i0.ɵɵtext(1);
i0.ɵɵelementEnd();
}
if (rf & 2) {
var field_r16 = i0.ɵɵnextContext().$implicit;
i0.ɵɵclassMapInterpolate1("header-label body-sm pull-left flip text-align-", field_r16.Layout.XAlignment, "");
i0.ɵɵpropertyInterpolate("id", field_r16.ApiName);
i0.ɵɵpropertyInterpolate("title", field_r16.Title);
i0.ɵɵadvance(1);
i0.ɵɵtextInterpolate1(" ", field_r16.Title, " ");
}
}
function PepperiListComponent_ng_container_1_div_1_div_5_label_2_Template(rf, ctx) {
if (rf & 1) {
i0.ɵɵelementStart(0, "label", 21);
i0.ɵɵtext(1, "\u00A0");
i0.ɵɵelementEnd();
}
if (rf & 2) {
var field_r16 = i0.ɵɵnextContext().$implicit;
i0.ɵɵpropertyInterpolate("id", field_r16.ApiName);
}
}
function PepperiListComponent_ng_container_1_div_1_div_5_div_3_Template(rf, ctx) {
if (rf & 1) {
var _r25_1 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "div", 22);
i0.ɵɵlistener("mousedown", function PepperiListComponent_ng_container_1_div_1_div_5_div_3_Template_div_mousedown_0_listener($event) { i0.ɵɵrestoreView(_r25_1); var field_r16 = i0.ɵɵnextContext().$implicit; var ctx_r24 = i0.ɵɵnextContext(3); return ctx_r24.onListResizeStart($event, field_r16.ApiName); });
i0.ɵɵelementStart(1, "mat-icon");
i0.ɵɵelement(2, "pep-icon", 23);
i0.ɵɵelementEnd();
i0.ɵɵelementEnd();
}
}
function PepperiListComponent_ng_container_1_div_1_div_5_div_4_mat_icon_1_Template(rf, ctx) {
if (rf & 1) {
i0.ɵɵelementStart(0, "mat-icon");
i0.ɵɵelement(1, "pep-icon", 26);
i0.ɵɵelementEnd();
}
}
var _c4 = function (a0) { return { "sort-by": a0 }; };
function PepperiListComponent_ng_container_1_div_1_div_5_div_4_mat_icon_2_Template(rf, ctx) {
if (rf & 1) {
i0.ɵɵelementStart(0, "mat-icon", 27);
i0.ɵɵpipe(1, "translate");
i0.ɵɵelement(2, "pep-icon", 28);
i0.ɵɵelementEnd();
}
if (rf & 2) {
var field_r16 = i0.ɵɵnextContext(2).$implicit;
var ctx_r28 = i0.ɵɵnextContext(3);
i0.ɵɵpropertyInterpolate("title", i0.ɵɵpipeBind1(1, 2, "Asc"));
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(4, _c4, field_r16.ApiName === ctx_r28.sortBy && ctx_r28.isAsc));
}
}
function PepperiListComponent_ng_container_1_div_1_div_5_div_4_mat_icon_3_Template(rf, ctx) {
if (rf & 1) {
i0.ɵɵelementStart(0, "mat-icon", 27);
i0.ɵɵpipe(1, "translate");
i0.ɵɵelement(2, "pep-icon", 29);
i0.ɵɵelementEnd();
}
if (rf & 2) {
var field_r16 = i0.ɵɵnextContext(2).$implicit;
var ctx_r29 = i0.ɵɵnextContext(3);
i0.ɵɵpropertyInterpolate("title", i0.ɵɵpipeBind1(1, 2, "Desc"));
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(4, _c4, field_r16.ApiName === ctx_r29.sortBy && !ctx_r29.isAsc));
}
}
var _c5 = function (a0) { return { "has-sorting": a0 }; };
function PepperiListComponent_ng_container_1_div_1_div_5_div_4_Template(rf, ctx) {
if (rf & 1) {
i0.ɵɵelementStart(0, "div", 24);
i0.ɵɵtemplate(1, PepperiListComponent_ng_container_1_div_1_div_5_div_4_mat_icon_1_Template, 2, 0, "mat-icon", 0);
i0.ɵɵtemplate(2, PepperiListComponent_ng_container_1_div_1_div_5_div_4_mat_icon_2_Template, 3, 6, "mat-icon", 25);
i0.ɵɵtemplate(3, PepperiListComponent_ng_container_1_div_1_div_5_div_4_mat_icon_3_Template, 3, 6, "mat-icon", 25);
i0.ɵɵelementEnd();
}
if (rf & 2) {
var field_r16 = i0.ɵɵnextContext().$implicit;
var ctx_r21 = i0.ɵɵnextContext(3);
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(4, _c5, field_r16.ApiName === ctx_r21.sortBy));
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", field_r16.ApiName !== ctx_r21.sortBy);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", field_r16.ApiName === ctx_r21.sortBy && !ctx_r21.isAsc);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", field_r16.ApiName === ctx_r21.sortBy && ctx_r21.isAsc);
}
}
var _c6 = function (a0) { return { width: a0 }; };
var _c7 = function (a0, a1, a2, a3, a4) { return { "support-sorting": a0, "has-sorting": a1, "is-resizing": a2, "is-first": a3, "is-last": a4 }; };
function PepperiListComponent_ng_container_1_div_1_div_5_Template(rf, ctx) {
if (rf & 1) {
var _r34_1 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "div", 15);
i0.ɵɵlistener("click", function PepperiListComponent_ng_container_1_div_1_div_5_Template_div_click_0_listener($event) { i0.ɵɵrestoreView(_r34_1); var field_r16 = ctx.$implicit; var ctx_r33 = i0.ɵɵnextContext(3); return ctx_r33.supportSorting ? ctx_r33.onListSortingChange(field_r16.ApiName, ctx_r33.sortBy !== null && ctx_r33.sortBy != field_r16.ApiName ? true : !ctx_r33.isAsc, $event) : false; });
i0.ɵɵtemplate(1, PepperiListComponent_ng_container_1_div_1_div_5_label_1_Template, 2, 6, "label", 16);
i0.ɵɵtemplate(2, PepperiListComponent_ng_container_1_div_1_div_5_label_2_Template, 2, 1, "label", 17);
i0.ɵɵtemplate(3, PepperiListComponent_ng_container_1_div_1_div_5_div_3_Template, 3, 0, "div", 18);
i0.ɵɵtemplate(4, PepperiListComponent_ng_container_1_div_1_div_5_div_4_Template, 4, 6, "div", 19);
i0.ɵɵelementEnd();
}
if (rf & 2) {
var field_r16 = ctx.$implicit;
var j_r17 = ctx.index;
var ctx_r12 = i0.ɵɵnextContext(3);
i0.ɵɵproperty("ngStyle", i0.ɵɵpureFunction1(6, _c6, field_r16.calcTitleColumnWidthString))("ngClass", i0.ɵɵpureFunction5(8, _c7, ctx_r12.supportSorting, field_r16.ApiName === ctx_r12.sortBy, field_r16.ApiName === ctx_r12.pressedColumn, j_r17 === 0 && ctx_r12.selectionTypeForActions !== ctx_r12.SELECTION_TYPE_FOR_ACTIONS.Multi, j_r17 === (ctx_r12.uiControl == null ? null : ctx_r12.uiControl.ControlFields == null ? null : ctx_r12.uiControl.ControlFields.length) - 1));
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", field_r16.Title != "");
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", field_r16.Title == "");
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", ctx_r12.supportResizing);
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngIf", ctx_r12.supportSorting);
}
}
var _c8 = function (a0) { return { "below-header-and-top-bar": a0 }; };
function PepperiListComponent_ng_container_1_div_1_Template(rf, ctx) {
if (rf & 1) {
var _r36_1 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "div", 8, 9);
i0.ɵɵlistener("mouseup", function PepperiListComponent_ng_container_1_div_1_Template_div_mouseup_0_listener($event) { i0.ɵɵrestoreView(_r36_1); var ctx_r35 = i0.ɵɵnextContext(2); return ctx_r35.onListResizeEnd($event); })("mouseenter", function PepperiListComponent_ng_container_1_div_1_Template_div_mouseenter_0_listener($event) { i0.ɵɵrestoreView(_r36_1); var ctx_r37 = i0.ɵɵnextContext(2); return ctx_r37.onListHeaderMouseEnter($event); })("mouseleave", function PepperiListComponent_ng_container_1_div_1_Template_div_mouseleave_0_listener($event) { i0.ɵɵrestoreView(_r36_1); var ctx_r38 = i0.ɵɵnextContext(2); return ctx_r38.onListHeaderMouseLeave($event); })("mousemove", function PepperiListComponent_ng_container_1_div_1_Template_div_mousemove_0_listener($event) { i0.ɵɵrestoreView(_r36_1); var ctx_r39 = i0.ɵɵnextContext(2); return ctx_r39.onListResize($event); });
i0.ɵɵelementStart(2, "fieldset", 10);
i0.ɵɵtemplate(3, PepperiListComponent_ng_container_1_div_1_mat_checkbox_3_Template, 2, 6, "mat-checkbox", 11);
i0.ɵɵelementStart(4, "fieldset");
i0.ɵɵtemplate(5, PepperiListComponent_ng_container_1_div_1_div_5_Template, 5, 14, "div", 12);
i0.ɵɵelementEnd();
i0.ɵɵelementEnd();
i0.ɵɵelementEnd();
}
if (rf & 2) {
var ctx_r6 = i0.ɵɵnextContext(2);
i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(3, _c8, ctx_r6.parentScroll == null));
i0.ɵɵadvance(3);
i0.ɵɵproperty("ngIf", ctx_r6.selectionTypeForActions !== ctx_r6.SELECTION_TYPE_FOR_ACTIONS.None);
i0.ɵɵadvance(2);
i0.ɵɵproperty("ngForOf", ctx_r6.uiControl == null ? null : ctx_r6.uiControl.ControlFields);
}
}
function PepperiListComponent_ng_container_1_virtual_scroll_2_ng_container_1_Template(rf, ctx) {
if (rf & 1) {
i0.ɵɵelementContainer(0);
}
}
var _c9 = function (a0, a1) { return { "table-body": a0, "cards-body": a1 }; };
function PepperiListComponent_ng_container_1_virtual_scroll_2_Template(rf, ctx) {
if (rf & 1) {
var _r42_1 = i0.ɵɵgetCurrentView();
i0.ɵɵelementStart(0, "virtual-scroll", 30);
i0.ɵɵlistener("load", function PepperiListComponent_ng_container_1_virtual_scroll_2_Template_virtual_scroll_load_0_listener($event) { i0.ɵɵrestoreView(_r42_1); var ctx_r41 = i0.ɵɵnextContext(2); return ctx_r41.onListLoad($event); })("change", function PepperiListComponent_ng_container_1_virtual_scroll_2_Template_virtual_scroll_change_0_listener($event) { i0.ɵɵrestoreView(_r42_1); var ctx_r43 = i0.ɵɵnextContext(2); return ctx_r43.onListChange($event); });
i0.ɵɵtemplate(1, PepperiListComponent_ng_container_1_virtual_scroll_2_ng_container_1_Template, 1, 0, "ng-container", 7);
i0.ɵɵelementEnd();
}
if (rf & 2) {
var ctx_r7 = i0.ɵɵnextContext(2);
var _r2 = i0.ɵɵreference(3);
i0.ɵɵproperty("totalRows", ctx_r7.totalRows)("isTable", ctx_r7.isTable)("parentScroll", ctx_r7.parentScroll ? ctx_r7.parentScroll : ctx_r7.nativeWindow)("bufferAmount", ctx_r7.isReport ? ctx_r7.isTable ? 20 : 3 : ctx_r7.isTable ? 15 : 3)("ngClass", i0.ɵɵpureFunction2(6, _c9, ctx_r7.isTable, !ctx_r7.isTable));
i0.ɵɵadvance(1);
i0.ɵɵproperty("ngTemplateOutlet", _r2);
}
}
function PepperiListComponent_ng_container_1_div_3_ng_container_2_Template(rf, ctx) {