@universis/ngx-tables 6.13.2 → 6.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,7 @@ import { ProgressbarModule } from 'ngx-bootstrap/progressbar';
23
23
  import { GroupByPipe, NgPipesModule } from 'ngx-pipes';
24
24
  import { template, at, cloneDeep, isEmpty } from 'lodash';
25
25
  import { __extends, __awaiter, __generator, __values, __assign, __spread } from 'tslib';
26
- import { Injectable, Directive, Optional, Input, Pipe, Component, EventEmitter, Output, ElementRef, ViewChild, ViewEncapsulation, defineInjectable, inject, NgModule, CUSTOM_ELEMENTS_SCHEMA, HostListener, ChangeDetectorRef, InjectionToken, Inject, Injector, ViewContainerRef, ChangeDetectionStrategy } from '@angular/core';
26
+ import { Injectable, Directive, Optional, Input, Pipe, Component, EventEmitter, Output, ElementRef, ViewChild, ViewEncapsulation, NgModule, CUSTOM_ELEMENTS_SCHEMA, defineInjectable, inject, HostListener, ChangeDetectionStrategy, ChangeDetectorRef, InjectionToken, Inject, Injector, ViewContainerRef } from '@angular/core';
27
27
  import { ActivatedRoute, Router, NavigationStart, NavigationEnd, RouterModule } from '@angular/router';
28
28
  import { createFeatureSelector, createSelector, select, Store } from '@ngrx/store';
29
29
  import { skip, first, filter } from 'rxjs/operators';
@@ -1869,7 +1869,11 @@ var AdvancedTableComponent = /** @class */ (function () {
1869
1869
  this.order = new EventEmitter();
1870
1870
  this.scroll = new EventEmitter();
1871
1871
  this.selectedItems = new EventEmitter();
1872
+ this.beforeServerData = new EventEmitter();
1873
+ this.afterServerData = new EventEmitter();
1872
1874
  this.loading = new EventEmitter();
1875
+ this.showDetails = new EventEmitter();
1876
+ this.hideDetails = new EventEmitter();
1873
1877
  this.scrollable = true;
1874
1878
  this.serverSide = true;
1875
1879
  this.lengthMenu = [50, 100, 200, 500];
@@ -2678,6 +2682,64 @@ var AdvancedTableComponent = /** @class */ (function () {
2678
2682
  }
2679
2683
  });
2680
2684
  }
2685
+ // display row details
2686
+ if (this.detailsTemplate) {
2687
+ /** @type {?} */
2688
+ var detailsString_1 = this._translateService.instant('Tables.RowDetails');
2689
+ /** @type {?} */
2690
+ var firstColumn = this.config.columns[0];
2691
+ /** @type {?} */
2692
+ var showDetailsColumnDefinition = {
2693
+ className: 'details-control pl-4 pr-0',
2694
+ data: firstColumn.property || firstColumn.name,
2695
+ defaultContent: '',
2696
+ title: '',
2697
+ sortable: false,
2698
+ visible: !this.customSelect,
2699
+ name: firstColumn.name,
2700
+ render: function () {
2701
+ return "<button role=\"button\" title=\"" + detailsString_1 + "\" arial-label=\"" + detailsString_1 + "\"></button>";
2702
+ },
2703
+ };
2704
+ // and finally add column
2705
+ // and finally add column
2706
+ tableColumns_1.unshift(showDetailsColumnDefinition);
2707
+ // user interface additions
2708
+ // Add event listener for opening and closing details
2709
+ // user interface additions
2710
+ // Add event listener for opening and closing details
2711
+ tableElement_1.on('click', 'td.details-control', function (e) {
2712
+ /** @type {?} */
2713
+ var tr = e.target.closest('tr');
2714
+ /** @type {?} */
2715
+ var row = self.dataTable.row(tr);
2716
+ /** @type {?} */
2717
+ var container = document.createElement('div');
2718
+ /** @type {?} */
2719
+ var detailsViewRef = _this._viewContainerRef.createEmbeddedView(_this.detailsTemplate, {
2720
+ rowData: row.data(),
2721
+ });
2722
+ detailsViewRef.detectChanges();
2723
+ if (detailsViewRef.rootNodes.length !== 1) {
2724
+ throw new Error('DetailsTemplate must have exactly one root node.');
2725
+ }
2726
+ container.appendChild(detailsViewRef.rootNodes[0]);
2727
+ if (row.child.isShown()) {
2728
+ // This row is already open - close it
2729
+ // This row is already open - close it
2730
+ _this.hideDetails.emit();
2731
+ row.child.hide();
2732
+ detailsViewRef.destroy();
2733
+ }
2734
+ else {
2735
+ // Open this row
2736
+ // Open this row
2737
+ _this.showDetails.emit({ row: row });
2738
+ row.child(container).show();
2739
+ row.child().addClass('dt-child');
2740
+ }
2741
+ });
2742
+ }
2681
2743
  /** @type {?} */
