| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742 |
- "use strict";
- var __assign = (this && this.__assign) || function () {
- __assign = Object.assign || function(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);
- };
- var __decorate = (this && this.__decorate) || function (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;
- };
- var __metadata = (this && this.__metadata) || function (k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
- };
- Object.defineProperty(exports, "__esModule", { value: true });
- var core_1 = require("@angular/core");
- var common_1 = require("@angular/common");
- var rxjs_1 = require("rxjs");
- var domhandler_1 = require("../dom/domhandler");
- var paginator_1 = require("../paginator/paginator");
- var shared_1 = require("../common/shared");
- var objectutils_1 = require("../utils/objectutils");
- var filterutils_1 = require("../utils/filterutils");
- var TreeTableService = /** @class */ (function () {
- function TreeTableService() {
- this.sortSource = new rxjs_1.Subject();
- this.selectionSource = new rxjs_1.Subject();
- this.contextMenuSource = new rxjs_1.Subject();
- this.uiUpdateSource = new rxjs_1.Subject();
- this.totalRecordsSource = new rxjs_1.Subject();
- this.sortSource$ = this.sortSource.asObservable();
- this.selectionSource$ = this.selectionSource.asObservable();
- this.contextMenuSource$ = this.contextMenuSource.asObservable();
- this.uiUpdateSource$ = this.uiUpdateSource.asObservable();
- this.totalRecordsSource$ = this.totalRecordsSource.asObservable();
- }
- TreeTableService.prototype.onSort = function (sortMeta) {
- this.sortSource.next(sortMeta);
- };
- TreeTableService.prototype.onSelectionChange = function () {
- this.selectionSource.next();
- };
- TreeTableService.prototype.onContextMenu = function (node) {
- this.contextMenuSource.next(node);
- };
- TreeTableService.prototype.onUIUpdate = function (value) {
- this.uiUpdateSource.next(value);
- };
- TreeTableService.prototype.onTotalRecordsChange = function (value) {
- this.totalRecordsSource.next(value);
- };
- TreeTableService = __decorate([
- core_1.Injectable()
- ], TreeTableService);
- return TreeTableService;
- }());
- exports.TreeTableService = TreeTableService;
- var TreeTable = /** @class */ (function () {
- function TreeTable(el, zone, tableService) {
- this.el = el;
- this.zone = zone;
- this.tableService = tableService;
- this.lazy = false;
- this.first = 0;
- this.pageLinks = 5;
- this.alwaysShowPaginator = true;
- this.paginatorPosition = 'bottom';
- this.defaultSortOrder = 1;
- this.sortMode = 'single';
- this.resetPageOnSort = true;
- this.selectionChange = new core_1.EventEmitter();
- this.contextMenuSelectionChange = new core_1.EventEmitter();
- this.contextMenuSelectionMode = "separate";
- this.compareSelectionBy = 'deepEquals';
- this.loadingIcon = 'pi pi-spinner';
- this.showLoader = true;
- this.virtualScrollDelay = 150;
- this.virtualRowHeight = 28;
- this.columnResizeMode = 'fit';
- this.rowTrackBy = function (index, item) { return item; };
- this.filters = {};
- this.filterDelay = 300;
- this.filterMode = 'lenient';
- this.onFilter = new core_1.EventEmitter();
- this.onNodeExpand = new core_1.EventEmitter();
- this.onNodeCollapse = new core_1.EventEmitter();
- this.onPage = new core_1.EventEmitter();
- this.onSort = new core_1.EventEmitter();
- this.onLazyLoad = new core_1.EventEmitter();
- this.sortFunction = new core_1.EventEmitter();
- this.onColResize = new core_1.EventEmitter();
- this.onColReorder = new core_1.EventEmitter();
- this.onNodeSelect = new core_1.EventEmitter();
- this.onNodeUnselect = new core_1.EventEmitter();
- this.onContextMenuSelect = new core_1.EventEmitter();
- this.onHeaderCheckboxToggle = new core_1.EventEmitter();
- this.onEditInit = new core_1.EventEmitter();
- this.onEditComplete = new core_1.EventEmitter();
- this.onEditCancel = new core_1.EventEmitter();
- this._value = [];
- this._totalRecords = 0;
- this._sortOrder = 1;
- this.selectionKeys = {};
- }
- TreeTable.prototype.ngOnInit = function () {
- if (this.lazy) {
- this.onLazyLoad.emit(this.createLazyLoadMetadata());
- }
- this.initialized = true;
- };
- TreeTable.prototype.ngAfterContentInit = function () {
- var _this = this;
- this.templates.forEach(function (item) {
- switch (item.getType()) {
- case 'caption':
- _this.captionTemplate = item.template;
- break;
- case 'header':
- _this.headerTemplate = item.template;
- break;
- case 'body':
- _this.bodyTemplate = item.template;
- break;
- case 'loadingbody':
- _this.loadingBodyTemplate = item.template;
- break;
- case 'footer':
- _this.footerTemplate = item.template;
- break;
- case 'summary':
- _this.summaryTemplate = item.template;
- break;
- case 'colgroup':
- _this.colGroupTemplate = item.template;
- break;
- case 'emptymessage':
- _this.emptyMessageTemplate = item.template;
- break;
- case 'paginatorleft':
- _this.paginatorLeftTemplate = item.template;
- break;
- case 'paginatorright':
- _this.paginatorRightTemplate = item.template;
- break;
- case 'frozenheader':
- _this.frozenHeaderTemplate = item.template;
- break;
- case 'frozenbody':
- _this.frozenBodyTemplate = item.template;
- break;
- case 'frozenfooter':
- _this.frozenFooterTemplate = item.template;
- break;
- case 'frozencolgroup':
- _this.frozenColGroupTemplate = item.template;
- break;
- }
- });
- };
- Object.defineProperty(TreeTable.prototype, "value", {
- get: function () {
- return this._value;
- },
- set: function (val) {
- this._value = val;
- if (!this.lazy) {
- this.totalRecords = (this._value ? this._value.length : 0);
- if (this.sortMode == 'single' && this.sortField)
- this.sortSingle();
- else if (this.sortMode == 'multiple' && this.multiSortMeta)
- this.sortMultiple();
- else if (this.hasFilter()) //sort already filters
- this._filter();
- }
- if (this.virtualScroll && this.virtualScrollCallback) {
- this.virtualScrollCallback();
- }
- this.updateSerializedValue();
- this.tableService.onUIUpdate(this.value);
- },
- enumerable: true,
- configurable: true
- });
- TreeTable.prototype.updateSerializedValue = function () {
- this.serializedValue = [];
- if (this.paginator)
- this.serializePageNodes();
- else
- this.serializeNodes(null, this.filteredNodes || this.value, 0, true);
- };
- TreeTable.prototype.serializeNodes = function (parent, nodes, level, visible) {
- if (nodes && nodes.length) {
- for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
- var node = nodes_1[_i];
- node.parent = parent;
- var rowNode = {
- node: node,
- parent: parent,
- level: level,
- visible: visible && (parent ? parent.expanded : true)
- };
- this.serializedValue.push(rowNode);
- if (rowNode.visible && node.expanded) {
- this.serializeNodes(node, node.children, level + 1, rowNode.visible);
- }
- }
- }
- };
- TreeTable.prototype.serializePageNodes = function () {
- var data = this.filteredNodes || this.value;
- this.serializedValue = [];
- if (data && data.length) {
- var first = this.lazy ? 0 : this.first;
- for (var i = first; i < (first + this.rows); i++) {
- var node = data[i];
- if (node) {
- this.serializedValue.push({
- node: node,
- parent: null,
- level: 0,
- visible: true
- });
- this.serializeNodes(node, node.children, 1, true);
- }
- }
- }
- };
- Object.defineProperty(TreeTable.prototype, "totalRecords", {
- get: function () {
- return this._totalRecords;
- },
- set: function (val) {
- this._totalRecords = val;
- this.tableService.onTotalRecordsChange(this._totalRecords);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(TreeTable.prototype, "sortField", {
- get: function () {
- return this._sortField;
- },
- set: function (val) {
- this._sortField = val;
- //avoid triggering lazy load prior to lazy initialization at onInit
- if (!this.lazy || this.initialized) {
- if (this.sortMode === 'single') {
- this.sortSingle();
- }
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(TreeTable.prototype, "sortOrder", {
- get: function () {
- return this._sortOrder;
- },
- set: function (val) {
- this._sortOrder = val;
- //avoid triggering lazy load prior to lazy initialization at onInit
- if (!this.lazy || this.initialized) {
- if (this.sortMode === 'single') {
- this.sortSingle();
- }
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(TreeTable.prototype, "multiSortMeta", {
- get: function () {
- return this._multiSortMeta;
- },
- set: function (val) {
- this._multiSortMeta = val;
- if (this.sortMode === 'multiple') {
- this.sortMultiple();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(TreeTable.prototype, "selection", {
- get: function () {
- return this._selection;
- },
- set: function (val) {
- this._selection = val;
- if (!this.preventSelectionSetterPropagation) {
- this.updateSelectionKeys();
- this.tableService.onSelectionChange();
- }
- this.preventSelectionSetterPropagation = false;
- },
- enumerable: true,
- configurable: true
- });
- TreeTable.prototype.updateSelectionKeys = function () {
- if (this.dataKey && this._selection) {
- this.selectionKeys = {};
- if (Array.isArray(this._selection)) {
- for (var _i = 0, _a = this._selection; _i < _a.length; _i++) {
- var node = _a[_i];
- this.selectionKeys[String(objectutils_1.ObjectUtils.resolveFieldData(node.data, this.dataKey))] = 1;
- }
- }
- else {
- this.selectionKeys[String(objectutils_1.ObjectUtils.resolveFieldData(this._selection.data, this.dataKey))] = 1;
- }
- }
- };
- TreeTable.prototype.onPageChange = function (event) {
- this.first = event.first;
- this.rows = event.rows;
- if (this.lazy)
- this.onLazyLoad.emit(this.createLazyLoadMetadata());
- else
- this.serializePageNodes();
- this.onPage.emit({
- first: this.first,
- rows: this.rows
- });
- this.tableService.onUIUpdate(this.value);
- };
- TreeTable.prototype.sort = function (event) {
- var originalEvent = event.originalEvent;
- if (this.sortMode === 'single') {
- this._sortOrder = (this.sortField === event.field) ? this.sortOrder * -1 : this.defaultSortOrder;
- this._sortField = event.field;
- this.sortSingle();
- }
- if (this.sortMode === 'multiple') {
- var metaKey = originalEvent.metaKey || originalEvent.ctrlKey;
- var sortMeta = this.getSortMeta(event.field);
- if (sortMeta) {
- if (!metaKey) {
- this._multiSortMeta = [{ field: event.field, order: sortMeta.order * -1 }];
- }
- else {
- sortMeta.order = sortMeta.order * -1;
- }
- }
- else {
- if (!metaKey || !this.multiSortMeta) {
- this._multiSortMeta = [];
- }
- this.multiSortMeta.push({ field: event.field, order: this.defaultSortOrder });
- }
- this.sortMultiple();
- }
- };
- TreeTable.prototype.sortSingle = function () {
- if (this.sortField && this.sortOrder) {
- if (this.resetPageOnSort) {
- this.first = 0;
- }
- if (this.lazy) {
- this.onLazyLoad.emit(this.createLazyLoadMetadata());
- }
- else if (this.value) {
- this.sortNodes(this.value);
- if (this.hasFilter()) {
- this._filter();
- }
- }
- var sortMeta = {
- field: this.sortField,
- order: this.sortOrder
- };
- this.onSort.emit(sortMeta);
- this.tableService.onSort(sortMeta);
- this.updateSerializedValue();
- }
- };
- TreeTable.prototype.sortNodes = function (nodes) {
- var _this = this;
- if (!nodes || nodes.length === 0) {
- return;
- }
- if (this.customSort) {
- this.sortFunction.emit({
- data: nodes,
- mode: this.sortMode,
- field: this.sortField,
- order: this.sortOrder
- });
- }
- else {
- nodes.sort(function (node1, node2) {
- var value1 = objectutils_1.ObjectUtils.resolveFieldData(node1.data, _this.sortField);
- var value2 = objectutils_1.ObjectUtils.resolveFieldData(node2.data, _this.sortField);
- var result = null;
- if (value1 == null && value2 != null)
- result = -1;
- else if (value1 != null && value2 == null)
- result = 1;
- else if (value1 == null && value2 == null)
- result = 0;
- else if (typeof value1 === 'string' && typeof value2 === 'string')
- result = value1.localeCompare(value2, undefined, { numeric: true });
- else
- result = (value1 < value2) ? -1 : (value1 > value2) ? 1 : 0;
- return (_this.sortOrder * result);
- });
- }
- for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
- var node = nodes_2[_i];
- this.sortNodes(node.children);
- }
- };
- TreeTable.prototype.sortMultiple = function () {
- if (this.multiSortMeta) {
- if (this.lazy) {
- this.onLazyLoad.emit(this.createLazyLoadMetadata());
- }
- else if (this.value) {
- this.sortMultipleNodes(this.value);
- if (this.hasFilter()) {
- this._filter();
- }
- }
- this.onSort.emit({
- multisortmeta: this.multiSortMeta
- });
- this.tableService.onSort(this.multiSortMeta);
- this.updateSerializedValue();
- }
- };
- TreeTable.prototype.sortMultipleNodes = function (nodes) {
- var _this = this;
- if (!nodes || nodes.length === 0) {
- return;
- }
- if (this.customSort) {
- this.sortFunction.emit({
- data: this.value,
- mode: this.sortMode,
- multiSortMeta: this.multiSortMeta
- });
- }
- else {
- this.value.sort(function (node1, node2) {
- return _this.multisortField(node1, node2, _this.multiSortMeta, 0);
- });
- }
- for (var _i = 0, nodes_3 = nodes; _i < nodes_3.length; _i++) {
- var node = nodes_3[_i];
- this.sortMultipleNodes(node.children);
- }
- };
- TreeTable.prototype.multisortField = function (node1, node2, multiSortMeta, index) {
- var value1 = objectutils_1.ObjectUtils.resolveFieldData(node1.data, multiSortMeta[index].field);
- var value2 = objectutils_1.ObjectUtils.resolveFieldData(node2.data, multiSortMeta[index].field);
- var result = null;
- if (value1 == null && value2 != null)
- result = -1;
- else if (value1 != null && value2 == null)
- result = 1;
- else if (value1 == null && value2 == null)
- result = 0;
- if (typeof value1 == 'string' || value1 instanceof String) {
- if (value1.localeCompare && (value1 != value2)) {
- return (multiSortMeta[index].order * value1.localeCompare(value2, undefined, { numeric: true }));
- }
- }
- else {
- result = (value1 < value2) ? -1 : 1;
- }
- if (value1 == value2) {
- return (multiSortMeta.length - 1) > (index) ? (this.multisortField(node1, node2, multiSortMeta, index + 1)) : 0;
- }
- return (multiSortMeta[index].order * result);
- };
- TreeTable.prototype.getSortMeta = function (field) {
- if (this.multiSortMeta && this.multiSortMeta.length) {
- for (var i = 0; i < this.multiSortMeta.length; i++) {
- if (this.multiSortMeta[i].field === field) {
- return this.multiSortMeta[i];
- }
- }
- }
- return null;
- };
- TreeTable.prototype.isSorted = function (field) {
- if (this.sortMode === 'single') {
- return (this.sortField && this.sortField === field);
- }
- else if (this.sortMode === 'multiple') {
- var sorted = false;
- if (this.multiSortMeta) {
- for (var i = 0; i < this.multiSortMeta.length; i++) {
- if (this.multiSortMeta[i].field == field) {
- sorted = true;
- break;
- }
- }
- }
- return sorted;
- }
- };
- TreeTable.prototype.createLazyLoadMetadata = function () {
- return {
- first: this.first,
- rows: this.virtualScroll ? this.rows * 2 : this.rows,
- sortField: this.sortField,
- sortOrder: this.sortOrder,
- filters: this.filters,
- globalFilter: this.filters && this.filters['global'] ? this.filters['global'].value : null,
- multiSortMeta: this.multiSortMeta
- };
- };
- TreeTable.prototype.handleVirtualScroll = function (event) {
- var _this = this;
- this.first = (event.page - 1) * this.rows;
- this.virtualScrollCallback = event.callback;
- this.zone.run(function () {
- if (_this.virtualScrollTimer) {
- clearTimeout(_this.virtualScrollTimer);
- }
- _this.virtualScrollTimer = setTimeout(function () {
- _this.onLazyLoad.emit(_this.createLazyLoadMetadata());
- }, _this.virtualScrollDelay);
- });
- };
- TreeTable.prototype.isEmpty = function () {
- var data = this.filteredNodes || this.value;
- return data == null || data.length == 0;
- };
- TreeTable.prototype.getBlockableElement = function () {
- return this.el.nativeElement.children[0];
- };
- TreeTable.prototype.onColumnResizeBegin = function (event) {
- var containerLeft = domhandler_1.DomHandler.getOffset(this.containerViewChild.nativeElement).left;
- this.lastResizerHelperX = (event.pageX - containerLeft + this.containerViewChild.nativeElement.scrollLeft);
- event.preventDefault();
- };
- TreeTable.prototype.onColumnResize = function (event) {
- var containerLeft = domhandler_1.DomHandler.getOffset(this.containerViewChild.nativeElement).left;
- domhandler_1.DomHandler.addClass(this.containerViewChild.nativeElement, 'ui-unselectable-text');
- this.resizeHelperViewChild.nativeElement.style.height = this.containerViewChild.nativeElement.offsetHeight + 'px';
- this.resizeHelperViewChild.nativeElement.style.top = 0 + 'px';
- this.resizeHelperViewChild.nativeElement.style.left = (event.pageX - containerLeft + this.containerViewChild.nativeElement.scrollLeft) + 'px';
- this.resizeHelperViewChild.nativeElement.style.display = 'block';
- };
- TreeTable.prototype.onColumnResizeEnd = function (event, column) {
- var delta = this.resizeHelperViewChild.nativeElement.offsetLeft - this.lastResizerHelperX;
- var columnWidth = column.offsetWidth;
- var newColumnWidth = columnWidth + delta;
- var minWidth = column.style.minWidth || 15;
- if (columnWidth + delta > parseInt(minWidth)) {
- if (this.columnResizeMode === 'fit') {
- var nextColumn = column.nextElementSibling;
- while (!nextColumn.offsetParent) {
- nextColumn = nextColumn.nextElementSibling;
- }
- if (nextColumn) {
- var nextColumnWidth = nextColumn.offsetWidth - delta;
- var nextColumnMinWidth = nextColumn.style.minWidth || 15;
- if (newColumnWidth > 15 && nextColumnWidth > parseInt(nextColumnMinWidth)) {
- if (this.scrollable) {
- var scrollableView = this.findParentScrollableView(column);
- var scrollableBodyTable = domhandler_1.DomHandler.findSingle(scrollableView, 'table.ui-treetable-scrollable-body-table');
- var scrollableHeaderTable = domhandler_1.DomHandler.findSingle(scrollableView, 'table.ui-treetable-scrollable-header-table');
- var scrollableFooterTable = domhandler_1.DomHandler.findSingle(scrollableView, 'table.ui-treetable-scrollable-footer-table');
- var resizeColumnIndex = domhandler_1.DomHandler.index(column);
- this.resizeColGroup(scrollableHeaderTable, resizeColumnIndex, newColumnWidth, nextColumnWidth);
- this.resizeColGroup(scrollableBodyTable, resizeColumnIndex, newColumnWidth, nextColumnWidth);
- this.resizeColGroup(scrollableFooterTable, resizeColumnIndex, newColumnWidth, nextColumnWidth);
- }
- else {
- column.style.width = newColumnWidth + 'px';
- if (nextColumn) {
- nextColumn.style.width = nextColumnWidth + 'px';
- }
- }
- }
- }
- }
- else if (this.columnResizeMode === 'expand') {
- if (this.scrollable) {
- var scrollableView = this.findParentScrollableView(column);
- var scrollableBodyTable = domhandler_1.DomHandler.findSingle(scrollableView, 'table.ui-treetable-scrollable-body-table');
- var scrollableHeaderTable = domhandler_1.DomHandler.findSingle(scrollableView, 'table.ui-treetable-scrollable-header-table');
- var scrollableFooterTable = domhandler_1.DomHandler.findSingle(scrollableView, 'table.ui-treetable-scrollable-footer-table');
- scrollableBodyTable.style.width = scrollableBodyTable.offsetWidth + delta + 'px';
- scrollableHeaderTable.style.width = scrollableHeaderTable.offsetWidth + delta + 'px';
- if (scrollableFooterTable) {
- scrollableFooterTable.style.width = scrollableHeaderTable.offsetWidth + delta + 'px';
- }
- var resizeColumnIndex = domhandler_1.DomHandler.index(column);
- this.resizeColGroup(scrollableHeaderTable, resizeColumnIndex, newColumnWidth, null);
- this.resizeColGroup(scrollableBodyTable, resizeColumnIndex, newColumnWidth, null);
- this.resizeColGroup(scrollableFooterTable, resizeColumnIndex, newColumnWidth, null);
- }
- else {
- this.tableViewChild.nativeElement.style.width = this.tableViewChild.nativeElement.offsetWidth + delta + 'px';
- column.style.width = newColumnWidth + 'px';
- var containerWidth = this.tableViewChild.nativeElement.style.width;
- this.containerViewChild.nativeElement.style.width = containerWidth + 'px';
- }
- }
- this.onColResize.emit({
- element: column,
- delta: delta
- });
- }
- this.resizeHelperViewChild.nativeElement.style.display = 'none';
- domhandler_1.DomHandler.removeClass(this.containerViewChild.nativeElement, 'ui-unselectable-text');
- };
- TreeTable.prototype.findParentScrollableView = function (column) {
- if (column) {
- var parent_1 = column.parentElement;
- while (parent_1 && !domhandler_1.DomHandler.hasClass(parent_1, 'ui-treetable-scrollable-view')) {
- parent_1 = parent_1.parentElement;
- }
- return parent_1;
- }
- else {
- return null;
- }
- };
- TreeTable.prototype.resizeColGroup = function (table, resizeColumnIndex, newColumnWidth, nextColumnWidth) {
- if (table) {
- var colGroup = table.children[0].nodeName === 'COLGROUP' ? table.children[0] : null;
- if (colGroup) {
- var col = colGroup.children[resizeColumnIndex];
- var nextCol = col.nextElementSibling;
- col.style.width = newColumnWidth + 'px';
- if (nextCol && nextColumnWidth) {
- nextCol.style.width = nextColumnWidth + 'px';
- }
- }
- else {
- throw "Scrollable tables require a colgroup to support resizable columns";
- }
- }
- };
- TreeTable.prototype.onColumnDragStart = function (event, columnElement) {
- this.reorderIconWidth = domhandler_1.DomHandler.getHiddenElementOuterWidth(this.reorderIndicatorUpViewChild.nativeElement);
- this.reorderIconHeight = domhandler_1.DomHandler.getHiddenElementOuterHeight(this.reorderIndicatorDownViewChild.nativeElement);
- this.draggedColumn = columnElement;
- event.dataTransfer.setData('text', 'b'); // For firefox
- };
- TreeTable.prototype.onColumnDragEnter = function (event, dropHeader) {
- if (this.reorderableColumns && this.draggedColumn && dropHeader) {
- event.preventDefault();
- var containerOffset = domhandler_1.DomHandler.getOffset(this.containerViewChild.nativeElement);
- var dropHeaderOffset = domhandler_1.DomHandler.getOffset(dropHeader);
- if (this.draggedColumn != dropHeader) {
- var targetLeft = dropHeaderOffset.left - containerOffset.left;
- var targetTop = containerOffset.top - dropHeaderOffset.top;
- var columnCenter = dropHeaderOffset.left + dropHeader.offsetWidth / 2;
- this.reorderIndicatorUpViewChild.nativeElement.style.top = dropHeaderOffset.top - containerOffset.top - (this.reorderIconHeight - 1) + 'px';
- this.reorderIndicatorDownViewChild.nativeElement.style.top = dropHeaderOffset.top - containerOffset.top + dropHeader.offsetHeight + 'px';
- if (event.pageX > columnCenter) {
- this.reorderIndicatorUpViewChild.nativeElement.style.left = (targetLeft + dropHeader.offsetWidth - Math.ceil(this.reorderIconWidth / 2)) + 'px';
- this.reorderIndicatorDownViewChild.nativeElement.style.left = (targetLeft + dropHeader.offsetWidth - Math.ceil(this.reorderIconWidth / 2)) + 'px';
- this.dropPosition = 1;
- }
- else {
- this.reorderIndicatorUpViewChild.nativeElement.style.left = (targetLeft - Math.ceil(this.reorderIconWidth / 2)) + 'px';
- this.reorderIndicatorDownViewChild.nativeElement.style.left = (targetLeft - Math.ceil(this.reorderIconWidth / 2)) + 'px';
- this.dropPosition = -1;
- }
- this.reorderIndicatorUpViewChild.nativeElement.style.display = 'block';
- this.reorderIndicatorDownViewChild.nativeElement.style.display = 'block';
- }
- else {
- event.dataTransfer.dropEffect = 'none';
- }
- }
- };
- TreeTable.prototype.onColumnDragLeave = function (event) {
- if (this.reorderableColumns && this.draggedColumn) {
- event.preventDefault();
- this.reorderIndicatorUpViewChild.nativeElement.style.display = 'none';
- this.reorderIndicatorDownViewChild.nativeElement.style.display = 'none';
- }
- };
- TreeTable.prototype.onColumnDrop = function (event, dropColumn) {
- event.preventDefault();
- if (this.draggedColumn) {
- var dragIndex = domhandler_1.DomHandler.indexWithinGroup(this.draggedColumn, 'ttreorderablecolumn');
- var dropIndex = domhandler_1.DomHandler.indexWithinGroup(dropColumn, 'ttreorderablecolumn');
- var allowDrop = (dragIndex != dropIndex);
- if (allowDrop && ((dropIndex - dragIndex == 1 && this.dropPosition === -1) || (dragIndex - dropIndex == 1 && this.dropPosition === 1))) {
- allowDrop = false;
- }
- if (allowDrop && ((dropIndex < dragIndex && this.dropPosition === 1))) {
- dropIndex = dropIndex + 1;
- }
- if (allowDrop && ((dropIndex > dragIndex && this.dropPosition === -1))) {
- dropIndex = dropIndex - 1;
- }
- if (allowDrop) {
- objectutils_1.ObjectUtils.reorderArray(this.columns, dragIndex, dropIndex);
- this.onColReorder.emit({
- dragIndex: dragIndex,
- dropIndex: dropIndex,
- columns: this.columns
- });
- }
- this.reorderIndicatorUpViewChild.nativeElement.style.display = 'none';
- this.reorderIndicatorDownViewChild.nativeElement.style.display = 'none';
- this.draggedColumn.draggable = false;
- this.draggedColumn = null;
- this.dropPosition = null;
- }
- };
- TreeTable.prototype.handleRowClick = function (event) {
- var targetNode = event.originalEvent.target.nodeName;
- if (targetNode == 'INPUT' || targetNode == 'BUTTON' || targetNode == 'A' || (domhandler_1.DomHandler.hasClass(event.originalEvent.target, 'ui-clickable'))) {
- return;
- }
- if (this.selectionMode) {
- this.preventSelectionSetterPropagation = true;
- var rowNode = event.rowNode;
- var selected = this.isSelected(rowNode.node);
- var metaSelection = this.rowTouched ? false : this.metaKeySelection;
- var dataKeyValue = this.dataKey ? String(objectutils_1.ObjectUtils.resolveFieldData(rowNode.node.data, this.dataKey)) : null;
- if (metaSelection) {
- var metaKey = event.originalEvent.metaKey || event.originalEvent.ctrlKey;
- if (selected && metaKey) {
- if (this.isSingleSelectionMode()) {
- this._selection = null;
- this.selectionKeys = {};
- this.selectionChange.emit(null);
- }
- else {
- var selectionIndex_1 = this.findIndexInSelection(rowNode.node);
- this._selection = this.selection.filter(function (val, i) { return i != selectionIndex_1; });
- this.selectionChange.emit(this.selection);
- if (dataKeyValue) {
- delete this.selectionKeys[dataKeyValue];
- }
- }
- this.onNodeUnselect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row' });
- }
- else {
- if (this.isSingleSelectionMode()) {
- this._selection = rowNode.node;
- this.selectionChange.emit(rowNode.node);
- if (dataKeyValue) {
- this.selectionKeys = {};
- this.selectionKeys[dataKeyValue] = 1;
- }
- }
- else if (this.isMultipleSelectionMode()) {
- if (metaKey) {
- this._selection = this.selection || [];
- }
- else {
- this._selection = [];
- this.selectionKeys = {};
- }
- this._selection = this.selection.concat([rowNode.node]);
- this.selectionChange.emit(this.selection);
- if (dataKeyValue) {
- this.selectionKeys[dataKeyValue] = 1;
- }
- }
- this.onNodeSelect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row', index: event.rowIndex });
- }
- }
- else {
- if (this.selectionMode === 'single') {
- if (selected) {
- this._selection = null;
- this.selectionKeys = {};
- this.selectionChange.emit(this.selection);
- this.onNodeUnselect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row' });
- }
- else {
- this._selection = rowNode.node;
- this.selectionChange.emit(this.selection);
- this.onNodeSelect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row', index: event.rowIndex });
- if (dataKeyValue) {
- this.selectionKeys = {};
- this.selectionKeys[dataKeyValue] = 1;
- }
- }
- }
- else if (this.selectionMode === 'multiple') {
- if (selected) {
- var selectionIndex_2 = this.findIndexInSelection(rowNode.node);
- this._selection = this.selection.filter(function (val, i) { return i != selectionIndex_2; });
- this.selectionChange.emit(this.selection);
- this.onNodeUnselect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row' });
- if (dataKeyValue) {
- delete this.selectionKeys[dataKeyValue];
- }
- }
- else {
- this._selection = this.selection ? this.selection.concat([rowNode.node]) : [rowNode.node];
- this.selectionChange.emit(this.selection);
- this.onNodeSelect.emit({ originalEvent: event.originalEvent, node: rowNode.node, type: 'row', index: event.rowIndex });
- if (dataKeyValue) {
- this.selectionKeys[dataKeyValue] = 1;
- }
- }
- }
- }
- this.tableService.onSelectionChange();
- }
- this.rowTouched = false;
- };
- TreeTable.prototype.handleRowTouchEnd = function (event) {
- this.rowTouched = true;
- };
- TreeTable.prototype.handleRowRightClick = function (event) {
- if (this.contextMenu) {
- var node = event.rowNode.node;
- if (this.contextMenuSelectionMode === 'separate') {
- this.contextMenuSelection = node;
- this.contextMenuSelectionChange.emit(node);
- this.onContextMenuSelect.emit({ originalEvent: event.originalEvent, node: node });
- this.contextMenu.show(event.originalEvent);
- this.tableService.onContextMenu(node);
- }
- else if (this.contextMenuSelectionMode === 'joint') {
- this.preventSelectionSetterPropagation = true;
- var selected = this.isSelected(node);
- var dataKeyValue = this.dataKey ? String(objectutils_1.ObjectUtils.resolveFieldData(node.data, this.dataKey)) : null;
- if (!selected) {
- if (this.isSingleSelectionMode()) {
- this.selection = node;
- this.selectionChange.emit(node);
- }
- else if (this.isMultipleSelectionMode()) {
- this.selection = [node];
- this.selectionChange.emit(this.selection);
- }
- if (dataKeyValue) {
- this.selectionKeys[dataKeyValue] = 1;
- }
- }
- this.contextMenu.show(event.originalEvent);
- this.onContextMenuSelect.emit({ originalEvent: event.originalEvent, node: node });
- }
- }
- };
- TreeTable.prototype.toggleNodeWithCheckbox = function (event) {
- this.selection = this.selection || [];
- this.preventSelectionSetterPropagation = true;
- var node = event.rowNode.node;
- var selected = this.isSelected(node);
- if (selected) {
- this.propagateSelectionDown(node, false);
- if (event.rowNode.parent) {
- this.propagateSelectionUp(node.parent, false);
- }
- this.selectionChange.emit(this.selection);
- this.onNodeUnselect.emit({ originalEvent: event, node: node });
- }
- else {
- this.propagateSelectionDown(node, true);
- if (event.rowNode.parent) {
- this.propagateSelectionUp(node.parent, true);
- }
- this.selectionChange.emit(this.selection);
- this.onNodeSelect.emit({ originalEvent: event, node: node });
- }
- this.tableService.onSelectionChange();
- };
- TreeTable.prototype.toggleNodesWithCheckbox = function (event, check) {
- var data = this.filteredNodes || this.value;
- this._selection = check && data ? data.slice() : [];
- if (check) {
- if (data && data.length) {
- for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {
- var node = data_1[_i];
- this.propagateSelectionDown(node, true);
- }
- }
- }
- else {
- this._selection = [];
- this.selectionKeys = {};
- }
- this.preventSelectionSetterPropagation = true;
- this.selectionChange.emit(this._selection);
- this.tableService.onSelectionChange();
- this.onHeaderCheckboxToggle.emit({ originalEvent: event, checked: check });
- };
- TreeTable.prototype.propagateSelectionUp = function (node, select) {
- if (node.children && node.children.length) {
- var selectedChildCount = 0;
- var childPartialSelected = false;
- var dataKeyValue = this.dataKey ? String(objectutils_1.ObjectUtils.resolveFieldData(node.data, this.dataKey)) : null;
- for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
- var child = _a[_i];
- if (this.isSelected(child))
- selectedChildCount++;
- else if (child.partialSelected)
- childPartialSelected = true;
- }
- if (select && selectedChildCount == node.children.length) {
- this._selection = (this.selection || []).concat([node]);
- node.partialSelected = false;
- if (dataKeyValue) {
- this.selectionKeys[dataKeyValue] = 1;
- }
- }
- else {
- if (!select) {
- var index_1 = this.findIndexInSelection(node);
- if (index_1 >= 0) {
- this._selection = this.selection.filter(function (val, i) { return i != index_1; });
- if (dataKeyValue) {
- delete this.selectionKeys[dataKeyValue];
- }
- }
- }
- if (childPartialSelected || selectedChildCount > 0 && selectedChildCount != node.children.length)
- node.partialSelected = true;
- else
- node.partialSelected = false;
- }
- }
- var parent = node.parent;
- if (parent) {
- this.propagateSelectionUp(parent, select);
- }
- };
- TreeTable.prototype.propagateSelectionDown = function (node, select) {
- var index = this.findIndexInSelection(node);
- var dataKeyValue = this.dataKey ? String(objectutils_1.ObjectUtils.resolveFieldData(node.data, this.dataKey)) : null;
- if (select && index == -1) {
- this._selection = (this.selection || []).concat([node]);
- if (dataKeyValue) {
- this.selectionKeys[dataKeyValue] = 1;
- }
- }
- else if (!select && index > -1) {
- this._selection = this.selection.filter(function (val, i) { return i != index; });
- if (dataKeyValue) {
- delete this.selectionKeys[dataKeyValue];
- }
- }
- node.partialSelected = false;
- if (node.children && node.children.length) {
- for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
- var child = _a[_i];
- this.propagateSelectionDown(child, select);
- }
- }
- };
- TreeTable.prototype.isSelected = function (node) {
- if (node && this.selection) {
- if (this.dataKey) {
- return this.selectionKeys[objectutils_1.ObjectUtils.resolveFieldData(node.data, this.dataKey)] !== undefined;
- }
- else {
- if (this.selection instanceof Array)
- return this.findIndexInSelection(node) > -1;
- else
- return this.equals(node, this.selection);
- }
- }
- return false;
- };
- TreeTable.prototype.findIndexInSelection = function (node) {
- var index = -1;
- if (this.selection && this.selection.length) {
- for (var i = 0; i < this.selection.length; i++) {
- if (this.equals(node, this.selection[i])) {
- index = i;
- break;
- }
- }
- }
- return index;
- };
- TreeTable.prototype.isSingleSelectionMode = function () {
- return this.selectionMode === 'single';
- };
- TreeTable.prototype.isMultipleSelectionMode = function () {
- return this.selectionMode === 'multiple';
- };
- TreeTable.prototype.equals = function (node1, node2) {
- return this.compareSelectionBy === 'equals' ? (node1 === node2) : objectutils_1.ObjectUtils.equals(node1.data, node2.data, this.dataKey);
- };
- TreeTable.prototype.filter = function (value, field, matchMode) {
- var _this = this;
- if (this.filterTimeout) {
- clearTimeout(this.filterTimeout);
- }
- if (!this.isFilterBlank(value)) {
- this.filters[field] = { value: value, matchMode: matchMode };
- }
- else if (this.filters[field]) {
- delete this.filters[field];
- }
- this.filterTimeout = setTimeout(function () {
- _this._filter();
- _this.filterTimeout = null;
- }, this.filterDelay);
- };
- TreeTable.prototype.filterGlobal = function (value, matchMode) {
- this.filter(value, 'global', matchMode);
- };
- TreeTable.prototype.isFilterBlank = function (filter) {
- if (filter !== null && filter !== undefined) {
- if ((typeof filter === 'string' && filter.trim().length == 0) || (filter instanceof Array && filter.length == 0))
- return true;
- else
- return false;
- }
- return true;
- };
- TreeTable.prototype._filter = function () {
- if (this.lazy) {
- this.onLazyLoad.emit(this.createLazyLoadMetadata());
- }
- else {
- if (!this.value) {
- return;
- }
- if (!this.hasFilter()) {
- this.filteredNodes = null;
- if (this.paginator) {
- this.totalRecords = this.value ? this.value.length : 0;
- }
- }
- else {
- var globalFilterFieldsArray = void 0;
- if (this.filters['global']) {
- if (!this.columns && !this.globalFilterFields)
- throw new Error('Global filtering requires dynamic columns or globalFilterFields to be defined.');
- else
- globalFilterFieldsArray = this.globalFilterFields || this.columns;
- }
- this.filteredNodes = [];
- var isStrictMode = this.filterMode === 'strict';
- var isValueChanged = false;
- for (var _i = 0, _a = this.value; _i < _a.length; _i++) {
- var node = _a[_i];
- var copyNode = __assign({}, node);
- var localMatch = true;
- var globalMatch = false;
- var paramsWithoutNode = void 0;
- for (var prop in this.filters) {
- if (this.filters.hasOwnProperty(prop) && prop !== 'global') {
- var filterMeta = this.filters[prop];
- var filterField = prop;
- var filterValue = filterMeta.value;
- var filterMatchMode = filterMeta.matchMode || 'startsWith';
- var filterConstraint = filterutils_1.FilterUtils[filterMatchMode];
- paramsWithoutNode = { filterField: filterField, filterValue: filterValue, filterConstraint: filterConstraint, isStrictMode: isStrictMode };
- if ((isStrictMode && !(this.findFilteredNodes(copyNode, paramsWithoutNode) || this.isFilterMatched(copyNode, paramsWithoutNode))) ||
- (!isStrictMode && !(this.isFilterMatched(copyNode, paramsWithoutNode) || this.findFilteredNodes(copyNode, paramsWithoutNode)))) {
- localMatch = false;
- }
- if (!localMatch) {
- break;
- }
- }
- }
- if (this.filters['global'] && !globalMatch && globalFilterFieldsArray) {
- for (var j = 0; j < globalFilterFieldsArray.length; j++) {
- var copyNodeForGlobal = __assign({}, copyNode);
- var filterField = globalFilterFieldsArray[j].field || globalFilterFieldsArray[j];
- var filterValue = this.filters['global'].value;
- var filterConstraint = filterutils_1.FilterUtils[this.filters['global'].matchMode];
- paramsWithoutNode = { filterField: filterField, filterValue: filterValue, filterConstraint: filterConstraint, isStrictMode: isStrictMode };
- if ((isStrictMode && (this.findFilteredNodes(copyNodeForGlobal, paramsWithoutNode) || this.isFilterMatched(copyNodeForGlobal, paramsWithoutNode))) ||
- (!isStrictMode && (this.isFilterMatched(copyNodeForGlobal, paramsWithoutNode) || this.findFilteredNodes(copyNodeForGlobal, paramsWithoutNode)))) {
- globalMatch = true;
- copyNode = copyNodeForGlobal;
- }
- }
- }
- var matches = localMatch;
- if (this.filters['global']) {
- matches = localMatch && globalMatch;
- }
- if (matches) {
- this.filteredNodes.push(copyNode);
- }
- isValueChanged = isValueChanged || !localMatch || globalMatch || (localMatch && this.filteredNodes.length > 0) || (!globalMatch && this.filteredNodes.length === 0);
- }
- if (!isValueChanged) {
- this.filteredNodes = null;
- }
- if (this.paginator) {
- this.totalRecords = this.filteredNodes ? this.filteredNodes.length : this.value ? this.value.length : 0;
- }
- }
- }
- this.first = 0;
- var filteredValue = this.filteredNodes || this.value;
- this.onFilter.emit({
- filters: this.filters,
- filteredValue: filteredValue
- });
- this.tableService.onUIUpdate(filteredValue);
- this.updateSerializedValue();
- };
- TreeTable.prototype.findFilteredNodes = function (node, paramsWithoutNode) {
- if (node) {
- var matched = false;
- if (node.children) {
- var childNodes = node.children.slice();
- node.children = [];
- for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) {
- var childNode = childNodes_1[_i];
- var copyChildNode = __assign({}, childNode);
- if (this.isFilterMatched(copyChildNode, paramsWithoutNode)) {
- matched = true;
- node.children.push(copyChildNode);
- }
- }
- }
- if (matched) {
- return true;
- }
- }
- };
- TreeTable.prototype.isFilterMatched = function (node, _a) {
- var filterField = _a.filterField, filterValue = _a.filterValue, filterConstraint = _a.filterConstraint, isStrictMode = _a.isStrictMode;
- var matched = false;
- var dataFieldValue = objectutils_1.ObjectUtils.resolveFieldData(node.data, filterField);
- if (filterConstraint(dataFieldValue, filterValue)) {
- matched = true;
- }
- if (!matched || (isStrictMode && !this.isNodeLeaf(node))) {
- matched = this.findFilteredNodes(node, { filterField: filterField, filterValue: filterValue, filterConstraint: filterConstraint, isStrictMode: isStrictMode }) || matched;
- }
- return matched;
- };
- TreeTable.prototype.isNodeLeaf = function (node) {
- return node.leaf === false ? false : !(node.children && node.children.length);
- };
- TreeTable.prototype.hasFilter = function () {
- var empty = true;
- for (var prop in this.filters) {
- if (this.filters.hasOwnProperty(prop)) {
- empty = false;
- break;
- }
- }
- return !empty;
- };
- TreeTable.prototype.reset = function () {
- this._sortField = null;
- this._sortOrder = 1;
- this._multiSortMeta = null;
- this.tableService.onSort(null);
- this.filteredNodes = null;
- this.filters = {};
- this.first = 0;
- if (this.lazy) {
- this.onLazyLoad.emit(this.createLazyLoadMetadata());
- }
- else {
- this.totalRecords = (this._value ? this._value.length : 0);
- }
- };
- TreeTable.prototype.updateEditingCell = function (cell) {
- this.editingCell = cell;
- this.bindDocumentEditListener();
- };
- TreeTable.prototype.isEditingCellValid = function () {
- return (this.editingCell && domhandler_1.DomHandler.find(this.editingCell, '.ng-invalid.ng-dirty').length === 0);
- };
- TreeTable.prototype.bindDocumentEditListener = function () {
- var _this = this;
- if (!this.documentEditListener) {
- this.documentEditListener = function (event) {
- if (_this.editingCell && !_this.editingCellClick && _this.isEditingCellValid()) {
- domhandler_1.DomHandler.removeClass(_this.editingCell, 'ui-editing-cell');
- _this.editingCell = null;
- _this.unbindDocumentEditListener();
- }
- _this.editingCellClick = false;
- };
- document.addEventListener('click', this.documentEditListener);
- }
- };
- TreeTable.prototype.unbindDocumentEditListener = function () {
- if (this.documentEditListener) {
- document.removeEventListener('click', this.documentEditListener);
- this.documentEditListener = null;
- }
- };
- TreeTable.prototype.ngOnDestroy = function () {
- this.unbindDocumentEditListener();
- this.editingCell = null;
- this.initialized = null;
- };
- __decorate([
- core_1.Input(),
- __metadata("design:type", Array)
- ], TreeTable.prototype, "columns", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Object)
- ], TreeTable.prototype, "style", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TreeTable.prototype, "styleClass", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "autoLayout", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "lazy", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "paginator", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Number)
- ], TreeTable.prototype, "rows", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Number)
- ], TreeTable.prototype, "first", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Number)
- ], TreeTable.prototype, "pageLinks", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Array)
- ], TreeTable.prototype, "rowsPerPageOptions", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "alwaysShowPaginator", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TreeTable.prototype, "paginatorPosition", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Object)
- ], TreeTable.prototype, "paginatorDropdownAppendTo", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Number)
- ], TreeTable.prototype, "defaultSortOrder", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TreeTable.prototype, "sortMode", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "resetPageOnSort", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "customSort", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TreeTable.prototype, "selectionMode", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "selectionChange", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Object)
- ], TreeTable.prototype, "contextMenuSelection", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "contextMenuSelectionChange", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TreeTable.prototype, "contextMenuSelectionMode", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TreeTable.prototype, "dataKey", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "metaKeySelection", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TreeTable.prototype, "compareSelectionBy", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "rowHover", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "loading", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TreeTable.prototype, "loadingIcon", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "showLoader", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "scrollable", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TreeTable.prototype, "scrollHeight", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "virtualScroll", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Number)
- ], TreeTable.prototype, "virtualScrollDelay", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Number)
- ], TreeTable.prototype, "virtualRowHeight", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TreeTable.prototype, "frozenWidth", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Array)
- ], TreeTable.prototype, "frozenColumns", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "resizableColumns", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TreeTable.prototype, "columnResizeMode", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TreeTable.prototype, "reorderableColumns", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Object)
- ], TreeTable.prototype, "contextMenu", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Function)
- ], TreeTable.prototype, "rowTrackBy", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Object)
- ], TreeTable.prototype, "filters", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Array)
- ], TreeTable.prototype, "globalFilterFields", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Number)
- ], TreeTable.prototype, "filterDelay", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TreeTable.prototype, "filterMode", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onFilter", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onNodeExpand", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onNodeCollapse", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onPage", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onSort", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onLazyLoad", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "sortFunction", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onColResize", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onColReorder", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onNodeSelect", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onNodeUnselect", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onContextMenuSelect", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onHeaderCheckboxToggle", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onEditInit", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onEditComplete", void 0);
- __decorate([
- core_1.Output(),
- __metadata("design:type", core_1.EventEmitter)
- ], TreeTable.prototype, "onEditCancel", void 0);
- __decorate([
- core_1.ViewChild('container', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TreeTable.prototype, "containerViewChild", void 0);
- __decorate([
- core_1.ViewChild('resizeHelper', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TreeTable.prototype, "resizeHelperViewChild", void 0);
- __decorate([
- core_1.ViewChild('reorderIndicatorUp', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TreeTable.prototype, "reorderIndicatorUpViewChild", void 0);
- __decorate([
- core_1.ViewChild('reorderIndicatorDown', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TreeTable.prototype, "reorderIndicatorDownViewChild", void 0);
- __decorate([
- core_1.ViewChild('table', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TreeTable.prototype, "tableViewChild", void 0);
- __decorate([
- core_1.ContentChildren(shared_1.PrimeTemplate),
- __metadata("design:type", core_1.QueryList)
- ], TreeTable.prototype, "templates", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Array),
- __metadata("design:paramtypes", [Array])
- ], TreeTable.prototype, "value", null);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Number),
- __metadata("design:paramtypes", [Number])
- ], TreeTable.prototype, "totalRecords", null);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String),
- __metadata("design:paramtypes", [String])
- ], TreeTable.prototype, "sortField", null);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Number),
- __metadata("design:paramtypes", [Number])
- ], TreeTable.prototype, "sortOrder", null);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Array),
- __metadata("design:paramtypes", [Array])
- ], TreeTable.prototype, "multiSortMeta", null);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Object),
- __metadata("design:paramtypes", [Object])
- ], TreeTable.prototype, "selection", null);
- TreeTable = __decorate([
- core_1.Component({
- selector: 'p-treeTable',
- template: "\n <div #container [ngStyle]=\"style\" [class]=\"styleClass\"\n [ngClass]=\"{'ui-treetable ui-widget': true, 'ui-treetable-auto-layout': autoLayout, 'ui-treetable-hoverable-rows': (rowHover||(selectionMode === 'single' || selectionMode === 'multiple')),\n 'ui-treetable-resizable': resizableColumns, 'ui-treetable-resizable-fit': (resizableColumns && columnResizeMode === 'fit')}\">\n <div class=\"ui-treetable-loading ui-widget-overlay\" *ngIf=\"loading && showLoader\"></div>\n <div class=\"ui-treetable-loading-content\" *ngIf=\"loading && showLoader\">\n <i [class]=\"'ui-treetable-loading-icon pi-spin ' + loadingIcon\"></i>\n </div>\n <div *ngIf=\"captionTemplate\" class=\"ui-treetable-caption ui-widget-header\">\n <ng-container *ngTemplateOutlet=\"captionTemplate\"></ng-container>\n </div>\n <p-paginator [rows]=\"rows\" [first]=\"first\" [totalRecords]=\"totalRecords\" [pageLinkSize]=\"pageLinks\" styleClass=\"ui-paginator-top\" [alwaysShow]=\"alwaysShowPaginator\"\n (onPageChange)=\"onPageChange($event)\" [rowsPerPageOptions]=\"rowsPerPageOptions\" *ngIf=\"paginator && (paginatorPosition === 'top' || paginatorPosition =='both')\"\n [templateLeft]=\"paginatorLeftTemplate\" [templateRight]=\"paginatorRightTemplate\" [dropdownAppendTo]=\"paginatorDropdownAppendTo\"></p-paginator>\n \n <div class=\"ui-treetable-wrapper\" *ngIf=\"!scrollable\">\n <table #table class=\"ui-treetable-table\">\n <ng-container *ngTemplateOutlet=\"colGroupTemplate; context {$implicit: columns}\"></ng-container>\n <thead class=\"ui-treetable-thead\">\n <ng-container *ngTemplateOutlet=\"headerTemplate; context: {$implicit: columns}\"></ng-container>\n </thead>\n <tfoot class=\"ui-treetable-tfoot\">\n <ng-container *ngTemplateOutlet=\"footerTemplate; context {$implicit: columns}\"></ng-container>\n </tfoot>\n <tbody class=\"ui-treetable-tbody\" [pTreeTableBody]=\"columns\" [pTreeTableBodyTemplate]=\"bodyTemplate\"></tbody>\n </table>\n </div>\n\n <div class=\"ui-treetable-scrollable-wrapper\" *ngIf=\"scrollable\">\n <div class=\"ui-treetable-scrollable-view ui-treetable-frozen-view\" *ngIf=\"frozenColumns||frozenBodyTemplate\" [ttScrollableView]=\"frozenColumns\" [frozen]=\"true\" [ngStyle]=\"{width: frozenWidth}\" [scrollHeight]=\"scrollHeight\"></div>\n <div class=\"ui-treetable-scrollable-view\" [ttScrollableView]=\"columns\" [frozen]=\"false\" [scrollHeight]=\"scrollHeight\"></div>\n </div>\n\n <p-paginator [rows]=\"rows\" [first]=\"first\" [totalRecords]=\"totalRecords\" [pageLinkSize]=\"pageLinks\" styleClass=\"ui-paginator-bottom\" [alwaysShow]=\"alwaysShowPaginator\"\n (onPageChange)=\"onPageChange($event)\" [rowsPerPageOptions]=\"rowsPerPageOptions\" *ngIf=\"paginator && (paginatorPosition === 'bottom' || paginatorPosition =='both')\"\n [templateLeft]=\"paginatorLeftTemplate\" [templateRight]=\"paginatorRightTemplate\" [dropdownAppendTo]=\"paginatorDropdownAppendTo\"></p-paginator>\n <div *ngIf=\"summaryTemplate\" class=\"ui-treetable-summary ui-widget-header\">\n <ng-container *ngTemplateOutlet=\"summaryTemplate\"></ng-container>\n </div>\n\n <div #resizeHelper class=\"ui-column-resizer-helper ui-state-highlight\" style=\"display:none\" *ngIf=\"resizableColumns\"></div>\n\n <span #reorderIndicatorUp class=\"pi pi-arrow-down ui-table-reorder-indicator-up\" *ngIf=\"reorderableColumns\"></span>\n <span #reorderIndicatorDown class=\"pi pi-arrow-up ui-table-reorder-indicator-down\" *ngIf=\"reorderableColumns\"></span>\n </div>\n ",
- providers: [TreeTableService]
- }),
- __metadata("design:paramtypes", [core_1.ElementRef, core_1.NgZone, TreeTableService])
- ], TreeTable);
- return TreeTable;
- }());
- exports.TreeTable = TreeTable;
- var TTBody = /** @class */ (function () {
- function TTBody(tt) {
- this.tt = tt;
- }
- __decorate([
- core_1.Input("pTreeTableBody"),
- __metadata("design:type", Array)
- ], TTBody.prototype, "columns", void 0);
- __decorate([
- core_1.Input("pTreeTableBodyTemplate"),
- __metadata("design:type", core_1.TemplateRef)
- ], TTBody.prototype, "template", void 0);
- TTBody = __decorate([
- core_1.Component({
- selector: '[pTreeTableBody]',
- template: "\n <ng-template ngFor let-serializedNode let-rowIndex=\"index\" [ngForOf]=\"tt.serializedValue\" [ngForTrackBy]=\"tt.rowTrackBy\">\n <ng-container *ngIf=\"serializedNode.visible\">\n <ng-container *ngTemplateOutlet=\"template; context: {$implicit: serializedNode, node: serializedNode.node, rowData: serializedNode.node.data, columns: columns}\"></ng-container>\n </ng-container>\n </ng-template>\n <ng-container *ngIf=\"tt.isEmpty()\">\n <ng-container *ngTemplateOutlet=\"tt.emptyMessageTemplate; context: {$implicit: columns}\"></ng-container>\n </ng-container>\n "
- }),
- __metadata("design:paramtypes", [TreeTable])
- ], TTBody);
- return TTBody;
- }());
- exports.TTBody = TTBody;
- var TTScrollableView = /** @class */ (function () {
- function TTScrollableView(tt, el, zone) {
- var _this = this;
- this.tt = tt;
- this.el = el;
- this.zone = zone;
- this.loadingArray = [];
- this.subscription = this.tt.tableService.uiUpdateSource$.subscribe(function () {
- _this.zone.runOutsideAngular(function () {
- setTimeout(function () {
- _this.alignScrollBar();
- _this.initialized = true;
- if (_this.scrollLoadingTableViewChild && _this.scrollLoadingTableViewChild.nativeElement) {
- _this.scrollLoadingTableViewChild.nativeElement.style.display = 'none';
- }
- }, 50);
- });
- });
- if (this.tt.virtualScroll) {
- this.totalRecordsSubscription = this.tt.tableService.totalRecordsSource$.subscribe(function () {
- _this.zone.runOutsideAngular(function () {
- setTimeout(function () {
- _this.setVirtualScrollerHeight();
- }, 50);
- });
- });
- }
- this.loadingArray = Array(this.tt.rows).fill(1);
- this.initialized = false;
- }
- Object.defineProperty(TTScrollableView.prototype, "scrollHeight", {
- get: function () {
- return this._scrollHeight;
- },
- set: function (val) {
- this._scrollHeight = val;
- this.setScrollHeight();
- },
- enumerable: true,
- configurable: true
- });
- TTScrollableView.prototype.ngAfterViewChecked = function () {
- if (!this.initialized && this.el.nativeElement.offsetParent) {
- this.alignScrollBar();
- this.initialized = true;
- }
- };
- TTScrollableView.prototype.ngAfterViewInit = function () {
- this.bindEvents();
- this.setScrollHeight();
- this.alignScrollBar();
- if (!this.frozen) {
- if (this.tt.frozenColumns || this.tt.frozenBodyTemplate) {
- domhandler_1.DomHandler.addClass(this.el.nativeElement, 'ui-treetable-unfrozen-view');
- }
- if (this.tt.frozenWidth) {
- this.el.nativeElement.style.left = this.tt.frozenWidth;
- this.el.nativeElement.style.width = 'calc(100% - ' + this.tt.frozenWidth + ')';
- }
- var frozenView = this.el.nativeElement.previousElementSibling;
- if (frozenView) {
- this.frozenSiblingBody = domhandler_1.DomHandler.findSingle(frozenView, '.ui-treetable-scrollable-body');
- }
- }
- else {
- this.scrollBodyViewChild.nativeElement.style.paddingBottom = domhandler_1.DomHandler.calculateScrollbarWidth() + 'px';
- }
- if (this.tt.virtualScroll) {
- this.setVirtualScrollerHeight();
- if (this.scrollLoadingTableViewChild && this.scrollLoadingTableViewChild.nativeElement) {
- this.scrollLoadingTableViewChild.nativeElement.style.display = 'table';
- }
- }
- };
- TTScrollableView.prototype.bindEvents = function () {
- var _this = this;
- this.zone.runOutsideAngular(function () {
- var scrollBarWidth = domhandler_1.DomHandler.calculateScrollbarWidth();
- if (_this.scrollHeaderViewChild && _this.scrollHeaderViewChild.nativeElement) {
- _this.headerScrollListener = _this.onHeaderScroll.bind(_this);
- _this.scrollHeaderBoxViewChild.nativeElement.addEventListener('scroll', _this.headerScrollListener);
- }
- if (_this.scrollFooterViewChild && _this.scrollFooterViewChild.nativeElement) {
- _this.footerScrollListener = _this.onFooterScroll.bind(_this);
- _this.scrollFooterViewChild.nativeElement.addEventListener('scroll', _this.footerScrollListener);
- }
- if (!_this.frozen) {
- _this.bodyScrollListener = _this.onBodyScroll.bind(_this);
- _this.scrollBodyViewChild.nativeElement.addEventListener('scroll', _this.bodyScrollListener);
- }
- });
- };
- TTScrollableView.prototype.unbindEvents = function () {
- if (this.scrollHeaderViewChild && this.scrollHeaderViewChild.nativeElement) {
- this.scrollHeaderBoxViewChild.nativeElement.removeEventListener('scroll', this.headerScrollListener);
- }
- if (this.scrollFooterViewChild && this.scrollFooterViewChild.nativeElement) {
- this.scrollFooterViewChild.nativeElement.removeEventListener('scroll', this.footerScrollListener);
- }
- this.scrollBodyViewChild.nativeElement.addEventListener('scroll', this.bodyScrollListener);
- };
- TTScrollableView.prototype.onHeaderScroll = function (event) {
- this.scrollHeaderViewChild.nativeElement.scrollLeft = 0;
- };
- TTScrollableView.prototype.onFooterScroll = function (event) {
- this.scrollFooterViewChild.nativeElement.scrollLeft = 0;
- };
- TTScrollableView.prototype.onBodyScroll = function (event) {
- var _this = this;
- if (this.scrollHeaderViewChild && this.scrollHeaderViewChild.nativeElement) {
- this.scrollHeaderBoxViewChild.nativeElement.style.marginLeft = -1 * this.scrollBodyViewChild.nativeElement.scrollLeft + 'px';
- }
- if (this.scrollFooterViewChild && this.scrollFooterViewChild.nativeElement) {
- this.scrollFooterBoxViewChild.nativeElement.style.marginLeft = -1 * this.scrollBodyViewChild.nativeElement.scrollLeft + 'px';
- }
- if (this.frozenSiblingBody) {
- this.frozenSiblingBody.scrollTop = this.scrollBodyViewChild.nativeElement.scrollTop;
- }
- if (this.tt.virtualScroll) {
- var viewport = domhandler_1.DomHandler.getOuterHeight(this.scrollBodyViewChild.nativeElement);
- var tableHeight = domhandler_1.DomHandler.getOuterHeight(this.scrollTableViewChild.nativeElement);
- var pageHeight_1 = this.tt.virtualRowHeight * this.tt.rows;
- var virtualTableHeight = domhandler_1.DomHandler.getOuterHeight(this.virtualScrollerViewChild.nativeElement);
- var pageCount = (virtualTableHeight / pageHeight_1) || 1;
- var scrollBodyTop = this.scrollTableViewChild.nativeElement.style.top || '0';
- if ((this.scrollBodyViewChild.nativeElement.scrollTop + viewport > parseFloat(scrollBodyTop) + tableHeight) || (this.scrollBodyViewChild.nativeElement.scrollTop < parseFloat(scrollBodyTop))) {
- if (this.scrollLoadingTableViewChild && this.scrollLoadingTableViewChild.nativeElement) {
- this.scrollLoadingTableViewChild.nativeElement.style.display = 'table';
- this.scrollLoadingTableViewChild.nativeElement.style.top = this.scrollBodyViewChild.nativeElement.scrollTop + 'px';
- }
- var page_1 = Math.floor((this.scrollBodyViewChild.nativeElement.scrollTop * pageCount) / (this.scrollBodyViewChild.nativeElement.scrollHeight)) + 1;
- this.tt.handleVirtualScroll({
- page: page_1,
- callback: function () {
- if (_this.scrollLoadingTableViewChild && _this.scrollLoadingTableViewChild.nativeElement) {
- _this.scrollLoadingTableViewChild.nativeElement.style.display = 'none';
- }
- _this.scrollTableViewChild.nativeElement.style.top = ((page_1 - 1) * pageHeight_1) + 'px';
- if (_this.frozenSiblingBody) {
- _this.frozenSiblingBody.children[0].style.top = _this.scrollTableViewChild.nativeElement.style.top;
- }
- }
- });
- }
- }
- };
- TTScrollableView.prototype.setScrollHeight = function () {
- if (this.scrollHeight && this.scrollBodyViewChild && this.scrollBodyViewChild.nativeElement) {
- if (this.scrollHeight.indexOf('%') !== -1) {
- var relativeHeight = void 0;
- this.scrollBodyViewChild.nativeElement.style.visibility = 'hidden';
- this.scrollBodyViewChild.nativeElement.style.height = '100px'; //temporary height to calculate static height
- var containerHeight = domhandler_1.DomHandler.getOuterHeight(this.tt.el.nativeElement.children[0]);
- if (this.scrollHeight.includes("calc")) {
- var percentHeight = parseInt(this.scrollHeight.slice(this.scrollHeight.indexOf("(") + 1, this.scrollHeight.indexOf("%")));
- var diffValue = parseInt(this.scrollHeight.slice(this.scrollHeight.indexOf("-") + 1, this.scrollHeight.indexOf(")")));
- relativeHeight = (domhandler_1.DomHandler.getOuterHeight(this.tt.el.nativeElement.parentElement) * percentHeight / 100) - diffValue;
- }
- else {
- relativeHeight = domhandler_1.DomHandler.getOuterHeight(this.tt.el.nativeElement.parentElement) * parseInt(this.scrollHeight) / 100;
- }
- var staticHeight = containerHeight - 100; //total height of headers, footers, paginators
- var scrollBodyHeight = (relativeHeight - staticHeight);
- if (this.frozen) {
- scrollBodyHeight -= domhandler_1.DomHandler.calculateScrollbarWidth();
- }
- this.scrollBodyViewChild.nativeElement.style.height = 'auto';
- this.scrollBodyViewChild.nativeElement.style.maxHeight = scrollBodyHeight + 'px';
- this.scrollBodyViewChild.nativeElement.style.visibility = 'visible';
- }
- else {
- if (this.frozen)
- this.scrollBodyViewChild.nativeElement.style.maxHeight = (parseInt(this.scrollHeight) - domhandler_1.DomHandler.calculateScrollbarWidth()) + 'px';
- else
- this.scrollBodyViewChild.nativeElement.style.maxHeight = this.scrollHeight;
- }
- }
- };
- TTScrollableView.prototype.setVirtualScrollerHeight = function () {
- if (this.virtualScrollerViewChild.nativeElement) {
- this.virtualScrollerViewChild.nativeElement.style.height = this.tt.totalRecords * this.tt.virtualRowHeight + 'px';
- }
- };
- TTScrollableView.prototype.hasVerticalOverflow = function () {
- return domhandler_1.DomHandler.getOuterHeight(this.scrollTableViewChild.nativeElement) > domhandler_1.DomHandler.getOuterHeight(this.scrollBodyViewChild.nativeElement);
- };
- TTScrollableView.prototype.alignScrollBar = function () {
- if (!this.frozen) {
- var scrollBarWidth = this.hasVerticalOverflow() ? domhandler_1.DomHandler.calculateScrollbarWidth() : 0;
- this.scrollHeaderBoxViewChild.nativeElement.style.marginRight = scrollBarWidth + 'px';
- if (this.scrollFooterBoxViewChild && this.scrollFooterBoxViewChild.nativeElement) {
- this.scrollFooterBoxViewChild.nativeElement.style.marginRight = scrollBarWidth + 'px';
- }
- }
- this.initialized = false;
- };
- TTScrollableView.prototype.ngOnDestroy = function () {
- this.unbindEvents();
- this.frozenSiblingBody = null;
- if (this.subscription) {
- this.subscription.unsubscribe();
- }
- if (this.totalRecordsSubscription) {
- this.totalRecordsSubscription.unsubscribe();
- }
- this.initialized = false;
- };
- __decorate([
- core_1.Input("ttScrollableView"),
- __metadata("design:type", Array)
- ], TTScrollableView.prototype, "columns", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TTScrollableView.prototype, "frozen", void 0);
- __decorate([
- core_1.ViewChild('scrollHeader', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TTScrollableView.prototype, "scrollHeaderViewChild", void 0);
- __decorate([
- core_1.ViewChild('scrollHeaderBox', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TTScrollableView.prototype, "scrollHeaderBoxViewChild", void 0);
- __decorate([
- core_1.ViewChild('scrollBody', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TTScrollableView.prototype, "scrollBodyViewChild", void 0);
- __decorate([
- core_1.ViewChild('scrollTable', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TTScrollableView.prototype, "scrollTableViewChild", void 0);
- __decorate([
- core_1.ViewChild('loadingTable', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TTScrollableView.prototype, "scrollLoadingTableViewChild", void 0);
- __decorate([
- core_1.ViewChild('scrollFooter', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TTScrollableView.prototype, "scrollFooterViewChild", void 0);
- __decorate([
- core_1.ViewChild('scrollFooterBox', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TTScrollableView.prototype, "scrollFooterBoxViewChild", void 0);
- __decorate([
- core_1.ViewChild('virtualScroller', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TTScrollableView.prototype, "virtualScrollerViewChild", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String),
- __metadata("design:paramtypes", [String])
- ], TTScrollableView.prototype, "scrollHeight", null);
- TTScrollableView = __decorate([
- core_1.Component({
- selector: '[ttScrollableView]',
- template: "\n <div #scrollHeader class=\"ui-treetable-scrollable-header ui-widget-header\">\n <div #scrollHeaderBox class=\"ui-treetable-scrollable-header-box\">\n <table class=\"ui-treetable-scrollable-header-table\">\n <ng-container *ngTemplateOutlet=\"frozen ? tt.frozenColGroupTemplate||tt.colGroupTemplate : tt.colGroupTemplate; context {$implicit: columns}\"></ng-container>\n <thead class=\"ui-treetable-thead\">\n <ng-container *ngTemplateOutlet=\"frozen ? tt.frozenHeaderTemplate||tt.headerTemplate : tt.headerTemplate; context {$implicit: columns}\"></ng-container>\n </thead>\n </table>\n </div>\n </div>\n <div #scrollBody class=\"ui-treetable-scrollable-body\">\n <table #scrollTable [ngClass]=\"{'ui-treetable-scrollable-body-table': true, 'ui-treetable-virtual-table': tt.virtualScroll}\">\n <ng-container *ngTemplateOutlet=\"frozen ? tt.frozenColGroupTemplate||tt.colGroupTemplate : tt.colGroupTemplate; context {$implicit: columns}\"></ng-container>\n <tbody class=\"ui-treetable-tbody\" [pTreeTableBody]=\"columns\" [pTreeTableBodyTemplate]=\"frozen ? tt.frozenBodyTemplate||tt.bodyTemplate : tt.bodyTemplate\"></tbody>\n </table>\n <table #loadingTable *ngIf=\"tt.virtualScroll && tt.loadingBodyTemplate != null\" [ngClass]=\"{'ui-treetable-scrollable-body-table ui-treetable-loading-virtual-table': true, 'ui-treetable-virtual-table': tt.virtualScroll}\">\n <tbody class=\"ui-treetable-tbody\">\n <ng-template ngFor [ngForOf]=\"loadingArray\">\n <ng-container *ngTemplateOutlet=\"tt.loadingBodyTemplate; context: {columns: columns}\"></ng-container>\n </ng-template>\n </tbody>\n </table>\n <div #virtualScroller class=\"ui-treetable-virtual-scroller\" *ngIf=\"tt.virtualScroll\"></div>\n </div>\n <div #scrollFooter *ngIf=\"tt.footerTemplate\" class=\"ui-treetable-scrollable-footer ui-widget-header\">\n <div #scrollFooterBox class=\"ui-treetable-scrollable-footer-box\">\n <table class=\"ui-treetable-scrollable-footer-table\">\n <ng-container *ngTemplateOutlet=\"frozen ? tt.frozenColGroupTemplate||tt.colGroupTemplate : tt.colGroupTemplate; context {$implicit: columns}\"></ng-container>\n <tfoot class=\"ui-treetable-tfoot\">\n <ng-container *ngTemplateOutlet=\"frozen ? tt.frozenFooterTemplate||tt.footerTemplate : tt.footerTemplate; context {$implicit: columns}\"></ng-container>\n </tfoot>\n </table>\n </div>\n </div>\n "
- }),
- __metadata("design:paramtypes", [TreeTable, core_1.ElementRef, core_1.NgZone])
- ], TTScrollableView);
- return TTScrollableView;
- }());
- exports.TTScrollableView = TTScrollableView;
- var TTSortableColumn = /** @class */ (function () {
- function TTSortableColumn(tt) {
- var _this = this;
- this.tt = tt;
- if (this.isEnabled()) {
- this.subscription = this.tt.tableService.sortSource$.subscribe(function (sortMeta) {
- _this.updateSortState();
- });
- }
- }
- TTSortableColumn.prototype.ngOnInit = function () {
- if (this.isEnabled()) {
- this.updateSortState();
- }
- };
- TTSortableColumn.prototype.updateSortState = function () {
- this.sorted = this.tt.isSorted(this.field);
- };
- TTSortableColumn.prototype.onClick = function (event) {
- if (this.isEnabled()) {
- this.updateSortState();
- this.tt.sort({
- originalEvent: event,
- field: this.field
- });
- domhandler_1.DomHandler.clearSelection();
- }
- };
- TTSortableColumn.prototype.onEnterKey = function (event) {
- this.onClick(event);
- };
- TTSortableColumn.prototype.isEnabled = function () {
- return this.ttSortableColumnDisabled !== true;
- };
- TTSortableColumn.prototype.ngOnDestroy = function () {
- if (this.subscription) {
- this.subscription.unsubscribe();
- }
- };
- __decorate([
- core_1.Input("ttSortableColumn"),
- __metadata("design:type", String)
- ], TTSortableColumn.prototype, "field", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TTSortableColumn.prototype, "ttSortableColumnDisabled", void 0);
- __decorate([
- core_1.HostListener('click', ['$event']),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [MouseEvent]),
- __metadata("design:returntype", void 0)
- ], TTSortableColumn.prototype, "onClick", null);
- __decorate([
- core_1.HostListener('keydown.enter', ['$event']),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [MouseEvent]),
- __metadata("design:returntype", void 0)
- ], TTSortableColumn.prototype, "onEnterKey", null);
- TTSortableColumn = __decorate([
- core_1.Directive({
- selector: '[ttSortableColumn]',
- host: {
- '[class.ui-sortable-column]': 'isEnabled()',
- '[class.ui-state-highlight]': 'sorted',
- '[attr.tabindex]': 'isEnabled() ? "0" : null'
- }
- }),
- __metadata("design:paramtypes", [TreeTable])
- ], TTSortableColumn);
- return TTSortableColumn;
- }());
- exports.TTSortableColumn = TTSortableColumn;
- var TTSortIcon = /** @class */ (function () {
- function TTSortIcon(tt) {
- var _this = this;
- this.tt = tt;
- this.subscription = this.tt.tableService.sortSource$.subscribe(function (sortMeta) {
- _this.updateSortState();
- });
- }
- TTSortIcon.prototype.ngOnInit = function () {
- this.updateSortState();
- };
- TTSortIcon.prototype.onClick = function (event) {
- event.preventDefault();
- };
- TTSortIcon.prototype.updateSortState = function () {
- if (this.tt.sortMode === 'single') {
- this.sortOrder = this.tt.isSorted(this.field) ? this.tt.sortOrder : 0;
- }
- else if (this.tt.sortMode === 'multiple') {
- var sortMeta = this.tt.getSortMeta(this.field);
- this.sortOrder = sortMeta ? sortMeta.order : 0;
- }
- };
- TTSortIcon.prototype.ngOnDestroy = function () {
- if (this.subscription) {
- this.subscription.unsubscribe();
- }
- };
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TTSortIcon.prototype, "field", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TTSortIcon.prototype, "ariaLabelDesc", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", String)
- ], TTSortIcon.prototype, "ariaLabelAsc", void 0);
- TTSortIcon = __decorate([
- core_1.Component({
- selector: 'p-treeTableSortIcon',
- template: "\n <i class=\"ui-sortable-column-icon pi pi-fw\" [ngClass]=\"{'pi-sort-up': sortOrder === 1, 'pi-sort-down': sortOrder === -1, 'pi-sort': sortOrder === 0}\"></i>\n "
- }),
- __metadata("design:paramtypes", [TreeTable])
- ], TTSortIcon);
- return TTSortIcon;
- }());
- exports.TTSortIcon = TTSortIcon;
- var TTResizableColumn = /** @class */ (function () {
- function TTResizableColumn(tt, el, zone) {
- this.tt = tt;
- this.el = el;
- this.zone = zone;
- }
- TTResizableColumn.prototype.ngAfterViewInit = function () {
- var _this = this;
- if (this.isEnabled()) {
- domhandler_1.DomHandler.addClass(this.el.nativeElement, 'ui-resizable-column');
- this.resizer = document.createElement('span');
- this.resizer.className = 'ui-column-resizer ui-clickable';
- this.el.nativeElement.appendChild(this.resizer);
- this.zone.runOutsideAngular(function () {
- _this.resizerMouseDownListener = _this.onMouseDown.bind(_this);
- _this.resizer.addEventListener('mousedown', _this.resizerMouseDownListener);
- });
- }
- };
- TTResizableColumn.prototype.bindDocumentEvents = function () {
- var _this = this;
- this.zone.runOutsideAngular(function () {
- _this.documentMouseMoveListener = _this.onDocumentMouseMove.bind(_this);
- document.addEventListener('mousemove', _this.documentMouseMoveListener);
- _this.documentMouseUpListener = _this.onDocumentMouseUp.bind(_this);
- document.addEventListener('mouseup', _this.documentMouseUpListener);
- });
- };
- TTResizableColumn.prototype.unbindDocumentEvents = function () {
- if (this.documentMouseMoveListener) {
- document.removeEventListener('mousemove', this.documentMouseMoveListener);
- this.documentMouseMoveListener = null;
- }
- if (this.documentMouseUpListener) {
- document.removeEventListener('mouseup', this.documentMouseUpListener);
- this.documentMouseUpListener = null;
- }
- };
- TTResizableColumn.prototype.onMouseDown = function (event) {
- this.tt.onColumnResizeBegin(event);
- this.bindDocumentEvents();
- };
- TTResizableColumn.prototype.onDocumentMouseMove = function (event) {
- this.tt.onColumnResize(event);
- };
- TTResizableColumn.prototype.onDocumentMouseUp = function (event) {
- this.tt.onColumnResizeEnd(event, this.el.nativeElement);
- this.unbindDocumentEvents();
- };
- TTResizableColumn.prototype.isEnabled = function () {
- return this.ttResizableColumnDisabled !== true;
- };
- TTResizableColumn.prototype.ngOnDestroy = function () {
- if (this.resizerMouseDownListener) {
- this.resizer.removeEventListener('mousedown', this.resizerMouseDownListener);
- }
- this.unbindDocumentEvents();
- };
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TTResizableColumn.prototype, "ttResizableColumnDisabled", void 0);
- TTResizableColumn = __decorate([
- core_1.Directive({
- selector: '[ttResizableColumn]'
- }),
- __metadata("design:paramtypes", [TreeTable, core_1.ElementRef, core_1.NgZone])
- ], TTResizableColumn);
- return TTResizableColumn;
- }());
- exports.TTResizableColumn = TTResizableColumn;
- var TTReorderableColumn = /** @class */ (function () {
- function TTReorderableColumn(tt, el, zone) {
- this.tt = tt;
- this.el = el;
- this.zone = zone;
- }
- TTReorderableColumn.prototype.ngAfterViewInit = function () {
- if (this.isEnabled()) {
- this.bindEvents();
- }
- };
- TTReorderableColumn.prototype.bindEvents = function () {
- var _this = this;
- this.zone.runOutsideAngular(function () {
- _this.mouseDownListener = _this.onMouseDown.bind(_this);
- _this.el.nativeElement.addEventListener('mousedown', _this.mouseDownListener);
- _this.dragStartListener = _this.onDragStart.bind(_this);
- _this.el.nativeElement.addEventListener('dragstart', _this.dragStartListener);
- _this.dragOverListener = _this.onDragEnter.bind(_this);
- _this.el.nativeElement.addEventListener('dragover', _this.dragOverListener);
- _this.dragEnterListener = _this.onDragEnter.bind(_this);
- _this.el.nativeElement.addEventListener('dragenter', _this.dragEnterListener);
- _this.dragLeaveListener = _this.onDragLeave.bind(_this);
- _this.el.nativeElement.addEventListener('dragleave', _this.dragLeaveListener);
- });
- };
- TTReorderableColumn.prototype.unbindEvents = function () {
- if (this.mouseDownListener) {
- document.removeEventListener('mousedown', this.mouseDownListener);
- this.mouseDownListener = null;
- }
- if (this.dragOverListener) {
- document.removeEventListener('dragover', this.dragOverListener);
- this.dragOverListener = null;
- }
- if (this.dragEnterListener) {
- document.removeEventListener('dragenter', this.dragEnterListener);
- this.dragEnterListener = null;
- }
- if (this.dragEnterListener) {
- document.removeEventListener('dragenter', this.dragEnterListener);
- this.dragEnterListener = null;
- }
- if (this.dragLeaveListener) {
- document.removeEventListener('dragleave', this.dragLeaveListener);
- this.dragLeaveListener = null;
- }
- };
- TTReorderableColumn.prototype.onMouseDown = function (event) {
- if (event.target.nodeName === 'INPUT' || domhandler_1.DomHandler.hasClass(event.target, 'ui-column-resizer'))
- this.el.nativeElement.draggable = false;
- else
- this.el.nativeElement.draggable = true;
- };
- TTReorderableColumn.prototype.onDragStart = function (event) {
- this.tt.onColumnDragStart(event, this.el.nativeElement);
- };
- TTReorderableColumn.prototype.onDragOver = function (event) {
- event.preventDefault();
- };
- TTReorderableColumn.prototype.onDragEnter = function (event) {
- this.tt.onColumnDragEnter(event, this.el.nativeElement);
- };
- TTReorderableColumn.prototype.onDragLeave = function (event) {
- this.tt.onColumnDragLeave(event);
- };
- TTReorderableColumn.prototype.onDrop = function (event) {
- if (this.isEnabled()) {
- this.tt.onColumnDrop(event, this.el.nativeElement);
- }
- };
- TTReorderableColumn.prototype.isEnabled = function () {
- return this.ttReorderableColumnDisabled !== true;
- };
- TTReorderableColumn.prototype.ngOnDestroy = function () {
- this.unbindEvents();
- };
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TTReorderableColumn.prototype, "ttReorderableColumnDisabled", void 0);
- __decorate([
- core_1.HostListener('drop', ['$event']),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Object]),
- __metadata("design:returntype", void 0)
- ], TTReorderableColumn.prototype, "onDrop", null);
- TTReorderableColumn = __decorate([
- core_1.Directive({
- selector: '[ttReorderableColumn]'
- }),
- __metadata("design:paramtypes", [TreeTable, core_1.ElementRef, core_1.NgZone])
- ], TTReorderableColumn);
- return TTReorderableColumn;
- }());
- exports.TTReorderableColumn = TTReorderableColumn;
- var TTSelectableRow = /** @class */ (function () {
- function TTSelectableRow(tt, tableService) {
- var _this = this;
- this.tt = tt;
- this.tableService = tableService;
- if (this.isEnabled()) {
- this.subscription = this.tt.tableService.selectionSource$.subscribe(function () {
- _this.selected = _this.tt.isSelected(_this.rowNode.node);
- });
- }
- }
- TTSelectableRow.prototype.ngOnInit = function () {
- if (this.isEnabled()) {
- this.selected = this.tt.isSelected(this.rowNode.node);
- }
- };
- TTSelectableRow.prototype.onClick = function (event) {
- if (this.isEnabled()) {
- this.tt.handleRowClick({
- originalEvent: event,
- rowNode: this.rowNode
- });
- }
- };
- TTSelectableRow.prototype.onEnterKey = function (event) {
- this.onClick(event);
- };
- TTSelectableRow.prototype.onTouchEnd = function (event) {
- if (this.isEnabled()) {
- this.tt.handleRowTouchEnd(event);
- }
- };
- TTSelectableRow.prototype.isEnabled = function () {
- return this.ttSelectableRowDisabled !== true;
- };
- TTSelectableRow.prototype.ngOnDestroy = function () {
- if (this.subscription) {
- this.subscription.unsubscribe();
- }
- };
- __decorate([
- core_1.Input("ttSelectableRow"),
- __metadata("design:type", Object)
- ], TTSelectableRow.prototype, "rowNode", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TTSelectableRow.prototype, "ttSelectableRowDisabled", void 0);
- __decorate([
- core_1.HostListener('click', ['$event']),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Event]),
- __metadata("design:returntype", void 0)
- ], TTSelectableRow.prototype, "onClick", null);
- __decorate([
- core_1.HostListener('keydown.enter', ['$event']),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Event]),
- __metadata("design:returntype", void 0)
- ], TTSelectableRow.prototype, "onEnterKey", null);
- __decorate([
- core_1.HostListener('touchend', ['$event']),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Event]),
- __metadata("design:returntype", void 0)
- ], TTSelectableRow.prototype, "onTouchEnd", null);
- TTSelectableRow = __decorate([
- core_1.Directive({
- selector: '[ttSelectableRow]',
- host: {
- '[class.ui-state-highlight]': 'selected'
- }
- }),
- __metadata("design:paramtypes", [TreeTable, TreeTableService])
- ], TTSelectableRow);
- return TTSelectableRow;
- }());
- exports.TTSelectableRow = TTSelectableRow;
- var TTSelectableRowDblClick = /** @class */ (function () {
- function TTSelectableRowDblClick(tt, tableService) {
- var _this = this;
- this.tt = tt;
- this.tableService = tableService;
- if (this.isEnabled()) {
- this.subscription = this.tt.tableService.selectionSource$.subscribe(function () {
- _this.selected = _this.tt.isSelected(_this.rowNode.node);
- });
- }
- }
- TTSelectableRowDblClick.prototype.ngOnInit = function () {
- if (this.isEnabled()) {
- this.selected = this.tt.isSelected(this.rowNode.node);
- }
- };
- TTSelectableRowDblClick.prototype.onClick = function (event) {
- if (this.isEnabled()) {
- this.tt.handleRowClick({
- originalEvent: event,
- rowNode: this.rowNode
- });
- }
- };
- TTSelectableRowDblClick.prototype.isEnabled = function () {
- return this.ttSelectableRowDisabled !== true;
- };
- TTSelectableRowDblClick.prototype.ngOnDestroy = function () {
- if (this.subscription) {
- this.subscription.unsubscribe();
- }
- };
- __decorate([
- core_1.Input("ttSelectableRowDblClick"),
- __metadata("design:type", Object)
- ], TTSelectableRowDblClick.prototype, "rowNode", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TTSelectableRowDblClick.prototype, "ttSelectableRowDisabled", void 0);
- __decorate([
- core_1.HostListener('dblclick', ['$event']),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Event]),
- __metadata("design:returntype", void 0)
- ], TTSelectableRowDblClick.prototype, "onClick", null);
- TTSelectableRowDblClick = __decorate([
- core_1.Directive({
- selector: '[ttSelectableRowDblClick]',
- host: {
- '[class.ui-state-highlight]': 'selected'
- }
- }),
- __metadata("design:paramtypes", [TreeTable, TreeTableService])
- ], TTSelectableRowDblClick);
- return TTSelectableRowDblClick;
- }());
- exports.TTSelectableRowDblClick = TTSelectableRowDblClick;
- var TTContextMenuRow = /** @class */ (function () {
- function TTContextMenuRow(tt, tableService) {
- var _this = this;
- this.tt = tt;
- this.tableService = tableService;
- if (this.isEnabled()) {
- this.subscription = this.tt.tableService.contextMenuSource$.subscribe(function (node) {
- _this.selected = _this.tt.equals(_this.rowNode.node, node);
- });
- }
- }
- TTContextMenuRow.prototype.onContextMenu = function (event) {
- if (this.isEnabled()) {
- this.tt.handleRowRightClick({
- originalEvent: event,
- rowNode: this.rowNode
- });
- event.preventDefault();
- }
- };
- TTContextMenuRow.prototype.isEnabled = function () {
- return this.ttContextMenuRowDisabled !== true;
- };
- TTContextMenuRow.prototype.ngOnDestroy = function () {
- if (this.subscription) {
- this.subscription.unsubscribe();
- }
- };
- __decorate([
- core_1.Input("ttContextMenuRow"),
- __metadata("design:type", Object)
- ], TTContextMenuRow.prototype, "rowNode", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TTContextMenuRow.prototype, "ttContextMenuRowDisabled", void 0);
- __decorate([
- core_1.HostListener('contextmenu', ['$event']),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Event]),
- __metadata("design:returntype", void 0)
- ], TTContextMenuRow.prototype, "onContextMenu", null);
- TTContextMenuRow = __decorate([
- core_1.Directive({
- selector: '[ttContextMenuRow]',
- host: {
- '[class.ui-contextmenu-selected]': 'selected'
- }
- }),
- __metadata("design:paramtypes", [TreeTable, TreeTableService])
- ], TTContextMenuRow);
- return TTContextMenuRow;
- }());
- exports.TTContextMenuRow = TTContextMenuRow;
- var TTCheckbox = /** @class */ (function () {
- function TTCheckbox(tt, tableService) {
- var _this = this;
- this.tt = tt;
- this.tableService = tableService;
- this.subscription = this.tt.tableService.selectionSource$.subscribe(function () {
- _this.checked = _this.tt.isSelected(_this.rowNode.node);
- });
- }
- TTCheckbox.prototype.ngOnInit = function () {
- this.checked = this.tt.isSelected(this.rowNode.node);
- };
- TTCheckbox.prototype.onClick = function (event) {
- if (!this.disabled) {
- this.tt.toggleNodeWithCheckbox({
- originalEvent: event,
- rowNode: this.rowNode
- });
- }
- domhandler_1.DomHandler.clearSelection();
- };
- TTCheckbox.prototype.onFocus = function () {
- domhandler_1.DomHandler.addClass(this.boxViewChild.nativeElement, 'ui-state-focus');
- };
- TTCheckbox.prototype.onBlur = function () {
- domhandler_1.DomHandler.removeClass(this.boxViewChild.nativeElement, 'ui-state-focus');
- };
- TTCheckbox.prototype.ngOnDestroy = function () {
- if (this.subscription) {
- this.subscription.unsubscribe();
- }
- };
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TTCheckbox.prototype, "disabled", void 0);
- __decorate([
- core_1.Input("value"),
- __metadata("design:type", Object)
- ], TTCheckbox.prototype, "rowNode", void 0);
- __decorate([
- core_1.ViewChild('box', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TTCheckbox.prototype, "boxViewChild", void 0);
- TTCheckbox = __decorate([
- core_1.Component({
- selector: 'p-treeTableCheckbox',
- template: "\n <div class=\"ui-chkbox ui-treetable-chkbox ui-widget\" (click)=\"onClick($event)\">\n <div class=\"ui-helper-hidden-accessible\">\n <input type=\"checkbox\" [checked]=\"checked\" (focus)=\"onFocus()\" (blur)=\"onBlur()\">\n </div>\n <div #box [ngClass]=\"{'ui-chkbox-box ui-widget ui-state-default':true,\n 'ui-state-active':checked, 'ui-state-disabled':disabled}\">\n <span class=\"ui-chkbox-icon ui-clickable pi\" [ngClass]=\"{'pi-check':checked, 'pi-minus': rowNode.node.partialSelected}\"></span>\n </div>\n </div>\n "
- }),
- __metadata("design:paramtypes", [TreeTable, TreeTableService])
- ], TTCheckbox);
- return TTCheckbox;
- }());
- exports.TTCheckbox = TTCheckbox;
- var TTHeaderCheckbox = /** @class */ (function () {
- function TTHeaderCheckbox(tt, tableService) {
- var _this = this;
- this.tt = tt;
- this.tableService = tableService;
- this.valueChangeSubscription = this.tt.tableService.uiUpdateSource$.subscribe(function () {
- _this.checked = _this.updateCheckedState();
- });
- this.selectionChangeSubscription = this.tt.tableService.selectionSource$.subscribe(function () {
- _this.checked = _this.updateCheckedState();
- });
- }
- TTHeaderCheckbox.prototype.ngOnInit = function () {
- this.checked = this.updateCheckedState();
- };
- TTHeaderCheckbox.prototype.onClick = function (event, checked) {
- if (this.tt.value && this.tt.value.length > 0) {
- this.tt.toggleNodesWithCheckbox(event, !checked);
- }
- domhandler_1.DomHandler.clearSelection();
- };
- TTHeaderCheckbox.prototype.onFocus = function () {
- domhandler_1.DomHandler.addClass(this.boxViewChild.nativeElement, 'ui-state-focus');
- };
- TTHeaderCheckbox.prototype.onBlur = function () {
- domhandler_1.DomHandler.removeClass(this.boxViewChild.nativeElement, 'ui-state-focus');
- };
- TTHeaderCheckbox.prototype.ngOnDestroy = function () {
- if (this.selectionChangeSubscription) {
- this.selectionChangeSubscription.unsubscribe();
- }
- if (this.valueChangeSubscription) {
- this.valueChangeSubscription.unsubscribe();
- }
- };
- TTHeaderCheckbox.prototype.updateCheckedState = function () {
- var checked;
- var data = this.tt.filteredNodes || this.tt.value;
- if (data) {
- for (var _i = 0, data_2 = data; _i < data_2.length; _i++) {
- var node = data_2[_i];
- if (this.tt.isSelected(node)) {
- checked = true;
- }
- else {
- checked = false;
- break;
- }
- }
- }
- else {
- checked = false;
- }
- return checked;
- };
- __decorate([
- core_1.ViewChild('box', { static: false }),
- __metadata("design:type", core_1.ElementRef)
- ], TTHeaderCheckbox.prototype, "boxViewChild", void 0);
- TTHeaderCheckbox = __decorate([
- core_1.Component({
- selector: 'p-treeTableHeaderCheckbox',
- template: "\n <div class=\"ui-chkbox ui-treetable-header-chkbox ui-widget\" (click)=\"onClick($event, cb.checked)\">\n <div class=\"ui-helper-hidden-accessible\">\n <input #cb type=\"checkbox\" [checked]=\"checked\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" [disabled]=\"!tt.value||tt.value.length === 0\">\n </div>\n <div #box [ngClass]=\"{'ui-chkbox-box ui-widget ui-state-default':true,\n 'ui-state-active':checked, 'ui-state-disabled': (!tt.value || tt.value.length === 0)}\">\n <span class=\"ui-chkbox-icon ui-clickable\" [ngClass]=\"{'pi pi-check':checked}\"></span>\n </div>\n </div>\n "
- }),
- __metadata("design:paramtypes", [TreeTable, TreeTableService])
- ], TTHeaderCheckbox);
- return TTHeaderCheckbox;
- }());
- exports.TTHeaderCheckbox = TTHeaderCheckbox;
- var TTEditableColumn = /** @class */ (function () {
- function TTEditableColumn(tt, el, zone) {
- this.tt = tt;
- this.el = el;
- this.zone = zone;
- }
- TTEditableColumn.prototype.ngAfterViewInit = function () {
- if (this.isEnabled()) {
- domhandler_1.DomHandler.addClass(this.el.nativeElement, 'ui-editable-column');
- }
- };
- TTEditableColumn.prototype.onClick = function (event) {
- if (this.isEnabled()) {
- this.tt.editingCellClick = true;
- if (this.tt.editingCell) {
- if (this.tt.editingCell !== this.el.nativeElement) {
- if (!this.tt.isEditingCellValid()) {
- return;
- }
- domhandler_1.DomHandler.removeClass(this.tt.editingCell, 'ui-editing-cell');
- this.openCell();
- }
- }
- else {
- this.openCell();
- }
- }
- };
- TTEditableColumn.prototype.openCell = function () {
- var _this = this;
- this.tt.updateEditingCell(this.el.nativeElement);
- domhandler_1.DomHandler.addClass(this.el.nativeElement, 'ui-editing-cell');
- this.tt.onEditInit.emit({ field: this.field, data: this.data });
- this.zone.runOutsideAngular(function () {
- setTimeout(function () {
- var focusable = domhandler_1.DomHandler.findSingle(_this.el.nativeElement, 'input, textarea');
- if (focusable) {
- focusable.focus();
- }
- }, 50);
- });
- };
- TTEditableColumn.prototype.closeEditingCell = function () {
- domhandler_1.DomHandler.removeClass(this.tt.editingCell, 'ui-editing-cell');
- this.tt.editingCell = null;
- this.tt.unbindDocumentEditListener();
- };
- TTEditableColumn.prototype.onKeyDown = function (event) {
- if (this.isEnabled()) {
- //enter
- if (event.keyCode == 13) {
- if (this.tt.isEditingCellValid()) {
- domhandler_1.DomHandler.removeClass(this.tt.editingCell, 'ui-editing-cell');
- this.closeEditingCell();
- this.tt.onEditComplete.emit({ field: this.field, data: this.data });
- }
- event.preventDefault();
- }
- //escape
- else if (event.keyCode == 27) {
- if (this.tt.isEditingCellValid()) {
- domhandler_1.DomHandler.removeClass(this.tt.editingCell, 'ui-editing-cell');
- this.closeEditingCell();
- this.tt.onEditCancel.emit({ field: this.field, data: this.data });
- }
- event.preventDefault();
- }
- //tab
- else if (event.keyCode == 9) {
- this.tt.onEditComplete.emit({ field: this.field, data: this.data });
- if (event.shiftKey)
- this.moveToPreviousCell(event);
- else
- this.moveToNextCell(event);
- }
- }
- };
- TTEditableColumn.prototype.findCell = function (element) {
- if (element) {
- var cell = element;
- while (cell && !domhandler_1.DomHandler.hasClass(cell, 'ui-editing-cell')) {
- cell = cell.parentElement;
- }
- return cell;
- }
- else {
- return null;
- }
- };
- TTEditableColumn.prototype.moveToPreviousCell = function (event) {
- var currentCell = this.findCell(event.target);
- var row = currentCell.parentElement;
- var targetCell = this.findPreviousEditableColumn(currentCell);
- if (targetCell) {
- domhandler_1.DomHandler.invokeElementMethod(targetCell, 'click');
- event.preventDefault();
- }
- };
- TTEditableColumn.prototype.moveToNextCell = function (event) {
- var currentCell = this.findCell(event.target);
- var row = currentCell.parentElement;
- var targetCell = this.findNextEditableColumn(currentCell);
- if (targetCell) {
- domhandler_1.DomHandler.invokeElementMethod(targetCell, 'click');
- event.preventDefault();
- }
- };
- TTEditableColumn.prototype.findPreviousEditableColumn = function (cell) {
- var prevCell = cell.previousElementSibling;
- if (!prevCell) {
- var previousRow = cell.parentElement ? cell.parentElement.previousElementSibling : null;
- if (previousRow) {
- prevCell = previousRow.lastElementChild;
- }
- }
- if (prevCell) {
- if (domhandler_1.DomHandler.hasClass(prevCell, 'ui-editable-column'))
- return prevCell;
- else
- return this.findPreviousEditableColumn(prevCell);
- }
- else {
- return null;
- }
- };
- TTEditableColumn.prototype.findNextEditableColumn = function (cell) {
- var nextCell = cell.nextElementSibling;
- if (!nextCell) {
- var nextRow = cell.parentElement ? cell.parentElement.nextElementSibling : null;
- if (nextRow) {
- nextCell = nextRow.firstElementChild;
- }
- }
- if (nextCell) {
- if (domhandler_1.DomHandler.hasClass(nextCell, 'ui-editable-column'))
- return nextCell;
- else
- return this.findNextEditableColumn(nextCell);
- }
- else {
- return null;
- }
- };
- TTEditableColumn.prototype.isEnabled = function () {
- return this.ttEditableColumnDisabled !== true;
- };
- __decorate([
- core_1.Input("ttEditableColumn"),
- __metadata("design:type", Object)
- ], TTEditableColumn.prototype, "data", void 0);
- __decorate([
- core_1.Input("ttEditableColumnField"),
- __metadata("design:type", Object)
- ], TTEditableColumn.prototype, "field", void 0);
- __decorate([
- core_1.Input(),
- __metadata("design:type", Boolean)
- ], TTEditableColumn.prototype, "ttEditableColumnDisabled", void 0);
- __decorate([
- core_1.HostListener('click', ['$event']),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [MouseEvent]),
- __metadata("design:returntype", void 0)
- ], TTEditableColumn.prototype, "onClick", null);
- __decorate([
- core_1.HostListener('keydown', ['$event']),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [KeyboardEvent]),
- __metadata("design:returntype", void 0)
- ], TTEditableColumn.prototype, "onKeyDown", null);
- TTEditableColumn = __decorate([
- core_1.Directive({
- selector: '[ttEditableColumn]'
- }),
- __metadata("design:paramtypes", [TreeTable, core_1.ElementRef, core_1.NgZone])
- ], TTEditableColumn);
- return TTEditableColumn;
- }());
- exports.TTEditableColumn = TTEditableColumn;
- var TreeTableCellEditor = /** @class */ (function () {
- function TreeTableCellEditor(tt, editableColumn) {
- this.tt = tt;
- this.editableColumn = editableColumn;
- }
- TreeTableCellEditor.prototype.ngAfterContentInit = function () {
- var _this = this;
- this.templates.forEach(function (item) {
- switch (item.getType()) {
- case 'input':
- _this.inputTemplate = item.template;
- break;
- case 'output':
- _this.outputTemplate = item.template;
- break;
- }
- });
- };
- __decorate([
- core_1.ContentChildren(shared_1.PrimeTemplate),
- __metadata("design:type", core_1.QueryList)
- ], TreeTableCellEditor.prototype, "templates", void 0);
- TreeTableCellEditor = __decorate([
- core_1.Component({
- selector: 'p-treeTableCellEditor',
- template: "\n <ng-container *ngIf=\"tt.editingCell === editableColumn.el.nativeElement\">\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"!tt.editingCell || tt.editingCell !== editableColumn.el.nativeElement\">\n <ng-container *ngTemplateOutlet=\"outputTemplate\"></ng-container>\n </ng-container>\n "
- }),
- __metadata("design:paramtypes", [TreeTable, TTEditableColumn])
- ], TreeTableCellEditor);
- return TreeTableCellEditor;
- }());
- exports.TreeTableCellEditor = TreeTableCellEditor;
- var TTRow = /** @class */ (function () {
- function TTRow(tt, el, zone) {
- this.tt = tt;
- this.el = el;
- this.zone = zone;
- }
- TTRow.prototype.onKeyDown = function (event) {
- switch (event.which) {
- //down arrow
- case 40:
- var nextRow = this.el.nativeElement.nextElementSibling;
- if (nextRow) {
- nextRow.focus();
- }
- event.preventDefault();
- break;
- //down arrow
- case 38:
- var prevRow = this.el.nativeElement.previousElementSibling;
- if (prevRow) {
- prevRow.focus();
- }
- event.preventDefault();
- break;
- //left arrow
- case 37:
- if (this.rowNode.node.expanded) {
- this.tt.toggleRowIndex = domhandler_1.DomHandler.index(this.el.nativeElement);
- this.rowNode.node.expanded = false;
- this.tt.onNodeCollapse.emit({
- originalEvent: event,
- node: this.rowNode.node
- });
- this.tt.updateSerializedValue();
- this.tt.tableService.onUIUpdate(this.tt.value);
- this.restoreFocus();
- }
- break;
- //right arrow
- case 39:
- if (!this.rowNode.node.expanded) {
- this.tt.toggleRowIndex = domhandler_1.DomHandler.index(this.el.nativeElement);
- this.rowNode.node.expanded = true;
- this.tt.onNodeExpand.emit({
- originalEvent: event,
- node: this.rowNode.node
- });
- this.tt.updateSerializedValue();
- this.tt.tableService.onUIUpdate(this.tt.value);
- this.restoreFocus();
- }
- break;
- }
- };
- TTRow.prototype.restoreFocus = function () {
- var _this = this;
- this.zone.runOutsideAngular(function () {
- setTimeout(function () {
- var row = domhandler_1.DomHandler.findSingle(_this.tt.containerViewChild.nativeElement, '.ui-treetable-tbody').children[_this.tt.toggleRowIndex];
- if (row) {
- row.focus();
- }
- }, 25);
- });
- };
- __decorate([
- core_1.Input('ttRow'),
- __metadata("design:type", Object)
- ], TTRow.prototype, "rowNode", void 0);
- __decorate([
- core_1.HostListener('keydown', ['$event']),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [KeyboardEvent]),
- __metadata("design:returntype", void 0)
- ], TTRow.prototype, "onKeyDown", null);
- TTRow = __decorate([
- core_1.Directive({
- selector: '[ttRow]',
- host: {
- '[attr.tabindex]': '"0"'
- }
- }),
- __metadata("design:paramtypes", [TreeTable, core_1.ElementRef, core_1.NgZone])
- ], TTRow);
- return TTRow;
- }());
- exports.TTRow = TTRow;
- var TreeTableToggler = /** @class */ (function () {
- function TreeTableToggler(tt) {
- this.tt = tt;
- }
- TreeTableToggler.prototype.onClick = function (event) {
- this.rowNode.node.expanded = !this.rowNode.node.expanded;
- if (this.rowNode.node.expanded) {
- this.tt.onNodeExpand.emit({
- originalEvent: event,
- node: this.rowNode.node
- });
- }
- else {
- this.tt.onNodeCollapse.emit({
- originalEvent: event,
- node: this.rowNode.node
- });
- }
- this.tt.updateSerializedValue();
- this.tt.tableService.onUIUpdate(this.tt.value);
- event.preventDefault();
- };
- __decorate([
- core_1.Input(),
- __metadata("design:type", Object)
- ], TreeTableToggler.prototype, "rowNode", void 0);
- TreeTableToggler = __decorate([
- core_1.Component({
- selector: 'p-treeTableToggler',
- template: "\n <a class=\"ui-treetable-toggler ui-unselectable-text\" *ngIf=\"rowNode.node.leaf === false || rowNode.level !== 0 || rowNode.node.children && rowNode.node.children.length\" (click)=\"onClick($event)\"\n [style.visibility]=\"rowNode.node.leaf === false || (rowNode.node.children && rowNode.node.children.length) ? 'visible' : 'hidden'\" [style.marginLeft]=\"rowNode.level * 16 + 'px'\">\n <i [ngClass]=\"rowNode.node.expanded ? 'pi pi-fw pi-chevron-down' : 'pi pi-fw pi-chevron-right'\"></i>\n </a>\n "
- }),
- __metadata("design:paramtypes", [TreeTable])
- ], TreeTableToggler);
- return TreeTableToggler;
- }());
- exports.TreeTableToggler = TreeTableToggler;
- var TreeTableModule = /** @class */ (function () {
- function TreeTableModule() {
- }
- TreeTableModule = __decorate([
- core_1.NgModule({
- imports: [common_1.CommonModule, paginator_1.PaginatorModule],
- exports: [TreeTable, shared_1.SharedModule, TreeTableToggler, TTSortableColumn, TTSortIcon, TTResizableColumn, TTRow, TTReorderableColumn, TTSelectableRow, TTSelectableRowDblClick, TTContextMenuRow, TTCheckbox, TTHeaderCheckbox, TTEditableColumn, TreeTableCellEditor],
- declarations: [TreeTable, TreeTableToggler, TTScrollableView, TTBody, TTSortableColumn, TTSortIcon, TTResizableColumn, TTRow, TTReorderableColumn, TTSelectableRow, TTSelectableRowDblClick, TTContextMenuRow, TTCheckbox, TTHeaderCheckbox, TTEditableColumn, TreeTableCellEditor]
- })
- ], TreeTableModule);
- return TreeTableModule;
- }());
- exports.TreeTableModule = TreeTableModule;
- //# sourceMappingURL=treetable.js.map
|