mg-components
Version:
1,274 lines (1,256 loc) • 183 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/animations'), require('@angular/core'), require('@angular/common'), require('@angular/material'), require('@angular/platform-browser/animations'), require('@angular/forms')) :
typeof define === 'function' && define.amd ? define('mg-components', ['exports', '@angular/animations', '@angular/core', '@angular/common', '@angular/material', '@angular/platform-browser/animations', '@angular/forms'], factory) :
(factory((global['mg-components'] = {}),global.ng.animations,global.ng.core,global.ng.common,global.ng.material,global.ng.platformBrowser.animations,global.ng.forms));
}(this, (function (exports,animations,i0,common,material,animations$1,forms) { 'use strict';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
/** @type {?} */
var menuAnimations = {
bodyExpansion: animations.trigger("bodyExpansion", [
animations.state("false", animations.style({ height: "0px", visibility: "hidden" })),
animations.state("true", animations.style({ height: "*", visibility: "visible" })),
animations.transition("true <=> false", animations.animate("225ms cubic-bezier(0.4,0.0,0.2,1)"))
])
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var SubmenuComponent = /** @class */ (function () {
function SubmenuComponent() {
}
SubmenuComponent.decorators = [
{ type: i0.Component, args: [{
selector: "mg-submenu",
template: "<ng-content></ng-content>\n",
styles: [":host /deep/ mg-menu .submenu-trigger-container{padding-left:20px}"]
}] }
];
return SubmenuComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var MenuComponent = /** @class */ (function () {
function MenuComponent() {
this.expanded = false;
}
/**
* @return {?}
*/
MenuComponent.prototype.onTriggerClick = /**
* @return {?}
*/
function () {
if (this.subMenu) {
this.expanded = !this.expanded;
}
};
MenuComponent.decorators = [
{ type: i0.Component, args: [{
selector: "mg-menu",
template: "<div class=\"submenu-trigger-container\" (click)=\"onTriggerClick()\">\n <div class=\"icon-container\">\n <ng-content select=\"mat-icon\"></ng-content>\n </div>\n <div class=\"content\">\n <ng-content></ng-content>\n </div>\n <mat-icon [ngClass]=\"{'drop-down': expanded}\" *ngIf=\"subMenu\">keyboard_arrow_down</mat-icon>\n</div>\n<div class=\"submenu-container\" [@bodyExpansion]=\"expanded\">\n <ng-content select=\"mg-submenu\"></ng-content>\n</div>\n",
animations: [menuAnimations.bodyExpansion],
styles: [".submenu-trigger-container{width:100%;display:flex;align-items:center;overflow:hidden;color:#757575;font-size:16px;border-left:2px solid transparent;padding:12px;box-sizing:border-box;cursor:pointer}.submenu-trigger-container:hover{border-left-color:#6c14c8;color:#6c14c8}.submenu-trigger-container>.icon-container{display:flex}.submenu-trigger-container>.icon-container mat-icon{margin:0 8px}.submenu-trigger-container>.content{flex:1}.submenu-container{overflow:hidden;width:100%}:host.mg-menu-active .submenu-trigger-container{color:#6c14c8;background-color:#f8f2fe}"]
}] }
];
MenuComponent.propDecorators = {
subMenu: [{ type: i0.ContentChild, args: [SubmenuComponent,] }]
};
return MenuComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var SubmenuTriggerDirective = /** @class */ (function () {
function SubmenuTriggerDirective() {
}
SubmenuTriggerDirective.decorators = [
{ type: i0.Directive, args: [{
selector: "[mgSubmenuTrigger]"
},] }
];
return SubmenuTriggerDirective;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var MenuModule = /** @class */ (function () {
function MenuModule() {
}
MenuModule.decorators = [
{ type: i0.NgModule, args: [{
imports: [common.CommonModule, animations$1.BrowserAnimationsModule, material.MatIconModule],
declarations: [SubmenuComponent, MenuComponent, SubmenuTriggerDirective],
exports: [SubmenuComponent, MenuComponent, SubmenuTriggerDirective]
},] }
];
return MenuModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var SearchInputService = /** @class */ (function () {
function SearchInputService() {
}
SearchInputService.decorators = [
{ type: i0.Injectable, args: [{
providedIn: "root"
},] }
];
/** @nocollapse */
SearchInputService.ctorParameters = function () { return []; };
/** @nocollapse */ SearchInputService.ngInjectableDef = i0.defineInjectable({ factory: function SearchInputService_Factory() { return new SearchInputService(); }, token: SearchInputService, providedIn: "root" });
return SearchInputService;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var SearchInputComponent = /** @class */ (function () {
function SearchInputComponent() {
this.valueChange = new i0.EventEmitter();
}
SearchInputComponent.decorators = [
{ type: i0.Component, args: [{
selector: "search-input",
template: "\n <input matInput type=\"text\" placeholder=\"{{placeholder}}\" [(ngModel)]=\"value\" />\n <button mat-button *ngIf=\"value\" matSuffix mat-icon-button aria-label=\"Clear\" (click)=\"value=''\">\n <mat-icon>close</mat-icon>\n </button>\n ",
styles: ["\n :host {\n height: 40px;\n background-color: white;\n box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.14),\n 0 1px 8px 0 rgba(0, 0, 0, 0.12), 0 3px 3px -2px rgba(0, 0, 0, 0.4);\n display: flex;\n border-radius: 2px;\n }\n\n input {\n border: none;\n padding: 4px 8px;\n outline: none;\n height: 40px;\n background-color: transparent;\n flex: 1;\n }\n "]
}] }
];
/** @nocollapse */
SearchInputComponent.ctorParameters = function () { return []; };
SearchInputComponent.propDecorators = {
placeholder: [{ type: i0.Input }],
value: [{ type: i0.Input }],
valueChange: [{ type: i0.Output }]
};
return SearchInputComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var SearchInputModule = /** @class */ (function () {
function SearchInputModule() {
}
SearchInputModule.decorators = [
{ type: i0.NgModule, args: [{
imports: [
common.CommonModule,
material.MatButtonModule,
material.MatInputModule,
material.MatIconModule,
forms.FormsModule
],
declarations: [SearchInputComponent],
exports: [SearchInputComponent]
},] }
];
return SearchInputModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var SpinnerOverlayComponent = /** @class */ (function () {
function SpinnerOverlayComponent() {
this.diameter = 48;
}
SpinnerOverlayComponent.decorators = [
{ type: i0.Component, args: [{
selector: "mg-spinner-overlay",
template: "\n <mat-progress-spinner mode=\"indeterminate\" [diameter]=\"diameter\"></mat-progress-spinner>\n ",
styles: ["\n :host {\n position: absolute;\n width: 100%;\n top: 0;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgba(255, 255, 255, 0.6);\n }\n "]
}] }
];
SpinnerOverlayComponent.propDecorators = {
diameter: [{ type: i0.Input }]
};
return SpinnerOverlayComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var SpinnerOverlayModule = /** @class */ (function () {
function SpinnerOverlayModule() {
}
SpinnerOverlayModule.decorators = [
{ type: i0.NgModule, args: [{
imports: [common.CommonModule, material.MatProgressSpinnerModule],
exports: [material.MatProgressSpinnerModule, SpinnerOverlayComponent],
declarations: [SpinnerOverlayComponent]
},] }
];
return SpinnerOverlayModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var Header = /** @class */ (function () {
function Header() {
}
Header.decorators = [
{ type: i0.Component, args: [{
selector: "mg-header",
template: "<ng-content></ng-content>"
}] }
];
return Header;
}());
var Footer = /** @class */ (function () {
function Footer() {
}
Footer.decorators = [
{ type: i0.Component, args: [{
selector: "mg-footer",
template: "<ng-content></ng-content>"
}] }
];
return Footer;
}());
var PrimeTemplate = /** @class */ (function () {
function PrimeTemplate(template) {
this.template = template;
}
/**
* @return {?}
*/
PrimeTemplate.prototype.getType = /**
* @return {?}
*/
function () {
if (this.type) {
console.log('Defining a pTemplate with type property is deprecated use pTemplate="type" instead.');
return this.type;
}
else {
return this.name;
}
};
PrimeTemplate.decorators = [
{ type: i0.Directive, args: [{
// tslint:disable-next-line:directive-selector
selector: "[yTemplate]"
},] }
];
/** @nocollapse */
PrimeTemplate.ctorParameters = function () {
return [
{ type: i0.TemplateRef }
];
};
PrimeTemplate.propDecorators = {
type: [{ type: i0.Input }],
name: [{ type: i0.Input, args: ["yTemplate",] }]
};
return PrimeTemplate;
}());
var TemplateWrapper = /** @class */ (function () {
function TemplateWrapper(viewContainer) {
this.viewContainer = viewContainer;
}
/**
* @return {?}
*/
TemplateWrapper.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this.view = this.viewContainer.createEmbeddedView(this.templateRef, {
$implicit: this.item,
index: this.index
});
};
/**
* @return {?}
*/
TemplateWrapper.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.view.destroy();
};
TemplateWrapper.decorators = [
{ type: i0.Directive, args: [{
// tslint:disable-next-line:directive-selector
selector: "[yTemplateWrapper]"
},] }
];
/** @nocollapse */
TemplateWrapper.ctorParameters = function () {
return [
{ type: i0.ViewContainerRef }
];
};
TemplateWrapper.propDecorators = {
item: [{ type: i0.Input }],
index: [{ type: i0.Input }],
templateRef: [{ type: i0.Input, args: ["yTemplateWrapper",] }]
};
return TemplateWrapper;
}());
var Column = /** @class */ (function () {
function Column() {
this.sortFunction = new i0.EventEmitter();
}
/**
* @return {?}
*/
Column.prototype.ngAfterContentInit = /**
* @return {?}
*/
function () {
var _this = this;
this.templates.forEach(function (item) {
switch (item.getType()) {
case "header":
_this.headerTemplate = item.template;
break;
case "body":
_this.bodyTemplate = item.template;
break;
case "footer":
_this.footerTemplate = item.template;
break;
case "filter":
_this.filterTemplate = item.template;
break;
case "editor":
_this.editorTemplate = item.template;
break;
default:
_this.bodyTemplate = item.template;
break;
}
});
};
Column.decorators = [
{ type: i0.Component, args: [{
selector: "mg-column",
template: ""
}] }
];
Column.propDecorators = {
field: [{ type: i0.Input }],
sortField: [{ type: i0.Input }],
header: [{ type: i0.Input }],
footer: [{ type: i0.Input }],
sortable: [{ type: i0.Input }],
editable: [{ type: i0.Input }],
filter: [{ type: i0.Input }],
filterMatchMode: [{ type: i0.Input }],
rowspan: [{ type: i0.Input }],
colspan: [{ type: i0.Input }],
style: [{ type: i0.Input }],
styleClass: [{ type: i0.Input }],
hidden: [{ type: i0.Input }],
expander: [{ type: i0.Input }],
selectionMode: [{ type: i0.Input }],
filterPlaceholder: [{ type: i0.Input }],
frozen: [{ type: i0.Input }],
sortFunction: [{ type: i0.Output }],
templates: [{ type: i0.ContentChildren, args: [PrimeTemplate,] }],
template: [{ type: i0.ContentChild, args: [i0.TemplateRef,] }]
};
return Column;
}());
var Row = /** @class */ (function () {
function Row() {
}
Row.decorators = [
{ type: i0.Component, args: [{
selector: "mg-row",
template: ""
}] }
];
Row.propDecorators = {
columns: [{ type: i0.ContentChildren, args: [Column,] }]
};
return Row;
}());
var HeaderColumnGroup = /** @class */ (function () {
function HeaderColumnGroup() {
}
HeaderColumnGroup.decorators = [
{ type: i0.Component, args: [{
// tslint:disable-next-line:component-selector
selector: "mg-headerColumnGroup",
template: ""
}] }
];
HeaderColumnGroup.propDecorators = {
rows: [{ type: i0.ContentChildren, args: [Row,] }]
};
return HeaderColumnGroup;
}());
var FooterColumnGroup = /** @class */ (function () {
function FooterColumnGroup() {
}
FooterColumnGroup.decorators = [
{ type: i0.Component, args: [{
// tslint:disable-next-line:component-selector
selector: "mg-footerColumnGroup",
template: ""
}] }
];
FooterColumnGroup.propDecorators = {
rows: [{ type: i0.ContentChildren, args: [Row,] }]
};
return FooterColumnGroup;
}());
var ColumnBodyTemplateLoader = /** @class */ (function () {
function ColumnBodyTemplateLoader(viewContainer) {
this.viewContainer = viewContainer;
}
/**
* @return {?}
*/
ColumnBodyTemplateLoader.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this.view = this.viewContainer.createEmbeddedView(this.column.bodyTemplate, {
$implicit: this.column,
rowData: this.rowData,
rowIndex: this.rowIndex,
level: this.level
});
};
/**
* @return {?}
*/
ColumnBodyTemplateLoader.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.view.destroy();
};
ColumnBodyTemplateLoader.decorators = [
{ type: i0.Component, args: [{
// tslint:disable-next-line:component-selector
selector: "mg-columnBodyTemplateLoader",
template: ""
}] }
];
/** @nocollapse */
ColumnBodyTemplateLoader.ctorParameters = function () {
return [
{ type: i0.ViewContainerRef }
];
};
ColumnBodyTemplateLoader.propDecorators = {
column: [{ type: i0.Input }],
rowData: [{ type: i0.Input }],
rowIndex: [{ type: i0.Input }],
level: [{ type: i0.Input }]
};
return ColumnBodyTemplateLoader;
}());
var ColumnHeaderTemplateLoader = /** @class */ (function () {
function ColumnHeaderTemplateLoader(viewContainer) {
this.viewContainer = viewContainer;
}
/**
* @return {?}
*/
ColumnHeaderTemplateLoader.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this.view = this.viewContainer.createEmbeddedView(this.column.headerTemplate, {
$implicit: this.column
});
};
/**
* @return {?}
*/
ColumnHeaderTemplateLoader.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.view.destroy();
};
ColumnHeaderTemplateLoader.decorators = [
{ type: i0.Component, args: [{
// tslint:disable-next-line:component-selector
selector: "mg-columnHeaderTemplateLoader",
template: ""
}] }
];
/** @nocollapse */
ColumnHeaderTemplateLoader.ctorParameters = function () {
return [
{ type: i0.ViewContainerRef }
];
};
ColumnHeaderTemplateLoader.propDecorators = {
column: [{ type: i0.Input }]
};
return ColumnHeaderTemplateLoader;
}());
var ColumnFooterTemplateLoader = /** @class */ (function () {
function ColumnFooterTemplateLoader(viewContainer) {
this.viewContainer = viewContainer;
}
/**
* @return {?}
*/
ColumnFooterTemplateLoader.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this.view = this.viewContainer.createEmbeddedView(this.column.footerTemplate, {
$implicit: this.column
});
};
/**
* @return {?}
*/
ColumnFooterTemplateLoader.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.view.destroy();
};
ColumnFooterTemplateLoader.decorators = [
{ type: i0.Component, args: [{
// tslint:disable-next-line:component-selector
selector: "mg-columnFooterTemplateLoader",
template: ""
}] }
];
/** @nocollapse */
ColumnFooterTemplateLoader.ctorParameters = function () {
return [
{ type: i0.ViewContainerRef }
];
};
ColumnFooterTemplateLoader.propDecorators = {
column: [{ type: i0.Input }]
};
return ColumnFooterTemplateLoader;
}());
var ColumnFilterTemplateLoader = /** @class */ (function () {
function ColumnFilterTemplateLoader(viewContainer) {
this.viewContainer = viewContainer;
}
/**
* @return {?}
*/
ColumnFilterTemplateLoader.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this.view = this.viewContainer.createEmbeddedView(this.column.filterTemplate, {
$implicit: this.column
});
};
/**
* @return {?}
*/
ColumnFilterTemplateLoader.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.view.destroy();
};
ColumnFilterTemplateLoader.decorators = [
{ type: i0.Component, args: [{
// tslint:disable-next-line:component-selector
selector: "mg-columnFilterTemplateLoader",
template: ""
}] }
];
/** @nocollapse */
ColumnFilterTemplateLoader.ctorParameters = function () {
return [
{ type: i0.ViewContainerRef }
];
};
ColumnFilterTemplateLoader.propDecorators = {
column: [{ type: i0.Input }]
};
return ColumnFilterTemplateLoader;
}());
var ColumnEditorTemplateLoader = /** @class */ (function () {
function ColumnEditorTemplateLoader(viewContainer) {
this.viewContainer = viewContainer;
}
/**
* @return {?}
*/
ColumnEditorTemplateLoader.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this.view = this.viewContainer.createEmbeddedView(this.column.editorTemplate, {
$implicit: this.column,
rowData: this.rowData
});
};
/**
* @return {?}
*/
ColumnEditorTemplateLoader.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.view.destroy();
};
ColumnEditorTemplateLoader.decorators = [
{ type: i0.Component, args: [{
// tslint:disable-next-line:component-selector
selector: "mg-columnEditorTemplateLoader",
template: ""
}] }
];
/** @nocollapse */
ColumnEditorTemplateLoader.ctorParameters = function () {
return [
{ type: i0.ViewContainerRef }
];
};
ColumnEditorTemplateLoader.propDecorators = {
column: [{ type: i0.Input }],
rowData: [{ type: i0.Input }]
};
return ColumnEditorTemplateLoader;
}());
var TemplateLoader = /** @class */ (function () {
function TemplateLoader(viewContainer) {
this.viewContainer = viewContainer;
}
/**
* @return {?}
*/
TemplateLoader.prototype.ngOnInit = /**
* @return {?}
*/
function () {
if (this.template) {
this.view = this.viewContainer.createEmbeddedView(this.template, {
$implicit: this.data
});
}
};
/**
* @return {?}
*/
TemplateLoader.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
if (this.view) {
this.view.destroy();
}
};
TemplateLoader.decorators = [
{ type: i0.Component, args: [{
// tslint:disable-next-line:component-selector
selector: "mg-templateLoader",
template: ""
}] }
];
/** @nocollapse */
TemplateLoader.ctorParameters = function () {
return [
{ type: i0.ViewContainerRef }
];
};
TemplateLoader.propDecorators = {
template: [{ type: i0.Input }],
data: [{ type: i0.Input }]
};
return TemplateLoader;
}());
var TreeSharedModule = /** @class */ (function () {
function TreeSharedModule() {
}
TreeSharedModule.decorators = [
{ type: i0.NgModule, args: [{
imports: [common.CommonModule],
exports: [
Header,
Footer,
Column,
TemplateWrapper,
ColumnHeaderTemplateLoader,
ColumnBodyTemplateLoader,
ColumnFooterTemplateLoader,
ColumnFilterTemplateLoader,
PrimeTemplate,
TemplateLoader,
Row,
HeaderColumnGroup,
FooterColumnGroup,
ColumnEditorTemplateLoader
],
declarations: [
Header,
Footer,
Column,
TemplateWrapper,
ColumnHeaderTemplateLoader,
ColumnBodyTemplateLoader,
ColumnFooterTemplateLoader,
ColumnFilterTemplateLoader,
PrimeTemplate,
TemplateLoader,
Row,
HeaderColumnGroup,
FooterColumnGroup,
ColumnEditorTemplateLoader
]
},] }
];
return TreeSharedModule;
}());
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function __values(o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m)
return m.call(o);
return {
next: function () {
if (o && i >= o.length)
o = void 0;
return { value: o && o[i++], done: !o };
}
};
}
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;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var TreeTable = /** @class */ (function () {
function TreeTable(renderer) {
this.renderer = renderer;
this.pageLinks = 5;
this.first = 0;
this.labelExpand = "Expand";
this.labelCollapse = "Collapse";
this.metaKeySelection = true;
this.filterDelay = 300;
this.RowDblclick = new i0.EventEmitter();
this.selectionChange = new i0.EventEmitter();
this.NodeSelect = new i0.EventEmitter();
this.NodeUnselect = new i0.EventEmitter();
this.NodeExpand = new i0.EventEmitter();
this.NodeCollapse = new i0.EventEmitter();
this.ContextMenuSelect = new i0.EventEmitter();
}
/**
* @param {?} event
* @param {?} node
* @return {?}
*/
TreeTable.prototype.onRowClick = /**
* @param {?} event
* @param {?} node
* @return {?}
*/
function (event, node) {
/** @type {?} */
var eventTarget = ( /** @type {?} */(event.target));
if (eventTarget.className &&
(eventTarget.className.indexOf("mg-treetable-toggler") >= 0 ||
eventTarget.className.indexOf("skip-selection") >= 0)) {
return;
}
else if (this.selectionMode) {
if (node.selectable === false) {
return;
}
/** @type {?} */
var metaSelection = this.rowTouched ? false : this.metaKeySelection;
/** @type {?} */
var index_1 = this.findIndexInSelection(node);
/** @type {?} */
var selected = index_1 >= 0;
if (this.isCheckboxSelectionMode()) {
if (selected) {
this.propagateSelectionDown(node, false);
if (node.parent) {
this.propagateSelectionUp(node.parent, false);
}
this.selectionChange.emit(this.selection);
this.NodeUnselect.emit({ originalEvent: event, node: node });
}
else {
this.propagateSelectionDown(node, true);
if (node.parent) {
this.propagateSelectionUp(node.parent, true);
}
this.selectionChange.emit(this.selection);
this.NodeSelect.emit({ originalEvent: event, node: node });
}
}
else {
if (metaSelection) {
/** @type {?} */
var metaKey = event.metaKey || event.ctrlKey;
if (selected && metaKey) {
if (this.isSingleSelectionMode()) {
this.selectionChange.emit(null);
}
else {
this.selection = this.selection.filter(function (val, i) { return i !== index_1; });
this.selectionChange.emit(this.selection);
}
this.NodeUnselect.emit({ originalEvent: event, node: node });
}
else {
if (this.isSingleSelectionMode()) {
this.selection = node;
this.selectionChange.emit(node);
}
else if (this.isMultipleSelectionMode()) {
this.selection = !metaKey ? [] : this.selection || [];
this.selection = __spread(this.selection, [node]);
this.selectionChange.emit(this.selection);
}
this.NodeSelect.emit({ originalEvent: event, node: node });
}
}
else {
if (this.isSingleSelectionMode()) {
if (selected) {
this.selection = null;
this.NodeUnselect.emit({ originalEvent: event, node: node });
}
else {
this.selection = node;
this.NodeSelect.emit({ originalEvent: event, node: node });
}
}
else {
if (selected) {
this.selection = this.selection.filter(function (val, i) { return i !== index_1; });
this.NodeUnselect.emit({ originalEvent: event, node: node });
}
else {
this.selection = __spread((this.selection || []), [node]);
this.NodeSelect.emit({ originalEvent: event, node: node });
}
}
this.selectionChange.emit(this.selection);
}
}
}
this.rowTouched = false;
};
/**
* @return {?}
*/
TreeTable.prototype.onRowTouchEnd = /**
* @return {?}
*/
function () {
this.rowTouched = true;
};
/**
* @param {?} event
* @param {?} node
* @return {?}
*/
TreeTable.prototype.onRowRightClick = /**
* @param {?} event
* @param {?} node
* @return {?}
*/
function (event, node) {
if (this.contextMenu) {
/** @type {?} */
var index = this.findIndexInSelection(node);
/** @type {?} */
var selected = index >= 0;
if (!selected) {
if (this.isSingleSelectionMode()) {
this.selection = node;
}
else if (this.isMultipleSelectionMode()) {
this.selection = [];
this.selection.push(node);
this.selectionChange.emit(this.selection);
}
this.selectionChange.emit(this.selection);
}
this.contextMenu.show(event);
this.ContextMenuSelect.emit({ originalEvent: event, node: node });
}
};
/**
* @param {?} node
* @return {?}
*/
TreeTable.prototype.findIndexInSelection = /**
* @param {?} node
* @return {?}
*/
function (node) {
/** @type {?} */
var index = -1;
if (this.selectionMode && this.selection) {
/** @type {?} */
var nodeKey = void 0;
if (this.uniqueKeyPath) {
nodeKey = this.resolveFieldData(node, this.uniqueKeyPath);
}
if (this.isSingleSelectionMode()) {
if (this.uniqueKeyPath) {
/** @type {?} */
var selectionKey = this.resolveFieldData(this.selection, this.uniqueKeyPath);
index = selectionKey === nodeKey ? 0 : -1;
}
else {
index = this.selection === node ? 0 : -1;
}
}
else {
for (var i = 0; i < this.selection.length; i++) {
if (this.uniqueKeyPath) {
/** @type {?} */
var selectionKey = this.resolveFieldData(this.selection[i], this.uniqueKeyPath);
if (selectionKey === nodeKey) {
index = i;
break;
}
}
else if (this.selection[i] === node) {
index = i;
break;
}
}
}
}
return index;
};
/**
* @param {?} node
* @param {?} select
* @return {?}
*/
TreeTable.prototype.propagateSelectionUp = /**
* @param {?} node
* @param {?} select
* @return {?}
*/
function (node, select) {
var e_1, _a;
if (node.children && node.children.length) {
/** @type {?} */
var selectedCount = 0;
/** @type {?} */
var childPartialSelected = false;
try {
for (var _b = __values(node.children), _c = _b.next(); !_c.done; _c = _b.next()) {
var child = _c.value;
if (this.isSelected(child)) {
selectedCount++;
}
else if (child.partialSelected) {
childPartialSelected = true;
}
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
if (select && selectedCount === node.children.length) {
this.selection = this.selection || [];
this.selection.push(node);
node.partialSelected = false;
}
else {
if (!select) {
/** @type {?} */
var index = this.findIndexInSelection(node);
if (index >= 0) {
this.selection.splice(index, 1);
}
}
if (childPartialSelected ||
(selectedCount > 0 && selectedCount !== node.children.length)) {
node.partialSelected = true;
}
else {
node.partialSelected = false;
}
}
}
/** @type {?} */
var parent = node.parent;
if (parent) {
this.propagateSelectionUp(parent, select);
}
};
/**
* @param {?} node
* @param {?} select
* @return {?}
*/
TreeTable.prototype.propagateSelectionDown = /**
* @param {?} node
* @param {?} select
* @return {?}
*/
function (node, select) {
var e_2, _a;
/** @type {?} */
var index = this.findIndexInSelection(node);
if (select && index === -1) {
this.selection = this.selection || [];
this.selection.push(node);
}
else if (!select && index > -1) {
this.selection.splice(index, 1);
}
node.partialSelected = false;
if (node.children && node.children.length) {
try {
for (var _b = __values(node.children), _c = _b.next(); !_c.done; _c = _b.next()) {
var child = _c.value;
this.propagateSelectionDown(child, select);
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_2)
throw e_2.error;
}
}
}
};
/**
* @param {?} node
* @return {?}
*/
TreeTable.prototype.isSelected = /**
* @param {?} node
* @return {?}
*/
function (node) {
return this.findIndexInSelection(node) !== -1;
};
/**
* @return {?}
*/
TreeTable.prototype.isSingleSelectionMode = /**
* @return {?}
*/
function () {
return this.selectionMode && this.selectionMode === "single";
};
/**
* @return {?}
*/
TreeTable.prototype.isMultipleSelectionMode = /**
* @return {?}
*/
function () {
return this.selectionMode && this.selectionMode === "multiple";
};
/**
* @return {?}
*/
TreeTable.prototype.isCheckboxSelectionMode = /**
* @return {?}
*/
function () {
return this.selectionMode && this.selectionMode === "checkbox";
};
/**
* @param {?} rowData
* @return {?}
*/
TreeTable.prototype.getRowStyleClass = /**
* @param {?} rowData
* @return {?}
*/
function (rowData) {
/** @type {?} */
var styleClass = "";
if (this.rowStyleClass) {
/** @type {?} */
var rowClass = this.rowStyleClass.call(this, rowData);
if (rowClass) {
styleClass += " " + rowClass;
}
}
return styleClass;
};
/**
* @return {?}
*/
TreeTable.prototype.hasFooter = /**
* @return {?}
*/
function () {
if (this.columns) {
/** @type {?} */
var columnsArr = this.columns.toArray();
for (var i = 0; i < columnsArr.length; i++) {
if (columnsArr[i].footer) {
return true;
}
}
}
return false;
};
/**
* @return {?}
*/
TreeTable.prototype.ngOnInit = /**
* @return {?}
*/
function () {
if (this.immutable) {
this.handleDataChange();
}
};
/**
* @return {?}
*/
TreeTable.prototype.ngAfterViewInit = /**
* @return {?}
*/
function () {
var _this = this;
if (this.globalFilter && this.value) {
this.globalFilterFunction = this.renderer.listen(this.globalFilter, "keyup", function () {
_this.filterTimeout = setTimeout(function () {
_this.filter();
_this.filterTimeout = null;
}, _this.filterDelay);
});
}
};
/**
* @param {?} changes
* @return {?}
*/
TreeTable.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if (changes["value"] && this.value && !this.immutable) {
this.handleDataChange();
}
};
/**
* @return {?}
*/
TreeTable.prototype.shownColumns = /**
* @return {?}
*/
function () {
return this.columns.filter(function (col) { return !col.hidden; });
};
/**
* @return {?}
*/
TreeTable.prototype.handleDataChange = /**
* @return {?}
*/
function () {
if (this.paginator) {
this.updatePaginator();
}
this.updateDataToRender(this.filteredValue || this.value);
};
/**
* @return {?}
*/
TreeTable.prototype.updatePaginator = /**
* @return {?}
*/
function () {
this.totalRecords = this.lazy
? this.totalRecords
: this.value
? this.value.length
: 0;
if (this.totalRecords && this.first >= this.totalRecords) {
/** @type {?} */
var numberOfPages = Math.ceil(this.totalRecords / this.rows);
this.first = Math.max((numberOf