2682
2744
  var settings = {
2683
2745
  // set length menu
@@ -2902,8 +2964,10 @@ var AdvancedTableComponent = /** @class */ (function () {
2902
2964
  }
2903
2965
  q.filter(expressions.join(' and '));
2904
2966
  }
2967
+ self.beforeServerData.emit(q);
2905
2968
  self.lastQueryParams = q.getParams();
2906
2969
  return q.getList().then(function (items) {
2970
+ self.afterServerData.emit(items);
2907
2971
  /** @type {?} */
2908
2972
  var dataSet = {
2909
2973
  recordsTotal: items.total,
@@ -2930,8 +2994,10 @@ var AdvancedTableComponent = /** @class */ (function () {
2930
2994
  return fnCallback(EMPTY_DATASET);
2931
2995
  });
2932
2996
  }
2997
+ self.beforeServerData.emit(q);
2933
2998
  self.lastQueryParams = q.getParams();
2934
2999
  q.getList().then(function (items) {
3000
+ self.afterServerData.emit(items);
2935
3001
  /** @type {?} */
2936
3002
  var dataSet = {
2937
3003
  recordsTotal: items.total,
@@ -3675,7 +3741,7 @@ var AdvancedTableComponent = /** @class */ (function () {
3675
3741
  selector: 'app-advanced-table',
3676
3742
  template: "\n <table #table class=\"dataTable\">\n </table>\n <div #emptyTable class=\"d-none\">\n <div>\n <div class=\"mt-4\">\n <div class=\"icon-circle bg-gray-300 border-gray-100\"></div>\n </div>\n <div class=\"mt-4\">\n <h4 class=\"font-3xl text-dark\" [translate]=\"'Tables.EmptyTableTitle'\"></h4>\n <p class=\"font-lg text-dark\" [translate]=\"'Tables.EmptyTableMessage'\"></p>\n </div>\n </div>\n </div>\n <div #errorTemplate class=\"d-none error-message\">\n <div class=\"text-center\">\n <div class=\"mt-4\">\n <div class=\"icon-circle bg-danger border-gray-100\"></div>\n </div>\n <div class=\"mt-4\">\n <h4 class=\"font-3xl text-secondary\" [translate]=\"'Tables.DataError.Title'\"></h4>\n <p class=\"font-lg text-secondary mb-1\" [translate]=\"'Tables.DataError.Message'\"></p>\n <p class=\"font-lg text-secondary error-inner-message\">\n <small></small>\n </p>\n </div>\n </div>\n </div>\n ",
3677
3743
  encapsulation: ViewEncapsulation.None,
3678
- styles: ["div.dataTables_processing>div:last-child>div{background-color:var(--secondary)}table.dataTable thead .sorting{background-image:none}table.dataTable thead tr th{border-bottom:none;font-weight:500;font-size:.75rem}table.dataTable thead th{color:#73818e;font-size:.75rem;font-weight:600;padding-top:16px;padding-bottom:4px;border-bottom:none;padding-left:8px}table.dataTable tbody tr:first-child td:first-child{border-radius:6px 0}table.dataTable tbody tr:first-child td:last-child{border-radius:0 6px}table.dataTable tbody tr{border-radius:6px}table.dataTable tbody tr td:first-child{border-left:1px solid #c2cfd6}table.dataTable tbody tr td:last-child{border-right:1px solid #c2cfd6}table.dataTable tbody tr td{padding-top:8px;padding-bottom:8px;border-top:1px solid #c2cfd6}table.dataTable tbody tr:last-child td:first-child{border-radius:0 0 0 6px}table.dataTable tbody tr:last-child td:last-child{border-radius:0 0 6px}table.dataTable tbody tr:last-child td{border-bottom:1px solid #c2cfd6}table.dataTable tbody tr.dtrg-group.dtrg-start th{border:2px solid #c2cfd6;border-bottom:1px solid #c2cfd6;color:#3e515b;background-color:#f0f3f5}table.dataTable tbody tr.dtrg-group.dtrg-end th{border-top:2px solid #c2cfd6;border-right:2px solid #c2cfd6;border-left:2px solid #c2cfd6;color:#3e515b;background-color:#f0f3f5}table.dataTable tbody tr:nth-last-child(1) th{border-bottom:2px solid #c2cfd6}table.dataTable td.dataTables_empty{border:none!important}table.dataTable .error-inner-message>small{overflow-wrap:break-word}table.dataTable.no-footer{border-bottom:none}.dataTables_paginate .btn.previous{margin-right:8px}.dataTables_paginate .btn.next{margin-left:8px}.dataTables_info,.dataTables_paginate{margin-top:1rem}.dataTables_paginate span .btn{border-radius:1.5rem}.dataTables_filter{display:none}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:0;overflow:auto}.dataTables_paginate{display:none}.dataTable.processing{opacity:15%}.dataTables_wrapper .dataTables_processing{background:0 0;position:absolute;display:inline-block;top:25%;z-index:5;color:#73818e}.text-decoration-line-through{text-decoration:line-through!important}tr.removed .checkbox+label{visibility:hidden}"]
3744
+ styles: ["div.dataTables_processing>div:last-child>div{background-color:var(--secondary)}table.dataTable thead .sorting{background-image:none}table.dataTable thead tr th{border-bottom:none;font-weight:500;font-size:.75rem}table.dataTable thead th{color:#73818e;font-size:.75rem;font-weight:600;padding-top:16px;padding-bottom:4px;border-bottom:none;padding-left:8px}table.dataTable tbody tr:first-child td:first-child{border-radius:6px 0}table.dataTable tbody tr:first-child td:last-child{border-radius:0 6px}table.dataTable tbody tr{border-radius:6px}table.dataTable tbody tr td:first-child{border-left:1px solid #c2cfd6}table.dataTable tbody tr td:last-child{border-right:1px solid #c2cfd6}table.dataTable tbody tr td{padding-top:8px;padding-bottom:8px;border-top:1px solid #c2cfd6}table.dataTable tbody tr:last-child td:first-child{border-radius:0 0 0 6px}table.dataTable tbody tr:last-child td:last-child{border-radius:0 0 6px}table.dataTable tbody tr:last-child td{border-bottom:1px solid #c2cfd6}table.dataTable tbody tr.dtrg-group.dtrg-start th{border:2px solid #c2cfd6;border-bottom:1px solid #c2cfd6;color:#3e515b;background-color:#f0f3f5}table.dataTable tbody tr.dtrg-group.dtrg-end th{border-top:2px solid #c2cfd6;border-right:2px solid #c2cfd6;border-left:2px solid #c2cfd6;color:#3e515b;background-color:#f0f3f5}table.dataTable tbody tr:nth-last-child(1) th{border-bottom:2px solid #c2cfd6}table.dataTable td.dataTables_empty{border:none!important}table.dataTable .error-inner-message>small{overflow-wrap:break-word}table.dataTable.no-footer{border-bottom:none}.dataTables_paginate .btn.previous{margin-right:8px}.dataTables_paginate .btn.next{margin-left:8px}.dataTables_info,.dataTables_paginate{margin-top:1rem}.dataTables_paginate span .btn{border-radius:1.5rem}.dataTables_filter{display:none}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:0;overflow:auto}.dataTables_paginate{display:none}.dataTable.processing{opacity:15%}.dataTables_wrapper .dataTables_processing{background:0 0;position:absolute;display:inline-block;top:25%;z-index:5;color:#73818e}.text-decoration-line-through{text-decoration:line-through!important}tr.removed .checkbox+label{visibility:hidden}table.dataTable td.details-control{cursor:pointer}table.dataTable td.details-control button{border:none;background-color:inherit;outline:0}table.dataTable td.details-control button::after{content:'\\25B7'}table.dataTable tr.dt-hasChild td.details-control button::after{content:'\\25BD'}"]
3679
3745
  }] }
3680
3746
  ];
3681
3747
  /** @nocollapse */
@@ -3714,7 +3780,11 @@ var AdvancedTableComponent = /** @class */ (function () {
3714
3780
  order: [{ type: Output, args: ['order',] }],
3715
3781
  scroll: [{ type: Output, args: ['scroll',] }],
3716
3782
  selectedItems: [{ type: Output, args: ['selectedItems',] }],
3783
+ beforeServerData: [{ type: Output, args: ['beforeServerData',] }],
3784
+ afterServerData: [{ type: Output, args: ['afterServerData',] }],
3717
3785
  loading: [{ type: Output, args: ['loading',] }],
3786
+ showDetails: [{ type: Output, args: ['showDetails',] }],
3787
+ hideDetails: [{ type: Output, args: ['hideDetails',] }],
3718
3788
  scrollable: [{ type: Input }],
3719
3789
  serverSide: [{ type: Input }],
3720
3790
  lengthMenu: [{ type: Input }],
@@ -3734,6 +3804,7 @@ var AdvancedTableComponent = /** @class */ (function () {
3734
3804
  rowGroup: [{ type: Input }],
3735
3805
  headerTemplate: [{ type: Input }],
3736
3806
  footerTemplate: [{ type: Input }],
3807
+ detailsTemplate: [{ type: Input }],
3737
3808
  header: [{ type: ViewChild, args: ['header',] }],
3738
3809
  footer: [{ type: ViewChild, args: ['footer',] }],
3739
3810
  config: [{ type: Input, args: ['config',] }],
@@ -7308,7 +7379,8 @@ var TABLES_EL = {
7308
7379
  },
7309
7380
  "ExportList": "Εξαγωγή λίστας",
7310
7381
  "ExportLimitExceeded": "Το πλήθος των στοιχείων προς εξαγωγή ({{dataLength}}) ξεπερνάει το μέγιστο επιτρεπτό ({{exportLimit}}). Παρακαλούμε προσαρμόστε τα φίλτρα της αναζήτησης και προσπαθήστε ξανά.",
7311
- "ExportResults": "Δεδομένα λίστας"
7382
+ "ExportResults": "Δεδομένα λίστας",
7383
+ "RowDetails": "Λεπτομέρειες"
7312
7384
  },
7313
7385
  "TrueFalse": {
7314
7386
  "long": {
@@ -7439,7 +7511,8 @@ var TABLES_EN = {
7439
7511
  },
7440
7512
  "ExportList": "Export list",
7441
7513
  "ExportLimitExceeded": "The number of items that are to be exported ({{dataLength}}) exceeds the export limit ({{exportLimit}}). Please apply more specific filters to the search.",
7442
- "ExportResults": "Exported list"
7514
+ "ExportResults": "Exported list",
7515
+ "RowDetails": "Details"
7443
7516
  },
7444
7517
  "TrueFalse": {
7445
7518
  "long": {