@esfaenza/es-table 11.2.21 → 11.2.22-beta4

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.
Files changed (111) hide show
  1. package/bundles/esfaenza-es-table.umd.js +2262 -562
  2. package/bundles/esfaenza-es-table.umd.js.map +1 -1
  3. package/bundles/esfaenza-es-table.umd.min.js +2 -2
  4. package/bundles/esfaenza-es-table.umd.min.js.map +1 -1
  5. package/esfaenza-es-table.d.ts +5 -5
  6. package/esfaenza-es-table.metadata.json +1 -1
  7. package/esm2015/esfaenza-es-table.js +6 -6
  8. package/esm2015/lib/directives/es_td.directive.js +2 -4
  9. package/esm2015/lib/directives/es_th.directive.js +23 -7
  10. package/esm2015/lib/domain/externals/classes/CornerMenuOption.js +4 -0
  11. package/esm2015/lib/domain/externals/classes/EsTableColumnsDefinition.js +31 -0
  12. package/esm2015/lib/domain/externals/classes/EsTableOperationDefinition.js +22 -0
  13. package/esm2015/lib/domain/externals/classes/appsearch/AppOrdering.js +16 -0
  14. package/esm2015/lib/domain/externals/classes/appsearch/AppSearch.js +35 -0
  15. package/esm2015/lib/domain/externals/classes/appsearch/GenericItem.js +11 -0
  16. package/esm2015/lib/domain/externals/classes/appsearch/Group.js +17 -0
  17. package/esm2015/lib/domain/externals/classes/appsearch/GroupAggregation.js +16 -0
  18. package/esm2015/lib/domain/externals/classes/appsearch/GroupFilter.js +14 -0
  19. package/esm2015/lib/domain/externals/classes/appsearch/GroupOrAggregation.js +16 -0
  20. package/esm2015/lib/domain/externals/classes/appsearch/ItemsSelection.js +23 -0
  21. package/esm2015/lib/domain/externals/classes/report/ReportColumn.js +4 -0
  22. package/esm2015/lib/domain/externals/classes/report/ReportDefinition.js +4 -0
  23. package/esm2015/lib/domain/externals/classes/report/ReportOrder.js +4 -0
  24. package/esm2015/lib/domain/externals/classes/report/ReportParam.js +4 -0
  25. package/esm2015/lib/domain/externals/classes/report/ReportResult.js +4 -0
  26. package/esm2015/lib/domain/externals/classes/report/ReportRow.js +4 -0
  27. package/esm2015/lib/domain/externals/index.js +18 -0
  28. package/esm2015/lib/domain/index.js +3 -16
  29. package/esm2015/lib/domain/internals/classes/CacheTriptic.js +16 -0
  30. package/esm2015/lib/domain/internals/classes/EsTableColumn.js +24 -0
  31. package/esm2015/lib/domain/internals/classes/GroupPager.js +21 -0
  32. package/esm2015/lib/domain/internals/classes/GroupRouteFragment.js +17 -0
  33. package/esm2015/lib/domain/internals/classes/ThAggregation.js +16 -0
  34. package/esm2015/lib/domain/internals/index.js +6 -0
  35. package/esm2015/lib/es-table.module.js +9 -4
  36. package/esm2015/lib/es_table.component.js +1829 -343
  37. package/esm2015/lib/es_table.component.loc.js +6 -7
  38. package/esm2015/lib/es_td.component.js +28 -43
  39. package/esm2015/lib/es_th.component.js +16 -44
  40. package/esm2015/lib/models/EsTableDefaultable.js +4 -0
  41. package/esm2015/lib/models/EsTableModuleConfig.js +2 -4
  42. package/esm2015/lib/pager/table_pager.component.js +48 -26
  43. package/esm2015/lib/pager/table_pager.component.loc.js +5 -7
  44. package/esm2015/lib/tokens.js +6 -4
  45. package/esm2015/public-api.js +3 -2
  46. package/fesm2015/esfaenza-es-table.js +2145 -553
  47. package/fesm2015/esfaenza-es-table.js.map +1 -1
  48. package/lib/directives/es_td.directive.d.ts +1 -3
  49. package/lib/directives/es_th.directive.d.ts +18 -5
  50. package/lib/domain/externals/classes/CornerMenuOption.d.ts +7 -0
  51. package/lib/domain/{classes → externals/classes}/EsTableColumnsDefinition.d.ts +5 -7
  52. package/lib/domain/{classes → externals/classes}/EsTableOperationDefinition.d.ts +1 -3
  53. package/lib/domain/{classes → externals/classes/appsearch}/AppOrdering.d.ts +0 -0
  54. package/lib/domain/externals/classes/appsearch/AppSearch.d.ts +67 -0
  55. package/lib/domain/externals/classes/appsearch/GenericItem.d.ts +13 -0
  56. package/lib/domain/externals/classes/appsearch/Group.d.ts +17 -0
  57. package/lib/domain/externals/classes/appsearch/GroupAggregation.d.ts +14 -0
  58. package/lib/domain/externals/classes/appsearch/GroupFilter.d.ts +12 -0
  59. package/lib/domain/externals/classes/appsearch/GroupOrAggregation.d.ts +14 -0
  60. package/lib/domain/externals/classes/appsearch/ItemsSelection.d.ts +22 -0
  61. package/lib/domain/externals/classes/report/ReportColumn.d.ts +15 -0
  62. package/lib/domain/externals/classes/report/ReportDefinition.d.ts +24 -0
  63. package/lib/domain/externals/classes/report/ReportOrder.d.ts +7 -0
  64. package/lib/domain/externals/classes/report/ReportParam.d.ts +40 -0
  65. package/lib/domain/externals/classes/report/ReportResult.d.ts +12 -0
  66. package/lib/domain/externals/classes/report/ReportRow.d.ts +5 -0
  67. package/lib/domain/externals/index.d.ts +17 -0
  68. package/lib/domain/index.d.ts +2 -15
  69. package/lib/domain/internals/classes/CacheTriptic.d.ts +14 -0
  70. package/lib/domain/{classes → internals/classes}/EsTableColumn.d.ts +6 -4
  71. package/lib/domain/internals/classes/GroupPager.d.ts +22 -0
  72. package/lib/domain/internals/classes/GroupRouteFragment.d.ts +15 -0
  73. package/lib/domain/internals/classes/ThAggregation.d.ts +14 -0
  74. package/lib/domain/internals/index.d.ts +5 -0
  75. package/lib/es_table.component.d.ts +456 -62
  76. package/lib/es_table.component.loc.d.ts +2 -6
  77. package/lib/es_td.component.d.ts +14 -36
  78. package/lib/es_th.component.d.ts +21 -61
  79. package/lib/models/EsTableDefaultable.d.ts +19 -0
  80. package/lib/models/EsTableModuleConfig.d.ts +8 -7
  81. package/lib/pager/table_pager.component.d.ts +27 -30
  82. package/lib/pager/table_pager.component.loc.d.ts +2 -6
  83. package/lib/tokens.d.ts +6 -3
  84. package/package.json +2 -1
  85. package/public-api.d.ts +2 -1
  86. package/esm2015/lib/domain/classes/AppOrdering.js +0 -16
  87. package/esm2015/lib/domain/classes/AppSearch.js +0 -35
  88. package/esm2015/lib/domain/classes/CornerMenuOption.js +0 -6
  89. package/esm2015/lib/domain/classes/EsTableColumn.js +0 -22
  90. package/esm2015/lib/domain/classes/EsTableColumnsDefinition.js +0 -31
  91. package/esm2015/lib/domain/classes/EsTableOperationDefinition.js +0 -24
  92. package/esm2015/lib/domain/classes/GenericItem.js +0 -15
  93. package/esm2015/lib/domain/classes/IAppSearch.js +0 -2
  94. package/esm2015/lib/domain/classes/ItemsSelection.js +0 -25
  95. package/esm2015/lib/domain/classes/ReportColumn.js +0 -6
  96. package/esm2015/lib/domain/classes/ReportDefinition.js +0 -6
  97. package/esm2015/lib/domain/classes/ReportOrder.js +0 -6
  98. package/esm2015/lib/domain/classes/ReportParam.js +0 -6
  99. package/esm2015/lib/domain/classes/ReportResult.js +0 -6
  100. package/esm2015/lib/domain/classes/ReportRow.js +0 -6
  101. package/lib/domain/classes/AppSearch.d.ts +0 -76
  102. package/lib/domain/classes/CornerMenuOption.d.ts +0 -13
  103. package/lib/domain/classes/GenericItem.d.ts +0 -25
  104. package/lib/domain/classes/IAppSearch.d.ts +0 -67
  105. package/lib/domain/classes/ItemsSelection.d.ts +0 -27
  106. package/lib/domain/classes/ReportColumn.d.ts +0 -29
  107. package/lib/domain/classes/ReportDefinition.d.ts +0 -46
  108. package/lib/domain/classes/ReportOrder.d.ts +0 -13
  109. package/lib/domain/classes/ReportParam.d.ts +0 -76
  110. package/lib/domain/classes/ReportResult.d.ts +0 -22
  111. package/lib/domain/classes/ReportRow.d.ts +0 -9
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@esfaenza/extensions'), require('@esfaenza/localizations'), require('@esfaenza/preferences'), require('@angular/platform-browser'), require('@angular/common'), require('@angular/router'), require('ngx-bootstrap/modal'), require('ngx-bootstrap/dropdown'), require('@ctrl/ngx-csv'), require('@esfaenza/ngx-contextmenu')) :
3
- typeof define === 'function' && define.amd ? define('@esfaenza/es-table', ['exports', '@angular/core', '@angular/forms', '@esfaenza/extensions', '@esfaenza/localizations', '@esfaenza/preferences', '@angular/platform-browser', '@angular/common', '@angular/router', 'ngx-bootstrap/modal', 'ngx-bootstrap/dropdown', '@ctrl/ngx-csv', '@esfaenza/ngx-contextmenu'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esfaenza = global.esfaenza || {}, global.esfaenza['es-table'] = {}), global.ng.core, global.ng.forms, global.extensions, global.localizations, global.preferences, global.ng.platformBrowser, global.ng.common, global.ng.router, global.modal, global.dropdown, global.ngxCsv, global.ngxContextmenu));
5
- }(this, (function (exports, core, forms, extensions, localizations, preferences, platformBrowser, common, router, modal, dropdown, ngxCsv, ngxContextmenu) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@esfaenza/extensions'), require('@esfaenza/localizations'), require('@esfaenza/preferences'), require('@angular/platform-browser'), require('@angular/common'), require('@angular/router'), require('@angular/material/select'), require('@angular/material/input'), require('ngx-bootstrap/modal'), require('ngx-bootstrap/dropdown'), require('@ctrl/ngx-csv'), require('@esfaenza/ngx-contextmenu')) :
3
+ typeof define === 'function' && define.amd ? define('@esfaenza/es-table', ['exports', '@angular/core', '@angular/forms', '@esfaenza/extensions', '@esfaenza/localizations', '@esfaenza/preferences', '@angular/platform-browser', '@angular/common', '@angular/router', '@angular/material/select', '@angular/material/input', 'ngx-bootstrap/modal', 'ngx-bootstrap/dropdown', '@ctrl/ngx-csv', '@esfaenza/ngx-contextmenu'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esfaenza = global.esfaenza || {}, global.esfaenza['es-table'] = {}), global.ng.core, global.ng.forms, global.extensions, global.localizations, global.preferences, global.ng.platformBrowser, global.ng.common, global.ng.router, global.ng.material.select, global.ng.material.input, global.modal, global.dropdown, global.ngxCsv, global.ngxContextmenu));
5
+ }(this, (function (exports, core, forms, extensions, localizations, preferences, platformBrowser, common, router, select, input, modal, dropdown, ngxCsv, ngxContextmenu) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -366,9 +366,7 @@
366
366
  return AppSearch;
367
367
  }());
368
368
 
369
- /**
370
- * Classe che identifica una colonna. Utilizzata in modalità "Colonne dinamiche"
371
- */
369
+ /** Classe che identifica una colonna. Utilizzata in modalità "Colonne dinamiche" */
372
370
  var EsTableColumnsDefinition = /** @class */ (function () {
373
371
  /**
374
372
  * Costruttore
@@ -383,8 +381,9 @@
383
381
  * @param {boolean} visible Visibilità o meno della colonna
384
382
  * @param {string} clss Classe da applicare sia ai TD che ai TH relativi a questa colonna
385
383
  * @param {boolean} orderable Indica se la colonna è ordinabile o no (nel senso ASC / DESC / NONE)
384
+ * @param {boolean} headerWraps Indica se il testo dell'header dev'essere wrappato all'interno del th. Di default no.
386
385
  */
387
- function EsTableColumnsDefinition(description, propertyName, routePath, routeParameterProperties, dataOrder, columnOrder, visible, clss, orderable) {
386
+ function EsTableColumnsDefinition(description, propertyName, routePath, routeParameterProperties, dataOrder, columnOrder, visible, clss, orderable, headerWraps) {
388
387
  if (routePath === void 0) { routePath = null; }
389
388
  if (routeParameterProperties === void 0) { routeParameterProperties = null; }
390
389
  if (dataOrder === void 0) { dataOrder = null; }
@@ -392,6 +391,7 @@
392
391
  if (visible === void 0) { visible = true; }
393
392
  if (clss === void 0) { clss = null; }
394
393
  if (orderable === void 0) { orderable = true; }
394
+ if (headerWraps === void 0) { headerWraps = false; }
395
395
  this.description = description;
396
396
  this.propertyName = propertyName;
397
397
  this.routePath = routePath;
@@ -401,92 +401,73 @@
401
401
  this.visible = visible;
402
402
  this.clss = clss;
403
403
  this.orderable = orderable;
404
+ this.headerWraps = headerWraps;
404
405
  }
405
406
  return EsTableColumnsDefinition;
406
407
  }());
407
408
 
408
- /**
409
- * Classe che definisce un oggetto generico come lista di proprietà-valore
410
- */
409
+ /** Classe che definisce un oggetto generico come lista di proprietà-valore */
411
410
  var GenericItem = /** @class */ (function () {
412
- /**
413
- * @ignore
414
- */
411
+ /** @ignore */
415
412
  function GenericItem() {
416
413
  this._selected = false;
417
414
  this._rowClass = null;
418
- this.hash = null;
415
+ this._hash = null;
419
416
  this.properties = {};
420
417
  }
421
418
  return GenericItem;
422
419
  }());
423
420
 
424
- /**
425
- * Indica un'opzione cliccabile nel Corner Menù della tabella (il menù richiamabile dai 3 pallini verticli in alto a destra)
426
- */
421
+ /** Indica un'opzione cliccabile nel Corner Menù della tabella (il menù richiamabile dai 3 pallini verticli in alto a destra) */
427
422
  var CornerMenuOption = /** @class */ (function () {
428
423
  function CornerMenuOption() {
429
424
  }
430
425
  return CornerMenuOption;
431
426
  }());
432
427
 
433
- /**
434
- * Definizione generica di un report che può o no disporre di paginazione/export e la cui richiesta è basata su uno o più parametri
435
- */
428
+ /** Definizione generica di un report che può o no disporre di paginazione/export e la cui richiesta è basata su uno o più parametri */
436
429
  var ReportDefinition = /** @class */ (function () {
437
430
  function ReportDefinition() {
438
431
  }
439
432
  return ReportDefinition;
440
433
  }());
441
434
 
442
- /**
443
- * Classe che identifica una direttiva di ordinamento per un report
444
- */
435
+ /** Classe che identifica una direttiva di ordinamento per un report */
445
436
  var ReportOrder = /** @class */ (function () {
446
437
  function ReportOrder() {
447
438
  }
448
439
  return ReportOrder;
449
440
  }());
450
441
 
451
- /**
452
- * Classe che rappresenta una colonna di un report
453
- */
442
+ /** Classe che rappresenta una colonna di un report */
454
443
  var ReportColumn = /** @class */ (function () {
455
444
  function ReportColumn() {
456
445
  }
457
446
  return ReportColumn;
458
447
  }());
459
448
 
460
- /**
461
- * Classe che rappresenta una lista di oggetti generati da un report
462
- */
449
+ /** Classe che rappresenta una lista di oggetti generati da un report */
463
450
  var ReportResult = /** @class */ (function () {
464
451
  function ReportResult() {
465
452
  }
466
453
  return ReportResult;
467
454
  }());
468
455
 
469
- /**
470
- * Classe che rappresenta i valori delle proprietà di un oggetto Report
471
- */
456
+ /** Classe che rappresenta i valori delle proprietà di un oggetto Report */
472
457
  var ReportRow = /** @class */ (function () {
473
458
  function ReportRow() {
474
459
  }
475
460
  return ReportRow;
476
461
  }());
477
462
 
478
- /**
479
- * Classe che identifica un parametro generico per un report
480
- */
463
+ /** Classe che identifica un parametro generico per un report */
481
464
  var ReportParam = /** @class */ (function () {
482
465
  function ReportParam() {
483
466
  }
484
467
  return ReportParam;
485
468
  }());
486
469
 
487
- /**
488
- * Indica operazioni dinamiche generiche che possono essere effettuate per riga. Appaiono come colonne extra sul lato sinistro della tabella
489
- */
470
+ /** Indica operazioni dinamiche generiche che possono essere effettuate per riga. Appaiono come colonne extra sul lato sinistro della tabella */
490
471
  var EsTableOperationDefinition = /** @class */ (function () {
491
472
  /**
492
473
  * Costruttore
@@ -509,9 +490,115 @@
509
490
  return EsTableOperationDefinition;
510
491
  }());
511
492
 
512
- /**
513
- * Definizione di una colonna
514
- */
493
+ /** Identifica una selezione applicabile agli oggetti presentati in una tabella */
494
+ var ItemsSelection = /** @class */ (function () {
495
+ /**
496
+ * Costruttore
497
+ *
498
+ * @param {T[]} selected Oggetti da considerare selezionati
499
+ */
500
+ function ItemsSelection(selected) {
501
+ /** Indica se tutti gli elementi sono da considerarsi selezionati (anche quelli di altre pagine) */
502
+ this.all = false;
503
+ /** Se **all** è **true**, indica gli elementi da escludere, altrimenti è insensato */
504
+ this.exclusions = [];
505
+ /** Se **all** è **true**, indica i gruppi da escludere, altrimenti è insensato */
506
+ this.group_exclusions = [];
507
+ this.count = selected.length;
508
+ this.items = selected;
509
+ this.all = false;
510
+ this.exclusions = [];
511
+ this.groups = [];
512
+ this.group_exclusions = [];
513
+ }
514
+ return ItemsSelection;
515
+ }());
516
+
517
+ /** Classe che rappresenta un Gruppo con le proprie aggregazioni */
518
+ var Group = /** @class */ (function () {
519
+ /**
520
+ * Costruttore
521
+ *
522
+ * @param {string} column ID della colonna raggruppata
523
+ * @param {number} count Numero di elementi raggruppati sotto questa colonna
524
+ * @param {string} value Valore del Gruppo
525
+ */
526
+ function Group(column, count, value) {
527
+ this.column = column;
528
+ this.count = count;
529
+ this.value = value;
530
+ this.aggregations = [];
531
+ }
532
+ return Group;
533
+ }());
534
+
535
+ /** Classe che rappresenta un'aggregazione */
536
+ var GroupAggregation = /** @class */ (function () {
537
+ /**
538
+ * Costruttore
539
+ *
540
+ * @param {string} column ID della colonna aggregata
541
+ * @param {'min' | 'max' | 'sum' } aggregation Aggregazione da effettuare su questa colonna
542
+ * @param {string} value Valore dell'aggregazione
543
+ */
544
+ function GroupAggregation(column, aggregation, value) {
545
+ this.column = column;
546
+ this.aggregation = aggregation;
547
+ this.value = value;
548
+ }
549
+ return GroupAggregation;
550
+ }());
551
+
552
+ /** Classe che rappresenta un filtro su un gruppo */
553
+ var GroupFilter = /** @class */ (function () {
554
+ /**
555
+ * Costruttore
556
+ *
557
+ * @param {string} column ID della colonna gruppata per cui si richiede di filtrare
558
+ * @param {string} value Valore del gruppo su questa **column** per cui si richiede di filtrare
559
+ */
560
+ function GroupFilter(column, value) {
561
+ this.column = column;
562
+ this.value = value;
563
+ }
564
+ return GroupFilter;
565
+ }());
566
+
567
+ /** Classe che rappresenta o un gruppo o una aggregazione su una colonna. Usata solo internamente */
568
+ var GroupOrAggregation = /** @class */ (function () {
569
+ /**
570
+ * Costruttore
571
+ *
572
+ * @param {string} column Colonna su cui è presente o un gruppo o un'aggregazione
573
+ * @param {'min' | 'max' | 'sum' } aggregation Aggregazione presente sulla **column**. Se questo campo è nullo significa che è un gruppo.
574
+ * @param {'string' | 'date' | 'number'} datatype Tipo di dati contenuto nella colonna **column** se non c'è alcuna aggregazione è inutile, pertanto non sarà valorizzato
575
+ */
576
+ function GroupOrAggregation(column, aggregation, datatype) {
577
+ this.column = column;
578
+ this.aggregation = aggregation;
579
+ this.datatype = datatype;
580
+ }
581
+ return GroupOrAggregation;
582
+ }());
583
+
584
+ /** Rappresenta un trittico formato da un array e due cache relative a tale array per un accesso estremamente veloce per tutte le operazioni del caso */
585
+ var CacheTriptic = /** @class */ (function () {
586
+ /**
587
+ * Costruttore
588
+ *
589
+ * @param {Map<string, any>} cache Cache Chiave-Oggetto
590
+ * @param {Map<string, number>} index_cache Cache Indice-Oggetto
591
+ * @param {any[]} array Array contenente gli oggetti
592
+ */
593
+ function CacheTriptic(cache, index_cache, array) {
594
+ this.cache = cache;
595
+ this.index_cache = index_cache;
596
+ this.array = array;
597
+ }
598
+ return CacheTriptic;
599
+ }());
600
+
601
+ /** Definizione di una colonna, utilizzato nella dialog che permette di modificare le posizioni e le visibilità */
515
602
  var EsTableColumn = /** @class */ (function () {
516
603
  /**
517
604
  * Costruttore
@@ -520,68 +607,93 @@
520
607
  * @param {string} description Descrizione (Header)
521
608
  * @param {boolean} visible Indica se di default mostrarla o meno
522
609
  * @param {boolean} fixed Indica se è una colonna fixed
610
+ * @param {boolean} pinned Indica se è una colonna pinnata
611
+ * @param {number} pinnedWidth Indica la dimensione da assegnare a questa colonna quando è pinnata
523
612
  * @param {TemplateRef<any>} template Indica il template da usare per mostrare il testo dell'Header
524
613
  */
525
- function EsTableColumn(id, description, visible, fixed, template) {
614
+ function EsTableColumn(id, description, visible, fixed, pinned, pinnedWidth, template) {
526
615
  this.id = id;
527
616
  this.description = description;
528
617
  this.visible = visible;
529
618
  this.fixed = fixed;
619
+ this.pinned = pinned;
620
+ this.pinnedWidth = pinnedWidth;
530
621
  this.template = template;
531
622
  }
532
623
  return EsTableColumn;
533
624
  }());
534
625
 
535
- /**
536
- * Identifica una selezione applicabile agli oggetti presentati in una tabella
537
- */
538
- var ItemsSelection = /** @class */ (function () {
626
+ /** Classe che rappresenta un separatore da inserire fra gli oggetti dell'es-table per le operazioni di paginazione dei raggruppamenti per riga */
627
+ var GroupPager = /** @class */ (function () {
539
628
  /**
540
629
  * Costruttore
541
630
  *
542
- * @param {T[]} selected Oggetti da considerare selezionati
631
+ * @param {number} groupLevel Livello del gruppo a cui questo separatore fa riferimento
632
+ * @param {string} parentKey Chiave del gruppo parent se esiste
633
+ * @param {AppSearch<any>} view Vista di ricerca collegata a questo elemento
634
+ * @param {'groups' | 'items'} searches Indica che cosa cerca questo separatore, se sottogruppi o oggetti
543
635
  */
544
- function ItemsSelection(selected) {
545
- /**
546
- * Indica se tutti gli elementi sono da considerarsi selezionati (anche quelli di altre pagine)
547
- */
548
- this.all = false;
549
- /**
550
- * Se **all** è **true**, indica gli elementi da escludere, altrimenti è insensato
551
- */
552
- this.exclusions = [];
553
- this.count = selected.length;
554
- this.items = selected;
555
- this.all = false;
556
- this.exclusions = [];
636
+ function GroupPager(_grouplevel, _thisRoute, _parent, view, searches) {
637
+ this._grouplevel = _grouplevel;
638
+ this._thisRoute = _thisRoute;
639
+ this._parent = _parent;
640
+ this.view = view;
641
+ this.searches = searches;
642
+ this._sep = true;
643
+ this.buttons = [];
557
644
  }
558
- return ItemsSelection;
645
+ return GroupPager;
559
646
  }());
560
647
 
561
- //Angular
562
648
  /**
563
- * Componente rappresentante una singola cella del body della tabella
649
+ * Classe che rappresenta un singolo frammento di route di un elemento gruppo o non. Un array di questi indica tutte le colonne di gruppo con i loro valori
650
+ * per arrivare ad una ricerca su sottogruppi o elementi relativi
564
651
  */
565
- var EsTd = /** @class */ (function () {
652
+ var GroupRouteFragment = /** @class */ (function () {
566
653
  /**
567
- * @ignore
654
+ * Costruttore
655
+ *
656
+ * @param {string} column Colonna di raggruppamento
657
+ * @param {string} value Valore della colonna di raggruppamento
658
+ */
659
+ function GroupRouteFragment(column, value) {
660
+ this.column = column;
661
+ this.value = value;
662
+ }
663
+ return GroupRouteFragment;
664
+ }());
665
+
666
+ /** Classe rappresentante una singola aggregazione effettuata su una colonna */
667
+ var ThAggregation = /** @class */ (function () {
668
+ /**
669
+ * Costruttore
670
+ *
671
+ * @param {'min' | 'max' | 'sum'} func Funzione di aggergazione, può essere **min**, **max** o **sum**
672
+ * @param {string} format Formato richiesto per il valore dell'aggregazione
673
+ * @param {string} match Match intero del pezzo di testo da cui si è estrapolata l'aggregazione, da rimpiazzare col valore calcolato
568
674
  */
675
+ function ThAggregation(func, format, match) {
676
+ this.func = func;
677
+ this.format = format;
678
+ this.match = match;
679
+ }
680
+ return ThAggregation;
681
+ }());
682
+
683
+ //Angular
684
+ /** Componente rappresentante una singola cella del body della tabella */
685
+ var EsTd = /** @class */ (function () {
686
+ /** @ignore */
569
687
  function EsTd(myself, renderer, _viewContainer, sanitizer) {
570
688
  this.myself = myself;
571
689
  this.renderer = renderer;
572
690
  this._viewContainer = _viewContainer;
573
691
  this.sanitizer = sanitizer;
574
- /**
575
- * Id della cella, dev'essere lo stesso della colonna **EsTh** relativa
576
- */
692
+ /** Id della cella, dev'essere lo stesso della colonna **EsTh** relativa */
577
693
  this.ID = "";
578
- /**
579
- * Valore da mostrare all'interno della cella. Se omesso verrà proiettato il contenuto dal template in cui è stata usata
580
- */
694
+ /** Valore da mostrare all'interno della cella. Se omesso verrà proiettato il contenuto dal template in cui è stata usata */
581
695
  this.Display = null;
582
- /**
583
- * Template Angular da istanziare per questo TD
584
- */
696
+ /** Template Angular da istanziare per questo TD */
585
697
  this.Template = null;
586
698
  }
587
699
  Object.defineProperty(EsTd.prototype, "Visible", {
@@ -610,13 +722,18 @@
610
722
  enumerable: false,
611
723
  configurable: true
612
724
  });
613
- /**
614
- * @ignore
615
- */
725
+ /** @ignore */
616
726
  EsTd.prototype.ngAfterViewInit = function () {
617
727
  // Se è Internal significa che è gestita internamente da ES-TABLE quindi evito di fare sti due passaggi di lettura del DOM
618
728
  if (this.Internal)
619
729
  return;
730
+ // L'hash è calcolato dalla ES-table in fase di binding
731
+ this.Context = this.Context || this.getTemplateContext()._hash;
732
+ this.Content = this.Display === null || this.Display === "" ? this.sanitizer.bypassSecurityTrustHtml(this.myself.nativeElement.innerHTML) : this.sanitizer.bypassSecurityTrustHtml(this.Display);
733
+ this.Class = this.myself.nativeElement.className.replace("app-display-none", "");
734
+ };
735
+ /** Ottiene il contesto della view su cui è istanziato il componente */
736
+ EsTd.prototype.getTemplateContext = function () {
620
737
  // NGBUG: (<any>this._viewContainer)._view non esiste più in IVY: https://stackoverflow.com/questions/60398827/getting-the-context-of-the-template-inside-of-which-my-component-has-been-render
621
738
  var vc = this._viewContainer;
622
739
  var context;
@@ -629,34 +746,23 @@
629
746
  context = vc._view.viewContainerParent.context.$implicit;
630
747
  else
631
748
  context = vc._view.context.$implicit;
749
+ if (context)
750
+ return context;
632
751
  // Se non ho ancora trovato il contesto probabilmente sono in IVY e devo fare dei lookup un po' incasinati per beccarlo
633
- if (context == null) {
634
- var array = this._viewContainer._hostLView;
635
- for (var i = 0; i < array.length; i++) {
636
- var item = array[i];
637
- if (item && item.$implicit && !item.ngIf) {
638
- context = item.$implicit;
639
- break;
640
- }
641
- // Second level search for the real context in case the first one we find is an ngIf
642
- if (item && item.length && item.length > 0) {
643
- for (var ii = 0; ii < item.length; ii++) {
644
- var iitem = item[ii];
645
- if (iitem && iitem.$implicit && !iitem.ngIf) {
646
- context = iitem.$implicit;
647
- break;
648
- }
649
- }
752
+ var array = this._viewContainer._hostLView;
753
+ for (var i = 0; i < array.length; i++) {
754
+ var item = array[i];
755
+ if (item && item.$implicit && !item.ngIf)
756
+ return item.$implicit;
757
+ // Second level search for the real context in case the first one we find is an ngIf
758
+ if (item && item.length && item.length > 0) {
759
+ for (var ii = 0; ii < item.length; ii++) {
760
+ var iitem = item[ii];
761
+ if (iitem && iitem.$implicit && !iitem.ngIf)
762
+ return iitem.$implicit;
650
763
  }
651
- if (context)
652
- break;
653
764
  }
654
765
  }
655
- // Calcolato dalla ES-table in fase di binding
656
- var hash = context.hash;
657
- this.Context = hash;
658
- this.Content = this.Display === null || this.Display === "" ? this.sanitizer.bypassSecurityTrustHtml(this.myself.nativeElement.innerHTML) : this.sanitizer.bypassSecurityTrustHtml(this.Display);
659
- this.Class = this.myself.nativeElement.className.replace("app-display-none", "");
660
766
  };
661
767
  return EsTd;
662
768
  }());
@@ -679,27 +785,20 @@
679
785
  RouterLink: [{ type: core.Input }],
680
786
  Display: [{ type: core.Input }],
681
787
  Template: [{ type: core.Input }],
788
+ Context: [{ type: core.Input }],
682
789
  Visible: [{ type: core.Input }]
683
790
  };
684
791
 
685
792
  //Angular
686
- /**
687
- * Componente rappresentante una Colonna della tabella
688
- */
793
+ /** Componente rappresentante una Colonna della tabella */
689
794
  var EsTh = /** @class */ (function () {
690
- /**
691
- * @ignore
692
- */
795
+ /** @ignore */
693
796
  function EsTh(myself, renderer) {
694
797
  this.myself = myself;
695
798
  this.renderer = renderer;
696
- /**
697
- * Dizionario di mappatura con ordinamento attuale e ordinamento successivo per gestire i passaggi di stato
698
- */
799
+ /** Dizionario di mappatura con ordinamento attuale e ordinamento successivo per gestire i passaggi di stato */
699
800
  this.orderNext = { "NONE": "DESC", "DESC": "ASC", "ASC": null };
700
- /**
701
- * Indica se si sta effettuando un'operazione di resize su questa colonna
702
- */
801
+ /** Indica se si sta effettuando un'operazione di resize su questa colonna */
703
802
  this.resizingThis = false;
704
803
  /**
705
804
  * Storicizza l'offset di partenza del resize dell'elemento HTML per poter calcolare la nuova dimensione richiesta durente il resize
@@ -707,21 +806,13 @@
707
806
  * nuova width = startOffset + posizione X del mouse
708
807
  */
709
808
  this.startOffset = null;
710
- /**
711
- * Id della colonna, dev'essere lo stesso per tutti gli **EsTd** relativi
712
- */
809
+ /** Id della colonna, dev'essere lo stesso per tutti gli **EsTd** relativi */
713
810
  this.ID = "";
714
- /**
715
- * Indica se questa colonna è ordinabile o meno
716
- */
811
+ /** Indica se questa colonna è ordinabile o meno */
717
812
  this.Orderable = true;
718
- /**
719
- * Valore da mostrare all'interno della colonna. Se omesso verrà proiettato il contenuto dal template in cui è stata usata
720
- */
813
+ /** Valore da mostrare all'interno della colonna. Se omesso verrà proiettato il contenuto dal template in cui è stata usata */
721
814
  this.Display = "";
722
- /**
723
- * Indica se le dimnsioni di questa colonna sono modificabili o meno
724
- */
815
+ /** Indica se le dimnsioni di questa colonna sono modificabili o meno */
725
816
  this.Resizable = false;
726
817
  /**
727
818
  * Indica se sta venendo eseguita una operazione di ricerca o meno, serve per evitare l'esecuzione di eventuale codice che potrebbe dare fastidio
@@ -732,18 +823,12 @@
732
823
  this.Wrap = false;
733
824
  /** Indica se la colonna è fixed, cioè se non può né essere nascosta, né riposizionata. Solo le prime colonne possono essere Fixed */
734
825
  this.Fixed = false;
735
- /**
736
- * Template Angular da istanziare per questo TH
737
- */
826
+ /** Template Angular da istanziare per questo TH */
738
827
  this.Template = null;
739
- /**
740
- * Evento emesso al cambio di ordinamento effettuato su questa colonna
741
- */
828
+ /** Evento emesso al cambio di ordinamento effettuato su questa colonna */
742
829
  this.onOrderChange = new core.EventEmitter();
743
- /**
744
- * Impostato dall'**EsTable**, per controllare che ci sia almeno un TD che utilizzi quest'header
745
- */
746
- this.Referenced = false;
830
+ /** Impostato dall'**EsTable**, per controllare che ci sia almeno un TD che utilizzi quest'header */
831
+ this._referenced = false;
747
832
  }
748
833
  Object.defineProperty(EsTh.prototype, "Visible", {
749
834
  /**
@@ -771,9 +856,7 @@
771
856
  enumerable: false,
772
857
  configurable: true
773
858
  });
774
- /**
775
- * @ignore
776
- */
859
+ /** @ignore */
777
860
  EsTh.prototype.ngAfterViewInit = function () {
778
861
  //Assegnare direttamente il content è più veloce che passare dal native element per qualche motivo
779
862
  this.Description = this.Display === null || this.Display === "" ? this.content.nativeElement.innerText : this.Display;
@@ -782,9 +865,7 @@
782
865
  if (this.Resizable)
783
866
  this.renderer.addClass(this.myself.nativeElement, "app-relative");
784
867
  };
785
- /**
786
- * Gestisce la modifica dell'ordinamento qualora venisse cliccato su questa colonna
787
- */
868
+ /** Gestisce la modifica dell'ordinamento qualora venisse cliccato su questa colonna */
788
869
  EsTh.prototype.setupNextOrderAndNotify = function () {
789
870
  if (!this.ID) {
790
871
  console.log("Attempt to order a column without ID. Operation ignored");
@@ -811,9 +892,7 @@
811
892
  this.resizingThis = true;
812
893
  this.startOffset = this.myself.nativeElement.offsetWidth - ev.pageX;
813
894
  };
814
- /**
815
- * Listener per la fine dell'operazione di resize
816
- */
895
+ /** Listener per la fine dell'operazione di resize */
817
896
  EsTh.prototype.onMouseUp = function () {
818
897
  if (!this.Resizable)
819
898
  return;
@@ -864,9 +943,7 @@
864
943
  onMouseMove: [{ type: core.HostListener, args: ['window:mousemove.out-zone', ['$event'],] }]
865
944
  };
866
945
 
867
- /**
868
- * Direttiva per la dichiarazione snella di un EsTd da emettere per ogni elemento, data una colonna
869
- */
946
+ /** Direttiva per la dichiarazione snella di un EsTd da emettere per ogni elemento, data una colonna */
870
947
  var EsTdDirective = /** @class */ (function () {
871
948
  /**
872
949
  * @ignore
@@ -895,23 +972,31 @@
895
972
  tdClass: [{ type: core.Input }]
896
973
  };
897
974
 
898
- /**
899
- * Direttiva per la dichiarazione snella di un EsTh da emettere come header
900
- */
975
+ /** Direttiva per la dichiarazione snella di un EsTh da emettere come header */
901
976
  var EsThDirective = /** @class */ (function () {
902
977
  /**
903
978
  * @ignore
904
979
  */
905
980
  function EsThDirective(Template) {
906
981
  this.Template = Template;
982
+ /** Variabile interna all'interno della quale viene raccolta la cache delle aggregazioni specificate in thAggregation */
983
+ this._thAggregations = null;
907
984
  /** Variabile interna che indica il fatto che questo componente è una direttiva. Serve per disambigualrlo dell'EsThComponent */
908
985
  this._directive = true;
986
+ /** Variabile interna impostata dall'**EsTable**, per controllare che ci sia almeno un TD che utilizzi quest'header */
987
+ this._referenced = false;
909
988
  /** Id della colonna, dev'essere lo stesso per tutti i **td** relativi */
910
989
  this.th = "";
990
+ /** Indica se la colonna è pinnata o no */
991
+ this.thPinned = false;
992
+ /** Indica le dimensioni che deve avere questa colonna quando viene pinnata, senza questo tutte le colonne mi collasserebbero l'una sull'altra */
993
+ this.thPinnedWidth = 150;
911
994
  /** Indicazione sulla visibilità della colonna */
912
995
  this.thVisible = true;
913
996
  /** Indica se la colonna è fixed, cioè se non può né essere nascosta, né riposizionata. Solo le prime colonne possono essere Fixed */
914
997
  this.thFixed = false;
998
+ /** Indica che la colonna è sotto ad un raggruppamento padre, con questo nome nel **th** */
999
+ this.thParent = "";
915
1000
  /** Indica se questa colonna è ordinabile o meno */
916
1001
  this.thOrderable = true;
917
1002
  /** Indica se il testo presente in questo Header può andare a capo o meno, di default non può */
@@ -920,8 +1005,10 @@
920
1005
  this.thResizable = false;
921
1006
  /** Equivalente dell'NgIf sul th */
922
1007
  this.thIf = true;
923
- /** Impostato dall'**EsTable**, per controllare che ci sia almeno un TD che utilizzi quest'header */
924
- this.Referenced = false;
1008
+ /** Indica che bisogna fare un raggruppamento su questa colonna */
1009
+ this.thGroup = false;
1010
+ /** Indica che bisogna fare una aggregazione su questa colonna, a fronte di almeno un altra con un raggruppamento */
1011
+ this.thAggregation = null;
925
1012
  }
926
1013
  return EsThDirective;
927
1014
  }());
@@ -933,31 +1020,38 @@
933
1020
  ]; };
934
1021
  EsThDirective.propDecorators = {
935
1022
  th: [{ type: core.Input }],
1023
+ thPinned: [{ type: core.Input }],
1024
+ thPinnedWidth: [{ type: core.Input }],
936
1025
  thVisible: [{ type: core.Input }],
937
1026
  thFixed: [{ type: core.Input }],
1027
+ thParent: [{ type: core.Input }],
938
1028
  thOrder: [{ type: core.Input }],
939
1029
  thOrderable: [{ type: core.Input }],
940
1030
  thWrap: [{ type: core.Input }],
941
1031
  thResizable: [{ type: core.Input }],
942
1032
  thClass: [{ type: core.Input }],
943
- thIf: [{ type: core.Input }]
1033
+ thGroupClass: [{ type: core.Input }],
1034
+ thIf: [{ type: core.Input }],
1035
+ thGroup: [{ type: core.Input }],
1036
+ thAggregation: [{ type: core.Input }]
944
1037
  };
945
1038
 
946
- /**
947
- * Token che indica il locale da utilizzare all'interno del componente. Supportati solo "it-IT" ed "en-US"
948
- */
949
- var EST_LOCALE = new core.InjectionToken('EST_LOCALE');
1039
+ /** Token che indica il locale da utilizzare all'interno del componente. Supportati solo "it-IT" ed "en-US" */
1040
+ var EST_LOCALE = new core.InjectionToken('EST_LOCALE');
1041
+ /** Token che indica se emettere log a console o meno */
1042
+ var EST_DEBUG = new core.InjectionToken('EST_DEBUG');
1043
+ /** Token che indica i default da assegnare agli Input */
1044
+ var EST_DEFAULTS = new core.InjectionToken('EST_DEFAULTS');
950
1045
 
951
- /**
952
- * Classe di localizzazione per il componente **EsTableComponent**
953
- */
1046
+ /** Classe di localizzazione per il componente **EsTableComponent** */
954
1047
  var EsTableLoc = /** @class */ (function (_super) {
955
1048
  __extends(EsTableLoc, _super);
956
- /**
957
- * @ignore
958
- */
1049
+ /** @ignore */
959
1050
  function EsTableLoc(LOC_LOCALE) {
960
1051
  var _this = _super.call(this, LOC_LOCALE !== null && LOC_LOCALE !== void 0 ? LOC_LOCALE : 'it-IT') || this;
1052
+ _super.prototype.set.call(_this, "en->it", "All", ["Tutto"]);
1053
+ _super.prototype.set.call(_this, "en->it", "Groups", ["Gruppi"]);
1054
+ _super.prototype.set.call(_this, "en->it", "Cannot export an empty dataset", ["Impossibile esportare un dataset vuoto"]);
961
1055
  _super.prototype.set.call(_this, "en->it", "Performing Table bootstrap", ["Sto caricando la Tabella"]);
962
1056
  _super.prototype.set.call(_this, "en->it", "Update every", ["Aggiorna ogni"]);
963
1057
  _super.prototype.set.call(_this, "en->it", "second/s", ["secondo/i"]);
@@ -984,25 +1078,34 @@
984
1078
  { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [EST_LOCALE,] }] }
985
1079
  ]; };
986
1080
 
1081
+ /** Raccolta di tutti gli Input dell'EsTable a cui può essere logicamente sensato assegnare default per progetto */
1082
+ var EsTableDefaultable = /** @class */ (function () {
1083
+ function EsTableDefaultable() {
1084
+ }
1085
+ return EsTableDefaultable;
1086
+ }());
1087
+
987
1088
  /** Componente che permette di rappresentare una griglia di valori */
988
1089
  var EsTableComponent = /** @class */ (function () {
989
1090
  /** @ignore */
990
- function EsTableComponent(ngControl, prefService, lc, cdr, hashExts, utiExts, expExts) {
1091
+ function EsTableComponent(ngControl, prefService, deafults, locale, lc, cdr, hashExts, utiExts, expExts, dateExts, msgExts) {
1092
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
991
1093
  this.ngControl = ngControl;
992
1094
  this.prefService = prefService;
1095
+ this.deafults = deafults;
1096
+ this.locale = locale;
993
1097
  this.lc = lc;
994
1098
  this.cdr = cdr;
995
1099
  this.hashExts = hashExts;
996
1100
  this.utiExts = utiExts;
997
1101
  this.expExts = expExts;
1102
+ this.dateExts = dateExts;
1103
+ this.msgExts = msgExts;
998
1104
  /** View finale su cui bindarsi lato Frontend, il tipo può essere IAppSearch<any> (per la **viewMode**), any[] (per l'**arrayMode**) e ReportDefinition per la **reportMode** */
999
1105
  this.View = null;
1000
1106
  /** Indica se l'es-table deve mostrare il check globale nell'header per fare il "seleziona tutto" */
1001
1107
  this.globalCheck = false;
1002
- /**
1003
- * Tiene da conto l'ultimo elemento selezionato in modo da fare ragionamenti del tipo
1004
- * "Ho selezionato questo, l'ultimo selezionato era **lastSelected**, devo selezionare tutti quelli in mezzo", ad esempio per la selezione multipla
1005
- */
1108
+ /** Tiene da conto l'ultimo elemento selezionato in modo da poter effettuare il SHIFT+CLICK */
1006
1109
  this.lastSelected = null;
1007
1110
  /** Conteggio interno per il numero di elementi selezionati */
1008
1111
  this.selectedObjects = 0;
@@ -1041,6 +1144,10 @@
1041
1144
  this.RowTHs = null;
1042
1145
  /** Modello di appoggio temporaneo per i **RowTHs** */
1043
1146
  this.TMPRowTHs = null;
1147
+ /** Modello di appoggio temporaneo per i **RowThGroups** */
1148
+ this.TMPRowThGroups = null;
1149
+ /** Modello rappresentante un singolo header group della tabella. Questa lista è già ordinata e pronta per essere utilizzata in ngFor */
1150
+ this.RowThGroups = null;
1044
1151
  /** Cache per i routerLink generati nelle tabelle dinamiche */
1045
1152
  this.DynamicTableRouterLinkCache = {};
1046
1153
  /**
@@ -1087,7 +1194,11 @@
1087
1194
  * @deprecated Utilizzare l'Input **Template** delle es-td e assegnare un template con tutti i binding che si vuole ai click
1088
1195
  */
1089
1196
  this.CustomCellActionsOn = '';
1090
- /** Serve per decidere di lanciare o meno il **event.stopPropagation()** al termine della gestione dell'evento */
1197
+ /**
1198
+ * Serve per decidere di lanciare o meno il **event.stopPropagation()** al termine della gestione dell'evento
1199
+ *
1200
+ * @deprecated Utilizzare l'Input **Template** delle es-td e assegnare un template con tutti i binding che si vuole ai click
1201
+ */
1091
1202
  this.CellActionPropagates = true;
1092
1203
  /**
1093
1204
  * Decide se utilizzare o meno le CustomCells. Impostandolo a **true** l'es-table diventa in grado di gestire nativamente:
@@ -1103,14 +1214,14 @@
1103
1214
  this.UseCustomCells = null;
1104
1215
  /** Permette di impostare l'altezza massima della tabella. Se null la dimensione si adatta al numero di elementi attualmente in visualizzazione */
1105
1216
  this.MaxHeight = null;
1106
- /** Classi da applicare alla tabella oltre a quelle gestite autonomamente dalla libreria */
1107
- this.Class = '';
1217
+ /** Classi da applicare al contenitore della tabella */
1218
+ this.ContainerClass = null;
1108
1219
  /** Permette o meno l'export in formato XLSX */
1109
1220
  this.XLSXExport = null;
1110
1221
  /** Permette o meno l'export in formato CSV */
1111
1222
  this.CSVExport = true;
1112
1223
  /** Permette di visualizzare o meno l'opzione di paginazione "Tutti" */
1113
- this.AllSearch = true;
1224
+ this.AllSearch = null;
1114
1225
  /** Diminuisce gli spazi fra una cella e l'altra, e internamente il padding del font in modo da presentare molti più dati in un'unica pagina */
1115
1226
  this.HighCellDensity = null;
1116
1227
  /** Abilita o meno la possibilità di selezionare oggetti */
@@ -1129,8 +1240,6 @@
1129
1240
  this.Export = null;
1130
1241
  /** Indica se permettere la selezione multipla Windows-like cliccando un oggetto e facendo poi Shift + click su un oggetto successivo */
1131
1242
  this.ShiftClick = null;
1132
- /** Mostra o nasconde le informazioni di paginazione, sia i pulsanti, sia il selettore degli oggetti per pagina */
1133
- this.ShowPaging = true;
1134
1243
  /** Indica se nascondere o mostrare il componente di paginazione */
1135
1244
  this.HidePaging = null;
1136
1245
  /** Indica se nascondere o mostrare il conteggio degli elementi trovati */
@@ -1142,12 +1251,10 @@
1142
1251
  /** Nome dell'esportazione generata da questa tabella */
1143
1252
  this.ExportFileName = 'Export.csv';
1144
1253
  /** Classe (HTML) di default della tabella */
1145
- this.TableClass = 'table table-striped table-hover table-sm';
1146
- /** Testo da visualizzare nel conteggio. Di default: "Oggetti selezionati" */
1147
- this.CountLabel = this.lc.loc('Found objects');
1148
- /** Indica la presenza di raggruppamenti a livello di header */
1254
+ this.TableClass = null;
1255
+ /** @deprecated Indica la presenza di raggruppamenti a livello di header */
1149
1256
  this.HasHeaderGroup = null;
1150
- /** Indica la presenza di raggruppamenti a livello del raggruppamento precedentemente esistente, chiaramente è insensata senza **HasHeaderGroup** */
1257
+ /** @deprecated Indica la presenza di raggruppamenti a livello del raggruppamento precedentemente esistente, chiaramente è insensata senza **HasHeaderGroup** */
1151
1258
  this.HasSecondaryHeaderGroup = null;
1152
1259
  /** Utilizzato per dividere la sorgente in modalità EndlessScroll */
1153
1260
  this.SliceSize = 100;
@@ -1179,11 +1286,7 @@
1179
1286
  this.HiddenColumns = null;
1180
1287
  /** Permette di riordinare le colonne in base alle impostazioni effettuate dal Menù contestuale in alto a destra */
1181
1288
  this.ColumnsOrdering = null;
1182
- /**
1183
- * Eventuale supporto alle ricerche applicate alla modalità Array
1184
- *
1185
- * @deprecated Utilizzato solo per un caso particolare del Metering
1186
- */
1289
+ /** Eventuale supporto alle ricerche applicate alla modalità Array */
1187
1290
  this.SearchView = null;
1188
1291
  /** Abilita o disabilita il sistema che permette di selezionare tutti gli elementi nella vista */
1189
1292
  this.SelectAll = null;
@@ -1203,6 +1306,10 @@
1203
1306
  this.StartsExpanded = true;
1204
1307
  /** Indica se effettuare il salvataggio delle preferenze di ricerca */
1205
1308
  this.SavePreferences = null;
1309
+ /** Indica dove visualizzare le informazioni di paginazione, se sopra, sotto o in entrambi */
1310
+ this.PagingStyle = null;
1311
+ /** Indica dove visualizzare le informazioni di paginazione, se sopra, sotto o in entrambi */
1312
+ this.RowGroupingPagingStyle = null;
1206
1313
  /**
1207
1314
  * Sorgente dati secondaria
1208
1315
  *
@@ -1216,12 +1323,19 @@
1216
1323
  */
1217
1324
  this.TertiarySource = null;
1218
1325
  /** Indica se utilizzare la cache di selezione che permette di mantenere gli stati di selezione dei vari oggetti navigando da una pagina all'altra */
1219
- this.UseSelectionCache = true;
1326
+ this.UseSelectionCache = null;
1327
+ /** Permette di decidere se, in modalità raggruppamento, mostrare o meno il valore delle colonne di gruppo negli oggetti finali. Di default sono nascosti */
1328
+ this.ShowItemGroupsColumns = null;
1220
1329
  /** Evento che viene richiamato al cambio di oridnamento di una colonna */
1221
1330
  this.onOrderChanged = new core.EventEmitter();
1222
1331
  /**
1223
1332
  * Evento che viene richiamato quando l'es-table ritiene sia necessario ri-effettuare la ricerca.
1224
- * Il booleano dell'evento indica se viene suggerito di resettare la pagina o meno
1333
+ * Il booleano dell'evento indica se viene suggerito di resettare la pagina o meno.
1334
+ *
1335
+ * Solo in caso venga utilizzata la modalità a raggruppamenti di righe può succedere che l'es-table passi un intero AppSearch come parametro di ricerca,
1336
+ * in quel caso l'applicazione ricevente dovrà onorare la richiesta spedendo al backand l'oggetto di ricerca AS-IS
1337
+ *
1338
+ * il tipo dell'Emitter invece di essere [boolean | AppSearch<any>] è stato impostato a "any" per evitare problemi di retrocompatibilità
1225
1339
  */
1226
1340
  this.onSearchRequest = new core.EventEmitter();
1227
1341
  /** Evento che parte ad ogni modifica di "checkaggio" in forma di comodo array. Espone l'oggetto con lo stato di check attuale */
@@ -1244,19 +1358,91 @@
1244
1358
  /** Numero di pagine (durante la paginazione in modalità Array) */
1245
1359
  this.arraymodePages = 1;
1246
1360
  /** Oggetti per ogni pagina (durante la paginazione in modalità Array) */
1247
- this.ArraymodeItemsPerPage = 15;
1361
+ this.ArraymodeItemsPerPage = null;
1362
+ /** Colonne da visualizzare in modalità array */
1363
+ this.arrayColumns = [];
1364
+ /** Ordine delle colonne da visualizzare in modalità array */
1365
+ this.arrayColumnOrdering = [];
1366
+ /** Ordinamenti ASC-DESC sulle colonne in modalità array */
1367
+ this.arrayOrders = [];
1248
1368
  /**
1249
1369
  * Variabile che serve a gestire il momento in cui l'es-table aggiorna la paginazione (pulsanti ecc).
1250
1370
  * Essendo operazioni comunque costose le effettuo solo su binding esterni, non su rewrite generati internamente
1251
1371
  */
1252
1372
  this.internalWriteCall = false;
1253
- /** Cache di selezione Hash - Oggetto */
1254
- this.selOrDeselCache = {};
1373
+ /**
1374
+ * Cache che conterrà tutte le ricerche effettuate su gruppi diversi dal primo e su elementi contenuti nei gruppi.
1375
+ * In caso di cambi di ordinamento delle colonne diverse dalla prima tutte le chiamate fatte dal secondo livello in poi devono essere rieseguite secondo la seguente logica:
1376
+ *
1377
+ *
1378
+ * **Cambio ordinamento sul primo gruppo**: reload completo, non mi occupo di ripulire gli elementi bindati in alcun modo
1379
+ *
1380
+ * **Cambio ordinamento sulla colonna relativa all'N-esimo gruppo**: reload completo del contenuto dei gruppi precedenti, ripulendo precedentemente
1381
+ * tutti gli elementi con **_grouplevel** = N
1382
+ *
1383
+ * **Cambio ordinamento su una colonna non raggruppata**: reload completo per tutti i gruppi finali aperti, devo precedentemente ripulire tutti gli elementi con **_item** = true
1384
+ *
1385
+ * Altri eventi non dovrebbero rappresentare problemi:
1386
+ * - Selezione: non cambia nulla
1387
+ * - Paginazione: cambia a livello root quindi viene ricaricato tutto comunque, stesso vale per le paginazioni interne
1388
+ */
1389
+ this.groupSearchRequestsCache = [];
1390
+ /** Variabile d'appoggio per capire se c'è bisogno di ri-effettuare una ricerca o meno */
1391
+ this.ResearchNeeded = false;
1392
+ /** Colonne visibili della vista attuale. Valorizzato di default al numero massimo di colonne supportate dalla tabella per le casistiche in assenza di custom cells */
1393
+ this.Columns = { Visibile: 100, VisibleUnpinned: 100, Global: 100 };
1394
+ /** In caso di Row Grouping qui viene salvata la vista principale dei gruppi base */
1395
+ this.MainGroupView = null;
1396
+ /** Conteggio base degli oggetti. In modalità normale viene resettato ad ogni nuova View inserita, in modalità RowGrouping viene resettato solo ad una nuova View di livello "0" */
1397
+ this.BaseItemsCount = null;
1398
+ /** Cache per salvare per ogni chiave di ogni gruppo chi è il gruppo rappresentato */
1399
+ this.rgGroupCache = new Map();
1400
+ /** Cache per salvare per ogni chiave di ogni gruppo chi sono gli oggetti sottostanti, non dei sottogruppi */
1401
+ this.rgItemCache = new Map();
1402
+ /** Cache per salvare per ogni chiave di ogni gruppo chi sono gli oggetti sottostanti, non dei sottogruppi */
1403
+ this.rgChildGroupsCache = new Map();
1404
+ /** Cache di selezione Hash - Oggetto per la variabile **items** dell'itemSelector. Facilita le operazioni di lookup via hash*/
1405
+ this.itemsCache = new Map();
1406
+ /** Cache di selezione Hash - Oggetto per la variabile **groups** dell'itemSelector. Facilita le operazioni di lookup via hash */
1407
+ this.groupsCache = new Map();
1408
+ /** Cache di selezione Hash - Oggetto per la variabile **exclusions** dell'itemSelector. Facilita le operazioni di lookup via hash */
1409
+ this.exclusionsCache = new Map();
1410
+ /** Cache di selezione Hash - Oggetto per la variabile **group_exclusions** dell'itemSelector. Facilita le operazioni di lookup via hash */
1411
+ this.group_exclusionsCache = new Map();
1412
+ /** Cache di selezione Hash - Oggetto per la variabile **items** dell'itemSelector. Facilita le operazioni di lookup via indice*/
1413
+ this.i_itemsCache = new Map();
1414
+ /** Cache di selezione Hash - Oggetto per la variabile **groups** dell'itemSelector. Facilita le operazioni di lookup via indice */
1415
+ this.i_groupsCache = new Map();
1416
+ /** Cache di selezione Hash - Oggetto per la variabile **exclusions** dell'itemSelector. Facilita le operazioni di lookup via indice */
1417
+ this.i_exclusionsCache = new Map();
1418
+ /** Cache di selezione Hash - Oggetto per la variabile **group_exclusions** dell'itemSelector. Facilita le operazioni di lookup via indice */
1419
+ this.i_group_exclusionsCache = new Map();
1420
+ /** Indica se nonostante siamo in modalità array sono stati individuati dei gruppi. In tal caso es-table si comporta da pseudo backend ed effettua le aggregazioni e raggruppamenti completamente lato client */
1421
+ this.ArrayGrouping = false;
1422
+ this.PagerOptions = { PagerCount: null, ShowCount: true, ShowPaging: true, UsesView: true, View: null, Ready: false, Searches: 'items' };
1255
1423
  /** @ignore */
1256
1424
  this.propagateChange = function (_) { };
1257
1425
  if (ngControl)
1258
1426
  ngControl.valueAccessor = this;
1427
+ // Assegnazione per tutti gli Input di default
1428
+ this.ColumnsResizable = this.InputOrDefault(this.ColumnsResizable, (_a = this.deafults) === null || _a === void 0 ? void 0 : _a.ColumnsResizable);
1429
+ this.AutoUpdate = this.InputOrDefault(this.AutoUpdate, (_b = this.deafults) === null || _b === void 0 ? void 0 : _b.AutoUpdate);
1430
+ this.AllSearch = this.InputOrDefault(this.AllSearch, (_c = this.deafults) === null || _c === void 0 ? void 0 : _c.AllSearch, true);
1431
+ this.Export = this.InputOrDefault(this.Export, (_d = this.deafults) === null || _d === void 0 ? void 0 : _d.Export);
1432
+ this.HidePaging = this.InputOrDefault(this.HidePaging, (_e = this.deafults) === null || _e === void 0 ? void 0 : _e.HidePaging, false);
1433
+ this.HidePagingCount = this.InputOrDefault(this.HidePagingCount, (_f = this.deafults) === null || _f === void 0 ? void 0 : _f.HidePagingCount);
1434
+ this.HidePagingButtons = this.InputOrDefault(this.HidePagingButtons, (_g = this.deafults) === null || _g === void 0 ? void 0 : _g.HidePagingButtons);
1435
+ this.ContainerClass = this.InputOrDefault(this.ContainerClass, (_h = this.deafults) === null || _h === void 0 ? void 0 : _h.ContainerClass, '');
1436
+ this.TableClass = this.InputOrDefault(this.TableClass, (_j = this.deafults) === null || _j === void 0 ? void 0 : _j.TableClass, 'table table-striped table-hover table-sm');
1437
+ this.Selection = this.InputOrDefault(this.Selection, (_k = this.deafults) === null || _k === void 0 ? void 0 : _k.Selection);
1438
+ this.SavePreferences = this.InputOrDefault(this.SavePreferences, (_l = this.deafults) === null || _l === void 0 ? void 0 : _l.SavePreferences);
1439
+ this.PagingStyle = this.InputOrDefault(this.PagingStyle, (_m = this.deafults) === null || _m === void 0 ? void 0 : _m.PagingStyle, 'bottom');
1440
+ this.RowGroupingPagingStyle = this.InputOrDefault(this.RowGroupingPagingStyle, (_o = this.deafults) === null || _o === void 0 ? void 0 : _o.RowGroupingPagingStyle, 'left');
1441
+ this.UseSelectionCache = this.InputOrDefault(this.UseSelectionCache, (_p = this.deafults) === null || _p === void 0 ? void 0 : _p.UseSelectionCache, true);
1442
+ this.ShowItemGroupsColumns = this.InputOrDefault(this.ShowItemGroupsColumns, (_q = this.deafults) === null || _q === void 0 ? void 0 : _q.ShowItemGroupsColumns, false);
1443
+ this.ArraymodeItemsPerPage = this.InputOrDefault(this.ArraymodeItemsPerPage, (_r = this.deafults) === null || _r === void 0 ? void 0 : _r.ArraymodeItemsPerPage, 15);
1259
1444
  }
1445
+ // #region Ciclo di vita ES-Table - Inizializzazioni
1260
1446
  /** @ignore */
1261
1447
  EsTableComponent.prototype.ngOnInit = function () {
1262
1448
  var _this = this;
@@ -1266,6 +1452,9 @@
1266
1452
  throw "Es-table error: Per poter utilizzare l'es-table con [Hierarchy]=\"true\" è richiesto anche [UseCustomCells]=\"true\"";
1267
1453
  // click destro su una riga con selezione attiva: Tiro fuori il context menu e selezione l'elemento corrente
1268
1454
  this.ctxMenuSubscription = (this.ContextMenu || this.tableEmptyMenu).open.subscribe(function (t) {
1455
+ // Gruppi va bene, oggetti pure, ma separatori fra gruppi proprio no...
1456
+ if (t.item._sep)
1457
+ return;
1269
1458
  var shouldEmit = !t.item._selected;
1270
1459
  t.item._selected = true;
1271
1460
  var itemSelection = _this.handleItemsSelection([t.item]);
@@ -1293,6 +1482,26 @@
1293
1482
  this.ShiftClick = true;
1294
1483
  }
1295
1484
  };
1485
+ /**
1486
+ * Se l'Input è null (valore non settato) vede se c'è un default con cui valorizzarlo. Se non c'è utilizza il valore di fallback (qualora fornito)
1487
+ *
1488
+ * @param {T} inputValue Valore dell'Input
1489
+ * @param {T} defaultValue Valore di default impostato da configurazione
1490
+ * @param {T} fallbackValue Valore dell'Input per quando non è stato assegnato dal programmatore e non ha un default
1491
+ */
1492
+ EsTableComponent.prototype.InputOrDefault = function (inputValue, defaultValue, fallbackValue) {
1493
+ // Input valorizzato dal programmatore
1494
+ if (inputValue != null && inputValue != undefined)
1495
+ return inputValue;
1496
+ // Input valorizzato da configurazione globale
1497
+ if (defaultValue != null && defaultValue != undefined)
1498
+ return defaultValue;
1499
+ //Input non valorizzato da niente e da nessuno
1500
+ if (fallbackValue != null && fallbackValue != undefined)
1501
+ return fallbackValue;
1502
+ // I casi in cui si arriva qui sono i casi di Input che di default va bene che siano nulli e che nessuno si caga
1503
+ return null;
1504
+ };
1296
1505
  /** @ignore */
1297
1506
  EsTableComponent.prototype.ngOnDestroy = function () {
1298
1507
  if (this.ctxMenuSubscription)
@@ -1302,7 +1511,7 @@
1302
1511
  EsTableComponent.prototype.ngOnChanges = function (changes) {
1303
1512
  return __awaiter(this, void 0, void 0, function () {
1304
1513
  var newSearchView;
1305
- return __generator(this, function (_c) {
1514
+ return __generator(this, function (_s) {
1306
1515
  newSearchView = changes['SearchView'];
1307
1516
  if (newSearchView && this.SearchView)
1308
1517
  this.arrayPulsanti = this.getPagesArray(6, this.SearchView.page, this.SearchView.pages || 1);
@@ -1310,6 +1519,7 @@
1310
1519
  });
1311
1520
  });
1312
1521
  };
1522
+ // #endregion
1313
1523
  // #region Implementazione ControlValueAccessor ignorabile
1314
1524
  /** @ignore */
1315
1525
  EsTableComponent.prototype.registerOnChange = function (fn) { this.propagateChange = fn; };
@@ -1320,6 +1530,7 @@
1320
1530
  // #endregion
1321
1531
  /** @ignore */
1322
1532
  EsTableComponent.prototype.writeValue = function (obj) {
1533
+ var _a;
1323
1534
  this.View = obj ? obj : null;
1324
1535
  // Mi è arrivata l'AppSearch quindi di sicuro non ho una ricerca in progress
1325
1536
  this.researchInProgress = false;
@@ -1352,10 +1563,11 @@
1352
1563
  else if (this.View && this.View instanceof AppSearch) {
1353
1564
  // Se cambia l'oggetto intero significa che ho rimandato la ricerca
1354
1565
  this.setMode('view');
1566
+ var firstItemGroupOrNoGrouping = (((_a = this.View.requestedgroups) === null || _a === void 0 ? void 0 : _a.length) || 0) == 0;
1355
1567
  // Se vengo da una ricerca interna mantengo lo stato di selezione precedente (quindi su cambio pagina, cambio ipp, ecc...)
1356
1568
  // se invece l'utente ha fatto una ricerca lui (quindi cambiando filtri), secco le info di selezione
1357
- if (!this.View.selection || !this.View.internalsearchrequest || !this.UseSelectionCache) {
1358
- this.selOrDeselCache = {};
1569
+ if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache) {
1570
+ this.clearSelectionCaches();
1359
1571
  this.View.selection = new ItemsSelection([]);
1360
1572
  this.onSelectionChanged.emit(this.View.selection);
1361
1573
  }
@@ -1374,55 +1586,136 @@
1374
1586
  }
1375
1587
  }
1376
1588
  }
1377
- this.arrayPulsanti = this.getPagesArray(6, this.View.page, this.View.pages || 1);
1589
+ // La paginazione devo farla solamente quando richiedo o un gruppo principale (se sono in row grouping) o se non richiedo gruppi (in tutti lgi altri casi)
1590
+ if (firstItemGroupOrNoGrouping)
1591
+ this.arrayPulsanti = this.getPagesArray(6, this.View.page, this.View.pages || 1);
1378
1592
  }
1379
1593
  else if (this.View && (this.View.length != null && this.View.length != undefined)) {
1380
1594
  this.setMode('array');
1381
1595
  if (!this.UseSelectionCache || !this.arraymodeSelection) {
1382
- this.selOrDeselCache = {};
1596
+ this.clearSelectionCaches();
1383
1597
  this.arraymodeSelection = new ItemsSelection([]);
1384
1598
  ;
1385
1599
  this.onSelectionChanged.emit(this.arraymodeSelection);
1386
1600
  }
1601
+ // Recupero Preference
1602
+ if (this.SavePreferences) {
1603
+ if (!this.ngControl.name)
1604
+ console.error("Non posso utilizzare le preference senza avere un 'name' per questa tabella");
1605
+ else if (!this.prefService)
1606
+ console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
1607
+ else {
1608
+ var prefs = this.prefService.retrieve(this.ngControl.name);
1609
+ if (prefs) {
1610
+ this.arrayColumns = prefs.columns;
1611
+ this.arrayColumnOrdering = prefs.column_ordering;
1612
+ }
1613
+ }
1614
+ }
1387
1615
  if (this.SearchView)
1388
1616
  this.arrayPulsanti = this.getPagesArray(6, this.SearchView.page, this.SearchView.pages || 1);
1389
1617
  }
1390
- if (this.View && !(this.View instanceof ReportDefinition)) {
1391
- /*
1392
- *Uso la tecnica di EndlessScroll se la variabile relativa è attiva e se
1393
- * 1) Ho un Array, oppure
1394
- * 2) Ho un AppSearch che sta cercando con paginazione "Tutto", oppure
1395
- * 3) Ho un AppSearch che sta cercando con paginazione diversa da "Tutto" ma con la variabile EndlessScrollOnlyForAll a false
1396
- */
1397
- var viewCasted = this.View;
1398
- var isAppSearchWithIppMax = this.viewMode && viewCasted.itemsperpageoverride == this.defaultAllPageOverride;
1399
- var isAppSearchNoMaxIpp = this.viewMode && viewCasted.itemsperpageoverride != this.defaultAllPageOverride;
1400
- this.UseEndlessscroll = this.EndlessScroll && (this.arrayMode || isAppSearchWithIppMax || (isAppSearchNoMaxIpp && !this.EndlessScrollOnlyForAll));
1401
- if (this.UseEndlessscroll) {
1402
- this.addedSlices = [];
1403
- this.boundSubSources = this.getItemSlices();
1404
- this.TMPBoundSource = this.boundSubSources[0] ? this.boundSubSources[0] : [];
1405
- if (this.boundSubSources[0])
1406
- this.addedSlices.push(0);
1618
+ if (this.View && !(this.View instanceof ReportDefinition))
1619
+ this.finalizeContext();
1620
+ this.postBoundSourceCalculation();
1621
+ };
1622
+ /**
1623
+ * Successivamente al bind del nuovo input questa funzione si occupa di finalizzare tutti i parametri di funzionamento dell'es-table
1624
+ * in base a Input - Modello, e qualsiasi altra cosa possa servire
1625
+ */
1626
+ EsTableComponent.prototype.finalizeContext = function () {
1627
+ var viewCasted = this.View;
1628
+ /*
1629
+ *Uso la tecnica di EndlessScroll se la variabile relativa è attiva e se
1630
+ * 1) Ho un Array, oppure
1631
+ * 2) Ho un AppSearch che sta cercando con paginazione "Tutto", oppure
1632
+ * 3) Ho un AppSearch che sta cercando con paginazione diversa da "Tutto" ma con la variabile EndlessScrollOnlyForAll a false
1633
+ */
1634
+ var isAppSearchWithIppMax = this.viewMode && viewCasted.itemsperpageoverride == this.defaultAllPageOverride;
1635
+ var isAppSearchNoMaxIpp = this.viewMode && viewCasted.itemsperpageoverride != this.defaultAllPageOverride;
1636
+ this.UseEndlessscroll = this.EndlessScroll && (this.arrayMode || isAppSearchWithIppMax || (isAppSearchNoMaxIpp && !this.EndlessScrollOnlyForAll));
1637
+ var hasRowGroups = (viewCasted.groupings && viewCasted.groupings.filter(function (t) { return !t.aggregation; }).length > 0) || (this.arrayMode && this.EsThsDirective.some(function (t) { return t.thGroup; }));
1638
+ // Se ho dei gruppi in modalità array devo sistemare un po' di variabili che diventano insensate
1639
+ if (this.arrayMode) {
1640
+ if (hasRowGroups)
1641
+ this.UseArrayModePaging = false;
1642
+ }
1643
+ // Riempimento della TMPBoundSource con gli oggetti che verranno poi mostrati ad interfaccia
1644
+ if (this.UseEndlessscroll && !hasRowGroups) {
1645
+ this.addedSlices = [];
1646
+ this.boundSubSources = this.getItemSlices();
1647
+ var firstSub = this.boundSubSources[0];
1648
+ this.TMPBoundSource = firstSub ? firstSub : [];
1649
+ if (firstSub)
1650
+ this.addedSlices.push(0);
1651
+ }
1652
+ else
1653
+ this.TMPBoundSource = this.getItemsByMode(false, !this.internalWriteCall);
1654
+ // Se ho una gerarchia, assegno i livelli gerarchici alla TMPBoundSource
1655
+ if (this.Hierarchy && !hasRowGroups)
1656
+ this.assignHierarchyLevels(this.TMPBoundSource);
1657
+ // L'hashing degli oggetti lo faccio a prescindere
1658
+ this.calculateHash(this.TMPBoundSource);
1659
+ // Assegno a una variabile mia l'eventuale override per la classe della riga
1660
+ // Se poi sono in modalità gerarchica inietto anche la classe per la configurazione del livello della riga
1661
+ if ((this.TMPBoundSource && this.RowClassAssigner) || this.Hierarchy) {
1662
+ for (var i = 0; i < this.TMPBoundSource.length; i++) {
1663
+ var item = this.TMPBoundSource[i];
1664
+ item._rowClass = this.RowClassAssigner ? this.RowClassAssigner(item) : "";
1665
+ item._rowClass += this.Hierarchy ? " est-row-lvl-" + item._level : "";
1407
1666
  }
1408
- else
1409
- this.TMPBoundSource = this.getItemsByMode(false, !this.internalWriteCall);
1410
- if (this.Hierarchy)
1411
- this.assignHierarchyLevels(this.TMPBoundSource);
1412
- this.calculateHash(this.TMPBoundSource);
1413
- // Assegno a una variabile mia l'eventuale override per la classe della riga
1414
- // Se poi sono in modalità gerarchica inietto anche la classe per la configurazione del livello della riga
1415
- if ((this.TMPBoundSource && this.RowClassAssigner) || this.Hierarchy) {
1416
- for (var i = 0; i < this.TMPBoundSource.length; i++) {
1417
- var item = this.TMPBoundSource[i];
1418
- item._rowClass = this.RowClassAssigner ? this.RowClassAssigner(item) : "";
1419
- item._rowClass += this.Hierarchy ? " est-row-lvl-" + item.level : "";
1420
- }
1667
+ }
1668
+ };
1669
+ /** Genera le informzioni di paginazione per la vista globale dell'es-table */
1670
+ EsTableComponent.prototype.setupPagingInformations = function () {
1671
+ this.PagerOptions.ShowCount = !this.HidePagingCount;
1672
+ if (this.arrayMode && this.UseArrayModePaging && !this.SearchView) {
1673
+ this.PagerOptions.PagerCount = this.View.length || 0;
1674
+ this.PagerOptions.ShowPaging = !this.HidePaging && this.View.length > 10;
1675
+ this.PagerOptions.View = this.View;
1676
+ this.PagerOptions.UsesView = false;
1677
+ }
1678
+ else if (this.arrayMode && (!this.UseArrayModePaging || this.SearchView)) {
1679
+ if (this.SearchView) {
1680
+ this.PagerOptions.View = this.SearchView;
1681
+ this.PagerOptions.PagerCount = this.SearchView.objectcount || 0;
1421
1682
  }
1683
+ else
1684
+ this.PagerOptions.PagerCount = this.View.length || 0;
1685
+ this.PagerOptions.ShowCount = this.PagerOptions.ShowCount || (this.View && this.View.length) || (this.SearchView && this.SearchView.objectcount && this.SearchView.objectcount != -1);
1422
1686
  }
1423
- this.postBoundSourceCalculation();
1687
+ else if (this.viewMode) {
1688
+ var tmpView = this.MainGroupView || this.View;
1689
+ var count = (tmpView === null || tmpView === void 0 ? void 0 : tmpView.groupcount) || (tmpView === null || tmpView === void 0 ? void 0 : tmpView.objectcount);
1690
+ this.PagerOptions.Searches = (tmpView === null || tmpView === void 0 ? void 0 : tmpView.groupcount) != null && (tmpView === null || tmpView === void 0 ? void 0 : tmpView.groupcount) != undefined ? 'groups' : 'items';
1691
+ this.PagerOptions.PagerCount = count || 0;
1692
+ this.PagerOptions.View = tmpView;
1693
+ this.PagerOptions.ShowCount = this.PagerOptions.ShowCount || (tmpView && count && count != -1);
1694
+ this.PagerOptions.ShowPaging = !this.HidePaging;
1695
+ }
1696
+ else if (this.reportMode) {
1697
+ var rvc = this.ReportValues.count;
1698
+ this.PagerOptions.View = this.View;
1699
+ this.PagerOptions.PagerCount = rvc && rvc == -1 ? this.ReportValues.rows.length : rvc && rvc > 0 ? this.ReportValues.count : 0;
1700
+ this.PagerOptions.ShowCount = this.PagerOptions.ShowCount || (this.View && this.View.objectcount && this.View.objectcount != -1);
1701
+ this.PagerOptions.ShowPaging = !this.HidePaging && this.View.pagingavailable;
1702
+ }
1703
+ };
1704
+ /**
1705
+ * Ripulisce le cache di selezione
1706
+ *
1707
+ * @todo: SELECTION
1708
+ */
1709
+ EsTableComponent.prototype.clearSelectionCaches = function () {
1710
+ this.itemsCache.clear();
1711
+ this.groupsCache.clear();
1712
+ this.exclusionsCache.clear();
1713
+ this.group_exclusionsCache.clear();
1714
+ this.i_itemsCache.clear();
1715
+ this.i_groupsCache.clear();
1716
+ this.i_exclusionsCache.clear();
1717
+ this.i_group_exclusionsCache.clear();
1424
1718
  };
1425
- // #region Gestione retrieve degli oggetti da mostrare in tabella, considerando eventuali Endless Scrolls
1426
1719
  /**
1427
1720
  * In base alla modalità specificata (ArrayMode, ViewMode, ecc...) questo metodo recupera l'array di oggetti da bindare ad interfaccia
1428
1721
  *
@@ -1431,6 +1724,8 @@
1431
1724
  * @param {boolean} allIfPossible [false] Indica se prendere tutti gli oggetti quaora possibile, usato solo in ArrayMode
1432
1725
  *
1433
1726
  * @returns {any[]} Lista degli oggetti su cui effettuare il bind lato interfaccia
1727
+ *
1728
+ * @todo: ITEMS
1434
1729
  */
1435
1730
  EsTableComponent.prototype.getItemsByMode = function (onlyselected, refreshPaging, allIfPossible) {
1436
1731
  if (onlyselected === void 0) { onlyselected = false; }
@@ -1441,6 +1736,8 @@
1441
1736
  items = this.getViewItemsBySource();
1442
1737
  }
1443
1738
  else if (this.arrayMode) {
1739
+ this.View.forEach(function (itm) { itm._item = true; });
1740
+ // Se faccio dei raggruppamenti ignoro la paginazione
1444
1741
  if (this.UseArrayModePaging && !allIfPossible) {
1445
1742
  // Se sono in modalità array ma la ricerca dipende da una view devo riallineare gli itemperpage
1446
1743
  if (this.SearchView)
@@ -1459,16 +1756,62 @@
1459
1756
  return items.filter(function (t) { return t._selected; });
1460
1757
  return items;
1461
1758
  };
1462
- /** @ignore */
1463
- EsTableComponent.prototype.getViewItemsBySource = function () {
1464
- return this.SecondarySource ? this.View.items2 : this.TertiarySource ? this.View.items3 : this.View.items;
1465
- };
1466
1759
  /**
1467
- * Metodo che prende tutti gli oggetti di cui dispone divisi in bucket da 100 elementi
1760
+ * @ignore
1468
1761
  *
1469
- * @returns {any[][]} Matrice di array Nx100
1762
+ * @todo: ITEMS
1470
1763
  */
1471
- EsTableComponent.prototype.getItemSlices = function () {
1764
+ EsTableComponent.prototype.getViewItemsBySource = function () {
1765
+ var _this = this;
1766
+ var _a, _b;
1767
+ var castedView = this.View;
1768
+ var groupKeys = castedView.groupings ? castedView.groupings.filter(function (t) { return !t.aggregation; }).length : 0;
1769
+ //Gruppi intermedi
1770
+ if ((((_a = castedView.requestedgroups) === null || _a === void 0 ? void 0 : _a.length) != groupKeys || ((_b = castedView.requestedgroups) === null || _b === void 0 ? void 0 : _b.length) == 0) && groupKeys > 0) {
1771
+ var ret = castedView.groups;
1772
+ ret.forEach(function (itm) {
1773
+ // Setto variabile interna per capire che questo è in realtà un gruppo
1774
+ itm._group = true;
1775
+ // Le informazioni passate come lista le metto dentro a una cache per velocizzarne l'accesso quando devo tirare fuori il display della proprietà
1776
+ _this.cacheAggregations(itm);
1777
+ });
1778
+ return ret;
1779
+ }
1780
+ else {
1781
+ var ret = this.SecondarySource ? this.View.items2 : this.TertiarySource ? this.View.items3 : this.View.items;
1782
+ // Setto variabile interna per specificare che questo è un elemento normale, non un gruppo o altro
1783
+ ret.forEach(function (itm) { itm._item = true; });
1784
+ return ret;
1785
+ }
1786
+ };
1787
+ /**
1788
+ * Helper per effettuare il caching delle aggregazioni. Le sposta da una lista di **GroupAggregation** a una **<Map<string, Map<string, string>>**
1789
+ *
1790
+ * @todo: ROWGROUPING
1791
+ */
1792
+ EsTableComponent.prototype.cacheAggregations = function (group) {
1793
+ group._aggregationsCache = new Map();
1794
+ var castedAgCache = group._aggregationsCache;
1795
+ for (var i = 0; i < group.aggregations.length; i++) {
1796
+ var agg = group.aggregations[i];
1797
+ if (castedAgCache.has(agg.column))
1798
+ castedAgCache.get(agg.column).set(agg.aggregation, agg.value);
1799
+ else {
1800
+ var tmp = new Map();
1801
+ tmp.set(agg.aggregation, agg.value);
1802
+ castedAgCache.set(agg.column, tmp);
1803
+ }
1804
+ }
1805
+ };
1806
+ /**
1807
+ * Metodo che prende tutti gli oggetti di cui dispone divisi in bucket da 100 elementi
1808
+ *
1809
+ * @returns {any[][]} Matrice di array Nx100
1810
+ *
1811
+ * @todo: ITEMS
1812
+ */
1813
+ EsTableComponent.prototype.getItemSlices = function () {
1814
+ // Se sono qui di sicuro non ho rowgrouping
1472
1815
  var items = this.getItemsByMode();
1473
1816
  if (!items)
1474
1817
  return [];
@@ -1503,8 +1846,6 @@
1503
1846
  }
1504
1847
  }
1505
1848
  };
1506
- // #endregion
1507
- // #region Gestione di tutto il ciclo di vita post binding oggetti
1508
1849
  /**
1509
1850
  * Metodo lanciato dopo che la sorgente dati è stata correttamente bindata, si occupa di ricalcolare tutto ciò che serve
1510
1851
  * all'es-table per renderizzare i valori da mostrare
@@ -1515,113 +1856,476 @@
1515
1856
  this.RowContexts = [];
1516
1857
  this.OrderDirectives = [];
1517
1858
  this.lastSelectedItemID = null;
1518
- // Set timeout e basta funzionerebbe per la modalità JIT, ma per AOT servono sia quello che detectChanges
1519
- this.cdr.detectChanges();
1520
- setTimeout(function () {
1521
- // Se non ho colonne dinamiche ma sono in modalità dinamica (lo capisco perché c'è una view piena di genericitem) metto il default delle colonne
1522
- _this.eventuallyReviewDynamicColumns();
1523
- // Molte cose sono ovviamente disponibili solo in modalità View
1524
- if (_this.viewMode && _this.UseCustomCells) {
1525
- var view = _this.View;
1526
- var ths = _this.EsThs && _this.EsThs.length > 0 ? _this.EsThs.toArray() : _this.EsThsDirective && _this.EsThsDirective.length > 0 ? _this.EsThsDirective.toArray() : [];
1527
- var tds = _this.EsTds && _this.EsTds.length > 0 ? _this.EsTds.toArray() : _this.EsTdsDirective && _this.EsTdsDirective.length > 0 ? _this.EsTdsDirective.toArray() : [];
1528
- // N.B: Rispettare l'ordine di queste 3 macrocategorie è VITALE
1529
- // ************************************* Sistemazioni di TH, TD, e visibilità varie *************************************
1530
- _this.alignColumnsIfLoadedView(view); // Se sto caricando una View da hotpotato (quindi con savedstate = true) riallineo la visibilità delle colonne e il loro ordine.
1531
- _this.refreshColumnsVisibility(ths, tds, view); // Lavoro sui TH ed eventualmente modifico la visibilità anche dei TD.
1532
- _this.alignHeadersOrdering(ths, view); // Allineo gli ordinamenti agli header
1533
- _this.reviewColumnsList(ths); // Aggiorna la lista delle colonne da mostrare nella dialog per ordinamento ecc
1534
- // ************************************* Generazione binding per righe e colonne *************************************
1535
- _this.evaluateRowThs(ths); // Raccolgo i TH
1536
- _this.evaluateRowTds(ths, tds); // Raccolgo i TD in contesti separati, un contesto per ogni item
1537
- // ************************************* Ultimi aggiustmaenti dei binding *************************************
1538
- _this.generateDefaultOrder(view); // Genero le direttive di ordinamento, che siano default o derivanti dalla AppSearch
1539
- _this.applyOrdering(view, true); // Applico l'ordinamento sulle colonne (non ASC DESC, ma "prima questa o quella colonna")
1540
- _this.MoveTemporaryVariablesToRealOnes(); // Collego TH e TD aggiustati fino ad ora alle variabili di Binding HTML
1541
- _this.evaluateSelection(view.items, view.selection); // Riallineo le info di selezione degli elementi della View
1542
- }
1543
- else if (_this.viewMode && !_this.UseCustomCells) {
1544
- // Riallineo le info di selezione degli elementi della View
1545
- var view = _this.View;
1546
- _this.evaluateSelection(view.items, view.selection);
1547
- }
1548
- else if (_this.arrayMode) {
1549
- // Riallineo le info di selezione degli elementi dell'array
1550
- _this.arrayModeEvaluateSelection(_this.View);
1551
- }
1552
- // Collego gli oggetti da mostrare
1553
- _this.boundSource = _this.TMPBoundSource;
1554
- // Per essere sicuro che dopo un bind di oggetti la es-table aggiorni la grafica
1555
- _this.cdr.markForCheck();
1556
- _this.FirstBind = false;
1557
- });
1859
+ if (this.EsThsDirective && this.EsThsDirective.length > 0 && this.EsTdsDirective && this.EsTdsDirective.length > 0)
1860
+ this.internalPostBoundSource();
1861
+ else {
1862
+ this.cdr.detectChanges();
1863
+ setTimeout(function () { _this.internalPostBoundSource(); });
1864
+ }
1558
1865
  };
1559
1866
  /**
1560
- * Metodo richiamato solo quando **TMPRowTDs** e **TMPRowTHs** sono completamente generati ed aggiustati. Serve per collegarli alle variabili usate lato binding HTML
1867
+ * Per poter distinguere le chiamate a questo metodo: Dopo il setTimeout se uso gli EsTd/EsTh vecchi, senza il setTimeout se uso le nuove direttive
1561
1868
  */
1562
- EsTableComponent.prototype.MoveTemporaryVariablesToRealOnes = function () {
1563
- this.RowTDs = this.TMPRowTDs;
1564
- this.RowTHs = this.TMPRowTHs;
1869
+ EsTableComponent.prototype.internalPostBoundSource = function () {
1870
+ var View = this.View;
1871
+ var ths = this.EsThs && this.EsThs.length > 0 ? this.EsThs.toArray() : this.EsThsDirective && this.EsThsDirective.length > 0 ? this.EsThsDirective.toArray() : [];
1872
+ var tds = this.EsTds && this.EsTds.length > 0 ? this.EsTds.toArray() : this.EsTdsDirective && this.EsTdsDirective.length > 0 ? this.EsTdsDirective.toArray() : [];
1873
+ // Se non ho colonne dinamiche ma sono in modalità dinamica (lo capisco perché c'è una view piena di genericitem) metto il default delle colonne
1874
+ this.eventuallyReviewDynamicColumns();
1875
+ this.bindDisplayToLoadedItemsOrGroups(View);
1876
+ // Questo dev'essere per forza lanciato dopo **bindDisplayToLoadedItemsOrGroups** dato che è lì che alcune cose vengono valorizzate
1877
+ this.setupPagingInformations();
1878
+ // Molte cose sono ovviamente disponibili solo in modalità View
1879
+ if ((this.viewMode || this.arrayMode) && this.UseCustomCells) {
1880
+ var view = this.viewMode ? View : null;
1881
+ var itemsAndGroups = this.viewMode ? __spread((view.items || []), (view.groups || [])) : View;
1882
+ var si = this.viewMode ? view.selection : this.arraymodeSelection;
1883
+ // N.B: Rispettare l'ordine di queste 3 macrocategorie è VITALE
1884
+ // ************************************* Sistemazioni di TH, TD, e visibilità varie *************************************
1885
+ var hI = this.evaluateHeadersGroupingInfos(ths); // Prepassaggio per tirare fuori tutte le info utili sugli headers in modo da non ricacolarseli sempre dopo
1886
+ if (this.arrayMode) { // In modalità array non ho un backend...
1887
+ this.arrayModeReviewOrderings(); // ... quindi gli ordinamenti li devo fare lato client, e ...
1888
+ this.arrayModeReviewGroupings(hI.leafs); // ... i raggruppamenti li devo fare lato client
1889
+ }
1890
+ this.reviewColumnsList(hI.leafs); // Aggiorna la lista delle colonne da mostrare nella dialog per ordinamento ecc
1891
+ this.moveFixedColumnsAtTheBeginning(hI.leafs, tds); // Sposto tutte le cose fixed all'inizio in modo che la creazione di th e td sia più snella (Utilizza le ColumnsList, quindi dev'essere richiamata PIRMA di reviewColumnsList)
1892
+ this.alignHeadersOrdering(hI.leafs, view); // Allineo gli ordinamenti agli header
1893
+ this.alignColumnsIfLoadedView(view); // Se sto caricando una View da hotpotato (quindi con savedstate = true) riallineo la visibilità delle colonne e il loro ordine.
1894
+ this.refreshColumnsVisibility(hI.leafs, tds, view); // Lavoro sui TH ed eventualmente modifico la visibilità anche dei TD.
1895
+ this.evaluatePinnedColumnsWidth(); // Se sono presenti colonne pinnate valuta la dimensione del contenitore
1896
+ this.generateDefaultOrder(hI.leafs, view); // Genero le direttive di ordinamento, che siano default o derivanti dalla AppSearch
1897
+ this.evaluateHeaderGroups(hI); // Valuto i raggruppamenti degli header se presenti
1898
+ // ************************************* Generazione binding per righe e colonne *************************************
1899
+ this.evaluateRowThs(hI.leafs); // Raccolgo i TH
1900
+ this.evaluateRowTds(hI.leafs, tds); // Raccolgo i TD in contesti separati, un contesto per ogni item o gruppo
1901
+ // ************************************* Ultimi aggiustmaenti dei binding *************************************
1902
+ this.applyOrdering(view, true); // Applico l'ordinamento sulle colonne (non ASC DESC, ma "prima questa o quella colonna")
1903
+ this.MoveTemporaryVariablesToRealOnes(); // Collego TH e TD aggiustati fino ad ora alle variabili di Binding HTML
1904
+ this.evaluateSelection(itemsAndGroups, si); // Riallineo le info di selezione degli elementi della View
1905
+ if (this.ResearchNeeded) {
1906
+ this.changed();
1907
+ this.emitSearchRequest(false);
1908
+ this.ResearchNeeded = false;
1909
+ }
1910
+ }
1911
+ else if ((this.viewMode || this.arrayMode) && !this.UseCustomCells) {
1912
+ // Riallineo le info di selezione degli elementi della View
1913
+ var items = this.viewMode ? View.items : View;
1914
+ var si = this.viewMode ? View.selection : this.arraymodeSelection;
1915
+ this.evaluateSelection(items, si);
1916
+ }
1917
+ // Per essere sicuro che dopo un bind di oggetti la es-table aggiorni la grafica
1918
+ this.cdr.markForCheck();
1919
+ this.FirstBind = false;
1565
1920
  };
1566
1921
  /**
1567
- * Valuta quali elementi devono essere marcati come selezionati nella vista attuale. Si basa sull'oggetto **selection** interno all'AppSearch
1922
+ * Se in modalità array applica gli ordinamenti ASC-DESC delle colonne
1568
1923
  *
1569
- * @param {any[]} items Oggetti di cui valutare la selezione
1570
- * @param {ItemsSelection<any>} selectionItem Oggetti di selezione derivante dalla view o dall'oggetto per Array
1924
+ * @todo: INTERNALDB
1571
1925
  */
1572
- EsTableComponent.prototype.evaluateSelection = function (items, selectionItem) {
1573
- if (!selectionItem)
1926
+ EsTableComponent.prototype.arrayModeReviewOrderings = function () {
1927
+ var _this = this;
1928
+ if (this.arrayOrders.length > 0)
1929
+ this.arrayOrders.forEach(function (t) {
1930
+ _this.boundSource = _this.boundSource.sort(function (a, b) { return (a[t.id] > b[t.id] ? 1 : -1) * (t.order == 'DESC' ? -1 : 1); });
1931
+ });
1932
+ };
1933
+ /**
1934
+ * Se in modalità array applica i raggruppamenti definiti lato row-grouping
1935
+ *
1936
+ * @param {ths: EsTh[] | EsThDirective[]} ths Header
1937
+ *
1938
+ * @todo: ROW GROUPING
1939
+ */
1940
+ EsTableComponent.prototype.arrayModeReviewGroupings = function (ths) {
1941
+ if (ths.length == 0)
1574
1942
  return;
1575
- this.handleSelectionEvaluation(items, selectionItem);
1943
+ if (this.isEsTh(ths[0]))
1944
+ return;
1945
+ var headerGroups = [];
1946
+ var headerAggregations = [];
1947
+ for (var i = 0; i < ths.length; i++) {
1948
+ var th = ths[i];
1949
+ if (th.thGroup)
1950
+ headerGroups.push(new Group(th.th, 0, ""));
1951
+ else if (th.thAggregation)
1952
+ headerAggregations = __spread(headerAggregations, this.getGroupAggregations(th));
1953
+ }
1954
+ if (headerGroups.length > 0) {
1955
+ // Pulizia delle cache
1956
+ this.rgGroupCache.clear();
1957
+ this.rgItemCache.clear();
1958
+ this.rgChildGroupsCache.clear();
1959
+ this.ArrayGrouping = true;
1960
+ this.boundSource = this.getGroupsRecursive(headerGroups, 0, this.boundSource, headerAggregations, null);
1961
+ }
1962
+ };
1963
+ /**
1964
+ * Data la definizione dei gruppi da generare da una lista di oggetti, suddivide gli oggetti passati in gruppi e sottogruppi
1965
+ *
1966
+ * @param {Group[]} grps Definizione dei gruppi
1967
+ * @param {number} currentIndex Indice di elaborazione. Al livello 0 ho tutti gli oggetti e devo generare i primi gruppi, a livello 1 ho tutti i gruppi principali e devo
1968
+ * elaborare i sottogruppi, e così via ricorsivamente...
1969
+ * @param {any[]} items Oggetti da raggruppare
1970
+ * @param {GroupOrAggregation[]} aggregations Info di aggregazione
1971
+ * @param {any} parent Riferimento al gruppo padre
1972
+ *
1973
+ * @todo: INTERNALDB
1974
+ */
1975
+ EsTableComponent.prototype.getGroupsRecursive = function (grps, currentIndex, items, aggregations, parent) {
1976
+ // Se l'indice è 0 devo sicuramente nascondere tutti gli oggetti. Solo i gruppi saranno visualizzati
1977
+ if (currentIndex == 0)
1978
+ items.forEach(function (i) { return i._visible = false; });
1979
+ var grp = grps[currentIndex];
1980
+ var ret = [];
1981
+ var last = grps.length == currentIndex + 1;
1982
+ var groups = this.groupBy(items, grp.column);
1983
+ var _loop_1 = function (prop) {
1984
+ var itms = groups[prop];
1985
+ var gp = new Group(grp.column, itms.length, prop);
1986
+ gp.aggregations = this_1.generateAggregations(itms, aggregations);
1987
+ var anygp = gp;
1988
+ anygp._group = true;
1989
+ anygp._expanded = false;
1990
+ if (!parent) {
1991
+ anygp._thisRoute = [{ column: gp.column, value: gp.value }];
1992
+ anygp._thisKey = gp.value;
1993
+ anygp._grouplevel = 0;
1994
+ }
1995
+ else {
1996
+ anygp._parent = parent._thisKey;
1997
+ anygp._parentRoute = parent._thisRoute;
1998
+ anygp._thisRoute = __spread(parent._thisRoute, [{ column: gp.column, value: gp.value }]);
1999
+ anygp._thisKey = parent._thisKey + gp.value;
2000
+ anygp._grouplevel = parent._grouplevel + 1;
2001
+ }
2002
+ // Pusho il gruppo, tutti i gruppi del livello sotto, o gli item se io sono l'ultimo gruppo.
2003
+ // La visibilità è solo per il gruppo a livello 0, tutti gli altri gruppi saranno mostrati o nascosti di conseguenza
2004
+ if (currentIndex == 0)
2005
+ anygp._visible = true;
2006
+ this_1.calculateHash([anygp]);
2007
+ this_1.cacheAggregations(anygp);
2008
+ // Aggiungo il gruppo padre
2009
+ ret.push(anygp);
2010
+ this_1.rgGroupCache.set(anygp._thisKey, anygp);
2011
+ if (!last) {
2012
+ //Dal gruppo padre, se non è l'ultimo gruppo della catena, calcolo ricorsivamente tutta la catena sotto
2013
+ var subGroupsAndItems = this_1.getGroupsRecursive(grps, currentIndex + 1, itms, aggregations, anygp);
2014
+ var childgroups = subGroupsAndItems.filter(function (t) { return t._group && t._parent == anygp._thisKey; });
2015
+ anygp._groupscount = childgroups.length;
2016
+ // Aggiungo la catena del gruppo sotto, aggiungendo alla cache solo i gruppi padre
2017
+ ret.push.apply(ret, __spread(subGroupsAndItems));
2018
+ this_1.rgChildGroupsCache.set(anygp._thisKey, childgroups);
2019
+ }
2020
+ else {
2021
+ // Al gruppo padre, se è l'ultimo assegno tutte le foglie assegnandogli anche la chiave del gruppo
2022
+ itms.forEach(function (i) { return i._thisKey = anygp._thisKey; });
2023
+ ret.push.apply(ret, __spread(itms));
2024
+ this_1.rgItemCache.set(anygp._thisKey, itms);
2025
+ }
2026
+ };
2027
+ var this_1 = this;
2028
+ for (var prop in groups) {
2029
+ _loop_1(prop);
2030
+ }
2031
+ return ret;
2032
+ };
2033
+ /**
2034
+ * Data una lista di oggetti genera le aggregazioni specificate. Si considera di avere tutti gli oggetti
2035
+ *
2036
+ * @param {any[]} items Oggetti di cui calcolare le aggregazione
2037
+ * @param {GroupOrAggregation[]} aggregations Aggergazioni da generare
2038
+ *
2039
+ * @todo: INTERNALDB
2040
+ */
2041
+ EsTableComponent.prototype.generateAggregations = function (items, aggregations) {
2042
+ var rets = [];
2043
+ var aggregationValue = "", feField = null, stringAgg = null, dateAgg = null, numberAgg = null;
2044
+ for (var i = 0; i < aggregations.length; i++) {
2045
+ var agg = aggregations[i];
2046
+ feField = agg.column;
2047
+ if (!feField)
2048
+ continue;
2049
+ switch (agg.datatype) {
2050
+ case 'string':
2051
+ stringAgg = items.map(function (i) { return i[feField].toString(); });
2052
+ break;
2053
+ case 'date':
2054
+ dateAgg = items.map(function (i) { return new Date(i[feField]).getTime(); });
2055
+ break;
2056
+ case 'number':
2057
+ numberAgg = items.map(function (i) { return parseFloat(i[feField]); });
2058
+ break;
2059
+ }
2060
+ switch (agg.aggregation) {
2061
+ case 'max':
2062
+ switch (agg.datatype) {
2063
+ case 'string':
2064
+ aggregationValue = stringAgg.sort().reverse()[0];
2065
+ break;
2066
+ case 'date':
2067
+ aggregationValue = new Date(Math.max.apply(Math, __spread(dateAgg))).toString();
2068
+ break;
2069
+ case 'number':
2070
+ aggregationValue = Math.max.apply(Math, __spread(numberAgg)).toString();
2071
+ break;
2072
+ }
2073
+ break;
2074
+ case 'min':
2075
+ switch (agg.datatype) {
2076
+ case 'string':
2077
+ aggregationValue = stringAgg.sort()[0];
2078
+ break;
2079
+ case 'date':
2080
+ aggregationValue = new Date(Math.min.apply(Math, __spread(dateAgg))).toString();
2081
+ break;
2082
+ case 'number':
2083
+ aggregationValue = Math.min.apply(Math, __spread(numberAgg)).toString();
2084
+ break;
2085
+ }
2086
+ break;
2087
+ case 'sum':
2088
+ switch (agg.datatype) {
2089
+ case 'string':
2090
+ aggregationValue = stringAgg.join(", ");
2091
+ break;
2092
+ case 'date':
2093
+ aggregationValue = "";
2094
+ break;
2095
+ case 'number':
2096
+ aggregationValue = numberAgg.reduce(function (pre, curr) { return pre + curr; }, 0).toString();
2097
+ break;
2098
+ }
2099
+ break;
2100
+ }
2101
+ rets.push(new GroupAggregation(agg.column, agg.aggregation, aggregationValue));
2102
+ }
2103
+ return rets;
2104
+ };
2105
+ /**
2106
+ * Data una lista di oggetti effettua dei raggruppamenti in base alla proprietà **field**, restituendo un oggetto del tipo { Gruppo1: oggetti[], Gruppo2: oggetti[], ecc... }
2107
+ *
2108
+ * @param {any[]} array Lista degli oggetti da raggruppare
2109
+ * @param {string} field Campo su cui effettuare i raggruppamenti
2110
+ *
2111
+ * @returns {{ [id: string]: any[] }} Dizionario dei gruppi
2112
+ *
2113
+ * @todo: INTERNALDB
2114
+ */
2115
+ EsTableComponent.prototype.groupBy = function (array, field) {
2116
+ var ret = {};
2117
+ for (var i = 0; i < array.length; i++) {
2118
+ var x = array[i];
2119
+ (ret[x[field]] = ret[x[field]] || []).push(x);
2120
+ }
2121
+ return ret;
1576
2122
  };
2123
+ ;
1577
2124
  /**
1578
- * Valuta quali elementi devono essere marcati come selezionati nella vista attuale. Si basa sull'oggetto **arraymodeSelection** dell'es-table
2125
+ * Effettua il binding degli oggetti pervenuti da questa chiamata con gli oggetti effettivamente da graficare
1579
2126
  *
1580
- * @param {any[]} array Lista di oggetti di cui valutare la selezione in modalità array
2127
+ * @param {any} view View da cui sono arrivati gli oggetti. Può essere o un array se sono in **arrayMode** o una AppSearch<T> se sono in **viewMode**
1581
2128
  */
1582
- EsTableComponent.prototype.arrayModeEvaluateSelection = function (array) {
1583
- if (array.length == 0)
2129
+ EsTableComponent.prototype.bindDisplayToLoadedItemsOrGroups = function (view) {
2130
+ var _a, _b;
2131
+ if (this.TMPBoundSource.length == 0) {
2132
+ this.BaseItemsCount = 0;
2133
+ return;
2134
+ }
2135
+ if (this.arrayMode || !this.UseCustomCells) {
2136
+ this.boundSource = this.TMPBoundSource;
2137
+ this.BaseItemsCount = (view === null || view === void 0 ? void 0 : view.objectcount) || view.length;
2138
+ return;
2139
+ }
2140
+ var groupingKeys = ((_b = (_a = view.groupings) === null || _a === void 0 ? void 0 : _a.filter(function (t) { return !t.aggregation; })) === null || _b === void 0 ? void 0 : _b.length) || 0;
2141
+ if (groupingKeys == 0) {
2142
+ this.boundSource = this.TMPBoundSource;
2143
+ this.BaseItemsCount = view.objectcount;
1584
2144
  return;
1585
- this.handleSelectionEvaluation(array, this.arraymodeSelection);
2145
+ }
2146
+ this.handleNewDataOnRowGrouping(view, groupingKeys);
1586
2147
  };
1587
2148
  /**
1588
- * Implementazione agnostica della valutazione delle selezioni degli oggetti. Richiede gli oggetti della vista attuale e l'itemSelector
2149
+ * In modalità rowgrouping quando mi arriva un nuovo blocco di oggetti devo aggiungerlo alla vista attuale:
1589
2150
  *
1590
- * @param {any[]} items Oggetti di cui aggiornare lo stato di selezione
1591
- * @param {ItemsSelection<any>} selectionItem Oggetto contenente lo stato attuale di selezione
2151
+ * 1) Se non viene richiesto il dettaglio di alcun gruppo significa che devo considerare mi siano arrivati tutti i gruppi principali
2152
+ * 2) Se viene richiesto il dettaglio di un gruppo diverso dall'ultimo devo aggiungere dopo al gruppo cliccato la lista dei sottogruppi
2153
+ * 2) Se viene richiesto il dettaglio dell'ultimo gruppo devo aggiungere dopo al gruppo cliccato la lista degli oggetti
2154
+ *
2155
+ * @param {any} view AppSearch<T> da cui sono arrivati gli oggetti
2156
+ * @param {number} groupingKeys Livelli di raggruppamento da aspettarsi sui dati
2157
+ *
2158
+ * @todo: ROWGROUPING
1592
2159
  */
1593
- EsTableComponent.prototype.handleSelectionEvaluation = function (items, selectionItem) {
1594
- var allSelected = true;
1595
- for (var i = 0; i < items.length; i++) {
1596
- var itm = items[i];
1597
- // Reidrato la cache di selezione coi nuovi oggetti altrimenti non riuscirei a beccare gli indici giusti
1598
- // Dopodiché la uso per calcolare istantaneamente se gli oggetti sono selezionati o no
1599
- if (this.selOrDeselCache[itm.hash])
1600
- this.selOrDeselCache[itm.hash] = itm;
1601
- if (selectionItem.all)
1602
- itm._selected = !this.selOrDeselCache[itm.hash];
1603
- else
1604
- itm._selected = !!this.selOrDeselCache[itm.hash];
1605
- allSelected = allSelected && itm._selected;
2160
+ EsTableComponent.prototype.handleNewDataOnRowGrouping = function (view, groupingKeys) {
2161
+ var e_1, _s, e_2, _t, _u;
2162
+ var _this = this;
2163
+ var _a, _b;
2164
+ // 1) Se non viene richiesto il dettaglio di alcun gruppo significa che la chiamata restituisce la lista paginata dei gruppi principali.
2165
+ // Li tratto come se fosse una qualsiasi altra query paginata su N elementi
2166
+ if ((((_a = view.requestedgroups) === null || _a === void 0 ? void 0 : _a.length) || 0) == 0) {
2167
+ this.boundSource = this.TMPBoundSource;
2168
+ this.rgGroupCache = new Map();
2169
+ this.rgItemCache = new Map();
2170
+ this.rgChildGroupsCache = new Map();
2171
+ this.TMPBoundSource.forEach(function (itm) {
2172
+ itm._thisRoute = itm._group ? [{ column: itm.column, value: itm.value }] : [];
2173
+ itm._thisKey = itm._group ? itm.value : null;
2174
+ itm._grouplevel = 0;
2175
+ _this.rgGroupCache.set(itm._thisKey, itm);
2176
+ });
2177
+ // Resetto la ricerca alla cache di questa "sessione"
2178
+ var firstItem = this.TMPBoundSource[0];
2179
+ this.MainGroupView = Object.assign({}, view);
2180
+ this.groupSearchRequestsCache = [{ path: '', route: [{ column: firstItem.column, value: firstItem.value }], view: this.MainGroupView, group_column: this.TMPBoundSource[0].column }];
2181
+ this.BaseItemsCount = view.objectcount;
1606
2182
  }
1607
- // Se tutti gli oggetti di questa pagina sono solezionati allora posso mettere il global check a true
1608
- // Se sono in situazione di all-select anche metto la global checkbox, nonostante ci possano essere delle esclusioni
1609
- this.globalCheck = allSelected || selectionItem.all;
1610
- this.canSelectAll = selectionItem.count > 0 && this.SelectAll;
1611
- // Potrebbe cambiare qualora qualcuno inserisse dati a manazza in modalità Array e desse il refresh manuale alla tabella
1612
- // Comunque costa 0 quindi mi permetto di refreshare
1613
- if (this.arrayMode) {
1614
- var prevSelected = this.selectedObjects;
1615
- this.finalizeSelectionInformations(selectionItem);
1616
- if (this.selectedObjects != prevSelected)
1617
- this.onSelectionChanged.emit(selectionItem);
2183
+ else {
2184
+ // 2) Se viene richiesto il dettaglio di un qualsiasi gruppo diverso dall'ultimo vuol dire che devo aggiungere
2185
+ // dopo al gruppo che ho cliccato la lista dei gruppi tirata fuori questa volta (intermediateGroup = true)
2186
+ /*
2187
+ * GruppoA GruppoA
2188
+ * GruppoB GruppoB
2189
+ * GruppoC <- Clicco qui GruppoC
2190
+ * GruppoD GruppoC1
2191
+ * GruppoE GruppoC2
2192
+ * GruppoD
2193
+ * GruppoE
2194
+ */
2195
+ // 3) se i gruppi richiesti dalla view sono uguali ai gruppi presenti vuol dire che sto prendendo gli oggetti veri e propri, sono in
2196
+ // view.items e quindi in TMPBoundSource, ho inoltre le informazioni di paginazione **per il singolo sottogruppo** (intermediateGroup = false)
2197
+ /*
2198
+ * GruppoA GruppoA
2199
+ * GruppoC1 GruppoC1
2200
+ * GruppoB GruppoB
2201
+ * GruppoC GruppoC
2202
+ * GruppoC1 <-- Clicco qui GruppoC1
2203
+ * Oggetto1
2204
+ * Oggetto2
2205
+ * Oggetto3
2206
+ * GruppoC2 GruppoC2
2207
+ * GruppoD GruppoD
2208
+ * GruppoE GruppoE
2209
+ */
2210
+ var intermediateGroup_1 = view.requestedgroups.length != groupingKeys;
2211
+ var items = this.boundSource;
2212
+ var insertIndex_1 = 0;
2213
+ var groupKey_1 = "";
2214
+ var groupRoute_1 = [];
2215
+ var _loop_2 = function (i) {
2216
+ var rg = view.requestedgroups[i];
2217
+ groupKey_1 += rg.value;
2218
+ groupRoute_1.push({ column: rg.column, value: rg.value });
2219
+ insertIndex_1 = items.findIndex(function (t, i) { return i >= insertIndex_1 && t._group && t.column == rg.column && t.value == rg.value; });
2220
+ };
2221
+ // Navigo la stuttura dei gruppi ignorando ricorsivamente tutti gli indici fino ai gruppi che mi interessano in modo da non beccare il primo "GruppoC1" del caso sopra
2222
+ for (var i = 0; i < view.requestedgroups.length; i++) {
2223
+ _loop_2(i);
2224
+ }
2225
+ var itemsCacheReference_1;
2226
+ var childGroupsCacheReference_1;
2227
+ // Se non è un gruppo intermedio devo ripulire la cache del gruppo su cui ho attualmente cliccato. Gli oggetti saranno riaggiunti dopo
2228
+ if (!intermediateGroup_1) {
2229
+ this.rgItemCache.set(groupKey_1, []);
2230
+ itemsCacheReference_1 = this.rgItemCache.get(groupKey_1);
2231
+ }
2232
+ else {
2233
+ try {
2234
+ // Se invece è un gruppo intermedio devo ripulire sia tutti i child group ricorsivamente, sia tutti gli item
2235
+ for (var _v = __values(this.rgChildGroupsCache.keys()), _w = _v.next(); !_w.done; _w = _v.next()) {
2236
+ var key = _w.value;
2237
+ if (key.startsWith(groupKey_1))
2238
+ this.rgChildGroupsCache.delete(key);
2239
+ }
2240
+ }
2241
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2242
+ finally {
2243
+ try {
2244
+ if (_w && !_w.done && (_s = _v.return)) _s.call(_v);
2245
+ }
2246
+ finally { if (e_1) throw e_1.error; }
2247
+ }
2248
+ try {
2249
+ for (var _x = __values(this.rgItemCache.keys()), _y = _x.next(); !_y.done; _y = _x.next()) {
2250
+ var key = _y.value;
2251
+ if (key.startsWith(groupKey_1))
2252
+ this.rgItemCache.delete(key);
2253
+ }
2254
+ }
2255
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2256
+ finally {
2257
+ try {
2258
+ if (_y && !_y.done && (_t = _x.return)) _t.call(_x);
2259
+ }
2260
+ finally { if (e_2) throw e_2.error; }
2261
+ }
2262
+ this.rgChildGroupsCache.set(groupKey_1, []);
2263
+ childGroupsCacheReference_1 = this.rgChildGroupsCache.get(groupKey_1);
2264
+ }
2265
+ // Assegno un livello ai valori che arrivano da usare per formattare la parte grafica. Il primo gruppo cliccato sarà a livello 1,
2266
+ // il secondo sarà a livello 2 e così via...
2267
+ // Li marco inoltre con il parent in modo da poter eliminare i vecchi qualora servisse
2268
+ this.TMPBoundSource.forEach(function (itm) {
2269
+ itm._parent = groupKey_1;
2270
+ itm._parentRoute = groupRoute_1;
2271
+ itm._thisRoute = itm._group ? __spread(groupRoute_1, [new GroupRouteFragment(itm.column, itm.value)]) : [];
2272
+ itm._thisKey = itm._group ? groupKey_1 + itm.value : groupKey_1;
2273
+ // Per le ricerca intermedie metto i gruppi nella cache dei gruppi
2274
+ if (intermediateGroup_1) {
2275
+ itm._grouplevel = view.requestedgroups.length;
2276
+ _this.rgGroupCache.set(itm._thisKey, itm);
2277
+ childGroupsCacheReference_1.push(itm);
2278
+ }
2279
+ else {
2280
+ // Metto anche gli oggetti nella cache non ricorsiva
2281
+ itemsCacheReference_1.push(itm);
2282
+ }
2283
+ });
2284
+ // Elimino gli oggetti vecchi
2285
+ // 1) Ricerca intermedia, stato salvato - Elimino tutti gli item e tutti i gruppi la cui route è più lunga della corrente, tutti gli item relativi alla path corrente, e tutte
2286
+ // le cache di ricerca effettuate su una path più profonda dell'attuale
2287
+ // 2) Ricerca finale o ricerca intermedia senza stato salvato - Elimino tutti gli item relativi alla path corrente
2288
+ // Per "stato salvato" si intendono ricerche vecchie salvate per poter essere rieffettuate in caso di ordinamenti su colonne di interesse
2289
+ if (intermediateGroup_1 && view.savedstate) {
2290
+ this.boundSource = this.boundSource.filter(function (t) { return !(t._item || t._thisRoute.length > groupRoute_1.length); });
2291
+ this.groupSearchRequestsCache = this.groupSearchRequestsCache.filter(function (t) { return !(t.route.length > groupRoute_1.length); });
2292
+ }
2293
+ this.boundSource = this.boundSource.filter(function (t) { return !(t._parent == groupKey_1); });
2294
+ var thisGroup = this.boundSource[insertIndex_1];
2295
+ if (intermediateGroup_1)
2296
+ thisGroup._groupscount = (_b = this.View) === null || _b === void 0 ? void 0 : _b.groupcount;
2297
+ // Li sostituisco coi nuovi di questa ricerca
2298
+ (_u = this.boundSource).splice.apply(_u, __spread([insertIndex_1 + 1, 0], this.TMPBoundSource));
2299
+ // Aggiungo un separatore alla fine o all'inizio di questi gruppi che dovrà occuparsi di caricare ALTRI gruppi o oggetti (se sono all'ultimo gruppo)
2300
+ var addLast = false;
2301
+ this.boundSource.splice(insertIndex_1 + 1 + (addLast ? this.TMPBoundSource.length : 0), 0, this.getGroupSeparator(view, groupKey_1, groupRoute_1, view.requestedgroups.length, intermediateGroup_1 ? 'groups' : 'items'));
2302
+ // Aggiungo la ricerca alla cache di questa "sessione"
2303
+ var toAdd_1 = { path: groupKey_1, route: groupRoute_1, view: Object.assign({}, view), group_column: intermediateGroup_1 ? this.TMPBoundSource[0].column : '' };
2304
+ var prev = this.groupSearchRequestsCache.findIndex(function (t) { return t.path == toAdd_1.path && t.group_column == toAdd_1.group_column; });
2305
+ if (prev == -1)
2306
+ this.groupSearchRequestsCache.push(toAdd_1);
2307
+ else
2308
+ this.groupSearchRequestsCache.splice(prev, 1, toAdd_1);
1618
2309
  }
1619
2310
  };
2311
+ /**
2312
+ * Metodo richiamato solo quando **TMPRowTDs** e **TMPRowTHs** sono completamente generati ed aggiustati. Serve per collegarli alle variabili usate lato binding HTML
2313
+ */
2314
+ EsTableComponent.prototype.MoveTemporaryVariablesToRealOnes = function () {
2315
+ this.RowTDs = this.TMPRowTDs;
2316
+ this.RowTHs = this.TMPRowTHs;
2317
+ this.RowThGroups = this.TMPRowThGroups ? this.TMPRowThGroups.reverse() : null;
2318
+ this.Columns.Visibile = this.RowTHs.filter(function (t) { return t.Visible; }).length;
2319
+ this.Columns.VisibleUnpinned = this.RowTHs.filter(function (t) { return t.Visible && !t.Pinned; }).length;
2320
+ this.Columns.Global = this.Columns.VisibleUnpinned + (this.HasPinnedColumns ? 1 : 0) + (this.Selection ? 1 : 0) + (this.Removal ? 1 : 0) + (this.Export || this.HiddenColumns || this.ColumnsOrdering || this.CornerMenuOptions ? 1 : 0);
2321
+ };
1620
2322
  /**
1621
2323
  * Permette di selezionare o deselezionare in maniera arbitraria degli oggetti
1622
2324
  *
1623
2325
  * @param {any[]} items Oggetti da selezionare o deselezionare
1624
2326
  * @param {boolean} select **true** per selezionarli, **false** per non toccarli
2327
+ *
2328
+ * @todo: SELECTION
1625
2329
  */
1626
2330
  EsTableComponent.prototype.setSelectionStatus = function (items, select) {
1627
2331
  this.handleItemsSelection(items, select);
@@ -1655,32 +2359,118 @@
1655
2359
  * @param {EsTh[] | EsThDirective[]} ths Colonne della tabella
1656
2360
  */
1657
2361
  EsTableComponent.prototype.reviewColumnsList = function (ths) {
1658
- this.ColumnsList = [];
2362
+ var _this = this;
2363
+ this.TMPColumnsList = [];
1659
2364
  if (ths.length == 0)
1660
2365
  return;
1661
- // Appena il contentChildren è valorizzato scorro tutti gli header
1662
- for (var i = 0; i < ths.length; i++) {
2366
+ var _loop_3 = function (i) {
1663
2367
  var th = ths[i];
1664
- if (this.isEsTh(th)) {
2368
+ if (this_2.isEsTh(th)) {
1665
2369
  // Se non ho un id il th è considerato inerte
1666
2370
  if (!th.ID)
1667
- continue;
1668
- th.OrderBy = this.OrderByColumn;
2371
+ return "continue";
2372
+ th.OrderBy = this_2.OrderByColumn;
1669
2373
  // Salvo le informazioni dell'header per far parte della lista da cui scegliere quali colonne visualizzare/nascondere
1670
2374
  // Di default la visibilità è quella impostata nel componente
1671
- if (this.HiddenColumns || th.Visible)
1672
- this.ColumnsList.push(new EsTableColumn(th.ID, th.Description, th.Visible, th.Fixed, null));
2375
+ if (this_2.HiddenColumns || th.Visible)
2376
+ this_2.TMPColumnsList.push(new EsTableColumn(th.ID, th.Description, th.Visible, th.Fixed, null, null, null));
1673
2377
  }
1674
2378
  else {
2379
+ var column_1 = th.th;
1675
2380
  // Se non ho un id il th è considerato inerte
1676
- if (!th.th)
1677
- continue;
2381
+ if (!column_1)
2382
+ return "continue";
1678
2383
  // Salvo le informazioni dell'header per far parte della lista da cui scegliere quali colonne visualizzare/nascondere
1679
2384
  // Di default la visibilità è quella impostata nel componente
1680
- if (this.HiddenColumns || th.thVisible)
1681
- this.ColumnsList.push(new EsTableColumn(th.th, null, th.thVisible, th.thFixed, th.Template));
2385
+ if (this_2.HiddenColumns || th.thVisible) {
2386
+ var previouslyPinned = !this_2.ColumnsList || this_2.ColumnsList.length == 0 || !this_2.ColumnsList.find(function (t) { return t.id == column_1; }) ? null : this_2.ColumnsList.find(function (t) { return t.id == column_1; }).pinned;
2387
+ this_2.TMPColumnsList.push(new EsTableColumn(column_1, null, th.thVisible, (th.thFixed || th.thGroup), previouslyPinned == null ? th.thPinned : previouslyPinned, th.thPinnedWidth, th.Template));
2388
+ }
2389
+ }
2390
+ };
2391
+ var this_2 = this;
2392
+ // Appena il contentChildren è valorizzato scorro tutti gli header
2393
+ for (var i = 0; i < ths.length; i++) {
2394
+ _loop_3(i);
2395
+ }
2396
+ this.ColumnsList = [];
2397
+ this.TMPColumnsList.forEach(function (c) { _this.ColumnsList.push(Object.assign({}, c)); });
2398
+ };
2399
+ /**
2400
+ * Prende i th e i td in modalità diretive e li ordina in base a se ci sono colonne fixed o meno
2401
+ */
2402
+ EsTableComponent.prototype.moveFixedColumnsAtTheBeginning = function (ths, tds) {
2403
+ var thsCache = {};
2404
+ var fixeds = 0, pinneds = 0;
2405
+ var columnsCache = {};
2406
+ var columnsIndexCache = {};
2407
+ // Creo la cache delle colonne
2408
+ for (var coli = 0; coli < this.ColumnsList.length; coli++) {
2409
+ var col = this.ColumnsList[coli];
2410
+ columnsCache[col.id] = col;
2411
+ }
2412
+ // Sposto tutti gli header fixed o pinned all'inizio
2413
+ for (var i = 0; i < ths.length; i++) {
2414
+ var th = ths[i];
2415
+ if (this.isEsTh(th)) {
2416
+ thsCache[th.ID] = th;
2417
+ if (th.Fixed) {
2418
+ if (i != pinneds + fixeds)
2419
+ this.arrayMove(ths, i, pinneds + fixeds);
2420
+ fixeds++;
2421
+ }
2422
+ }
2423
+ else {
2424
+ thsCache[th.th] = th;
2425
+ // Riassegno sempre per ripulire valori di partenza o per aggiornarli in caso di modifiche utente
2426
+ th.thPinned = (!columnsCache[th.th] && th.thPinned) || (columnsCache[th.th] && columnsCache[th.th].pinned);
2427
+ if (th.thPinned) {
2428
+ if (i != pinneds)
2429
+ this.arrayMove(ths, i, pinneds);
2430
+ pinneds++;
2431
+ }
2432
+ //In questo caso sono informazioni statiche invece, non modificabili dall'utente, quindi non mi dò preoccupazioni
2433
+ if (th.thFixed || th.thGroup) {
2434
+ if (i != pinneds + fixeds)
2435
+ this.arrayMove(ths, i, pinneds + fixeds);
2436
+ fixeds++;
2437
+ }
1682
2438
  }
1683
2439
  }
2440
+ if (this.isEsTh(ths[0]) || this.isEsTd(tds[0]))
2441
+ return;
2442
+ // Cache degli indici per riposizionare i td come i th
2443
+ for (var i = 0; i < ths.length; i++)
2444
+ columnsIndexCache[ths[i].th] = i;
2445
+ // Riordino le celle per fargli mantenere la stessa struttura dei th
2446
+ var newTds = new Array(ths.length);
2447
+ for (var i = 0; i < tds.length; i++) {
2448
+ var item = tds[i];
2449
+ newTds[columnsIndexCache[item.td]] = item;
2450
+ }
2451
+ this.HasPinnedColumns = pinneds > 0;
2452
+ };
2453
+ /**
2454
+ * In base alla configurazione delle colonne calcola le dimenioni delle colonne pinnate
2455
+ */
2456
+ EsTableComponent.prototype.evaluatePinnedColumnsWidth = function () {
2457
+ if (!this.HasPinnedColumns)
2458
+ return;
2459
+ this.PinnedContainerWidth = 0;
2460
+ for (var i = 0; i < this.ColumnsList.length; i++) {
2461
+ var col = this.ColumnsList[i];
2462
+ if (col.pinned && col.visible)
2463
+ this.PinnedContainerWidth += col.pinnedWidth;
2464
+ }
2465
+ this.PinnedContainerWidth += this.Selection ? 25 : 0;
2466
+ };
2467
+ /**
2468
+ * Helper per spostare un oggetto di un array da un indice all'altro, in place
2469
+ */
2470
+ EsTableComponent.prototype.arrayMove = function (array, oldI, newI) {
2471
+ if (newI > array.length - 1 || oldI > array.length - 1 || newI < 0 || oldI < 0)
2472
+ throw "Gli indici passati non fanno riferimento a una posizione dell'array. Length: " + array.length + " Old:" + oldI + " New: " + newI;
2473
+ array.splice(newI, 0, array.splice(oldI, 1)[0]);
1684
2474
  };
1685
2475
  /**
1686
2476
  * Terminato il binding delle colonne da **reviewColumnsList** e della **View** dal **writeValue** questo metodo si occupa
@@ -1690,14 +2480,19 @@
1690
2480
  */
1691
2481
  EsTableComponent.prototype.alignColumnsIfLoadedView = function (view) {
1692
2482
  var _this = this;
1693
- var emitChanged = view.savedstate;
2483
+ var emitChanged = this.viewMode && view.savedstate;
1694
2484
  var newColset = [];
1695
2485
  if (!this.ColumnsList || this.ColumnsList.length == 0)
1696
2486
  return;
2487
+ var columns = this.viewMode ? view.columns : this.arrayColumns;
1697
2488
  this.ColumnsList.forEach(function (c) {
1698
- var exCl = view.columns.filter(function (cc) { return cc == c.id; });
1699
- // Se l'appsearch viene da uno stato precedente, uso le informaizoni sulle colonne che ha dentro, altrimenti sovrascrivo tutto **
1700
- if (c.visible && view.columns.length == 0)
2489
+ // Se la colonna è pinnata mi arriva col simoleon
2490
+ var exCl = columns.filter(function (cc) { return cc.replace('§', '') == c.id; });
2491
+ // Se la colonna è pinnata aggiorno l'informazione nella view
2492
+ if (exCl.length == 1)
2493
+ c.pinned = exCl[0].startsWith('§');
2494
+ // Se l'appsearch viene da uno stato precedente, uso le informazioni sulle colonne che ha dentro, altrimenti sovrascrivo tutto **
2495
+ if (c.visible && columns.length == 0)
1701
2496
  newColset.push(c.id);
1702
2497
  // Se ho una colonna lato AppSearch e nella ColumnList non è visibile, allineo all'AppSearch
1703
2498
  else if (exCl.length == 1 && !c.visible)
@@ -1707,11 +2502,15 @@
1707
2502
  c.visible = false;
1708
2503
  });
1709
2504
  // Non ho colonne nella appsearch, vuol dire che sono al primo binding
1710
- if (view.columns.length == 0)
1711
- view.columns = newColset;
1712
- if (view.savedstate && this.ColumnsOrdering && view.column_ordering.length > 0) {
1713
- var newColList_1 = [];
2505
+ if (columns.length == 0) {
2506
+ if (this.viewMode)
2507
+ view.columns = newColset;
2508
+ else
2509
+ this.arrayColumns = newColset;
2510
+ }
2511
+ if ((this.viewMode && view.savedstate) && this.ColumnsOrdering && view.column_ordering.length > 0) {
1714
2512
  // Scorro gli ordinamenti che avevo salvato e ricreo la ColumnsList in base a loro
2513
+ var newColList_1 = [];
1715
2514
  view.column_ordering.forEach(function (co) {
1716
2515
  _this.ColumnsList.forEach(function (c) {
1717
2516
  if (c.id == co)
@@ -1721,7 +2520,8 @@
1721
2520
  this.ColumnsList = newColList_1;
1722
2521
  }
1723
2522
  // In ogni caso questo non mi serve più, lo resetto **
1724
- view.savedstate = false;
2523
+ if (this.viewMode)
2524
+ view.savedstate = false;
1725
2525
  if (emitChanged)
1726
2526
  this.changed();
1727
2527
  };
@@ -1732,20 +2532,22 @@
1732
2532
  * @param {'DESC' | 'ASC'} order Nuovo ordine selezionato per la colonna
1733
2533
  */
1734
2534
  EsTableComponent.prototype.thOrderChanged = function (id, order) {
1735
- if (!this.viewMode) {
1736
- console.warn('Order changed on a table not in viewMode. Operation not supported');
2535
+ if (!this.viewMode && !this.arrayMode) {
2536
+ console.warn('Order changed on a table not in viewMode or Array mode. Operation not supported');
1737
2537
  return;
1738
2538
  }
1739
2539
  if (!this.OrderByColumn)
1740
2540
  return;
1741
- var appSearch = this.View;
2541
+ var orders = this.viewMode ? this.View.orders : this.arrayOrders;
1742
2542
  var orderToAdd = true;
1743
2543
  var orderToRemove = null;
1744
2544
  // Se per qualche motivo il costruttore non è passato (cache tarpate o simila) fixo
1745
- if (!appSearch.orders)
1746
- appSearch.orders = [];
1747
- for (var i = 0; i < appSearch.orders.length; i++) {
1748
- var t = appSearch.orders[i];
2545
+ if (!orders && this.viewMode)
2546
+ this.View.orders = [];
2547
+ else if (!orders && this.arrayMode)
2548
+ this.arrayOrders = [];
2549
+ for (var i = 0; i < orders.length; i++) {
2550
+ var t = orders[i];
1749
2551
  if (t.id == id) {
1750
2552
  if (order) {
1751
2553
  t.order = order;
@@ -1756,27 +2558,46 @@
1756
2558
  }
1757
2559
  }
1758
2560
  if (orderToRemove != null) {
1759
- appSearch.orders.splice(orderToRemove, 1);
2561
+ orders.splice(orderToRemove, 1);
1760
2562
  }
1761
2563
  else if (orderToAdd) {
1762
2564
  if (this.MultipleOrderingDirectives)
1763
- appSearch.orders.push(new AppOrdering(id, order));
1764
- else
1765
- appSearch.orders = [new AppOrdering(id, order)];
2565
+ orders.push(new AppOrdering(id, order));
2566
+ else {
2567
+ if (this.viewMode)
2568
+ this.View.orders = [new AppOrdering(id, order)];
2569
+ else if (this.arrayMode)
2570
+ this.arrayOrders = [new AppOrdering(id, order)];
2571
+ }
1766
2572
  }
1767
2573
  this.onOrderChanged.emit({ id: id, order: order });
1768
- this.emitSearchRequest(false);
2574
+ if (this.viewMode) {
2575
+ if (this.groupSearchRequestsCache.length > 0)
2576
+ this.emitRowGroupingSearches(id, orders);
2577
+ else
2578
+ this.emitSearchRequest(false);
2579
+ }
2580
+ else if (this.arrayMode)
2581
+ this.internalWriteValue();
1769
2582
  };
1770
2583
  /**
1771
2584
  * Metodo da chiamare ogni volta che si vuole dare evidenza all'esterno del bisogno di rieffettuare la ricerca
2585
+ *
2586
+ * @param {boolean} resetsPage Indica al listener che deve resettare il numero di pagina
2587
+ * @param {AppSearch<any>} viewOverride Override della view da emettere per questa ricerca
1772
2588
  */
1773
- EsTableComponent.prototype.emitSearchRequest = function (value) {
1774
- if (this.viewMode) {
2589
+ EsTableComponent.prototype.emitSearchRequest = function (resetsPage, viewOverride) {
2590
+ if (this.viewMode && !viewOverride) {
1775
2591
  this.View.internalsearchrequest = true;
1776
2592
  this.changed();
1777
2593
  }
2594
+ if (viewOverride) {
2595
+ if (resetsPage)
2596
+ viewOverride.page = 1;
2597
+ viewOverride.internalsearchrequest = true;
2598
+ }
1778
2599
  this.researchInProgress = true;
1779
- this.onSearchRequest.emit(value);
2600
+ this.onSearchRequest.emit(viewOverride ? viewOverride : resetsPage);
1780
2601
  };
1781
2602
  /**
1782
2603
  * In base alla visibilità registrata nelle **ColumnsList** questo metodo si occupa di prendere tutti i **EsThs** ed **EsTds** relativi e nasonderli/mostrarli
@@ -1788,16 +2609,19 @@
1788
2609
  * @param {AppSearch<any>} view AppSearch da utilizzare per questa operazione
1789
2610
  */
1790
2611
  EsTableComponent.prototype.refreshColumnsVisibility = function (ths, tds, view) {
1791
- var columnsCache = {};
1792
2612
  var newColset = [];
1793
2613
  var fixedThs = {};
2614
+ var columnsCache = {};
1794
2615
  for (var coli = 0; coli < this.ColumnsList.length; coli++) {
1795
2616
  var col = this.ColumnsList[coli];
1796
2617
  columnsCache[col.id] = col;
1797
2618
  if (col.visible)
1798
- newColset.push(col.id);
2619
+ newColset.push((col.pinned ? "§" : "") + col.id);
1799
2620
  }
1800
- view.columns = newColset;
2621
+ if (view)
2622
+ view.columns = newColset;
2623
+ else
2624
+ this.arrayColumns = newColset;
1801
2625
  // Da qui in poi devono essere eseguiti SOLO in fase di writeValue quindi devo assicurarmi di passarli null in tutti i passaggi diversi da quello
1802
2626
  if (ths) {
1803
2627
  // Definisco se la colonna è visibile in base alla sua rappresentazione locale in ColumnsList
@@ -1810,7 +2634,7 @@
1810
2634
  }
1811
2635
  else {
1812
2636
  th.thVisible = th.thFixed || (columnsCache[th.th] ? columnsCache[th.th].visible : th.thVisible);
1813
- if (th.thFixed)
2637
+ if (th.thFixed || th.thGroup)
1814
2638
  fixedThs[th.th] = true;
1815
2639
  }
1816
2640
  }
@@ -1827,18 +2651,6 @@
1827
2651
  }
1828
2652
  this.changed();
1829
2653
  };
1830
- /**
1831
- *
1832
- */
1833
- EsTableComponent.prototype.isEsTd = function (td) {
1834
- return !td._directive;
1835
- };
1836
- /**
1837
- *
1838
- */
1839
- EsTableComponent.prototype.isEsTh = function (th) {
1840
- return !th._directive;
1841
- };
1842
2654
  /**
1843
2655
  * Allinea gli ordinamenti dati fra le **EsThs** e le informazioni all'interno della View bindata
1844
2656
  *
@@ -1846,30 +2658,28 @@
1846
2658
  * @param {EsTh[] | EsThDirective[]} ths Colonne della tabella
1847
2659
  */
1848
2660
  EsTableComponent.prototype.alignHeadersOrdering = function (ths, view) {
1849
- var researchNeeded = false;
2661
+ var orders = view ? view.orders : this.arrayOrders;
1850
2662
  for (var i = 0; i < ths.length; i++) {
1851
2663
  var th = ths[i];
1852
2664
  if (this.isEsTh(th)) {
1853
2665
  th.Order = null;
1854
2666
  // Assegno tutti gli ordinamenti che mi vengono da AppSearch. Sono i più importanti. Non faccio cache o cose strano perché tanto questa
1855
2667
  // variabile sarà sempre massimo 3 elementi
1856
- for (var i_1 = 0; i_1 < view.orders.length; i_1++) {
1857
- var or = view.orders[i_1];
2668
+ for (var i_1 = 0; i_1 < orders.length; i_1++) {
2669
+ var or = orders[i_1];
1858
2670
  if (or.id == th.ID)
1859
2671
  th.Order = or.order;
1860
2672
  }
1861
2673
  }
1862
2674
  else {
1863
2675
  th.thOrder = null;
1864
- for (var i_2 = 0; i_2 < view.orders.length; i_2++) {
1865
- var or = view.orders[i_2];
2676
+ for (var i_2 = 0; i_2 < orders.length; i_2++) {
2677
+ var or = orders[i_2];
1866
2678
  if (or.id == th.th)
1867
2679
  th.thOrder = or.order;
1868
2680
  }
1869
2681
  }
1870
2682
  }
1871
- if (researchNeeded)
1872
- this.emitSearchRequest(false);
1873
2683
  };
1874
2684
  /**
1875
2685
  * Partendo dagli **EsTds** bindati genera, all'interno del dizionario **TMPRowTDs** tutti i contesti dei vari oggetti.
@@ -1885,6 +2695,11 @@
1885
2695
  if (tds.length == 0)
1886
2696
  return;
1887
2697
  var thsCache = {};
2698
+ var columnsCache = {};
2699
+ for (var coli = 0; coli < this.ColumnsList.length; coli++) {
2700
+ var col = this.ColumnsList[coli];
2701
+ columnsCache[col.id] = col;
2702
+ }
1888
2703
  for (var i = 0; i < ths.length; i++) {
1889
2704
  var th = ths[i];
1890
2705
  thsCache[this.isEsTh(th) ? th.ID : th.th] = th;
@@ -1897,11 +2712,11 @@
1897
2712
  if (this.isEsTd(td)) {
1898
2713
  var th = thsCache[td.ID];
1899
2714
  if (!!th)
1900
- th.Referenced = true;
2715
+ th._referenced = true;
1901
2716
  else
1902
2717
  throw "ID dell'oggeto EsTd non compatibile con gli ID dicharati negli EsTh: " + td.ID;
1903
- var isFixed = (this.isEsTh(th) && th.Fixed) || (!this.isEsTh(th) && th.thFixed);
1904
- var itemToAdd = { ID: td.ID, Visible: td.Visible, Class: td.Class, Content: td.Content, RouterLink: td.RouterLink, Template: td.Template };
2718
+ var isFixed = (this.isEsTh(th) && th.Fixed) || (!this.isEsTh(th) && (th.thFixed || th.thGroup));
2719
+ var itemToAdd = { GroupAggregation: false, GroupHeader: false, Wraps: true, ID: td.ID, Visible: td.Visible, Class: td.Class, Content: td.Content, RouterLink: td.RouterLink, Template: td.Template };
1905
2720
  var ctx = td.Context;
1906
2721
  if (this.TMPRowTDs[ctx]) {
1907
2722
  if (isFixed)
@@ -1916,22 +2731,27 @@
1916
2731
  }
1917
2732
  }
1918
2733
  else {
1919
- for (var i_3 = 0; i_3 < this.TMPBoundSource.length; i_3++) {
1920
- var ctx = this.TMPBoundSource[i_3].hash;
2734
+ for (var i_3 = 0; i_3 < this.boundSource.length; i_3++) {
2735
+ var item = this.boundSource[i_3];
2736
+ var ctx = item._hash;
1921
2737
  var key = td.td;
1922
2738
  var th = thsCache[td.td];
1923
2739
  if (!!th)
1924
- th.Referenced = true;
2740
+ th._referenced = true;
1925
2741
  else
1926
2742
  throw "ID dell'oggeto EsTd non compatibile con gli ID dicharati negli EsTh: " + td.td;
1927
- if (td.tdIf) {
1928
- var isFixed = (this.isEsTh(th) && th.Fixed) || (!this.isEsTh(th) && th.thFixed);
1929
- var itemToAdd = { ID: key, Visible: td.tdVisible, Class: td.tdClass, Template: td.Template };
2743
+ if (td.tdIf || (!this.isEsTh(th) && th.thGroup)) {
2744
+ var thCasted = th;
2745
+ var isFixed = (this.isEsTh(th) && th.Fixed) || (!this.isEsTh(th) && (th.thFixed || th.thGroup || th.thPinned));
2746
+ var itemToAdd = item._item ?
2747
+ { LeftBorder: thCasted._lbord, RightBorder: thCasted._rbord, ID: key, Pinned: columnsCache[td.td].pinned, PinnedWidth: thCasted.thPinnedWidth, GroupHeader: false, GroupAggregation: false, Visible: columnsCache[td.td].visible, Wraps: false, Class: td.tdClass, Template: thCasted.thGroup && !this.ShowItemGroupsColumns ? null : td.Template } :
2748
+ { LeftBorder: thCasted._lbord, RightBorder: thCasted._rbord, ID: key, Pinned: columnsCache[td.td].pinned, PinnedWidth: thCasted.thPinnedWidth, GroupHeader: thCasted.thGroup, GroupAggregation: !!thCasted.thAggregation, Visible: columnsCache[td.td].visible, Wraps: false, Class: thCasted.thGroupClass || '', Content: this.getGroupCellDisplay(item, key, th) };
1930
2749
  if (this.TMPRowTDs[ctx]) {
1931
- if (isFixed)
1932
- this.TMPRowTDs[ctx].splice(0 + (contextFixeds[ctx]++), 0, itemToAdd);
1933
- else
1934
- this.TMPRowTDs[ctx].push(itemToAdd);
2750
+ // Non serve più grazie al metodo **oveFixedColumnsAtTheBeginning**
2751
+ //if (isFixed)
2752
+ // this.TMPRowTDs[ctx].splice(0 + (contextFixeds[ctx]++), 0, itemToAdd);
2753
+ //else
2754
+ this.TMPRowTDs[ctx].push(itemToAdd);
1935
2755
  }
1936
2756
  else {
1937
2757
  this.RowContexts.push(ctx);
@@ -1948,7 +2768,7 @@
1948
2768
  var errs = [];
1949
2769
  for (var i = 0; i < ths.length; i++) {
1950
2770
  var th = ths[i];
1951
- if (!th.Referenced)
2771
+ if (!th._referenced)
1952
2772
  errs.push(this.isEsTh(th) ? th.ID : th.th);
1953
2773
  }
1954
2774
  if (errs.length > 0) {
@@ -1966,85 +2786,457 @@
1966
2786
  * @param {EsTh[] | EsThDirective[]} ths Colonne della tabella
1967
2787
  */
1968
2788
  EsTableComponent.prototype.evaluateRowThs = function (ths) {
2789
+ var _s;
1969
2790
  if (ths.length == 0)
1970
2791
  return;
2792
+ var columnsListCache = {};
2793
+ var castedView = this.View;
2794
+ var groupingsUndefined = this.viewMode && (castedView && !castedView.groupings || castedView.groupings.length == 0);
2795
+ for (var i = 0; i < this.ColumnsList.length; i++) {
2796
+ var itm = this.ColumnsList[i];
2797
+ columnsListCache[itm.id] = itm;
2798
+ }
1971
2799
  this.TMPRowTHs = [];
1972
2800
  var fixed = 0;
1973
2801
  for (var i = 0; i < ths.length; i++) {
1974
2802
  var th = ths[i];
1975
2803
  var toAdd = void 0;
1976
2804
  if (this.isEsTh(th)) {
1977
- toAdd = { Fixed: th.Fixed, ID: th.ID, Visible: th.Visible, Class: th.Class, Order: th.Order, Orderable: th.Orderable, Template: null, Content: th.Description, Wrap: false };
2805
+ toAdd = { Pinned: false, ID: th.ID, Visible: th.Visible, Class: th.Class, Order: th.Order, Orderable: th.Orderable, Template: null, Content: th.Description, Wrap: false };
1978
2806
  if (th.Fixed)
1979
2807
  this.TMPRowTHs.splice(0 + (fixed++), 0, toAdd);
1980
2808
  else
1981
2809
  this.TMPRowTHs.push(toAdd);
1982
2810
  }
1983
- else if (th.thIf) {
1984
- // Mentre inserisco mi assicuro di mettere l'elemento per bene in ordine in base alla proprietà "Fixed". Tutte le colonne Fixed devono finire all'inizio
1985
- // (Questo probabilmente diventerà il comportamento di default anche per le colonne "Pinned")
1986
- toAdd = { Fixed: th.thFixed, ID: th.th, Visible: th.thVisible, Class: th.thClass, Order: th.thOrder, Orderable: th.thOrderable, Template: th.Template, Content: null, Wrap: false };
1987
- if (th.thFixed)
1988
- this.TMPRowTHs.splice(0 + (fixed++), 0, toAdd);
1989
- else
1990
- this.TMPRowTHs.push(toAdd);
2811
+ else if (th.thIf || th.thGroup) {
2812
+ var thClass = (th.thClass || '') + (th.thGroup ? " est-col-min" : "");
2813
+ toAdd = { Pinned: columnsListCache[th.th].pinned, PinnedWidth: th.thPinnedWidth, ID: th.th, Visible: th.thVisible, Class: thClass, Order: th.thOrder, Orderable: th.thOrderable, Template: th.Template, Content: null, Wrap: false, LeftBorder: th._lbord, RightBorder: th._rbord };
2814
+ this.TMPRowTHs.push(toAdd);
2815
+ // Se ho un modello che deve funzionare a rowgrouping ma non è ancora stata effettuata nessuna ricerca sui gruppi principali (groupingsUndefined)
2816
+ // li genero e mando la prima ricerca che dev'essere spedita al backend per il primo caricamento dei gruppi
2817
+ if (groupingsUndefined && (th.thAggregation || th.thGroup)) {
2818
+ var groupAggregations = this.getGroupAggregations(th);
2819
+ if (!castedView.groupings)
2820
+ castedView.groupings = groupAggregations;
2821
+ else
2822
+ (_s = castedView.groupings).push.apply(_s, __spread(groupAggregations));
2823
+ this.ResearchNeeded = true;
2824
+ }
2825
+ }
2826
+ }
2827
+ };
2828
+ EsTableComponent.prototype.evaluateHeadersGroupingInfos = function (ths) {
2829
+ // Pregiro per trovare i parent
2830
+ var parentsCache = {};
2831
+ var thsCache = {};
2832
+ for (var i = 0; i < ths.length; i++) {
2833
+ var th = ths[i];
2834
+ if (this.isEsTh(th))
2835
+ continue;
2836
+ thsCache[th.th] = th;
2837
+ if (th.thParent && !parentsCache[th.thParent])
2838
+ parentsCache[th.thParent] = true;
2839
+ }
2840
+ // Secondo giro per beccare il livello massimo e la lista di foglie (th senza parent)
2841
+ var hMaxLevel = 0;
2842
+ var leafs = [];
2843
+ for (var i = 0; i < ths.length; i++) {
2844
+ var th = ths[i];
2845
+ if (this.isEsTh(th)) {
2846
+ leafs.push(th);
2847
+ continue;
2848
+ }
2849
+ // Se sono una foglia vedo quanti livelli ci sono sopra
2850
+ if (!parentsCache[th.th]) {
2851
+ leafs.push(th);
2852
+ var tmp = this.jumpsToFinalParent(th, thsCache);
2853
+ hMaxLevel = tmp > hMaxLevel ? tmp : hMaxLevel;
2854
+ }
2855
+ }
2856
+ return { leafs: leafs, groupingLevel: hMaxLevel, parentsCache: parentsCache, thsCache: thsCache };
2857
+ };
2858
+ /**
2859
+ * Genera gli header groups da una lista di info sui th all'interno della variabile **TMPRowThGroups**
2860
+ */
2861
+ EsTableComponent.prototype.evaluateHeaderGroups = function (infos) {
2862
+ if (infos.groupingLevel == 0)
2863
+ return;
2864
+ // Giro 2.5, creo l'output dei raggruppamenti per header in modo da non dovermi preoccupare di celle non inizializzate
2865
+ var expandedGroups = [];
2866
+ var visibleUnpinnedLeafs = infos.leafs.filter(function (t) { return t.thVisible && !t.thPinned; });
2867
+ for (var l = 0; l < infos.groupingLevel; l++) {
2868
+ expandedGroups.push([]);
2869
+ for (var i = 0; i < visibleUnpinnedLeafs.length; i++)
2870
+ expandedGroups[l].push("");
2871
+ }
2872
+ // Ordino le foglie in base agli ordinamenti delle colonne
2873
+ var orderedLeafs = [];
2874
+ for (var i = 0; i < this.OrderDirectives.length; i++) {
2875
+ var leaf = infos.thsCache[this.OrderDirectives[i]];
2876
+ if (leaf.thVisible && !leaf.thPinned)
2877
+ orderedLeafs.push(leaf);
2878
+ }
2879
+ // Terzo giro per creare l'array group con tutti i riferimenti del caso
2880
+ var currentParent = "";
2881
+ for (var i = 0; i < orderedLeafs.length; i++) {
2882
+ var refTh = orderedLeafs[i];
2883
+ var prevTh = i - 1 >= 0 ? orderedLeafs[i - 1] : null;
2884
+ // Parent diverso da prima, metto il bordo a sinistra e a destra della cella precedente (se c'è)
2885
+ // All'ultimo giro metto il bordo a destra. Tutto questo lo rieseguo per ogni cella in modo da ripulire eventuali a cui avevo assegnato tag precedentemente
2886
+ refTh._lbord = refTh.thParent != currentParent;
2887
+ refTh._rbord = visibleUnpinnedLeafs.length == i + 1;
2888
+ if (prevTh)
2889
+ prevTh._rbord = refTh.thParent != currentParent;
2890
+ currentParent = refTh.thParent;
2891
+ // Per ogni gruppo srotolo il parent nella matrice dei raggruppamenti
2892
+ for (var l = 0; l < infos.groupingLevel; l++) {
2893
+ var parent = refTh.thParent;
2894
+ if (parent && !refTh.thPinned) {
2895
+ expandedGroups[l][i] = parent;
2896
+ refTh = infos.thsCache[parent];
2897
+ }
2898
+ }
2899
+ }
2900
+ // Quarto giro per compattarlo nell'elemento finale su cui bindarmi
2901
+ currentParent = "";
2902
+ var currentSpan = 0;
2903
+ this.TMPRowThGroups = [];
2904
+ for (var l = 0; l < expandedGroups.length; l++) {
2905
+ var levelArray = [];
2906
+ this.TMPRowThGroups.push(levelArray);
2907
+ if (this.Selection || this.HasPinnedColumns)
2908
+ levelArray.push({ Span: 1, Template: null, Pinned: this.HasPinnedColumns });
2909
+ for (var h = 0; h < expandedGroups[l].length; h++) {
2910
+ var item = expandedGroups[l][h];
2911
+ if (item == currentParent)
2912
+ currentSpan++;
2913
+ else {
2914
+ if (currentSpan > 0)
2915
+ levelArray.push({ Span: currentSpan, Template: (currentParent ? infos.thsCache[currentParent].Template : null), Borders: !!currentParent });
2916
+ currentSpan = 1;
2917
+ currentParent = item;
2918
+ }
1991
2919
  }
2920
+ // Ultima aggiunta che altrimenti mi rimarrebbe in cache
2921
+ levelArray.push({ Span: currentSpan, Template: (currentParent ? infos.thsCache[currentParent].Template : null), Borders: !!currentParent });
2922
+ if (this.Removal)
2923
+ levelArray.push({ Span: 1, Template: null });
2924
+ if (this.Export || this.HiddenColumns || this.ColumnsOrdering || this.CornerMenuOptions)
2925
+ levelArray.push({ Span: 1, Template: null });
2926
+ currentSpan = 0;
2927
+ currentParent = "";
2928
+ }
2929
+ };
2930
+ /**
2931
+ * Calcola il numero di salti da un header foglia all'ultimo parent della catena
2932
+ */
2933
+ EsTableComponent.prototype.jumpsToFinalParent = function (th, thsCache) {
2934
+ var jumps = 0;
2935
+ var parent = null;
2936
+ do {
2937
+ parent = th.thParent;
2938
+ if (parent)
2939
+ jumps++;
2940
+ th = thsCache[parent];
2941
+ } while (parent);
2942
+ return jumps;
2943
+ };
2944
+ /**
2945
+ * Data una direttiva EsTh restituisce la lista delle aggregazioni richiesta per questa colonna o il gruppo che rappresenta
2946
+ *
2947
+ * @param {EsThDirective} th Direttiva
2948
+ *
2949
+ * @returns {GroupOrAggregation[]} Lista dei gruppi o aggregazioni relativi alla Direttiva passata
2950
+ */
2951
+ EsTableComponent.prototype.getGroupAggregations = function (th) {
2952
+ var ret = [];
2953
+ // Es: '{min:dd/MM/yyyy} - {max:dd/MM/yyyy}'
2954
+ if (th.thAggregation) {
2955
+ this.getEsThDirectiveListOfAggregations(th).forEach(function (agg) {
2956
+ var isdate = agg.format && ['small', 'long', 'verylong'].includes(agg.format);
2957
+ var isnumber = agg.format && agg.format.startsWith("F") && !Number.isNaN(agg.format.charAt(1)) && agg.format.length == 2;
2958
+ if (!isdate && !isnumber && agg.format)
2959
+ throw "Le aggergazioni supportate dall'es-table sono solo 'small', 'long', 'verylong' per le date e 'F0-9' per i numeri";
2960
+ ret.push(new GroupOrAggregation(th.th, agg.func, isdate ? 'date' : isnumber ? 'number' : 'string'));
2961
+ });
1992
2962
  }
2963
+ else if (th.thGroup)
2964
+ ret.push(new GroupOrAggregation(th.th, null));
2965
+ return ret;
2966
+ };
2967
+ /**
2968
+ * Data una direttiva con un formato restituisce tutte le coppie Funzione di Aggregazione - Formato
2969
+ *
2970
+ * @param {EsThDirective} th Direttiva EsTh di cui calcolare le funzioni di aggregazione usate
2971
+ *
2972
+ * @returns {{ func: string, format: string }[]} Lista delle funzioni di aggregazione rilevate
2973
+ */
2974
+ EsTableComponent.prototype.getEsThDirectiveListOfAggregations = function (th) {
2975
+ if (!th.thAggregation)
2976
+ return [];
2977
+ // Se ho già effettuato questo calcolo per questo th restituisco la versione in cache
2978
+ if (th._thAggregations)
2979
+ return th._thAggregations;
2980
+ var ret = [];
2981
+ var display = th.thAggregation;
2982
+ var matches = display.match(/{[a-zA-Z0-9\/:]*}/gi);
2983
+ if (!matches)
2984
+ return [];
2985
+ matches.forEach(function (m) {
2986
+ var split = m.split(":");
2987
+ var func = m, format = "";
2988
+ if (split.length > 0) {
2989
+ // Escludo primo e ultimo carattere (le graffe)
2990
+ func = split[0].substr(1);
2991
+ format = split[1].substr(0, split[1].length - 1);
2992
+ }
2993
+ ret.push({ func: func, format: format, match: m });
2994
+ });
2995
+ th._thAggregations = ret;
2996
+ return ret;
1993
2997
  };
1994
2998
  /**
1995
2999
  * Metodo che genera l'ordine di default delle colonne
1996
3000
  *
1997
3001
  * @param {AppSearch<any>} view AppSearch da utilizzare per questa operazione
1998
3002
  */
1999
- EsTableComponent.prototype.generateDefaultOrder = function (view) {
2000
- if (this.TMPRowTHs.length == 0)
3003
+ EsTableComponent.prototype.generateDefaultOrder = function (ths, view) {
3004
+ if (ths.length == 0)
2001
3005
  return;
3006
+ var orderings = this.viewMode ? view.column_ordering : this.arrayColumnOrdering;
2002
3007
  // Genero ordinamento di default da 0 fino a dove deve arrivare. Situazione attuale senza hotpotato
2003
- if (!view.column_ordering || view.column_ordering.length == 0) {
2004
- for (var i = 0; i < this.TMPRowTHs.length; i++)
2005
- this.OrderDirectives.push(this.TMPRowTHs[i].ID);
3008
+ if (!orderings || orderings.length == 0) {
3009
+ for (var i = 0; i < ths.length; i++) {
3010
+ var th = ths[i];
3011
+ var order = this.isEsTh(th) ? th.ID : th.th;
3012
+ this.OrderDirectives.push(order);
3013
+ }
3014
+ }
3015
+ else
3016
+ this.OrderDirectives = orderings;
3017
+ };
3018
+ /**
3019
+ * Applica l'ordine specificato alle varie colonne
3020
+ *
3021
+ * @param {AppSearch<any>} view AppSearch da utilizzare per questa operazione
3022
+ * @param {boolean} finalize Se **true** significa che non mi aspetto di dover effettuare altre operazioni e posso renderizzare la situazione in base ai RowContext
3023
+ * Senza finalize significa che mi aspetto altre operazioni che prima o poi richiameranno questa funzione col finalize.
3024
+ *
3025
+ * Ad esempio, una volta selezionato ordinamento fisico/logico delle colonne so che parte un altra ricerca che mi rivalorizzerà da "writeValue", che già chiama questa funzione.
3026
+ * Mettendo solo la chiamata da "writeValue" come "finalizzante" mi assicuro che smanattamenti a frontend non causino flickering fino a quando non servono
3027
+ */
3028
+ EsTableComponent.prototype.applyOrdering = function (view, finalize) {
3029
+ var _this = this;
3030
+ // Genero ordinamento per gli header
3031
+ var newHeaders = [];
3032
+ // Se devo finalizzare aggancio tutte le variabili di bind
3033
+ if (finalize) {
3034
+ this.OrderDirectives.forEach(function (o) {
3035
+ var heaedrItem = _this.TMPRowTHs.filter(function (t) { return t.ID == o; })[0];
3036
+ if (heaedrItem)
3037
+ newHeaders.push(heaedrItem);
3038
+ });
3039
+ this.TMPRowTHs = newHeaders;
3040
+ var _loop_4 = function (i) {
3041
+ var context = this_3.TMPRowTDs[this_3.RowContexts[i]];
3042
+ var newContext = [];
3043
+ this_3.OrderDirectives.forEach(function (o) {
3044
+ var contextItem = context.filter(function (t) { return t.ID == o; })[0];
3045
+ newContext.push(contextItem);
3046
+ });
3047
+ this_3.TMPRowTDs[this_3.RowContexts[i]] = newContext;
3048
+ };
3049
+ var this_3 = this;
3050
+ // Genero ordinamento per le celle
3051
+ for (var i = 0; i < this.RowContexts.length; i++) {
3052
+ _loop_4(i);
3053
+ }
3054
+ }
3055
+ if (this.viewMode)
3056
+ view.column_ordering = this.OrderDirectives;
3057
+ else
3058
+ this.arrayColumnOrdering = this.OrderDirectives;
3059
+ this.changed();
3060
+ };
3061
+ // #endregion
3062
+ // #region Gestione raggruppamenti per riga
3063
+ /**
3064
+ * Ottiene un elemento di separazione fra Gruppi che serve per paginare le ricerche all'interno di ogni singolo gruppo
3065
+ *
3066
+ * @param {AppSearch<any>} view View utilizzata per la ricerca. Me ne salvo i parametri nel separatore attuale dato che ne ho bisogno per caricare altri elementi
3067
+ * facenti riferimento allo stesso contesto
3068
+ * @param {string} parent Parent path che rappresenta a quale gruppo è affibbiato questo separatore
3069
+ * @param {GroupRouteFragment[]} route Route path che rappresenta a quale gruppo è affibbiato questo separatore
3070
+ * @param {number} level Livello del gruppo di cui questo elemento è separatore, viene usato per applicare la classe "est-lvl-{{level}}"
3071
+ *
3072
+ * @returns {any} Elemento di separazione contenente tutti i bind per presentare una paginazione sotto questo gruppo lato interfaccia
3073
+ */
3074
+ EsTableComponent.prototype.getGroupSeparator = function (view, parent, route, level, searches) {
3075
+ var item = new GroupPager(level, route, parent, Object.assign({}, view), searches);
3076
+ item.buttons = this.getPagesArray(6, view.page, view.pages);
3077
+ this.calculateHash([item]);
3078
+ return item;
3079
+ };
3080
+ /**
3081
+ * Sposta la ricerca di una pagina in avanti (o indietro)
3082
+ *
3083
+ * @param {number} page Numero di pagine da aggiungere (o sottrarre, se negativo) alla pagina attuale
3084
+ * @param {any} pager Elemento di separazione su cui è effettuata la ricerca
3085
+ */
3086
+ EsTableComponent.prototype.addToPageGroup = function (page, pager) {
3087
+ this.goToPageGroup(pager.view.page + page, pager);
3088
+ };
3089
+ /**
3090
+ * Sposta la ricerca alla pagina specificata
3091
+ *
3092
+ * @param {number} page Pagina a cui navigare
3093
+ * @param {any} pager Elemento di separazione su cui è effettuata la ricerca
3094
+ */
3095
+ EsTableComponent.prototype.goToPageGroup = function (page, pager) {
3096
+ var appSearchElement = pager.view;
3097
+ if (page === 0 || page > appSearchElement.pages)
3098
+ return;
3099
+ appSearchElement.page = page;
3100
+ pager.buttons = this.getPagesArray(6, appSearchElement.page, appSearchElement.pages);
3101
+ this.emitSearchRequest(false, appSearchElement);
3102
+ };
3103
+ /**
3104
+ * Data una colonna effettua la riemissione di tutte le ricerche relative.
3105
+ *
3106
+ * Es. Ho 2 campi di gruppo e ho espanso fino a vedere i valori fino ad un livello qualsiasi.
3107
+ * Clicco l'ordinamento sul secondo gruppo.
3108
+ * Tutte le ricerche relative ai primi gruppi devono essere rieseguite. Quando i risultati arriveranno ci penserà il metodo **bindDisplayToLoadedItemsOrGroups**
3109
+ * a tagliare via gli oggetti non più visualizzati
3110
+ *
3111
+ * @param {string} column Colonna su cui si è effettuata un'operazione di ordinamento
3112
+ * @param {AppOrdering[]} orderings Direttive di ordinamento da applicare alle varie sottoricerche
3113
+ *
3114
+ * @todo: Testare
3115
+ */
3116
+ EsTableComponent.prototype.emitRowGroupingSearches = function (column, orderings) {
3117
+ var _this = this;
3118
+ // Per tutte le ricerche intermedie che devo rivalutare le re-emitto in modo da aggiornargli i dati
3119
+ var meaningfulAppSearches = this.groupSearchRequestsCache.filter(function (t) { return t.group_column == column; }).map(function (t) { return t.view; });
3120
+ // Se non ne trovo significa che ho fatto l'ordinamento o sugli item, o su colonne relative a un sottogruppo non caricato
3121
+ if (!meaningfulAppSearches || meaningfulAppSearches.length == 0)
3122
+ meaningfulAppSearches = this.groupSearchRequestsCache.filter(function (t) { return !t.group_column; }).map(function (t) { return t.view; });
3123
+ // Se non ne trovo qui significa che sto ordinando su colonne relative a un sottogruppo non caricato
3124
+ if (!meaningfulAppSearches || meaningfulAppSearches.length == 0)
3125
+ return;
3126
+ meaningfulAppSearches.forEach(function (as) {
3127
+ // Ovviamente gli oridnamenti devono essere quelli appena generati
3128
+ as.orders = orderings;
3129
+ as.savedstate = true;
3130
+ _this.emitSearchRequest(false, as);
3131
+ });
3132
+ };
3133
+ /**
3134
+ * Helper che calcola il contenuto di una cella relativa a un gruppo riga, tenendo conto del formato delle eventuali aggregazioni
3135
+ *
3136
+ * @param {Group} grp Gruppo di cui mostrare le celle
3137
+ * @param {string} cell Cella attuale di cui calcolare il testo
3138
+ * @param {EsThDirective} header Header relativo alla cella attuale, utilizzata per identificare le informazioni di aggregazione
3139
+ *
3140
+ * @returns {string} Testo finale calcolato per la **cell** corrente, in base alle aggregazioni di **header**
3141
+ */
3142
+ EsTableComponent.prototype.getGroupCellDisplay = function (grp, cell, header) {
3143
+ var _this = this;
3144
+ if (grp._sep)
3145
+ return "";
3146
+ var display = header.thAggregation;
3147
+ if (grp.column == cell) {
3148
+ var groupsPart = grp._groupscount ? " - " + grp._groupscount + " " + this.lc.loc("Groups") : "";
3149
+ return grp.value + " (" + grp.count + groupsPart + ")";
3150
+ }
3151
+ else {
3152
+ var agg_1 = grp._aggregationsCache.get(cell);
3153
+ if (!agg_1)
3154
+ return "";
3155
+ this.getEsThDirectiveListOfAggregations(header).forEach(function (itm) {
3156
+ display = display.replace(itm.match, _this.formatAggregationValue(agg_1.get(itm.func), itm.format));
3157
+ });
3158
+ return display;
3159
+ }
3160
+ };
3161
+ /**
3162
+ * Gestisce i click sulla tabella solo per le righe a gruppo.
3163
+ * O rimuove gli elementi attualmente presenti o carica il contenuto del gruppo
3164
+ *
3165
+ * @param {any} group Gruppo bindato su cui si è effettuato il click
3166
+ *
3167
+ * @returns {boolean} **true** se l'operaizone è andata a buon fine, **false** altrimenti
3168
+ */
3169
+ EsTableComponent.prototype.handleGroupClick = function (group) {
3170
+ var casted = this.View;
3171
+ var anyG = group;
3172
+ anyG._expanded = !anyG._expanded;
3173
+ // Sono in modalità raggruppamento virtuale da array: Espandere significa rendere visibili tutti gli oggetti relativi a questo gruppo, viceversa il contrarre
3174
+ if (this.ArrayGrouping) {
3175
+ var allRelatives = this.boundSource.filter(function (t) { return (t._group && ((anyG._expanded && t._parent == anyG._thisKey) || (!anyG._expanded && t._parent && t._parent.startsWith(anyG._thisKey)))) ||
3176
+ (t._item && ((anyG._expanded && t._thisKey == anyG._thisKey) || (!anyG._expanded && t._thisKey.startsWith(anyG._thisKey)))); });
3177
+ allRelatives.forEach(function (t) {
3178
+ t._visible = anyG._expanded;
3179
+ if (t._group)
3180
+ t._expanded = false;
3181
+ });
3182
+ return;
3183
+ }
3184
+ if (anyG._expanded) {
3185
+ // Resetto ipp
3186
+ casted.itemsperpageoverride = 15;
3187
+ if (!casted.requestedgroups)
3188
+ casted.requestedgroups = [new GroupFilter(group.column, group.value)];
3189
+ else {
3190
+ var level = anyG._grouplevel;
3191
+ // se il gruppo cliccato non ha un livello è il primo gruppo, quindi ordinamento unico
3192
+ // altrimenti devo rimuovere tutti i filtri su livelli superiori al level cliccato e aggiungere il level cliccato
3193
+ if (!level)
3194
+ casted.requestedgroups = [new GroupFilter(group.column, group.value)];
3195
+ else {
3196
+ casted.requestedgroups = [];
3197
+ anyG._parentRoute.forEach(function (step) {
3198
+ casted.requestedgroups.push(new GroupFilter(step.column, step.value));
3199
+ });
3200
+ casted.requestedgroups.push(new GroupFilter(group.column, group.value));
3201
+ }
3202
+ }
3203
+ this.changed();
3204
+ this.emitSearchRequest(true);
2006
3205
  }
2007
- else
2008
- this.OrderDirectives = view.column_ordering;
3206
+ else {
3207
+ var path_1 = (anyG._parent || '') + group.value;
3208
+ // Se ho chiuso un gruppo non mi serve rieffettuare ricerce, mi basta eliminare dagli oggetti bindati tutti gli elementi sottostanti a quel gruppo
3209
+ this.boundSource = this.boundSource.filter(function (t) { return !t._parent || !t._parent.startsWith(path_1); });
3210
+ // devo però anche rimuovere eventuali cache relative
3211
+ this.groupSearchRequestsCache = this.groupSearchRequestsCache.filter(function (t) { return t.path != path_1; });
3212
+ }
3213
+ return true;
2009
3214
  };
2010
3215
  /**
2011
- * Applica l'ordine specificato alle varie colonne
3216
+ * Funzione che dato un valore lo formatta in base al tipo
2012
3217
  *
2013
- * @param {AppSearch<any>} view AppSearch da utilizzare per questa operazione
2014
- * @param {boolean} finalize Se **true** significa che non mi aspetto di dover effettuare altre operazioni e posso renderizzare la situazione in base ai RowContext
2015
- * Senza finalize significa che mi aspetto altre operazioni che prima o poi richiameranno questa funzione col finalize.
3218
+ * @param {string} value Valore che generalemnte può essere una data o un numero
3219
+ * @param {string} fromat Formato su cui formattare il valore. Può essere ad esempio "small", "long" "verylong" per le date o F{0-9} per i numeri decimali
2016
3220
  *
2017
- * Ad esempio, una volta selezionato ordinamento fisico/logico delle colonne so che parte un altra ricerca che mi rivalorizzera da "writeValue", che già chiama questa funzione.
2018
- * Mettendo solo la chiamata da "writeValue" come "finalizzante" mi assicuro che smanattamenti a frontend non causino flickering fino a quando non servono
3221
+ * @returns {string} Valore dell'aggregazione formattato come si deve
2019
3222
  */
2020
- EsTableComponent.prototype.applyOrdering = function (view, finalize) {
2021
- var _this = this;
2022
- // Genero ordinamento per gli header
2023
- var newHeaders = [];
2024
- // Se devo finalizzare aggancio tutte le variabili di bind
2025
- if (finalize) {
2026
- this.OrderDirectives.forEach(function (o) {
2027
- var heaedrItem = _this.TMPRowTHs.filter(function (t) { return t.ID == o; })[0];
2028
- newHeaders.push(heaedrItem);
2029
- });
2030
- this.TMPRowTHs = newHeaders;
2031
- var _loop_1 = function (i) {
2032
- var context = this_1.TMPRowTDs[this_1.RowContexts[i]];
2033
- var newContext = [];
2034
- this_1.OrderDirectives.forEach(function (o) {
2035
- var contextItem = context.filter(function (t) { return t.ID == o; })[0];
2036
- newContext.push(contextItem);
2037
- });
2038
- this_1.TMPRowTDs[this_1.RowContexts[i]] = newContext;
2039
- };
2040
- var this_1 = this;
2041
- // Genero ordinamento per le celle
2042
- for (var i = 0; i < this.RowContexts.length; i++) {
2043
- _loop_1(i);
2044
- }
3223
+ EsTableComponent.prototype.formatAggregationValue = function (value, format) {
3224
+ if (!format)
3225
+ return value;
3226
+ var isNumber = !Number.isNaN(value) && (!format || format.startsWith("F"));
3227
+ if (isNumber && format.startsWith("F") && !Number.isNaN(format.substr(1)))
3228
+ return parseFloat(value).toFixed(parseInt(format.substr(1)));
3229
+ var date = null;
3230
+ // Alcune versione di extensions rischiano di crashare con cose non date... è stato risolto dopo quindi questo try - catch in realtà
3231
+ // torna utile solo con versioni vecchie/deprecate della libreria @esfaenza/extensions
3232
+ try {
3233
+ date = this.dateExts.getDateConvertion(value);
2045
3234
  }
2046
- view.column_ordering = this.OrderDirectives;
2047
- this.changed();
3235
+ catch (_a) { }
3236
+ if (date)
3237
+ return this.dateExts.getFormatted(date, format == 'small', format == 'verylong');
3238
+ // Qui ci finisco sia per input che non sono né date né numeri, sia per formati non riconosciuti
3239
+ return value;
2048
3240
  };
2049
3241
  // #endregion
2050
3242
  // #region Gestione Operaizoni dialog ordinamento/visibilità colonne
@@ -2055,7 +3247,7 @@
2055
3247
  */
2056
3248
  EsTableComponent.prototype.sendUp = function (columnItem) {
2057
3249
  var itemIndex = this.TMPColumnsList.indexOf(columnItem);
2058
- if (this.TMPColumnsList[itemIndex - 1].fixed)
3250
+ if (this.TMPColumnsList[itemIndex - 1].fixed || this.TMPColumnsList[itemIndex - 1].pinned)
2059
3251
  return;
2060
3252
  this.utiExts.swap(this.TMPColumnsList, itemIndex, itemIndex - 1);
2061
3253
  // Non posso fare JSON.parse(JSON.stringify(this.ColumnsList)) perché contiene riferimenti a TemplateRef
@@ -2076,6 +3268,25 @@
2076
3268
  this.TMPColumnsList.forEach(function (c) { tmp.push(Object.assign({}, c)); });
2077
3269
  this.TMPColumnsList = tmp;
2078
3270
  };
3271
+ /**
3272
+ * All'interno della dialog "Ordinamento e Visibilità Colonne" pinna la colonna specificata
3273
+ *
3274
+ * @param {EsTableColumn} columnItem Colonna da spostare
3275
+ */
3276
+ EsTableComponent.prototype.pinOrUnpinColumn = function (columnItem) {
3277
+ var itemIndex = this.TMPColumnsList.indexOf(columnItem);
3278
+ // Sposto la colonna alla fine di tutte quelle pinnate. La cosa funziona in entrambi sensi:
3279
+ // 1) Se sto pinnando, devo metterla come ultima pinnata
3280
+ // 2) Se sto spinnando devo metterla come prima non pinnata
3281
+ // Coincidenza vuole che il punto 1 e 2 siano equivalenti
3282
+ for (var i = 0; i < this.TMPColumnsList.length; i++) {
3283
+ if (!this.TMPColumnsList[i].pinned) {
3284
+ this.arrayMove(this.TMPColumnsList, itemIndex, i);
3285
+ break;
3286
+ }
3287
+ }
3288
+ columnItem.pinned = !columnItem.pinned;
3289
+ };
2079
3290
  /**
2080
3291
  * All'interno della dialog "Ordinamento e Visibilità Colonne" inverte le impostazioni di visibilità della colonna
2081
3292
  *
@@ -2136,12 +3347,12 @@
2136
3347
  // Non permetto di non selezionare nulla
2137
3348
  if (this.TMPColumnsList.every(function (t) { return !t.visible; }))
2138
3349
  return false;
2139
- var castedView = this.View;
3350
+ var castedView = this.viewMode ? this.View : null;
2140
3351
  this.ColumnsList = [];
2141
3352
  this.TMPColumnsList.forEach(function (c) { _this.ColumnsList.push(Object.assign({}, c)); });
2142
3353
  this.refreshColumnOrdering();
2143
- this.refreshColumnsVisibility(null, null, castedView);
2144
3354
  this.applyOrdering(castedView, false);
3355
+ this.refreshColumnsVisibility(null, null, castedView);
2145
3356
  //Salvo le preferences di questa view
2146
3357
  //Di default registro ordinamento e visibilità delle colonne nella vista. Solo le cose di UI
2147
3358
  if (this.SavePreferences) {
@@ -2153,11 +3364,17 @@
2153
3364
  console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
2154
3365
  return false;
2155
3366
  }
2156
- var toStore = { columns: JSON.parse(JSON.stringify(castedView.columns)), column_ordering: JSON.parse(JSON.stringify(castedView.column_ordering)) };
3367
+ var columns = this.arrayMode ? this.arrayColumns : castedView.columns;
3368
+ var columnsOrderings = this.arrayMode ? this.arrayColumnOrdering : castedView.column_ordering;
3369
+ var toStore = { columns: JSON.parse(JSON.stringify(columns)), column_ordering: JSON.parse(JSON.stringify(columnsOrderings)) };
2157
3370
  this.prefService.store(this.ngControl.name, toStore);
2158
3371
  }
3372
+ // Rieseguo l'ultima ricerca bindata alla tabella
2159
3373
  // Mi assicuro di farlo dopo l'espansione del changed o rischio che la ricerca mi ridia colonne che in realtà non esistono
2160
- setTimeout(function () { _this.emitSearchRequest(false); });
3374
+ if (this.viewMode)
3375
+ setTimeout(function () { _this.emitSearchRequest(false); });
3376
+ else if (this.arrayMode)
3377
+ setTimeout(function () { _this.internalWriteValue(); });
2161
3378
  // Lo vorrei mettere lato template ma no
2162
3379
  this.lastSelectedItemID = null;
2163
3380
  return true;
@@ -2167,7 +3384,10 @@
2167
3384
  */
2168
3385
  EsTableComponent.prototype.globalColVisCheckChanged = function () {
2169
3386
  var _this = this;
2170
- this.TMPColumnsList.forEach(function (t) { t.visible = _this.globalColVisCheck; });
3387
+ this.TMPColumnsList.forEach(function (t) {
3388
+ if (!t.fixed)
3389
+ t.visible = _this.globalColVisCheck;
3390
+ });
2171
3391
  };
2172
3392
  // #endregion
2173
3393
  // #region Gestione data source gerarchici
@@ -2215,9 +3435,9 @@
2215
3435
  var obj = objs[i];
2216
3436
  // Se la parentKey non è valorizzata, questo è il livello 0 (1... perché gli 0 son perciolosi)
2217
3437
  if (!obj[this.ParentKey] && levelToAssign == 1) {
2218
- obj.level = 1;
2219
- obj.visible = true;
2220
- obj.expanded = this.StartsExpanded;
3438
+ obj._level = 1;
3439
+ obj._visible = true;
3440
+ obj._expanded = this.StartsExpanded;
2221
3441
  assigned++;
2222
3442
  continue;
2223
3443
  }
@@ -2227,13 +3447,13 @@
2227
3447
  for (var p = 0; p < objs.length; p++) {
2228
3448
  var possibleParent = objs[p];
2229
3449
  // Trovato il parent dell'item, assegno all'item il livello giusto
2230
- if (possibleParent[this.OwnKey] == obj[this.ParentKey] && possibleParent.level == levelToAssign - 1) {
2231
- obj.level = levelToAssign;
3450
+ if (possibleParent[this.OwnKey] == obj[this.ParentKey] && possibleParent._level == levelToAssign - 1) {
3451
+ obj._level = levelToAssign;
2232
3452
  // So che questo item ha un parent. Ribadisco che il parent è espanso in base alle impostazione e stessa logica
2233
3453
  // per la visibilità del figlio
2234
- possibleParent.expanded = this.StartsExpanded;
3454
+ possibleParent._expanded = this.StartsExpanded;
2235
3455
  possibleParent.parent = true;
2236
- obj.visible = this.StartsExpanded;
3456
+ obj._visible = this.StartsExpanded;
2237
3457
  assigned++;
2238
3458
  break;
2239
3459
  }
@@ -2252,12 +3472,12 @@
2252
3472
  var obj = this.boundSource[i];
2253
3473
  // Trovo il parent con quell'id e lo espando
2254
3474
  if (obj[this.OwnKey] == key) {
2255
- obj.expanded = true;
3475
+ obj._expanded = true;
2256
3476
  for (var ic = 0; ic < this.boundSource.length; ic++) {
2257
3477
  var child = this.boundSource[ic];
2258
3478
  // Trovo tutti i child di quel parent e li rendo visibili
2259
3479
  if (child[this.ParentKey] == key)
2260
- child.visible = true;
3480
+ child._visible = true;
2261
3481
  }
2262
3482
  return;
2263
3483
  }
@@ -2273,7 +3493,7 @@
2273
3493
  var obj = this.boundSource[i];
2274
3494
  // Trovo il parent con quell'id e lo collasso
2275
3495
  if (obj[this.OwnKey] == key) {
2276
- obj.expanded = false;
3496
+ obj._expanded = false;
2277
3497
  // Collasso/nascondo tutti i child del parent
2278
3498
  this.collapseChildOfParent(key);
2279
3499
  return;
@@ -2291,16 +3511,105 @@
2291
3511
  // Trovo tutti i child di quel parent e li rendo invisibili. Se il child trovato è a sua volta un parent,
2292
3512
  // lo collasso e vado in ricorsione sui figli
2293
3513
  if (child[this.ParentKey] == parentKey && !child.parent)
2294
- child.visible = false;
3514
+ child._visible = false;
2295
3515
  else if (child[this.ParentKey] == parentKey && child.parent) {
2296
- child.expanded = false;
2297
- child.visible = false;
3516
+ child._expanded = false;
3517
+ child._visible = false;
2298
3518
  this.collapseChildOfParent(child[this.OwnKey]);
2299
3519
  }
2300
3520
  }
2301
3521
  };
2302
3522
  // #endregion
2303
3523
  // #region Gestione Selezione
3524
+ /**
3525
+ * Valuta quali elementi devono essere marcati come selezionati nella vista attuale. Si basa sull'oggetto **selection** interno all'AppSearch
3526
+ *
3527
+ * @param {any[]} items Oggetti di cui valutare la selezione
3528
+ * @param {ItemsSelection<any>} selectionItem Oggetti di selezione derivante dalla view o dall'oggetto per Array
3529
+ */
3530
+ EsTableComponent.prototype.evaluateSelection = function (items, selectionItem) {
3531
+ if (!selectionItem)
3532
+ return;
3533
+ this.handleSelectionEvaluation(items, selectionItem);
3534
+ };
3535
+ /**
3536
+ * Implementazione agnostica della valutazione delle selezioni degli oggetti. Richiede gli oggetti della vista attuale e l'itemSelector
3537
+ *
3538
+ * @param {any[]} items Oggetti di cui aggiornare lo stato di selezione
3539
+ * @param {ItemsSelection<any>} selectionItem Oggetto contenente lo stato attuale di selezione
3540
+ */
3541
+ EsTableComponent.prototype.handleSelectionEvaluation = function (items, selectionItem) {
3542
+ for (var i = 0; i < items.length; i++) {
3543
+ var itm = items[i];
3544
+ var hash = itm._hash;
3545
+ var itemGroup = itm._group ? null : this.getItemGroup(itm);
3546
+ // Reidrato la cache di selezione coi nuovi oggetti altrimenti non riuscirei a beccare gli indici giusti
3547
+ // Dopodiché la uso per calcolare istantaneamente se gli oggetti sono selezionati o no
3548
+ this.rehidrateCache(itm);
3549
+ if (itm._item) {
3550
+ if (selectionItem.all)
3551
+ itm._selected = !this.exclusionsCache.has(hash) && ((!this.groupsCache.has(itemGroup === null || itemGroup === void 0 ? void 0 : itemGroup._hash) && this.itemsCache.has(hash)) || !this.group_exclusionsCache.has(itemGroup === null || itemGroup === void 0 ? void 0 : itemGroup._hash));
3552
+ else
3553
+ itm._selected = !this.exclusionsCache.has(hash) && (this.groupsCache.has(itemGroup === null || itemGroup === void 0 ? void 0 : itemGroup._hash) || this.itemsCache.has(hash) || (this.parentTreeStatus(itemGroup) == 'included' && !this.group_exclusionsCache.has(itemGroup === null || itemGroup === void 0 ? void 0 : itemGroup._hash)));
3554
+ }
3555
+ else if (itm._group) {
3556
+ if (selectionItem.all)
3557
+ itm._selected = !this.group_exclusionsCache.has(hash) && this.parentTreeStatus(itm) != 'excluded';
3558
+ else
3559
+ itm._selected = this.groupsCache.has(hash) || (this.parentTreeStatus(itm) == 'included' && !this.group_exclusionsCache.has(hash));
3560
+ }
3561
+ }
3562
+ // Se tutti gli oggetti di questa pagina sono solezionati allora posso mettere il global check a true
3563
+ // Se sono in situazione di all-select anche metto la global checkbox, nonostante ci possano essere delle esclusioni
3564
+ this.globalCheck = this.boundSource.filter(function (t) { return t._group || t._item; }).every(function (t) { return t._selected; });
3565
+ this.canSelectAll = selectionItem.count > 0 && this.SelectAll;
3566
+ // Potrebbe cambiare qualora qualcuno inserisse dati a manazza in modalità Array e desse il refresh manuale alla tabella
3567
+ // Comunque costa 0 quindi mi permetto di refreshare
3568
+ if (this.arrayMode) {
3569
+ var prevSelected = this.selectedObjects;
3570
+ this.finalizeSelectionInformations(selectionItem);
3571
+ if (this.selectedObjects != prevSelected)
3572
+ this.onSelectionChanged.emit(selectionItem);
3573
+ }
3574
+ };
3575
+ /**
3576
+ * Dato un oggetto trova la cella di cache in cui è registrato e aggiorna il contenuto
3577
+ *
3578
+ * @param {any} item Oggetto da aggiornare
3579
+ */
3580
+ EsTableComponent.prototype.rehidrateCache = function (item) {
3581
+ var ctx = item._hash;
3582
+ if (this.itemsCache.has(ctx))
3583
+ this.itemsCache.set(ctx, item);
3584
+ if (this.group_exclusionsCache.has(ctx))
3585
+ this.group_exclusionsCache.set(ctx, item);
3586
+ if (this.groupsCache.has(ctx))
3587
+ this.groupsCache.set(ctx, item);
3588
+ if (this.exclusionsCache.has(ctx))
3589
+ this.exclusionsCache.set(ctx, item);
3590
+ };
3591
+ /**
3592
+ * Dato un gruppo controlla ricorsivamente l'albero di cui fa parte se c'è stata una inclusione o esclusione diretta
3593
+ *
3594
+ * @param {any} grp Gruppo da controllare
3595
+ *
3596
+ * @returns {'none' | 'excluded' | 'included'}
3597
+ * 'none' se non ci sono informazioni su inclusioni o esclusioni
3598
+ * 'included' se il gruppo controllato è stato incluso in maniera esplicita dall'albero dei gruppi padri
3599
+ * 'excluded' se il gruppo controllato è stato escluso in maniera esplicita dall'albero dei gruppi padri
3600
+ */
3601
+ EsTableComponent.prototype.parentTreeStatus = function (grp) {
3602
+ if (!grp)
3603
+ return 'none';
3604
+ var parentGroup = this.rgGroupCache.get(grp._parent);
3605
+ if (!parentGroup)
3606
+ return 'none';
3607
+ if (this.group_exclusionsCache.has(parentGroup._hash))
3608
+ return 'excluded';
3609
+ if (this.groupsCache.has(parentGroup._hash))
3610
+ return 'included';
3611
+ return this.parentTreeStatus(parentGroup);
3612
+ };
2304
3613
  /**
2305
3614
  * Gestisce la selezione globale degli oggetti, sia per pagina che a livello di **SelectAll**
2306
3615
  *
@@ -2308,7 +3617,8 @@
2308
3617
  */
2309
3618
  EsTableComponent.prototype.globalCheckChanged = function (forcedVal) {
2310
3619
  if (forcedVal === void 0) { forcedVal = null; }
2311
- var items = this.getItemsByMode();
3620
+ // Prendo tutti gli elementi presenti in questa vista. Se ho gruppi prendo solo i gruppi a livello 0, altrimenti prendo tutti gli oggetti per selezionarli
3621
+ var items = this.boundSource.find(function (t) { return t._group; }) ? this.boundSource.filter(function (t) { return t._group && !t._parent; }) : this.boundSource;
2312
3622
  var itemSelection = this.handleItemsSelection(items, forcedVal, this.globalCheck);
2313
3623
  this.changed();
2314
3624
  this.onSelectionChanged.emit(itemSelection);
@@ -2327,14 +3637,14 @@
2327
3637
  EsTableComponent.prototype.handleItemsSelection = function (items, forcedVal, globalCheck) {
2328
3638
  if (forcedVal === void 0) { forcedVal = null; }
2329
3639
  if (globalCheck === void 0) { globalCheck = null; }
2330
- var _a, _b;
2331
- var selectionItem = ((_a = this.View) === null || _a === void 0 ? void 0 : _a.selection) || this.arraymodeSelection;
3640
+ var _a, _b, _c;
3641
+ var si = ((_a = this.View) === null || _a === void 0 ? void 0 : _a.selection) || this.arraymodeSelection;
2332
3642
  // Se sono in modalità di selezione singola e devo selezionare un'oggetto, per prima cosa devo deselezionare tutti gli altri
2333
- if (this.SingleSelection && ((_b = items[0]) === null || _b === void 0 ? void 0 : _b._selected)) {
3643
+ if (this.SingleSelection && ((_b = items[0]) === null || _b === void 0 ? void 0 : _b._selected) && !((_c = items[0]) === null || _c === void 0 ? void 0 : _c._group)) {
2334
3644
  if (items.length > 1 && forcedVal == null)
2335
3645
  throw "Tentativo di selezionare o deselezionare più di un elemento con SingleSelection attivo";
2336
3646
  if (items.length == 1 && forcedVal == null) {
2337
- selectionItem = this.handleItemsSelection(this.getItemsByMode(), false, null);
3647
+ si = this.handleItemsSelection(this.boundSource.filter(function (t) { return !t._group; }), false, null);
2338
3648
  items[0]._selected = true;
2339
3649
  }
2340
3650
  }
@@ -2344,59 +3654,385 @@
2344
3654
  // Se dev'essere overridato il valore di check effettuo l'override o col valore forzato o col valore globale
2345
3655
  if (toChange && !item.locked)
2346
3656
  item._selected = forcedVal != null ? forcedVal : this.globalCheck;
2347
- if (selectionItem.all) {
2348
- // In caso di "seleziona tutto"...
2349
- // N.B: la selOrDeselCache agisce come cache di DESELEZIONE in questo blocco di codice
2350
- if (item._selected && this.selOrDeselCache[item.hash]) {
2351
- // Oggetto selezionato: lo rimuovo dalle esclusioni di selezione
2352
- selectionItem.exclusions.splice(selectionItem.exclusions.indexOf(this.selOrDeselCache[item.hash]), 1);
2353
- delete this.selOrDeselCache[item.hash];
2354
- }
2355
- else if (!item._selected && !this.selOrDeselCache[item.hash]) {
2356
- // Oggetto deselezionato: lo aggiungo alle esclusioni di selezione
2357
- this.selOrDeselCache[item.hash] = item;
2358
- selectionItem.exclusions.push(item);
2359
- }
3657
+ // Se il valore non dev'essere variato e vengo da una selezione globale semplicemente evito di effettuare operaizoni inutili. L'item/gruppo è già nello stato giusto
3658
+ if (!toChange && globalCheck != null)
3659
+ continue;
3660
+ var allSelection = si.all;
3661
+ var isGroup = item._group;
3662
+ var isSelection = item._selected;
3663
+ var itemGroup = null, allItems = null, selectedItems = null, unselectedItems = null, allGroups = null, selectedGroups = null, unselectedGroups = null, parentGroupSelected = null, parentGroupUnselected = null;
3664
+ if (isGroup) {
3665
+ var pts = this.parentTreeStatus(item);
3666
+ parentGroupSelected = pts == 'included';
3667
+ parentGroupUnselected = pts == 'excluded';
3668
+ allItems = this.getGroupItems(si, item, null, true);
3669
+ selectedItems = this.getGroupItems(si, item, 'selected', true, allItems);
3670
+ unselectedItems = this.getGroupItems(si, item, 'unselected', true, allItems);
3671
+ allGroups = this.getGroupChildGroups(si, item, null, true);
3672
+ selectedGroups = this.getGroupChildGroups(si, item, 'selected', true, allGroups);
3673
+ unselectedGroups = this.getGroupChildGroups(si, item, 'unselected', true, allGroups);
2360
3674
  }
2361
3675
  else {
2362
- //In caso di non "seleziona tutto"...
2363
- // N.B: la selOrDeselCache agisce come cache di SELEZIONE in questo blocco di codice
2364
- if (item._selected && !this.selOrDeselCache[item.hash]) {
2365
- // Oggetto selezionato: lo aggiungo alla selezione attuale
2366
- this.selOrDeselCache[item.hash] = item;
2367
- selectionItem.items.push(item);
2368
- }
2369
- else if (!item._selected && this.selOrDeselCache[item.hash]) {
2370
- // Oggetto deselezionato: lo rimuovo dalla selezione attuale
2371
- selectionItem.items.splice(selectionItem.items.indexOf(this.selOrDeselCache[item.hash]), 1);
2372
- delete this.selOrDeselCache[item.hash];
2373
- }
3676
+ itemGroup = this.getItemGroup(item);
3677
+ parentGroupSelected = itemGroup == null ? null : itemGroup._selected;
3678
+ parentGroupUnselected = itemGroup == null ? null : !itemGroup._selected;
2374
3679
  }
3680
+ if (!this.ArrayGrouping)
3681
+ this.performSelectionOperations(si, item, allSelection, isGroup, isSelection, selectedItems, selectedGroups, unselectedItems, unselectedGroups, allItems, allGroups, parentGroupSelected, parentGroupUnselected);
3682
+ else
3683
+ this.performSimpleSelectionOperations(si, item, isGroup, isSelection, itemGroup, selectedItems, unselectedItems, allItems, allGroups);
2375
3684
  }
2376
3685
  // Imposto il check globale in base a se tutti gli elementi sono selezionati o meno.
2377
3686
  // Evito di fare queste operazioni se la selezione deriva proprio dal global Check
2378
- // Non è ottimizzatissimo mettere 2 some ma scrivere questo codice a for sono tipo 25 righe....
2379
3687
  if (globalCheck == null)
2380
- this.globalCheck = !items.some(function (t) { return !t._selected; }) && !this.getItemsByMode().some(function (t) { return !t._selected; });
2381
- this.finalizeSelectionInformations(selectionItem);
2382
- return selectionItem;
3688
+ this.globalCheck = !this.boundSource.some(function (t) { return !t._selected && !t._sep; });
3689
+ this.finalizeSelectionInformations(si);
3690
+ return si;
3691
+ };
3692
+ /**
3693
+ * Dato L'oggetto di selezione, l'oggetto da selezionare/deselezionare e tutti i parametri del caso effettua le operazioni che servono.
3694
+ *
3695
+ * Logica semplificata rispetto all'originale **performSelectionOperations** per lavorare in una modalità in cui tutti gli elementi sono caricati (**ArrayGrouping** = true)
3696
+ */
3697
+ EsTableComponent.prototype.performSimpleSelectionOperations = function (base, item, group, sel, itm_group, sel_itm, desel_itm, all_itms, all_grps) {
3698
+ var _this = this;
3699
+ var tripticItem = this.getTriptic('item', base);
3700
+ if (group) {
3701
+ if (sel) {
3702
+ all_grps.forEach(function (gr) { gr._selected = true; });
3703
+ if (desel_itm)
3704
+ desel_itm.forEach(function (el) { el._selected = true; _this.addItem(el, tripticItem); });
3705
+ }
3706
+ else {
3707
+ all_grps.forEach(function (gr) { gr._selected = false; });
3708
+ if (sel_itm)
3709
+ sel_itm.forEach(function (el) { el._selected = false; _this.removeItem(el, tripticItem); });
3710
+ }
3711
+ }
3712
+ else {
3713
+ if (sel) {
3714
+ this.addItem(item, tripticItem);
3715
+ if (itm_group && all_itms && all_itms.every(function (t) { return t._selected; }))
3716
+ this.selectGroup(itm_group);
3717
+ }
3718
+ else {
3719
+ this.removeItem(item, tripticItem);
3720
+ if (itm_group)
3721
+ itm_group._selected = false;
3722
+ }
3723
+ }
3724
+ };
3725
+ /**
3726
+ * Helper per selezionare un gruppo e, ricorsivamente, se tutti i gruppi sottostanti al parent sono selezionati, selezionare i gruppi padri
3727
+ *
3728
+ * @param {any} group Gruppo da selezionare
3729
+ */
3730
+ EsTableComponent.prototype.selectGroup = function (group) {
3731
+ group._selected = true;
3732
+ var parent = this.getGroupParent(group);
3733
+ if (parent && this.getGroupChildGroups(null, parent, null, true).every(function (t) { return t._selected; }))
3734
+ this.selectGroup(parent);
3735
+ };
3736
+ /**
3737
+ * Dato L'oggetto di selezione, l'oggetto da selezionare/deselezionare e tutti i parametri del caso effettua le operazioni che servono.
3738
+ *
3739
+ * La logica di questa funzione è nata essenzialmente da spam di trial & error ed è stata testata solo fino a due livelli di raggruppamento,
3740
+ * qualsiasi cosa vada oltre non è 100% detto che funzioni...
3741
+ */
3742
+ EsTableComponent.prototype.performSelectionOperations = function (base, item, all, group, sel, sel_itm, sel_grp, desel_itm, desel_grp, all_itms, all_grps, parent_incl, parent_excl) {
3743
+ var _this = this;
3744
+ var tripticGroup = this.getTriptic('group', base);
3745
+ var tripticItem = this.getTriptic('item', base);
3746
+ var tripticExcl = this.getTriptic('exclusion', base);
3747
+ var tripticgrpExcl = this.getTriptic('group_exclusion', base);
3748
+ if (group) {
3749
+ if (sel) {
3750
+ if (all || parent_incl)
3751
+ this.removeItem(item, tripticgrpExcl);
3752
+ else
3753
+ this.addItem(item, tripticGroup);
3754
+ if (sel_itm)
3755
+ sel_itm.forEach(function (el) { return _this.removeItem(el, tripticItem); });
3756
+ if (sel_grp)
3757
+ sel_grp.forEach(function (gr) { return _this.removeItem(gr, tripticGroup); });
3758
+ if (all_itms)
3759
+ all_itms.forEach(function (el) { el._selected = true; _this.removeItem(el, tripticExcl); });
3760
+ if (all_grps)
3761
+ all_grps.forEach(function (gr) { gr._selected = true; _this.removeItem(gr, tripticgrpExcl); });
3762
+ }
3763
+ else {
3764
+ if (all || parent_incl)
3765
+ this.addItem(item, tripticgrpExcl);
3766
+ else
3767
+ this.removeItem(item, tripticGroup);
3768
+ if (desel_itm)
3769
+ desel_itm.forEach(function (el) { return _this.removeItem(el, tripticExcl); });
3770
+ if (desel_grp)
3771
+ desel_grp.forEach(function (gr) { return _this.removeItem(gr, tripticExcl); });
3772
+ if (all_itms)
3773
+ all_itms.forEach(function (el) { el._selected = false; _this.removeItem(el, tripticItem); });
3774
+ if (all_grps)
3775
+ all_grps.forEach(function (gr) { gr._selected = false; _this.removeItem(gr, tripticGroup); });
3776
+ }
3777
+ }
3778
+ else {
3779
+ if (sel) {
3780
+ if ((parent_excl == null && all) || parent_incl)
3781
+ this.removeItem(item, tripticExcl);
3782
+ else
3783
+ this.addItem(item, tripticItem);
3784
+ }
3785
+ else {
3786
+ if (parent_excl || (!all && parent_excl == null))
3787
+ this.removeItem(item, tripticItem);
3788
+ else
3789
+ this.addItem(item, tripticExcl);
3790
+ }
3791
+ }
3792
+ };
3793
+ /**
3794
+ * Helper per evitare di riscrivere ogni santa volta array.splice(array.indexof(item), 1);
3795
+ */
3796
+ EsTableComponent.prototype.removeItem = function (item, triptic) {
3797
+ var index = triptic.index_cache.get(item._hash);
3798
+ if (index != null) {
3799
+ triptic.cache.delete(item._hash);
3800
+ triptic.index_cache.delete(item._hash);
3801
+ triptic.array[index] = null;
3802
+ }
3803
+ return !!index;
3804
+ };
3805
+ /**
3806
+ * Helper per evitare di riscrivere ogni santa volta array.push(item); e la gestione della
3807
+ */
3808
+ EsTableComponent.prototype.addItem = function (item, triptic) {
3809
+ if (triptic.index_cache.get(item._hash) == null) {
3810
+ var i = triptic.array.push(item) - 1;
3811
+ triptic.cache.set(item._hash, item);
3812
+ triptic.index_cache.set(item._hash, i);
3813
+ return true;
3814
+ }
3815
+ return false;
3816
+ };
3817
+ /**
3818
+ * Ottiene il trittico di selezione: L'array degli oggetti e le due cache
3819
+ */
3820
+ EsTableComponent.prototype.getTriptic = function (subject, base) {
3821
+ switch (subject) {
3822
+ case 'group':
3823
+ return new CacheTriptic(this.groupsCache, this.i_groupsCache, base.groups);
3824
+ case 'item':
3825
+ return new CacheTriptic(this.itemsCache, this.i_itemsCache, base.items);
3826
+ case 'group_exclusion':
3827
+ return new CacheTriptic(this.group_exclusionsCache, this.i_group_exclusionsCache, base.group_exclusions);
3828
+ case 'exclusion':
3829
+ return new CacheTriptic(this.exclusionsCache, this.i_exclusionsCache, base.exclusions);
3830
+ }
3831
+ };
3832
+ /**
3833
+ * Dato un oggetto restituisce il gruppo di cui fa parte, se esiste
3834
+ *
3835
+ * @param {any} item Oggetto di cui trovare il gruppo
3836
+ */
3837
+ EsTableComponent.prototype.getItemGroup = function (item) {
3838
+ var parent = this.rgGroupCache.get(item._thisKey);
3839
+ if (parent)
3840
+ return parent;
3841
+ return null;
3842
+ };
3843
+ /**
3844
+ * Data la chiave di un gruppo restituisce tutti gli oggetti con quella chiave
3845
+ *
3846
+ * @param {any} group Chiave da cercare
3847
+ * @param {'selected' | 'unselected'} status Stato degli elementi, selezionati o no
3848
+ * @param {boolean} recursive Indica se cercare solo gli elementi direttamente collegati o se prendere anche quelli dei gruppi figli
3849
+ *
3850
+ * @returns {any[]} Oggetti di tipo **_item** facenti capo alla chiave **groupKey**
3851
+ */
3852
+ EsTableComponent.prototype.getGroupItems = function (sel, group, status, recursive, allbase) {
3853
+ var e_3, _s;
3854
+ if (recursive === void 0) { recursive = false; }
3855
+ if (allbase === void 0) { allbase = null; }
3856
+ var items = [];
3857
+ if (allbase)
3858
+ items = allbase;
3859
+ else {
3860
+ if (recursive) {
3861
+ try {
3862
+ // In modalità ricorsiva prendo gli oggetti di tutte le chiavi simili che trovo
3863
+ for (var _t = __values(this.rgItemCache.keys()), _u = _t.next(); !_u.done; _u = _t.next()) {
3864
+ var key = _u.value;
3865
+ if (key.startsWith(group._thisKey))
3866
+ items.push.apply(items, __spread(this.rgItemCache.get(key)));
3867
+ }
3868
+ }
3869
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
3870
+ finally {
3871
+ try {
3872
+ if (_u && !_u.done && (_s = _t.return)) _s.call(_t);
3873
+ }
3874
+ finally { if (e_3) throw e_3.error; }
3875
+ }
3876
+ }
3877
+ else
3878
+ items = this.rgItemCache.get(group._thisKey);
3879
+ }
3880
+ items = items.filter(function (t) { return !status || (t._selected && status == 'selected') || (!t._selected && status == 'unselected'); });
3881
+ // Non trovo nessun oggetto, però magari di oggetti ne ho all'interno dell'oggetto di selezione.
3882
+ // Questo può essere vero solo se NON sono in modalità array, in caso contrario gli oggetti li devo per forza avere tutti
3883
+ if (items.length != 0 || !sel || this.arrayMode)
3884
+ return items;
3885
+ if (status == 'unselected')
3886
+ items = sel.exclusions.filter(function (t) { return t != null &&
3887
+ (!recursive && t._thisKey == group._thisKey) ||
3888
+ (recursive && t._thisKey.startsWith(group._thisKey)); });
3889
+ else if (status == 'selected')
3890
+ items = sel.items.filter(function (t) { return t != null &&
3891
+ (!recursive && t._thisKey == group._thisKey) ||
3892
+ (recursive && t._thisKey.startsWith(group._thisKey)); });
3893
+ return items;
3894
+ };
3895
+ /**
3896
+ * Data la chiave di un gruppo restituisce tutti gli oggetti con quella chiave
3897
+ *
3898
+ * @param {any} group Gruppo di cui cercare il parent
3899
+ *
3900
+ * @returns {any} Oggetto di tipo **_group** rappresentante il parent del **group** attuale
3901
+ */
3902
+ EsTableComponent.prototype.getGroupParent = function (group) {
3903
+ var parent = this.rgGroupCache.get(group._parent);
3904
+ if (parent)
3905
+ return parent;
3906
+ return null;
3907
+ };
3908
+ /**
3909
+ * Data la chiave di un gruppo restituisce tutti i gruppi figli
3910
+ *
3911
+ * @param {string} group Gruppo che rappresenta il padre di cui cercare i figli
3912
+ * @param {'selected' | 'unselected'} status Stato dei gruppi, selezionati o no
3913
+ * @param {boolean} recursive Indica se cercare solo i gruppi direttamente collegati o se prendere anche quelli dei gruppi figli
3914
+ *
3915
+ * @returns {any[]} Oggetti di tipo **_group** facenti capo alla chiave **groupKey**
3916
+ */
3917
+ EsTableComponent.prototype.getGroupChildGroups = function (sel, group, status, recursive, allbase) {
3918
+ var e_4, _s;
3919
+ if (recursive === void 0) { recursive = false; }
3920
+ if (allbase === void 0) { allbase = null; }
3921
+ var thisGroup = this.rgGroupCache.get(group._thisKey);
3922
+ var items = [];
3923
+ if (allbase)
3924
+ items = allbase;
3925
+ else {
3926
+ if (recursive) {
3927
+ try {
3928
+ // In modalità ricorsiva prendo gli oggetti di tutte le chiavi simili che trovo
3929
+ for (var _t = __values(this.rgChildGroupsCache.keys()), _u = _t.next(); !_u.done; _u = _t.next()) {
3930
+ var key = _u.value;
3931
+ if (key.startsWith(group._thisKey))
3932
+ items.push.apply(items, __spread(this.rgChildGroupsCache.get(key)));
3933
+ }
3934
+ }
3935
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
3936
+ finally {
3937
+ try {
3938
+ if (_u && !_u.done && (_s = _t.return)) _s.call(_t);
3939
+ }
3940
+ finally { if (e_4) throw e_4.error; }
3941
+ }
3942
+ }
3943
+ else
3944
+ items = this.rgChildGroupsCache.get(group._thisKey);
3945
+ }
3946
+ items = items.filter(function (t) { return !status || (t._selected && status == 'selected') || (!t._selected && status == 'unselected'); });
3947
+ // Non trovo nessun oggetto, però magari di oggetti ne ho all'interno dell'oggetto di selezione
3948
+ if (items.length != 0 || !sel)
3949
+ return items;
3950
+ if (status == 'unselected')
3951
+ items = sel.group_exclusions.filter(function (t) { return t != null && ((!recursive && t._thisRoute.length == thisGroup._thisRoute.length + 1 && t._thisRoute.startsWith(group._thisKey)) ||
3952
+ (recursive && t._thisKey.startsWith(group._thisKey))); });
3953
+ else
3954
+ items = sel.groups.filter(function (t) { return t != null && ((!recursive && t._thisRoute.length == thisGroup._thisRoute.length + 1 && t._thisRoute.startsWith(group._thisKey)) ||
3955
+ (recursive && t._thisKey.startsWith(group._thisKey))); });
3956
+ return items;
2383
3957
  };
2384
3958
  /**
2385
3959
  * Finalizza le informazioni di selezione del **ItemsSelection** corrente
2386
3960
  */
2387
3961
  EsTableComponent.prototype.finalizeSelectionInformations = function (selectionItem) {
3962
+ // Dato che le delete sono logiche dato che tengo la cache degli indici devo renderle fisiche
3963
+ var tmpGrp = [], tmpItems = [], tmpExcl = [], tmpGrpExcl = [];
3964
+ var grpRemoved = false, itemsRemoved = false, exclRemoved = false, grpExclRemoved = false;
3965
+ for (var i = 0; i < selectionItem.items.length; i++)
3966
+ if (selectionItem.items[i] != null)
3967
+ tmpItems.push(selectionItem.items[i]);
3968
+ else
3969
+ itemsRemoved = true;
3970
+ for (var i = 0; i < selectionItem.groups.length; i++)
3971
+ if (selectionItem.groups[i] != null)
3972
+ tmpGrp.push(selectionItem.groups[i]);
3973
+ else
3974
+ grpRemoved = true;
3975
+ for (var i = 0; i < selectionItem.exclusions.length; i++)
3976
+ if (selectionItem.exclusions[i] != null)
3977
+ tmpExcl.push(selectionItem.exclusions[i]);
3978
+ else
3979
+ exclRemoved = true;
3980
+ for (var i = 0; i < selectionItem.group_exclusions.length; i++)
3981
+ if (selectionItem.group_exclusions[i] != null)
3982
+ tmpGrpExcl.push(selectionItem.group_exclusions[i]);
3983
+ else
3984
+ grpExclRemoved = true;
3985
+ selectionItem.items = tmpItems;
3986
+ selectionItem.group_exclusions = tmpGrpExcl;
3987
+ selectionItem.exclusions = tmpExcl;
3988
+ selectionItem.groups = tmpGrp;
3989
+ // Le cache degli indici potrebbero avere buchi, risolvo
3990
+ if (grpRemoved)
3991
+ this.i_groupsCache = this.compactIndexMap(this.i_groupsCache);
3992
+ if (itemsRemoved)
3993
+ this.i_itemsCache = this.compactIndexMap(this.i_itemsCache);
3994
+ if (exclRemoved)
3995
+ this.i_exclusionsCache = this.compactIndexMap(this.i_exclusionsCache);
3996
+ if (grpExclRemoved)
3997
+ this.i_group_exclusionsCache = this.compactIndexMap(this.i_group_exclusionsCache);
3998
+ // Poi riprendo a fare tutto in normalità
2388
3999
  selectionItem.count = this.evaluateSelected();
2389
4000
  // Se ho fatto selezione "all" ma poi mi sono messo a togliere tutti gli elementi fino a rimanerne 0 resetto l'oggetto di selezione
2390
- if (selectionItem.count == 0 && selectionItem.all) {
4001
+ if (selectionItem.count == 0) {
4002
+ this.boundSource.forEach(function (t) { return t._selected = false; });
2391
4003
  selectionItem.all = false;
2392
4004
  selectionItem.exclusions = [];
2393
4005
  selectionItem.items = [];
4006
+ selectionItem.groups = [];
4007
+ selectionItem.group_exclusions = [];
2394
4008
  // Ripulisco la cache altrimenti mi rimane piena di tutte le esclusioni
2395
- this.selOrDeselCache = {};
4009
+ this.clearSelectionCaches();
2396
4010
  }
2397
4011
  // Se la possibilità di fare "Seleziona tutto" è abilitata allora la considero appena mi viene selezionato qualcosa
2398
4012
  this.canSelectAll = selectionItem.count > 0 && this.SelectAll;
2399
4013
  };
4014
+ /**
4015
+ * Compatta una cache di indici
4016
+ */
4017
+ EsTableComponent.prototype.compactIndexMap = function (map) {
4018
+ var e_5, _s;
4019
+ var index = 0;
4020
+ var ret = new Map();
4021
+ try {
4022
+ for (var _t = __values(map.keys()), _u = _t.next(); !_u.done; _u = _t.next()) {
4023
+ var key = _u.value;
4024
+ ret.set(key, index++);
4025
+ }
4026
+ }
4027
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
4028
+ finally {
4029
+ try {
4030
+ if (_u && !_u.done && (_s = _t.return)) _s.call(_t);
4031
+ }
4032
+ finally { if (e_5) throw e_5.error; }
4033
+ }
4034
+ return ret;
4035
+ };
2400
4036
  /**
2401
4037
  * Gestisce i click sulla tabella, gestendo eventualmente anche gli Shift + Click per selezionare un range di oggetti
2402
4038
  *
@@ -2415,7 +4051,7 @@
2415
4051
  var selecteditems = [];
2416
4052
  if (event.shiftKey && this.ShiftClick && !this.SingleSelection) {
2417
4053
  var startSelecting = false;
2418
- var items = this.getItemsByMode();
4054
+ var items = this.boundSource.filter(function (t) { return !t._group && !t._sep; });
2419
4055
  for (var i = 0; i < items.length; i++) {
2420
4056
  var t = items[i];
2421
4057
  if (startSelecting) {
@@ -2448,8 +4084,10 @@
2448
4084
  */
2449
4085
  EsTableComponent.prototype.evaluateSelected = function () {
2450
4086
  var _a;
2451
- var selectionItem = ((_a = this.View) === null || _a === void 0 ? void 0 : _a.selection) || this.arraymodeSelection;
2452
- this.selectedObjects = selectionItem.all ? (this.View.objectcount || this.View.length) - selectionItem.exclusions.length : selectionItem.items.length;
4087
+ var si = ((_a = this.View) === null || _a === void 0 ? void 0 : _a.selection) || this.arraymodeSelection;
4088
+ var excByGroup = si.group_exclusions.reduce(function (prev, curr) { return prev + curr.count; }, 0);
4089
+ var incByGroup = si.groups.reduce(function (prev, curr) { return prev + curr.count; }, 0);
4090
+ this.selectedObjects = (si.all ? this.BaseItemsCount : incByGroup) - excByGroup + si.items.length - si.exclusions.length;
2453
4091
  return this.selectedObjects;
2454
4092
  };
2455
4093
  /**
@@ -2457,9 +4095,11 @@
2457
4095
  */
2458
4096
  EsTableComponent.prototype.selectAllOrResetSelection = function () {
2459
4097
  var selectionItem = this.View.selection || this.arraymodeSelection;
2460
- this.selOrDeselCache = {};
4098
+ this.clearSelectionCaches();
2461
4099
  selectionItem.all = !selectionItem.all;
2462
4100
  selectionItem.exclusions = [];
4101
+ selectionItem.groups = [];
4102
+ selectionItem.group_exclusions = [];
2463
4103
  selectionItem.items = [];
2464
4104
  // Ripulisco gli stati UI di selezione globale se l'ho disattivata
2465
4105
  if (!selectionItem.all) {
@@ -2469,7 +4109,7 @@
2469
4109
  this.finalizeSelectionInformations(selectionItem);
2470
4110
  this.onSelectionChanged.emit(selectionItem);
2471
4111
  // Dopo aver resettato direttamente il solo oggetto this.View.selection devo anche riallineare a tutti gli oggetti bindati
2472
- this.evaluateSelection(this.viewMode ? this.View.items : this.View, selectionItem);
4112
+ this.evaluateSelection(this.boundSource, selectionItem);
2473
4113
  };
2474
4114
  // #endregion
2475
4115
  // #region Gestione Paginazione
@@ -2479,9 +4119,9 @@
2479
4119
  * @param {number} page Numero di pagine da aggiungere (o sottrarre, se negativo) alla pagina attuale
2480
4120
  */
2481
4121
  EsTableComponent.prototype.addToPage = function (page) {
2482
- if (!(this.View instanceof AppSearch) && !(this.SearchView instanceof AppSearch) && !(this.View instanceof ReportDefinition))
2483
- return;
2484
- this.goToPage((this.SearchView || this.View).page + page);
4122
+ var _a;
4123
+ var view = this.MainGroupView ? this.MainGroupView : this.View;
4124
+ this.goToPage((((_a = (this.SearchView || view)) === null || _a === void 0 ? void 0 : _a.page) || 0) + page);
2485
4125
  };
2486
4126
  /**
2487
4127
  * Sposta la ricerca alla pagina specificata
@@ -2489,21 +4129,35 @@
2489
4129
  * @param {number} page Pagina a cui navigare
2490
4130
  */
2491
4131
  EsTableComponent.prototype.goToPage = function (page) {
2492
- if (!(this.View instanceof AppSearch) && !(this.SearchView instanceof AppSearch) && !(this.View instanceof ReportDefinition))
4132
+ var view = this.MainGroupView ? this.MainGroupView : this.View;
4133
+ if (!view.page || !view.pages)
2493
4134
  return;
2494
- var appSearchElement = this.SearchView || this.View;
4135
+ var appSearchElement = this.SearchView || view;
2495
4136
  if (page === 0 || page > appSearchElement.pages)
2496
4137
  return;
2497
4138
  appSearchElement.page = page;
2498
4139
  this.arrayPulsanti = this.getPagesArray(6, appSearchElement.page, appSearchElement.pages);
2499
- this.emitSearchRequest(false);
4140
+ var hasGroupings = !!this.MainGroupView;
4141
+ this.emitSearchRequest(false, hasGroupings ? view : null);
2500
4142
  };
2501
4143
  /**
2502
4144
  * Evento richiamato sul cambio della paginazione. Verrà richiamato l'evento **emitSearchRequest**
2503
4145
  * per comunicare al componente che utilizza questa tabella che i dati sono da aggiornare
2504
4146
  */
2505
- EsTableComponent.prototype.onItemsPerPageChanged = function () {
2506
- this.emitSearchRequest(true);
4147
+ EsTableComponent.prototype.onItemsPerPageChanged = function (newIpp) {
4148
+ this.PagerOptions.View.itemsperpageoverride = newIpp;
4149
+ this.changed();
4150
+ if (this.MainGroupView)
4151
+ this.emitSearchRequest(true, this.MainGroupView);
4152
+ else
4153
+ this.emitSearchRequest(true);
4154
+ };
4155
+ /**
4156
+ * Evento richiamato sul cambio della paginazione. Verrà richiamato l'evento **emitSearchRequest** con la vista del separatore
4157
+ */
4158
+ EsTableComponent.prototype.onGroupItemsPerPageChanged = function (pager, newIpp) {
4159
+ pager.view.itemsperpageoverride = newIpp;
4160
+ this.emitSearchRequest(true, pager.view);
2507
4161
  };
2508
4162
  // #endregion
2509
4163
  // #region Gestione Export
@@ -2523,6 +4177,10 @@
2523
4177
  if (cancel === void 0) { cancel = false; }
2524
4178
  if (cancel)
2525
4179
  return;
4180
+ if (data.length == 0) {
4181
+ _this.msgExts.simpleWarning(_this.lc.loc("Cannot export an empty dataset"));
4182
+ return;
4183
+ }
2526
4184
  _this.setupExport(data);
2527
4185
  _this.cdr.detectChanges();
2528
4186
  setTimeout(function () { _this.exportDownloader.nativeElement.click(); });
@@ -2650,12 +4308,12 @@
2650
4308
  * @returns {any} Router link generato in base al parametri
2651
4309
  */
2652
4310
  EsTableComponent.prototype.generateRouterLink = function (path, parameterProps, item) {
2653
- if (this.DynamicTableRouterLinkCache[item.hash + path]) {
2654
- return this.DynamicTableRouterLinkCache[item.hash + path];
4311
+ if (this.DynamicTableRouterLinkCache[item._hash + path]) {
4312
+ return this.DynamicTableRouterLinkCache[item._hash + path];
2655
4313
  }
2656
4314
  else {
2657
4315
  var link = this.getRouterLink(path, parameterProps, item);
2658
- this.DynamicTableRouterLinkCache[item.hash + path] = link;
4316
+ this.DynamicTableRouterLinkCache[item._hash + path] = link;
2659
4317
  return link;
2660
4318
  }
2661
4319
  };
@@ -2753,6 +4411,14 @@
2753
4411
  };
2754
4412
  // #endregion
2755
4413
  // #region Metodi di utilità
4414
+ /** Helper che identifica se il td attuale è di tipo **EsTd**. In caso contrario è da considerarsi **EsTdDirective** */
4415
+ EsTableComponent.prototype.isEsTd = function (td) {
4416
+ return !td._directive;
4417
+ };
4418
+ /** Helper che identifica se il th attuale è di tipo **EsTh**. In caso contrario è da considerarsi **EsThDirective** */
4419
+ EsTableComponent.prototype.isEsTh = function (th) {
4420
+ return !th._directive;
4421
+ };
2756
4422
  /** Impostazione modalità dell'EsTable */
2757
4423
  EsTableComponent.prototype.setMode = function (mode) {
2758
4424
  this.viewMode = mode == 'view';
@@ -2765,7 +4431,8 @@
2765
4431
  }
2766
4432
  };
2767
4433
  /**
2768
- * Helper per effettuare chiamate interne di allineamento alla funzione **writeValue**, impostando prima **internalWriteCall** in modo da non effettuare operazioni inutili
4434
+ * Helper per effettuare chiamate interne di allineamento alla funzione **writeValue**,
4435
+ * impostando prima **internalWriteCall** in modo da non effettuare operazioni inutili
2769
4436
  */
2770
4437
  EsTableComponent.prototype.internalWriteValue = function () {
2771
4438
  this.internalWriteCall = true;
@@ -2829,11 +4496,13 @@
2829
4496
  for (var i = 0; i < items.length; i++) {
2830
4497
  var item = items[i];
2831
4498
  // Prima di calcolare l'hash rimuovo le proprietà interne prima che mi scompensino i calcoli successivi
2832
- delete item._selected;
2833
- delete item.hash;
2834
- var hash = this.hashExts.hashObject(item);
4499
+ var tmp = Object.assign({}, items[i]);
4500
+ delete tmp._selected;
4501
+ delete tmp._visible;
4502
+ delete tmp._hash;
4503
+ var hash = this.hashExts.hashObject(tmp);
2835
4504
  usedHashesCache[hash] = usedHashesCache[hash] ? usedHashesCache[hash] + 1 : 1;
2836
- item.hash = hash + (usedHashesCache[hash] > 1 ? "_" + usedHashesCache[hash] : "");
4505
+ item._hash = hash + (usedHashesCache[hash] > 1 ? "_" + usedHashesCache[hash] : "");
2837
4506
  }
2838
4507
  };
2839
4508
  /**
@@ -2862,18 +4531,22 @@
2862
4531
  viewProviders: [{ provide: localizations.LocalizationService, useClass: EsTableLoc }],
2863
4532
  changeDetection: core.ChangeDetectionStrategy.OnPush,
2864
4533
  encapsulation: core.ViewEncapsulation.None,
2865
- template: "<!-- Patacchino di autoaggiornamento -->\r\n<div class=\"w-100\" *ngIf=\"AutoUpdate\">\r\n <div class=\"pull-right\">\r\n {{'Update every' | localize : lc}}&nbsp;<input [readonly]=\"autoUpdate\" maxlength=\"3\" class=\"form-control est-custom-input\" type=\"text\" [(ngModel)]=\"seconds\" />&nbsp;{{'second/s' | localize : lc}}\r\n </div>\r\n <div class=\"pull-right m-t-2\">\r\n <label class=\"est-switch\">\r\n <input type=\"checkbox\" [(ngModel)]=\"autoUpdate\" (ngModelChange)=\"autoUpdateChanged();\" />\r\n <div class=\"est-slider round\"></div>\r\n </label>\r\n </div>\r\n</div>\r\n\r\n<!--\r\nI TH sono contenuto statico, questo significa che senza condizione per RowTHs arriverebbero sia qui sia nell ng-container dell'header in fase non inizializzata, duplicando fisicamente le colonne.\r\nPer ovviare al problema, questo pezzo lo faccio apparire solo se ci sono gi\u00E0 dei RowTHs, quindi su valorizzazione della View succeder\u00E0:\r\n1) appaiono i th nell' ng-container dell'header, e NON qui\r\n2) i TH vengono presi, elaborati e trasformati in RowTHs\r\n3) l'ng-container dell'header sparisce (per la condizione !UseCustomCells || !RowTHs) e qui appaiono i nuovi TH (che poi sono gli stessi di prima che girano)\r\n4) Vengono presi i nuovi TH da qui e trasformati a loro volta in RowTHs\r\n-->\r\n<div hidden *ngIf=\"UseCustomCells && RowTHs\">\r\n <ng-container *ngIf=\"View\">\r\n <!--Qui invece ci sono tutti i TH-->\r\n <ng-container *ngTemplateOutlet=\"headerRef\"></ng-container>\r\n </ng-container>\r\n</div>\r\n\r\n<!--\r\nQuesta parte \u00E8 un po' pi\u00F9 semplice del sopra. Infatti i TD vengono s\u00EC bindati in entrambi i punti (qui e nell'ng-container del body), ma avr\u00F2 le TD statiche prima di generare la TMPBoundSource.\r\nQuesto significa che il workflow di binding sar\u00E0:\r\n1) Appaiono i TD statici nel body e NON qui, perch\u00E9 i TMPBoundSource non sono ancora stati emessi\r\n2) Contemporaneamente all'emissione dei TMPBoundSource vengono anche emessi i RowTds\r\n3) Considerando il punto 2, al giro dopo appariranno i TD qui, perch\u00E9 \u00E8 stata generata la TMPBoundSource, e spariranno contemporaneamente dall'ng-container del body (per la condizione !UseCustomCells || !RowTDs)\r\n-->\r\n<div hidden *ngIf=\"UseCustomCells && bodyRef\">\r\n <ng-container *ngIf=\"View\">\r\n <!--Tutti i TD che dopo verranno presi ed elaborati internamente-->\r\n <ng-container *ngFor=\"let item of TMPBoundSource\">\r\n <ng-container *ngTemplateOutlet=\"bodyRef; context : {$implicit: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</div>\r\n\r\n<ng-container *ngIf=\"View\">\r\n <div *ngIf=\"FirstBind && ShowLoadingOnBootstrap\" class=\"est-loading-box\">\r\n <div class=\"est-loading-content\">\r\n <span class=\"fa fa-spinner fa-spin\"></span>&nbsp;{{'Performing Table bootstrap' | localize: lc}}...\r\n </div>\r\n </div>\r\n\r\n <div class=\"table-responsive datatable {{Class}}\" [class.est-scrollable]=\"UseEndlessscroll\" (scroll)=\"UseEndlessscroll && onScroll($event)\" [style.max-height.px]=\"MaxHeight\">\r\n <table class=\"{{ TableClass }}\" [class.est-high-density]=\"HighCellDensity\">\r\n <thead [hidden]=\"HeaderHidden || FirstBind\">\r\n\r\n <!-- Aggiungo il pezzo che gestisce la selezione di tutto se attivo da config -->\r\n <tr *ngIf=\"SelectAll\">\r\n <th colspan=\"42\" [class.est-hidden]=\"!canSelectAll && !(View?.selection || arraymodeSelection).all\">\r\n <span>{{ (selectedObjects || 0).toString() + ' ' + ((selectedObjects == 1 ? 'Object Selected' : 'Objects Selected') | localize : lc) }}</span>&nbsp;\r\n <span class=\"app-link app-inline\" (click)=\"selectAllOrResetSelection()\">{{ (View?.selection || arraymodeSelection).all ? ('Reset Selection' | localize : lc) : ('Select Everything' | localize : lc)}}</span>\r\n </th>\r\n </tr>\r\n\r\n <!-- Blocco header group -->\r\n <tr *ngIf=\"HasHeaderGroup\">\r\n <ng-container *ngTemplateOutlet=\"headerGroupRef\"></ng-container>\r\n <th *ngIf=\"Export\"></th>\r\n </tr>\r\n\r\n <!-- Blocco header group secondario -->\r\n <tr *ngIf=\"HasSecondaryHeaderGroup\">\r\n <ng-container *ngTemplateOutlet=\"secondaryHeaderGroupRef\"></ng-container>\r\n <th *ngIf=\"Export\"></th>\r\n </tr>\r\n\r\n <!-- Blocco effettivo degli header -->\r\n <tr>\r\n <!-- Aggiungo una checkbox se la selezione \u00E8 attiva -->\r\n <th class=\"est-col-min\" *ngIf=\"Selection\">\r\n <input *ngIf=\"!SingleSelection\" class=\"est-pointer\" type=\"checkbox\" [disabled]=\"SelectionDisabled\" [(ngModel)]=\"globalCheck\" [ngModelOptions]=\"{'standalone': true}\" (ngModelChange)=\"globalCheckChanged();\">\r\n </th>\r\n\r\n <!-- Header che valgono per view mode e array mode -->\r\n <ng-container *ngIf=\"(viewMode || arrayMode)\">\r\n\r\n <!-- In una tabella base prendo semplicemente i th scritti dall'utente nell'HTML -->\r\n <ng-container *ngIf=\"(!UseCustomCells || !RowTHs) && !DynamicRowColumnsDefinition\">\r\n <ng-container *ngTemplateOutlet=\"headerRef\"></ng-container>\r\n </ng-container>\r\n\r\n <!-- Se ho un modello dinamico dell'oggetto creo le colonne in base alle propriet\u00E0 -->\r\n <ng-container *ngIf=\"(!UseCustomCells || !RowTHs) && DynamicRowColumnsDefinition\">\r\n <ng-container *ngFor=\"let operation of DynamicOperations\">\r\n <th class=\"est-col-min est-no-side-padding\"></th>\r\n </ng-container>\r\n \r\n <ng-container *ngFor=\"let rowHeader of DynamicRowColumnsDefinition\">\r\n <ng-container *ngIf=\"rowHeader.visible\">\r\n <th *ngIf=\"OrderByColumn\" es-th=\"{{rowHeader.propertyName}}\" class=\"{{UserDefinedDynamicCols ? rowHeader.clss : ' est-nowrap'}}\" [Order]=\"rowHeader.dataOrder\" [Resizable]=\"ColumnsResizable\" [Orderable]=\"rowHeader.orderable\" [OrderBy]=\"OrderByColumn\" [SearchInProgress]=\"!!researchInProgress\" (onOrderChange)=\"thOrderChanged(rowHeader.propertyName, $event)\">{{rowHeader.description}}</th>\r\n <th *ngIf=\"!OrderByColumn\" es-th=\"{{rowHeader.propertyName}}\" class=\"{{UserDefinedDynamicCols ? rowHeader.clss : ' est-nowrap'}}\" [Order]=\"rowHeader.dataOrder\" [Resizable]=\"ColumnsResizable\" [Orderable]=\"rowHeader.orderable\" [OrderBy]=\"OrderByColumn\">{{rowHeader.description}}</th>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <!-- Se non ho un modello dinamico ma invece delle celle custom, genero gli header in base ai row th -->\r\n <ng-container *ngIf=\"UseCustomCells && RowTHs\">\r\n <ng-container *ngFor=\"let rowHeader of RowTHs\">\r\n <ng-container *ngIf=\"rowHeader && rowHeader.Visible\">\r\n <th es-th=\"{{rowHeader.ID}}\" class=\"{{rowHeader.Class}}{{rowHeader.Wrap ? '' : ' est-nowrap'}}\" [Order]=\"rowHeader.Order\" [Resizable]=\"ColumnsResizable\" [Orderable]=\"rowHeader.Orderable\" [OrderBy]=\"OrderByColumn\" [SearchInProgress]=\"!!researchInProgress\" (onOrderChange)=\"OrderByColumn && thOrderChanged(rowHeader.ID, $event)\">\r\n <ng-container *ngIf=\"rowHeader.Template\">\r\n <ng-container *ngTemplateOutlet=\"rowHeader.Template;\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!rowHeader.Template\">\r\n {{rowHeader.Content}}\r\n </ng-container>\r\n </th>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <!--Casistica in cui ho il setup proveniente da un report. Gli header sono definiti da come \u00E8 fatto il report-->\r\n <ng-container *ngIf=\"reportMode\">\r\n <th [style.color]=\"clm.color\" *ngFor=\"let clm of ReportValues.columns\" class=\"app-no-selection app-pointer est-nowrap\" (click)=\"setupNextOrderAndSearch(clm)\">\r\n {{clm.description}}<span class=\"fa\" [class.fa-chevron-down]=\"clm.order == 'DESC'\" [class.fa-chevron-up]=\"clm.order == 'ASC'\"></span>\r\n </th>\r\n </ng-container>\r\n\r\n <!--Per l'eliminazione mi serve un header aggiuntivo-->\r\n <th *ngIf=\"Removal\" [class.app-right-10]=\"Export || HiddenColumns\" class=\"est-col-min app-sticky-last-column\"><span class=\"fa fa-trash\"></span></th>\r\n\r\n <!--Per l'esportazione mi serve l'header extra da cui faccio uscire i 3 pallocchi-->\r\n <th *ngIf=\"Export || HiddenColumns || ColumnsOrdering || CornerMenuOptions\" class=\"app-table-dotted-menu app-sticky-last-column est-col-min text-sm-center\">\r\n \r\n <!-- Link nascosto che serve a scaricare il file -->\r\n <a *ngIf=\"headers\" hidden #exportDownloader csvLink [data]=\"data\" [headers]=\"headers\" [delimiter]=\"';'\" [filename]=\"ExportFileName\"></a>\r\n\r\n <!-- Blocco con i 3 pallocchi che tira fuori il context menu delle operazioni -->\r\n <div class=\"btn-group\" container=\"body\" placement=\"bottom right\" dropdown #dropdown=\"bs-dropdown\" [autoClose]=\"true\">\r\n <span dropdownToggle class=\"fa fa-ellipsis-v app-fs-18 app-pointer app-padding-3\"></span>\r\n\r\n <div *dropdownMenu class=\"dropdown-menu dropdown-menu-right app-bring-to-front-strong\">\r\n <div class=\"est-pointer\">\r\n <a class=\"dropdown-item\" *ngIf=\"(HiddenColumns || ColumnsOrdering)\" (click)=\"resetColumnVisSelection(); changeColumnVisibilityModal.show();\">\r\n <ng-container *ngIf=\"!HiddenColumns && ColumnsOrdering\">\r\n {{'Columns Order' | localize : lc}}\r\n </ng-container>\r\n <ng-container *ngIf=\"HiddenColumns && !ColumnsOrdering\">\r\n {{'Columns Visibility' | localize : lc}}\r\n </ng-container>\r\n <ng-container *ngIf=\"HiddenColumns && ColumnsOrdering\">\r\n {{'Columns Visibility and Order' | localize : lc}}\r\n </ng-container>\r\n </a>\r\n <a class=\"dropdown-item\" *ngIf=\"Export && CSVExport\" (click)=\"tryExport('CSV')\">{{'Export View' | localize : lc}} (CSV)</a>\r\n <a class=\"dropdown-item\" *ngIf=\"Export && XLSXExport\" (click)=\"tryExport('XLSX')\">{{'Export View' | localize : lc}} (XLSX)</a>\r\n <a class=\"dropdown-item\" *ngFor=\"let option of CornerMenuOptions\" (click)=\"cornerActionClicked(option.id)\">{{option.description}}</a>\r\n </div>\r\n </div>\r\n </div>\r\n </th>\r\n </tr>\r\n </thead>\r\n \r\n <!-- Valido per modalit\u00E0 View o Array. Se sono in report mode il body \u00E8 creato in altro modo -->\r\n <tbody [hidden]=\"BodyHidden || FirstBind\" *ngIf=\"(arrayMode || viewMode)\">\r\n <!--Con selection attiva richiamo il template che gestisce il context menu-->\r\n <ng-container *ngIf=\"Selection\">\r\n <ng-container *ngTemplateOutlet=\"TBodySelection; context: { $implicit: { selDisabled: arrayMode ? false : SelectionDisabled, sel: Selection }}\"></ng-container>\r\n </ng-container>\r\n\r\n <!--Senza selection richiamo il template che NON gestisce il context menu-->\r\n <ng-container *ngIf=\"!Selection\">\r\n <ng-container *ngTemplateOutlet=\"TBody\"></ng-container>\r\n </ng-container>\r\n </tbody>\r\n\r\n <!-- Per la modalit\u00E0 a report c'\u00E8 un body particolare semi-dinamico -->\r\n <tbody [hidden]=\"BodyHidden\" *ngIf=\"reportMode\">\r\n <tr *ngFor=\"let row of ReportValues.rows; let even = even;\">\r\n <td class=\"est-nowrap\" *ngFor=\"let val of row.values\">{{val}}</td>\r\n <td class=\"app-sticky-last-column{{even && !Hierarchy ? '-alt' : ''}}\"></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n\r\n <ng-container *ngIf=\"ShowPaging && !FirstBind\">\r\n\r\n <!-- Paginatore dove appare la count e le opzioni di paginazione -->\r\n <div class=\"pull-left m-t-min-3\">\r\n <ng-container *ngIf=\"viewMode\">\r\n <ng-container *ngTemplateOutlet=\"pagerSelector; context: { $implicit: { ShowCount: !HidePagingCount || (View && View.objectcount && View.objectcount != -1), ShowPaging: !HidePaging, View: View, UsesView: true }}\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"arrayMode && (!UseArrayModePaging || SearchView)\">\r\n <ng-container *ngTemplateOutlet=\"pagerSelector; context: { $implicit: { ShowCount: !HidePagingCount || (View && View.length) || (SearchView && SearchView.objectcount && SearchView.objectcount != -1), ShowPaging: !HidePaging && SearchView, View: SearchView, SecondaryView: View, UsesView: true }}\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"arrayMode && (UseArrayModePaging && !SearchView)\">\r\n <ng-container *ngTemplateOutlet=\"pagerSelector; context: { $implicit: { ShowCount: !HidePagingCount, ShowPaging: !HidePaging && View.length > 10, View: View, UsesView: false }}\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"reportMode\">\r\n <ng-container *ngTemplateOutlet=\"pagerSelector; context: { $implicit: { ShowCount: !HidePagingCount || (View && View.objectcount && View.objectcount != -1), ShowPaging: View.pagingavailable, MightBeNoPaging: true, View: View, Report: ReportValues, UsesView: true }}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n \r\n <!-- Pulsanti avanti-indietro di paginazione -->\r\n <div class=\"pull-right btn-toolbar\" *ngIf=\"ShowPaging && !HidePagingButtons\">\r\n <ng-container *ngIf=\"(!reportMode || View?.pagingavailable) && (!arrayMode || SearchView)\">\r\n <ng-container *ngTemplateOutlet=\"pagingButtons; context: { $implicit: { ATP: addToPage.bind(this), GTP: goToPage.bind(this), Array: arrayPulsanti }}\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"arrayMode && UseArrayModePaging && !SearchView\">\r\n <ng-container *ngTemplateOutlet=\"pagingButtons; context: { $implicit: { ATP: arrayAddToPage.bind(this), GTP: arrayGoToPage.bind(this), Array: arrayPulsanti }}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n </ng-container>\r\n</ng-container>\r\n\r\n<!-- Template che contiene i pulsanti per cambiare pagina -->\r\n<ng-template #pagingButtons let-options>\r\n <a class=\"btn app-white-button app-no-margin\" (click)=\"options.ATP(-1)\"><span class=\"fa fa-chevron-left\"></span></a>\r\n <div *ngIf=\"options.Array\" class=\"app-inline\">\r\n <a *ngFor=\"let p of options.Array\" class=\"btn {{p.cssClass}} app-no-margin\" (click)=\"options.GTP(p.val)\">{{p.val}}</a>\r\n </div>\r\n <a class=\"btn app-white-button app-no-margin\" (click)=\"options.ATP(1)\"><span class=\"fa fa-chevron-right\"></span></a>\r\n</ng-template>\r\n\r\n<!-- Template che mostra le informazioni base di paginazione: conteggio oggetti, paginazione attuale e pulsanti per cambiarla -->\r\n<ng-template #pagerSelector let-options>\r\n <div *ngIf=\"options.ShowCount\">\r\n {{ CountLabel }}:&nbsp;\r\n <strong *ngIf=\"options.UsesView && !options.Report\">\r\n {{ options.View?.objectcount ? options.View.objectcount : options.SecondaryView && options.SecondaryView.length ? options.SecondaryView.length : \"0\" }}\r\n </strong>\r\n <strong *ngIf=\"!options.UsesView && !options.Report\">\r\n {{ options.View.length ? options.View.length : \"0\" }}\r\n </strong>\r\n <strong *ngIf=\"options.Report\">\r\n {{ options.Report.count && options.Report.count == -1 ? options.Report.rows.length : options.Report.count && options.Report.count > 0 ? options.Report.count : 0 }}\r\n </strong>\r\n </div>\r\n <div *ngIf=\"options.ShowPaging\">\r\n <app-paging *ngIf=\"!options.UsesView\" [Hidden]=\"!options.View || options.View.length == 0\" [WarnOnAll]=\"false\" [CurrentPageSize]=\"ArraymodeItemsPerPage\" (pagingSelected)=\"refreshPaging($event)\"></app-paging>\r\n <app-paging *ngIf=\"options.UsesView\" [AllSearch]=\"AllSearch\" [DefaultAll]=\"defaultAllPageOverride\" [View]=\"options.View\" (pagingSelected)=\"options.View.itemsperpageoverride = $event; changed(); onItemsPerPageChanged();\"></app-paging>\r\n </div>\r\n <div *ngIf=\"options.MightBeNoPaging && !options.ShowPaging\">\r\n <em>{{'Paging options are not available for this report' | localize: lc}}</em>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- Questi due template rappresentano effettivamente il body della tabella. essendo il tr l'unica cosa che davvero cambia, il resto \u00E8 templatizzato -->\r\n<ng-template #TBodySelection let-templateOptions>\r\n <ng-container *ngFor=\"let item of boundSource; let even = even; let i=index;\">\r\n <tr *ngIf=\"item.visible || !Hierarchy\" \r\n [class]=\"item._rowClass ? item._rowClass : ''\" [class.est-line-through]=\"item.removed || item.deleted\" [class.est-pointer]=\"!item.locked\" [class.est-white-selected]=\"item._selected && !item.locked\"\r\n [contextMenu]=\"!item.locked ? (ContextMenu || emptyMenu) : emptyMenu\" [contextMenuSubject]=\"item\"\r\n (click)=\"!item.locked && handleClick($event, item)\">\r\n \r\n <td *ngIf=\"!item.locked\"><input type=\"checkbox\" [disabled]=\"templateOptions.selDisabled\" [class.est-pointer]=\"!item.locked\" [(ngModel)]=\"item._selected\" name=\"check{{i}}\"></td>\r\n <td *ngIf=\"item.locked\"></td>\r\n\r\n <ng-container *ngTemplateOutlet=\"basicColumns; context: { $implicit: item }\"></ng-container>\r\n <ng-container *ngTemplateOutlet=\"dynamicColumns; context: { $implicit: item }\"></ng-container>\r\n <ng-container *ngTemplateOutlet=\"customCells; context: { $implicit: item }\"></ng-container>\r\n <ng-container *ngTemplateOutlet=\"bodyDeleteAndExport; context: { $implicit: { even: even, item: item }}\"></ng-container>\r\n\r\n </tr>\r\n </ng-container>\r\n</ng-template> \r\n\r\n<ng-template #TBody>\r\n <ng-container *ngFor=\"let item of boundSource; let even = even;\">\r\n <tr *ngIf=\"item.visible || !Hierarchy\" [class]=\"item._rowClass ? item._rowClass : ''\" [class.est-line-through]=\"item.removed || item.deleted\">\r\n\r\n <ng-container *ngTemplateOutlet=\"basicColumns; context: { $implicit: item }\"></ng-container>\r\n <ng-container *ngTemplateOutlet=\"dynamicColumns; context: { $implicit: item }\"></ng-container>\r\n <ng-container *ngTemplateOutlet=\"customCells; context: { $implicit: item }\"></ng-container>\r\n <ng-container *ngTemplateOutlet=\"bodyDeleteAndExport; context: { $implicit: { even: even, item: item }}\"></ng-container>\r\n\r\n </tr>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<!-- Questo template contiene la print condizionale su tabelle semplici, con header e body scritti a manazza -->\r\n<ng-template #basicColumns let-item>\r\n <ng-container *ngIf=\"(!UseCustomCells || !RowTDs) && !DynamicRowColumnsDefinition\">\r\n <ng-container *ngTemplateOutlet=\"bodyRef; context : {$implicit: item}\"></ng-container>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<!-- Questo template contiene la print condizionale su tabelle definite in maniera dinamica dal modello -->\r\n<ng-template #dynamicColumns let-item>\r\n <ng-container *ngIf=\"(!UseCustomCells || !RowTDs) && DynamicRowColumnsDefinition\">\r\n <ng-container *ngFor=\"let operation of DynamicOperations; let first = first; let last = last;\">\r\n <ng-container *ngIf=\"!operation.conditionField || (item.properties[operation.conditionField] == operation.conditionValue)\">\r\n <td [class.est-no-right-padding]=\"last\" [class.est-no-left-padding]=\"!first\" class=\"est-col-min\"><span title=\"{{operation.title}}\" class=\"{{operation.iconClass}} app-pointer\" (click)=\"dynamicOperation(item, operation.id)\">{{operation.text}}</span></td>\r\n </ng-container>\r\n <ng-container *ngIf=\"operation.conditionField && (item.properties[operation.conditionField] != operation.conditionValue)\">\r\n <td class=\"est-col-min est-no-side-padding\"></td>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let rowItem of DynamicRowColumnsDefinition\">\r\n <ng-container *ngIf=\"rowItem.routePath && rowItem.visible\">\r\n <td es-td=\"{{rowItem.propertyName}}\" class=\"{{UserDefinedDynamicCols ? rowItem.clss : 'est-nowrap'}}\" [Internal]=\"false\">\r\n <a [routerLink]=\"generateRouterLink(rowItem.routePath, rowItem.routeParameterProperties, item)\" class=\"app-link\" [innerHTML]=\"item.properties[rowItem.propertyName]\"></a>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngIf=\"!rowItem.routePath && rowItem.visible\">\r\n <ng-container *ngTemplateOutlet=\"findEsTd(rowItem.propertyName) || defaultEsTd; context: { $implicit: item.properties[rowItem.propertyName], rowItem : rowItem, item : item }\"> </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<ng-template #defaultEsTd let-value let-rowItem='rowItem' let-item='item'>\r\n <td es-td=\"{{rowItem.propertyName}}\" class=\"{{UserDefinedDynamicCols ? rowItem.clss : 'est-nowrap'}}\"\r\n [class.app-pointer]=\"UseCustomCellActions && CustomCellActionsOn.indexOf('$' + rowItem.propertyName + '$') != -1\"\r\n (click)=\"cellClicked(rowItem.propertyName, item) && !CellActionPropagates && $event.stopPropagation()\"\r\n [Internal]=\"false\">\r\n {{value}}\r\n </td>\r\n</ng-template>\r\n\r\n<!-- Questo template contiene la print condizionale delle celle custom se configurate -->\r\n<ng-template #customCells let-item>\r\n <ng-container *ngIf=\"UseCustomCells && RowTDs\">\r\n <ng-container *ngFor=\"let rowItem of RowTDs[item.hash]; let i = index\">\r\n <ng-container *ngIf=\"rowItem\">\r\n\r\n <ng-container *ngIf=\"!bodyRef && rowItem.Visible\">\r\n <td es-td=\"{{rowItem.ID}}\" class=\"{{rowItem.Class}}\" [class.est-nowrap]=\"Hierarchy\" [Internal]=\"true\">\r\n <ng-container *ngIf=\"rowItem.Template\">\r\n <ng-container *ngTemplateOutlet=\"rowItem.Template; context: { $implicit: item }\"></ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"rowItem.RouterLink && rowItem.Visible && bodyRef\">\r\n <td es-td=\"{{rowItem.ID}}\" class=\"{{rowItem.Class}}\" [class.est-nowrap]=\"Hierarchy\" [Internal]=\"true\">\r\n <ng-container *ngIf=\"Hierarchy && i == 0\">\r\n <span *ngIf=\"!item.parent\" class=\"fa fa-chevron-down\" style=\"visibility:hidden\"></span>\r\n <span *ngIf=\"item.parent && item.expanded\" class=\"fa fa-chevron-down est-pointer app-no-selection\" (click)=\"collapseParent(item[this.OwnKey])\"></span>\r\n <span *ngIf=\"item.parent && !item.expanded\" class=\"fa fa-chevron-up est-pointer app-no-selection\" (click)=\"expandParent(item[this.OwnKey])\"></span>\r\n &nbsp;\r\n </ng-container>\r\n <a [routerLink]='rowItem.RouterLink' class=\"app-link\" [innerHTML]=\"rowItem.Content\"></a>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngIf=\"!rowItem.RouterLink && rowItem.Visible && bodyRef\">\r\n <td es-td=\"{{rowItem.ID}}\" class=\"{{rowItem.Class}}\" [class.est-nowrap]=\"Hierarchy\" [class.app-pointer]=\"UseCustomCellActions && CustomCellActionsOn.indexOf('$' + $any(rowItem).ID + '$') != -1\" (click)=\"cellClicked(rowItem.ID, item) && !CellActionPropagates && $event.stopPropagation()\" [Internal]=\"true\">\r\n <ng-container *ngIf=\"Hierarchy && i == 0\">\r\n <span *ngIf=\"!item.parent\" class=\"fa fa-chevron-down\" style=\"visibility:hidden\"></span>\r\n <span *ngIf=\"item.parent && item.expanded\" class=\"fa fa-chevron-down est-pointer app-no-selection\" (click)=\"collapseParent(item[this.OwnKey])\"></span>\r\n <span *ngIf=\"item.parent && !item.expanded\" class=\"fa fa-chevron-up est-pointer app-no-selection\" (click)=\"expandParent(item[this.OwnKey])\"></span>\r\n &nbsp;\r\n </ng-container>\r\n <ng-container *ngIf=\"rowItem.Template\">\r\n <ng-container *ngTemplateOutlet=\"rowItem.Template; context: { $implicit: item }\"></ng-container>\r\n </ng-container>\r\n <span *ngIf=\"!rowItem.Template\" [innerHTML]=\"rowItem.Content\"></span>\r\n </td>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<!-- Questo template contiene i pulsanti di eliminazione/undo eliminazione ed esportazione che vanno in fondo ad un record edlla tabella -->\r\n<ng-template #bodyDeleteAndExport let-options>\r\n <ng-container *ngIf=\"Removal && !RemovalCondition\">\r\n <td class=\"app-sticky-last-column{{options.even? '-alt' : ''}} {{Export || HiddenColumns || CornerMenuOptions ? 'est-right-10' : ''}}\" *ngIf=\"!(options.item.removed || options.item.deleted)\"><span class=\"fa fa-remove app-pointer text-danger\" [hidden]=\"options.item.removable != undefined && !options.item.removable\" (click)=\"onRemoval.emit(options.item)\"></span></td>\r\n <td class=\"app-sticky-last-column{{options.even? '-alt' : ''}} {{Export || HiddenColumns || CornerMenuOptions ? 'est-right-10' : ''}}\" *ngIf=\"(options.item.removed || options.item.deleted)\"><span class=\"fa fa-undo text-warning app-pointer\" (click)=\"onAbortRemoval.emit(options.item)\"></span></td>\r\n </ng-container>\r\n <ng-container *ngIf=\"Removal && RemovalCondition\">\r\n <td class=\"app-sticky-last-column{{options.even? '-alt' : ''}} {{Export || HiddenColumns || CornerMenuOptions ? 'est-right-10' : ''}}\" *ngIf=\"!(options.item.removed || options.item.deleted) && options.item[RemovalCondition]\"><span class=\"fa fa-remove app-pointer text-danger\" [hidden]=\"options.item.removable != undefined && !options.item.removable\" (click)=\"onRemoval.emit(options.item)\"></span></td>\r\n <td class=\"app-sticky-last-column{{options.even? '-alt' : ''}} {{Export || HiddenColumns || CornerMenuOptions ? 'est-right-10' : ''}}\" *ngIf=\"(options.item.removed || options.item.deleted) && options.item[RemovalCondition]\"><span class=\"fa fa-undo text-warning app-pointer\" (click)=\"onAbortRemoval.emit(options.item)\"></span></td>\r\n <td class=\"app-sticky-last-column{{options.even? '-alt' : ''}} {{Export || HiddenColumns || CornerMenuOptions ? 'est-right-10' : ''}}\" *ngIf=\"!options.item[RemovalCondition]\"><span class=\"fa fa-remove app-hidden-view\"></span></td>\r\n </ng-container>\r\n <td *ngIf=\"Export || HiddenColumns || CornerMenuOptions\" class=\"app-sticky-last-column{{options.even && !Hierarchy ? '-alt' : ''}}\"></td>\r\n</ng-template>\r\n\r\n<!-- Context menu vuoto default per tutte le tabella che non ce l'hanno, in modo che al click destro appaia \"nessuna op disponibile\" -->\r\n<context-menu #emptyMenu>\r\n <ng-template contextMenuItem>\r\n <span>\r\n <em>{{'No operations available' | localize : lc}}...</em>\r\n </span>\r\n </ng-template>\r\n</context-menu>\r\n\r\n<!-- Modal per cambiare posizione e visibilit\u00E0 delle colonne dell'es-table -->\r\n<div bsModal #changeColumnVisibilityModal=\"bs-modal\" class=\"modal fade\" role=\"dialog\" aria-hidden=\"true\">\r\n <div class=\"modal-dialog modal-lg\">\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h5 class=\"modal-title pull-left\">\r\n <ng-container *ngIf=\"!HiddenColumns && ColumnsOrdering\">\r\n {{'Columns Order' | localize : lc}}\r\n </ng-container>\r\n <ng-container *ngIf=\"HiddenColumns && !ColumnsOrdering\">\r\n {{'Columns Visibility' | localize : lc}}\r\n </ng-container>\r\n <ng-container *ngIf=\"HiddenColumns && ColumnsOrdering\">\r\n {{'Columns Visibility and Order' | localize : lc}}\r\n </ng-container>\r\n </h5>\r\n <button type=\"button\" class=\"close pull-right\" (click)=\"changeColumnVisibilityModal.hide();\" aria-label=\"Close\">\r\n <span aria-hidden=\"true\">&times;</span>\r\n </button>\r\n </div>\r\n <div class=\"modal-body\">\r\n <div *ngIf=\"!TMPColumnsList || TMPColumnsList.length == 0\" class=\"card card-info app-padding-10 app-margin-bottom-0\">\r\n {{'There are no columns configured to be hidden/shown in this view' | localize : lc}}\r\n </div>\r\n <div *ngIf=\"TMPColumnsList && TMPColumnsList.length > 0\" style=\"max-height:500px; overflow-y:auto\">\r\n <!--Aaaaaaah la tristezza... qui mi servirebbe l'es-table per facilitare la selezione multipla ecc... peccato che se la linko qui entro in un loop impressionante-->\r\n <table class=\"table table-striped table-sm app-margin-bottom-0\">\r\n <thead>\r\n <tr>\r\n <th class=\"est-col-min\" *ngIf=\"HiddenColumns\">\r\n <input class=\"est-pointer\" type=\"checkbox\" [(ngModel)]=\"globalColVisCheck\" [ngModelOptions]=\"{'standalone': true}\" (ngModelChange)=\"globalColVisCheckChanged();\">\r\n </th>\r\n <th class=\"est-col-min\" *ngIf=\"ColumnsOrdering\"></th>\r\n <th class=\"est-col-min est-nowrap\">{{'Column Name' | localize : lc}}</th>\r\n <!--Filler-->\r\n <th></th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let item of TMPColumnsList; let i = index; let last = last\" class=\"est-pointer\" [class.est-white-selected]=\"lastSelectedItemID == item.id\" [class.est-no-selection]=\"!item.visible\" (click)=\"columnClicked(item);\">\r\n <td *ngIf=\"HiddenColumns\">\r\n <input type=\"checkbox\" [class.est-hidden-view]=\"item.fixed\" class=\"est-pointer\" [(ngModel)]=\"item.visible\" name=\"visible{{i}}\" (ngModelChange)=\"updateGlobalColVisCheck();\" />\r\n </td>\r\n <td class=\"est-nowrap\" *ngIf=\"ColumnsOrdering\">\r\n <span class=\"fa fa-arrow-up\" [class.est-hidden-view]=\"item.fixed\" (click)=\"lastSelectedItemID = item.id; i != 0 && !item.fixed && sendUp(item); $event.stopPropagation();\"></span>\r\n <span class=\"fa fa-arrow-down\" [class.est-hidden-view]=\"item.fixed\" (click)=\"lastSelectedItemID = item.id; !last && !item.fixed && sendDown(item); $event.stopPropagation();\"></span>\r\n </td>\r\n <td class=\"est-nowrap\">\r\n <ng-container *ngIf=\"item.template\">\r\n <ng-container *ngTemplateOutlet=\"item.template\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!item.template\">{{item.description}}</ng-container>\r\n </td>\r\n <!--Filler-->\r\n <td></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n </div>\r\n <div class=\"modal-footer\">\r\n <button type=\"button\" class=\"btn btn-secondary app-margin-right-10\" (click)=\"lastSelectedItemID = null; changeColumnVisibilityModal.hide();\">{{'Close' | localize : lc}}</button>\r\n <button type=\"button\" [disabled]=\"!TMPColumnsList || TMPColumnsList.length == 0\" class=\"btn btn-primary\" (click)=\"confirmColumnVisibilitySelection() && changeColumnVisibilityModal.hide()\">{{'Confirm' | localize : lc}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n</div>",
2866
- styles: [".est-loading-box{height:200px;text-align:center;position:relative;background:#ccc}.est-loading-content{margin:0;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:35px}.est-scrollable{max-height:600px;overflow:auto}.est-pointer{cursor:pointer}.est-high-density td,.est-high-density th{padding:0 .2rem}.est-no-selection{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none}.est-hidden-view{visibility:hidden}.est-nowrap{white-space:nowrap}.est-white-selected{background-color:#ddd!important}.est-line-through{text-decoration:line-through}.est-no-side-padding{padding-left:0;padding-right:0}.est-no-left-padding,.est-no-right-padding{padding-left:0}.est-col-min{width:1px}.est-switch{position:relative;display:inline-block;width:30px;height:17px;margin-bottom:0;margin-right:5px;margin-left:5px}.est-switch input{display:none}.est-slider{cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc}.est-slider,.est-slider:before{position:absolute;transition:.4s}.est-slider:before{content:\"\";height:13px;width:13px;left:3px;bottom:2px;background-color:#fff}input:checked+.est-slider{background-color:#2196f3}input:focus+.est-slider{box-shadow:0 0 1px #2196f3}input:checked+.est-slider:before{transform:translateX(11px)}.est-slider.round{border-radius:10px}.est-slider.round:before{border-radius:50%}.est-custom-input{width:30px;display:inline;padding:1px;height:20px}.est-row-lvl-1 td:first-child{padding-left:5px}.est-row-lvl-2 td:first-child{padding-left:20px}.est-row-lvl-3 td:first-child{padding-left:35px}.est-row-lvl-4 td:first-child{padding-left:50px}.est-row-lvl-5 td:first-child{padding-left:65px}.est-row-lvl-6 td:first-child{padding-left:80px}.est-row-lvl-7 td:first-child{padding-left:95px}.est-row-lvl-8 td:first-child{padding-left:110px}.est-row-lvl-9 td:first-child{padding-left:125px}.est-row-lvl-10 td:first-child{padding-left:140px}.est-row-lvl-11 td:first-child{padding-left:155px}.est-row-lvl-12 td:first-child{padding-left:170px}.est-row-lvl-13 td:first-child{padding-left:185px}.est-row-lvl-14 td:first-child{padding-left:200px}.est-row-lvl-15 td:first-child{padding-left:215px}.est-row-lvl-16 td:first-child{padding-left:230px}.est-row-lvl-17 td:first-child{padding-left:245px}.est-row-lvl-18 td:first-child{padding-left:260px}.est-row-lvl-19 td:first-child{padding-left:275px}.est-row-lvl-20 td:first-child{padding-left:290px}.est-row-lvl-21 td:first-child{padding-left:305px}.est-row-lvl-22 td:first-child{padding-left:320px}.est-row-lvl-23 td:first-child{padding-left:335px}.est-row-lvl-24 td:first-child{padding-left:350px}.est-row-lvl-25 td:first-child{padding-left:365px}.est-row-lvl-26 td:first-child{padding-left:380px}.est-row-lvl-27 td:first-child{padding-left:395px}.est-row-lvl-28 td:first-child{padding-left:410px}.est-row-lvl-29 td:first-child{padding-left:425px}.est-row-lvl-30 td:first-child{padding-left:440px}.est-row-lvl-31 td:first-child{padding-left:455px}.est-row-lvl-32 td:first-child{padding-left:470px}.est-row-lvl-33 td:first-child{padding-left:485px}.est-row-lvl-34 td:first-child{padding-left:500px}.est-row-lvl-35 td:first-child{padding-left:515px}.est-row-lvl-36 td:first-child{padding-left:530px}.est-row-lvl-37 td:first-child{padding-left:545px}.est-row-lvl-38 td:first-child{padding-left:560px}.est-row-lvl-39 td:first-child{padding-left:575px}.est-row-lvl-40 td:first-child{padding-left:590px}.est-row-lvl-41 td:first-child{padding-left:605px}.est-row-lvl-42 td:first-child{padding-left:620px}.est-row-lvl-43 td:first-child{padding-left:635px}.est-row-lvl-44 td:first-child{padding-left:650px}.est-row-lvl-45 td:first-child{padding-left:665px}.est-row-lvl-46 td:first-child{padding-left:680px}.est-row-lvl-47 td:first-child{padding-left:695px}.est-row-lvl-48 td:first-child{padding-left:710px}.est-row-lvl-49 td:first-child{padding-left:725px}.est-row-lvl-50 td:first-child{padding-left:740px}.est-row-lvl-51 td:first-child{padding-left:755px}.est-row-lvl-52 td:first-child{padding-left:770px}.est-row-lvl-53 td:first-child{padding-left:785px}.est-row-lvl-54 td:first-child{padding-left:800px}.est-row-lvl-55 td:first-child{padding-left:815px}.est-row-lvl-56 td:first-child{padding-left:830px}.est-row-lvl-57 td:first-child{padding-left:845px}.est-row-lvl-58 td:first-child{padding-left:860px}.est-row-lvl-59 td:first-child{padding-left:875px}.est-row-lvl-60 td:first-child{padding-left:890px}.est-row-lvl-61 td:first-child{padding-left:905px}.est-row-lvl-62 td:first-child{padding-left:920px}.est-row-lvl-63 td:first-child{padding-left:935px}.est-row-lvl-64 td:first-child{padding-left:950px}.est-row-lvl-65 td:first-child{padding-left:965px}.est-row-lvl-66 td:first-child{padding-left:980px}.est-row-lvl-67 td:first-child{padding-left:995px}.est-row-lvl-68 td:first-child{padding-left:1010px}.est-row-lvl-69 td:first-child{padding-left:1025px}.est-row-lvl-70 td:first-child{padding-left:1040px}.est-row-lvl-71 td:first-child{padding-left:1055px}.est-row-lvl-72 td:first-child{padding-left:1070px}.est-row-lvl-73 td:first-child{padding-left:1085px}.est-row-lvl-74 td:first-child{padding-left:1100px}.est-row-lvl-75 td:first-child{padding-left:1115px}.est-row-lvl-76 td:first-child{padding-left:1130px}.est-row-lvl-77 td:first-child{padding-left:1145px}.est-row-lvl-78 td:first-child{padding-left:1160px}.est-row-lvl-79 td:first-child{padding-left:1175px}.est-row-lvl-80 td:first-child{padding-left:1190px}.est-row-lvl-81 td:first-child{padding-left:1205px}.est-row-lvl-82 td:first-child{padding-left:1220px}.est-row-lvl-83 td:first-child{padding-left:1235px}.est-row-lvl-84 td:first-child{padding-left:1250px}.est-row-lvl-85 td:first-child{padding-left:1265px}.est-row-lvl-86 td:first-child{padding-left:1280px}.est-row-lvl-87 td:first-child{padding-left:1295px}.est-row-lvl-88 td:first-child{padding-left:1310px}.est-row-lvl-89 td:first-child{padding-left:1325px}.est-row-lvl-90 td:first-child{padding-left:1340px}.est-row-lvl-91 td:first-child{padding-left:1355px}.est-row-lvl-92 td:first-child{padding-left:1370px}.est-row-lvl-93 td:first-child{padding-left:1385px}.est-row-lvl-94 td:first-child{padding-left:1400px}.est-row-lvl-95 td:first-child{padding-left:1415px}.est-row-lvl-96 td:first-child{padding-left:1430px}.est-row-lvl-97 td:first-child{padding-left:1445px}.est-row-lvl-98 td:first-child{padding-left:1460px}.est-row-lvl-99 td:first-child{padding-left:1475px}.est-right-10{right:10px}.est-hidden{visibility:hidden}"]
4534
+ template: "<!-- Patacchino di autoaggiornamento -->\r\n<div class=\"w-100\" *ngIf=\"AutoUpdate\">\r\n <div class=\"pull-right\">\r\n {{'Update every' | localize : lc}}&nbsp;<input [readonly]=\"autoUpdate\" maxlength=\"3\" class=\"form-control est-custom-input\" type=\"text\" [(ngModel)]=\"seconds\" />&nbsp;{{'second/s' | localize : lc}}\r\n </div>\r\n <div class=\"pull-right m-t-2\">\r\n <label class=\"est-switch\">\r\n <input type=\"checkbox\" [(ngModel)]=\"autoUpdate\" (ngModelChange)=\"autoUpdateChanged();\" />\r\n <div class=\"est-slider round\"></div>\r\n </label>\r\n </div>\r\n</div>\r\n\r\n<!--\r\nI TH sono contenuto statico, questo significa che senza condizione per RowTHs arriverebbero sia qui sia nell ng-container dell'header in fase non inizializzata, duplicando fisicamente le colonne.\r\nPer ovviare al problema, questo pezzo lo faccio apparire solo se ci sono gi\u00E0 dei RowTHs, quindi su valorizzazione della View succeder\u00E0:\r\n1) appaiono i th nell' ng-container dell'header, e NON qui\r\n2) i TH vengono presi, elaborati e trasformati in RowTHs\r\n3) l'ng-container dell'header sparisce (per la condizione !UseCustomCells || !RowTHs) e qui appaiono i nuovi TH (che poi sono gli stessi di prima che girano)\r\n4) Vengono presi i nuovi TH da qui e trasformati a loro volta in RowTHs\r\n-->\r\n<div hidden *ngIf=\"UseCustomCells && RowTHs\">\r\n <ng-container *ngIf=\"View\">\r\n <!--Qui invece ci sono tutti i TH-->\r\n <ng-container *ngTemplateOutlet=\"headerRef\"></ng-container>\r\n </ng-container>\r\n</div>\r\n\r\n<!--\r\nQuesta parte \u00E8 un po' pi\u00F9 semplice del sopra. Infatti i TD vengono s\u00EC bindati in entrambi i punti (qui e nell'ng-container del body), ma avr\u00F2 le TD statiche prima di generare la TMPBoundSource.\r\nQuesto significa che il workflow di binding sar\u00E0:\r\n1) Appaiono i TD statici nel body e NON qui, perch\u00E9 i TMPBoundSource non sono ancora stati emessi\r\n2) Contemporaneamente all'emissione dei TMPBoundSource vengono anche emessi i RowTds\r\n3) Considerando il punto 2, al giro dopo appariranno i TD qui, perch\u00E9 \u00E8 stata generata la TMPBoundSource, e spariranno contemporaneamente dall'ng-container del body (per la condizione !UseCustomCells || !RowTDs)\r\n-->\r\n<div hidden *ngIf=\"UseCustomCells && bodyRef\">\r\n <ng-container *ngIf=\"View\">\r\n <!--Tutti i TD che dopo verranno presi ed elaborati internamente-->\r\n <ng-container *ngFor=\"let item of TMPBoundSource\">\r\n <ng-container *ngTemplateOutlet=\"bodyRef; context : {$implicit: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</div>\r\n\r\n<ng-container *ngIf=\"View\">\r\n <div *ngIf=\"FirstBind && ShowLoadingOnBootstrap\" class=\"est-loading-box\">\r\n <div class=\"est-loading-content\">\r\n <span class=\"fa fa-spinner fa-spin\"></span>&nbsp;{{'Performing Table bootstrap' | localize: lc}}...\r\n </div>\r\n </div>\r\n\r\n <div *ngIf=\"PagingStyle == 'both' || PagingStyle == 'top'\">\r\n <ng-container *ngTemplateOutlet=\"pagingElement\"></ng-container>\r\n </div>\r\n\r\n <div class=\"table-responsive datatable {{ContainerClass}}\" [class.est-scrollable]=\"UseEndlessscroll\" (scroll)=\"UseEndlessscroll && onScroll($event)\" [style.max-height.px]=\"MaxHeight\">\r\n <table class=\"{{ TableClass }} est-margin-bottom-10\" [class.est-high-density]=\"HighCellDensity\">\r\n <thead [hidden]=\"HeaderHidden || FirstBind\">\r\n <!-- Aggiungo il pezzo che gestisce la selezione di tutto se attivo da config -->\r\n <tr *ngIf=\"SelectAll\">\r\n <th class=\"est-no-selection\" [attr.colspan]=\"Columns.Global\" [class.est-hidden]=\"!canSelectAll && !(View?.selection || arraymodeSelection).all\">\r\n <span>{{ ((selectedObjects || 0) | number : '0.0-0' : locale) + ' ' + ((selectedObjects == 1 ? 'Object Selected' : 'Objects Selected') | localize : lc) }}</span>&nbsp;\r\n <span class=\"est-link est-inline\" (click)=\"selectAllOrResetSelection()\">{{ (View?.selection || arraymodeSelection).all ? ('Reset Selection' | localize : lc) : ('Select Everything' | localize : lc)}}</span>\r\n </th>\r\n </tr>\r\n\r\n <!-- Blocco header group -->\r\n <ng-container *ngIf=\"RowThGroups\">\r\n <tr *ngFor=\"let level of RowThGroups\">\r\n <th *ngFor=\"let cell of level\" [attr.colspan]=\"cell.Span\" \r\n [class.est-pinned-header]=\"cell.Pinned\" [class.est-col-min]=\"cell.Pinned\"\r\n [class.est-ltab-border]=\"cell.Borders\" [class.est-rtab-border]=\"cell.Borders\"\r\n class=\"est-text-center\">\r\n <ng-container *ngIf=\"cell.Pinned; Else: cell.Template\">\r\n <div class=\"est-pinned-border est-cell-group-padding\"></div>\r\n </ng-container>\r\n </th>\r\n </tr>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"!RowThGroups\">\r\n <tr *ngIf=\"headerGroupRef\">\r\n <ng-container *ngTemplateOutlet=\"headerGroupRef\"></ng-container>\r\n <th *ngIf=\"Export\"></th>\r\n </tr>\r\n \r\n <!-- Blocco header group secondario -->\r\n <tr *ngIf=\"secondaryHeaderGroupRef\">\r\n <ng-container *ngTemplateOutlet=\"secondaryHeaderGroupRef\"></ng-container>\r\n <th *ngIf=\"Export\"></th>\r\n </tr>\r\n </ng-container>\r\n\r\n <!-- Blocco effettivo degli header -->\r\n <tr>\r\n <!-- Aggiungo una checkbox se la selezione \u00E8 attiva -->\r\n <th class=\"est-col-min\" *ngIf=\"Selection && !HasPinnedColumns\">\r\n <input *ngIf=\"!SingleSelection\" class=\"est-pointer\" type=\"checkbox\" [disabled]=\"SelectionDisabled\" [(ngModel)]=\"globalCheck\" [ngModelOptions]=\"{'standalone': true}\" (ngModelChange)=\"globalCheckChanged();\">\r\n </th>\r\n\r\n <!-- Header che valgono per view mode e array mode -->\r\n <ng-container *ngIf=\"(viewMode || arrayMode)\">\r\n\r\n <!-- In una tabella base prendo semplicemente i th scritti dall'utente nell'HTML -->\r\n <ng-container *ngIf=\"(!UseCustomCells || !RowTHs) && !DynamicRowColumnsDefinition\">\r\n <ng-container *ngTemplateOutlet=\"headerRef\"></ng-container>\r\n </ng-container>\r\n\r\n <!-- Se ho un modello dinamico dell'oggetto creo le colonne in base alle propriet\u00E0 -->\r\n <ng-container *ngIf=\"(!UseCustomCells || !RowTHs) && DynamicRowColumnsDefinition\">\r\n <th *ngFor=\"let operation of DynamicOperations\" class=\"est-col-min est-no-side-padding\"></th>\r\n \r\n <ng-container *ngFor=\"let rowHeader of DynamicRowColumnsDefinition\">\r\n <ng-container *ngIf=\"rowHeader.visible\">\r\n <th *ngIf=\"OrderByColumn\" es-th=\"{{rowHeader.propertyName}}\" class=\"{{UserDefinedDynamicCols ? ((rowHeader.clss || '') + (rowHeader.headerWraps ? '' : ' est-nowrap')) : ' est-nowrap'}}\" [Order]=\"rowHeader.dataOrder\" [Resizable]=\"ColumnsResizable\" [Orderable]=\"rowHeader.orderable\" [OrderBy]=\"OrderByColumn\" [SearchInProgress]=\"!!researchInProgress\" (onOrderChange)=\"thOrderChanged(rowHeader.propertyName, $event)\">{{rowHeader.description}}</th>\r\n <th *ngIf=\"!OrderByColumn\" es-th=\"{{rowHeader.propertyName}}\" class=\"{{UserDefinedDynamicCols ? ((rowHeader.clss || '') + (rowHeader.headerWraps ? '' : ' est-nowrap')) : ' est-nowrap'}}\" [Order]=\"rowHeader.dataOrder\" [Resizable]=\"ColumnsResizable\" [Orderable]=\"rowHeader.orderable\" [OrderBy]=\"OrderByColumn\">{{rowHeader.description}}</th>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <!-- Se non ho un modello dinamico ma invece delle celle custom, genero gli header in base ai row th -->\r\n <ng-container *ngIf=\"UseCustomCells && RowTHs\">\r\n <th *ngIf=\"HasPinnedColumns\" class=\"est-pinned-header est-col-min\">\r\n <div [style.width.px]=\"PinnedContainerWidth\" class=\"est-pinned-border\">\r\n <th class=\"est-col-min est-no-border\" *ngIf=\"Selection\">\r\n <input *ngIf=\"!SingleSelection\" class=\"est-pointer\" type=\"checkbox\" [disabled]=\"SelectionDisabled\" [(ngModel)]=\"globalCheck\" [ngModelOptions]=\"{'standalone': true}\" (ngModelChange)=\"globalCheckChanged();\">\r\n </th>\r\n <ng-container *ngFor=\"let rowHeader of RowTHs\">\r\n <th *ngIf=\"rowHeader && rowHeader.Visible && rowHeader.Pinned\" [style.width.px]=\"rowHeader.PinnedWidth\" es-th=\"{{rowHeader.ID}}\" [class.est-no-border]=\"true\" [class.est-nowrap]=\"!rowHeader.Wrap\" class=\"{{rowHeader.Class || ''}}\" [Order]=\"rowHeader.Order\" [Resizable]=\"ColumnsResizable\" [Orderable]=\"rowHeader.Orderable\" [OrderBy]=\"OrderByColumn\" [SearchInProgress]=\"!!researchInProgress\" (onOrderChange)=\"OrderByColumn && thOrderChanged(rowHeader.ID, $event)\">\r\n <ng-container *ngIf=\"rowHeader.Template\"><ng-container *ngTemplateOutlet=\"rowHeader.Template;\"></ng-container></ng-container>\r\n <span *ngIf=\"!rowHeader.Template\">{{rowHeader.Content}}</span>\r\n </th>\r\n </ng-container>\r\n </div>\r\n </th>\r\n <ng-container *ngFor=\"let rowHeader of RowTHs\">\r\n <th *ngIf=\"rowHeader && rowHeader.Visible && !rowHeader.Pinned\" es-th=\"{{rowHeader.ID}}\" [class.est-ltab-border]=\"rowHeader.LeftBorder\" [class.est-rtab-border]=\"rowHeader.RightBorder\" [class.est-nowrap]=\"!rowHeader.Wrap\" class=\"{{rowHeader.Class || ''}}\" [Order]=\"rowHeader.Order\" [Resizable]=\"ColumnsResizable\" [Orderable]=\"rowHeader.Orderable\" [OrderBy]=\"OrderByColumn\" [SearchInProgress]=\"!!researchInProgress\" (onOrderChange)=\"OrderByColumn && thOrderChanged(rowHeader.ID, $event)\">\r\n <ng-container *ngIf=\"rowHeader.Template\"><ng-container *ngTemplateOutlet=\"rowHeader.Template;\"></ng-container></ng-container>\r\n <span *ngIf=\"!rowHeader.Template\">{{rowHeader.Content}}</span>\r\n </th>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <!--Casistica in cui ho il setup proveniente da un report. Gli header sono definiti da come \u00E8 fatto il report-->\r\n <ng-container *ngIf=\"reportMode\">\r\n <th [style.color]=\"clm.color\" *ngFor=\"let clm of ReportValues.columns\" class=\"est-no-selection est-pointer est-nowrap\" (click)=\"setupNextOrderAndSearch(clm)\">\r\n {{clm.description}}<span class=\"fa\" [class.fa-chevron-down]=\"clm.order == 'DESC'\" [class.fa-chevron-up]=\"clm.order == 'ASC'\"></span>\r\n </th>\r\n </ng-container>\r\n\r\n <!--Per l'eliminazione mi serve un header aggiuntivo-->\r\n <th *ngIf=\"Removal\" [class.est-right-10]=\"Export || HiddenColumns\" class=\"est-col-min est-sticky-last-column\"><span class=\"fa fa-trash\"></span></th>\r\n\r\n <!--Per l'esportazione mi serve l'header extra da cui faccio uscire i 3 pallocchi-->\r\n <th *ngIf=\"Export || HiddenColumns || ColumnsOrdering || CornerMenuOptions\" class=\"est-table-dotted-menu est-sticky-last-column est-col-min text-sm-center\">\r\n \r\n <!-- Link nascosto che serve a scaricare il file -->\r\n <a *ngIf=\"headers\" hidden #exportDownloader csvLink [data]=\"data\" [headers]=\"headers\" [delimiter]=\"';'\" [filename]=\"ExportFileName\"></a>\r\n\r\n <!-- Blocco con i 3 pallocchi che tira fuori il context menu delle operazioni -->\r\n <div class=\"btn-group\" container=\"body\" placement=\"bottom right\" dropdown #dropdown=\"bs-dropdown\" [autoClose]=\"true\">\r\n <span dropdownToggle class=\"fa fa-ellipsis-v est-fs-18 est-pointer est-padding-3\"></span>\r\n\r\n <div *dropdownMenu class=\"dropdown-menu dropdown-menu-right est-bring-to-front-strong\">\r\n <div class=\"est-pointer\">\r\n <a class=\"dropdown-item\" *ngIf=\"HiddenColumns || ColumnsOrdering\" (click)=\"resetColumnVisSelection(); changeColumnVisibilityModal.show();\">\r\n <ng-container *ngIf=\"!HiddenColumns && ColumnsOrdering\">\r\n {{'Columns Order' | localize : lc}}\r\n </ng-container>\r\n <ng-container *ngIf=\"HiddenColumns && !ColumnsOrdering\">\r\n {{'Columns Visibility' | localize : lc}}\r\n </ng-container>\r\n <ng-container *ngIf=\"HiddenColumns && ColumnsOrdering\">\r\n {{'Columns Visibility and Order' | localize : lc}}\r\n </ng-container>\r\n </a>\r\n <a class=\"dropdown-item\" *ngIf=\"Export && CSVExport\" (click)=\"tryExport('CSV')\">{{'Export View' | localize : lc}} (CSV)</a>\r\n <a class=\"dropdown-item\" *ngIf=\"Export && XLSXExport\" (click)=\"tryExport('XLSX')\">{{'Export View' | localize : lc}} (XLSX)</a>\r\n <a class=\"dropdown-item\" *ngFor=\"let option of CornerMenuOptions\" (click)=\"cornerActionClicked(option.id)\">{{option.description}}</a>\r\n </div>\r\n </div>\r\n </div>\r\n </th>\r\n </tr>\r\n </thead>\r\n \r\n <!-- Valido per modalit\u00E0 View o Array. Se sono in report mode il body \u00E8 creato in altro modo -->\r\n <tbody [hidden]=\"BodyHidden || FirstBind\" *ngIf=\"(arrayMode || viewMode)\">\r\n <!--Con selection attiva richiamo il template che gestisce il context menu-->\r\n <ng-container *ngIf=\"Selection\">\r\n <ng-container *ngTemplateOutlet=\"TBodySelection; context: { $implicit: { selDisabled: arrayMode ? false : SelectionDisabled, sel: Selection }}\"></ng-container>\r\n </ng-container>\r\n\r\n <!--Senza selection richiamo il template che NON gestisce il context menu-->\r\n <ng-container *ngIf=\"!Selection\">\r\n <ng-container *ngTemplateOutlet=\"TBody\"></ng-container>\r\n </ng-container>\r\n </tbody>\r\n\r\n <!-- Per la modalit\u00E0 a report c'\u00E8 un body particolare semi-dinamico -->\r\n <tbody [hidden]=\"BodyHidden\" *ngIf=\"reportMode\">\r\n <tr *ngFor=\"let row of ReportValues.rows; let even = even;\">\r\n <td class=\"est-nowrap\" *ngFor=\"let val of row.values\">{{val}}</td>\r\n <td class=\"est-sticky-last-column{{even && !Hierarchy ? '-alt' : ''}}\"></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n\r\n <div *ngIf=\"PagingStyle == 'both' || PagingStyle == 'bottom'\">\r\n <ng-container *ngTemplateOutlet=\"pagingElement\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<!-- Template che contiene tutte le info di paginazione in modo da poterlo replicare anche sopra -->\r\n<ng-template #pagingElement>\r\n <ng-container *ngIf=\"!FirstBind\">\r\n <!-- Pulsanti avanti-indietro di paginazione -->\r\n <div *ngIf=\"PagerOptions.ShowPaging && !HidePagingButtons\" class=\"pull-right btn-toolbar\">\r\n <ng-container *ngIf=\"(!reportMode || View?.pagingavailable) && (!arrayMode || SearchView)\">\r\n <ng-container *ngTemplateOutlet=\"pagingButtons; context: { $implicit: { ATP: addToPage.bind(this), GTP: goToPage.bind(this), Array: arrayPulsanti }}\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"arrayMode && UseArrayModePaging && !SearchView\">\r\n <ng-container *ngTemplateOutlet=\"pagingButtons; context: { $implicit: { ATP: arrayAddToPage.bind(this), GTP: arrayGoToPage.bind(this), Array: arrayPulsanti }}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <!-- Paginatore dove appare la count e le opzioni di paginazione -->\r\n <div class=\"pull-right m-t-min-3 est-margin-right-50\">\r\n <div *ngIf=\"PagerOptions.ShowPaging && (PagerOptions.PagerCount > 10 || reportMode && View.pagingavailable)\">\r\n <app-paging *ngIf=\"!PagerOptions.UsesView\" [ShowCount]=\"PagerOptions.ShowCount\" [PagerCount]=\"PagerOptions.PagerCount\" [WarnOnAll]=\"false\" [CurrentPageSize]=\"ArraymodeItemsPerPage\" (pagingSelected)=\"refreshPaging($event)\"></app-paging>\r\n <app-paging *ngIf=\"PagerOptions.UsesView\" [ShowCount]=\"PagerOptions.ShowCount\" [PagerCount]=\"PagerOptions.PagerCount\" [GroupMode]=\"PagerOptions.Searches == 'groups'\" [AllSearch]=\"AllSearch\" [View]=\"PagerOptions.View\" (pagingSelected)=\"onItemsPerPageChanged($event);\"></app-paging>\r\n </div>\r\n <div *ngIf=\"reportMode && !PagerOptions.ShowPaging\"><em>{{'Paging options are not available for this report' | localize: lc}}</em></div>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<!-- Template che contiene i pulsanti per cambiare pagina -->\r\n<ng-template #pagingButtons let-options>\r\n <a class=\"btn\" class=\"est-page-prev app-pointer\" (click)=\"options.ATP(-1, options.separator)\">\r\n <span class=\"fa fa-chevron-left\"></span>\r\n </a>\r\n <div *ngIf=\"options.Array\" class=\"est-inline\">\r\n <a *ngFor=\"let p of options.Array\" class=\"btn est-page-sel {{p.cssClass}}\" (click)=\"options.GTP(p.val, options.separator)\">{{p.val}}</a>\r\n </div>\r\n <a class=\"btn\" class=\"est-page-next app-pointer\" (click)=\"options.ATP(1, options.separator)\">\r\n <span class=\"fa fa-chevron-right\"></span>\r\n </a>\r\n</ng-template>\r\n\r\n<!-- Questi due template rappresentano effettivamente il body della tabella. essendo il tr l'unica cosa che davvero cambia, il resto \u00E8 templatizzato -->\r\n<ng-template #TBodySelection let-templateOptions>\r\n <ng-container *ngFor=\"let item of boundSource; let even = even; let i=index;\">\r\n <tr *ngIf=\"item._visible || (!Hierarchy && !ArrayGrouping)\" \r\n [class]=\"item._rowClass ? item._rowClass : ''\" \r\n [class.est-line-through]=\"item.removed || item.deleted\" \r\n [class.est-pointer]=\"!item.locked\" \r\n [class.est-white-selected]=\"item._selected && !item.locked\"\r\n [class.est-rg]=\"item._group\"\r\n [class.est-rg-sep]=\"item._sep\"\r\n [contextMenu]=\"!item.locked ? (ContextMenu || emptyMenu) : emptyMenu\" [contextMenuSubject]=\"item\"\r\n (click)=\"(!item.locked && !item._sep && !item._group && handleClick($event, item)) || item._group && handleGroupClick(item)\">\r\n\r\n <td *ngIf=\"!item.locked && !item._sep && !HasPinnedColumns\">\r\n <input type=\"checkbox\" \r\n [disabled]=\"templateOptions.selDisabled\" \r\n [class.est-pointer]=\"!item.locked\"\r\n [(ngModel)]=\"item._selected\" name=\"check{{i}}\" \r\n (click)=\"$event.stopPropagation(); handleClick($event, item);\">\r\n </td>\r\n <td *ngIf=\"(item.locked || item._sep) && !HasPinnedColumns\"></td>\r\n\r\n <ng-container *ngIf=\"item._sep\"><ng-container *ngTemplateOutlet=\"groupPager; context: { $implicit: item }\"></ng-container> </ng-container>\r\n\r\n <ng-container *ngIf=\"!item._sep\">\r\n <ng-container *ngTemplateOutlet=\"basicColumns; context: { $implicit: item }\"></ng-container>\r\n <ng-container *ngTemplateOutlet=\"dynamicColumns; context: { $implicit: item }\"></ng-container>\r\n <ng-container *ngTemplateOutlet=\"customCells; context: { $implicit: item, templateOptions: templateOptions }\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngTemplateOutlet=\"bodyDeleteAndExport; context: { $implicit: { even: even, item: item }}\"></ng-container>\r\n </tr>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<ng-template #TBody>\r\n <ng-container *ngFor=\"let item of boundSource; let even = even;\">\r\n <tr *ngIf=\"item._visible || !Hierarchy\" \r\n [class]=\"item._rowClass ? item._rowClass : ''\" \r\n [class.est-line-through]=\"item.removed || item.deleted\"\r\n [class.est-rg]=\"item._group\"\r\n [class.est-rg-sep]=\"item._sep\"\r\n (click)=\"item._group && handleGroupClick(item)\">\r\n\r\n <ng-container *ngIf=\"item._sep\"><ng-container *ngTemplateOutlet=\"groupPager; context: { $implicit: item }\"></ng-container></ng-container>\r\n\r\n <ng-container *ngIf=\"!item._sep\">\r\n <ng-container *ngTemplateOutlet=\"basicColumns; context: { $implicit: item }\"></ng-container>\r\n <ng-container *ngTemplateOutlet=\"dynamicColumns; context: { $implicit: item }\"></ng-container>\r\n <ng-container *ngTemplateOutlet=\"customCells; context: { $implicit: item }\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngTemplateOutlet=\"bodyDeleteAndExport; context: { $implicit: { even: even, item: item }}\"></ng-container>\r\n </tr>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<ng-template #groupPager let-item>\r\n <td *ngIf=\"HasPinnedColumns\"></td>\r\n <td *ngIf=\"item._grouplevel > 1\" [attr.colspan]=\"item._grouplevel-1\"></td>\r\n <td [attr.colspan]=\"Columns.VisibleUnpinned - (item._grouplevel > 0 ? item._grouplevel - 1 : 0)\">\r\n <div class=\"est-rg-sep-flex-right\" *ngIf=\"RowGroupingPagingStyle == 'right'\">\r\n <div class=\"est-rg-page\"><ng-container *ngTemplateOutlet=\"pagingButtons; context: { $implicit: { separator: item, ATP: addToPageGroup.bind(this), GTP: goToPageGroup.bind(this), Array: item.buttons }}\"></ng-container></div>\r\n <div class=\"est-rg-ipp\"><app-paging [AllSearch]=\"AllSearch\" [GroupMode]=\"item.searches == 'groups'\" [PagerCount]=\"item.searches == 'groups' ? item.view.groupcount : item.view.objectcount\" [View]=\"item.view\" (pagingSelected)=\"onGroupItemsPerPageChanged(item, $event);\"></app-paging></div>\r\n </div>\r\n\r\n <div class=\"est-rg-sep-flex-left\" *ngIf=\"RowGroupingPagingStyle == 'left'\">\r\n <div class=\"est-rg-ipp\"><app-paging [AllSearch]=\"AllSearch\" [GroupMode]=\"item.searches == 'groups'\" [PagerCount]=\"item.searches == 'groups' ? item.view.groupcount : item.view.objectcount\" [View]=\"item.view\" (pagingSelected)=\"onGroupItemsPerPageChanged(item, $event);\"></app-paging></div>\r\n <div class=\"est-rg-page\"><ng-container *ngTemplateOutlet=\"pagingButtons; context: { $implicit: { separator: item, ATP: addToPageGroup.bind(this), GTP: goToPageGroup.bind(this), Array: item.buttons }}\"></ng-container></div>\r\n </div>\r\n </td>\r\n</ng-template>\r\n\r\n<!-- Questo template contiene la print condizionale su tabelle semplici, con header e body scritti a manazza -->\r\n<ng-template #basicColumns let-item>\r\n <ng-container *ngIf=\"(!UseCustomCells || !RowTDs) && !DynamicRowColumnsDefinition\">\r\n <ng-container *ngTemplateOutlet=\"bodyRef; context : {$implicit: item}\"></ng-container>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<!-- Questo template contiene la print condizionale su tabelle definite in maniera dinamica dal modello -->\r\n<ng-template #dynamicColumns let-item>\r\n <ng-container *ngIf=\"(!UseCustomCells || !RowTDs) && DynamicRowColumnsDefinition\">\r\n <ng-container *ngFor=\"let operation of DynamicOperations; let first = first; let last = last;\">\r\n <ng-container *ngIf=\"!operation.conditionField || (item.properties[operation.conditionField] == operation.conditionValue)\">\r\n <td [class.est-no-right-padding]=\"last\" [class.est-no-left-padding]=\"!first\" class=\"est-col-min\"><span title=\"{{operation.title}}\" class=\"{{operation.iconClass}} est-pointer\" (click)=\"dynamicOperation(item, operation.id)\">{{operation.text}}</span></td>\r\n </ng-container>\r\n <ng-container *ngIf=\"operation.conditionField && (item.properties[operation.conditionField] != operation.conditionValue)\">\r\n <td class=\"est-col-min est-no-side-padding\"></td>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let rowItem of DynamicRowColumnsDefinition\">\r\n <ng-container *ngIf=\"rowItem.routePath && rowItem.visible\">\r\n <td es-td=\"{{rowItem.propertyName}}\" class=\"{{UserDefinedDynamicCols ? rowItem.clss : 'est-nowrap'}}\" [Internal]=\"false\" [Context]=\"item._hash\">\r\n <a [routerLink]=\"generateRouterLink(rowItem.routePath, rowItem.routeParameterProperties, item)\" class=\"est-link\" [innerHTML]=\"item.properties[rowItem.propertyName]\"></a>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngIf=\"!rowItem.routePath && rowItem.visible\">\r\n <ng-container *ngTemplateOutlet=\"findEsTd(rowItem.propertyName) || defaultEsTd; context: { $implicit: item.properties[rowItem.propertyName], rowItem : rowItem, item : item }\"> </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<ng-template #defaultEsTd let-value let-rowItem='rowItem' let-item='item'>\r\n <td es-td=\"{{rowItem.propertyName}}\" class=\"{{UserDefinedDynamicCols ? rowItem.clss : 'est-nowrap'}}\"\r\n [class.est-pointer]=\"UseCustomCellActions && CustomCellActionsOn.indexOf('$' + rowItem.propertyName + '$') != -1\"\r\n (click)=\"cellClicked(rowItem.propertyName, item) && !CellActionPropagates && $event.stopPropagation()\"\r\n [Internal]=\"false\" [Context]=\"item._hash\">\r\n {{value}}\r\n </td>\r\n</ng-template>\r\n\r\n<!-- Questo template contiene la print condizionale delle celle custom se configurate -->\r\n<ng-template #customCells let-item let-opt=\"templateOptions\">\r\n <ng-container *ngIf=\"UseCustomCells && RowTDs\">\r\n\r\n <td *ngIf=\"HasPinnedColumns\" class=\"est-pinned-body est-col-min\" [class.est-white-selected]=\"item._selected\">\r\n <div [style.width.px]=\"PinnedContainerWidth\" class=\"est-pinned-border\">\r\n <td *ngIf=\"!item.locked && !item._sep && Selection\" class=\"est-no-border est-col-min\">\r\n <input type=\"checkbox\" [disabled]=\"opt.selDisabled\" [class.est-pointer]=\"!item.locked\" [(ngModel)]=\"item._selected\" name=\"check{{item._hash}}\" (click)=\"$event.stopPropagation(); handleClick($event, item);\">\r\n </td>\r\n <td class=\"est-no-border est-col-min\" *ngIf=\"(item.locked || item._sep) && Selection\"></td>\r\n\r\n <ng-container *ngFor=\"let rowItem of RowTDs[item._hash]; let i = index\">\r\n <td *ngIf=\"rowItem && rowItem.Pinned\" [style.width.px]=\"rowItem.PinnedWidth\" es-td=\"{{rowItem.ID}}\" class=\"{{rowItem.Class}}\" [class.est-no-border]=\"true\" [class.est-rg-hdr]=\"rowItem.GroupHeader\" [class.est-rg-agg]=\"rowItem.GroupAggregation\" \r\n [class.est-nowrap]=\"Hierarchy || !rowItem.Wraps\" [Internal]=\"true\">\r\n <ng-container *ngIf=\"Hierarchy && i == 0\"><ng-container *ngTemplateOutlet=\"HierarchyNavigator; context: { $implicit: item }\"></ng-container></ng-container>\r\n <ng-container *ngIf=\"rowItem.Template\"><ng-container *ngTemplateOutlet=\"rowItem.Template; context: { $implicit: item }\"></ng-container></ng-container>\r\n <span *ngIf=\"!rowItem.Template\">{{rowItem.Content}}</span>\r\n </td>\r\n </ng-container>\r\n </div>\r\n </td>\r\n\r\n <ng-container *ngFor=\"let rowItem of RowTDs[item._hash]; let i = index\">\r\n <ng-container *ngIf=\"rowItem && !rowItem.Pinned\">\r\n\r\n <!-- Casistica senza bodyRef, quindi con direttive per i td -->\r\n <ng-container *ngIf=\"!bodyRef && rowItem.Visible\">\r\n <td es-td=\"{{rowItem.ID}}\" class=\"{{rowItem.Class}}\" [class.est-ltab-border]=\"rowItem.LeftBorder\" [class.est-rtab-border]=\"rowItem.RightBorder\" [class.est-rg-hdr]=\"rowItem.GroupHeader\" [class.est-rg-agg]=\"rowItem.GroupAggregation\" \r\n [class.est-nowrap]=\"Hierarchy || !rowItem.Wraps\" [Internal]=\"true\">\r\n <ng-container *ngIf=\"Hierarchy && i == 0\"><ng-container *ngTemplateOutlet=\"HierarchyNavigator; context: { $implicit: item }\"></ng-container></ng-container>\r\n <ng-container *ngIf=\"rowItem.Template\"><ng-container *ngTemplateOutlet=\"rowItem.Template; context: { $implicit: item }\"></ng-container></ng-container>\r\n <span *ngIf=\"!rowItem.Template\">{{rowItem.Content}}</span>\r\n </td>\r\n </ng-container>\r\n\r\n <!-- Casistica bodyRef, quindi con componenti per i td (RouterLink) DEPRECATO -->\r\n <ng-container *ngIf=\"rowItem.RouterLink && rowItem.Visible && bodyRef\">\r\n <td es-td=\"{{rowItem.ID}}\" class=\"{{rowItem.Class}}\" [class.est-nowrap]=\"Hierarchy || !rowItem.Wraps\" [Internal]=\"true\">\r\n <ng-container *ngIf=\"Hierarchy && i == 0\">\r\n <ng-container *ngTemplateOutlet=\"HierarchyNavigator; context: { $implicit: item }\"></ng-container>\r\n </ng-container>\r\n <a [routerLink]='rowItem.RouterLink' class=\"est-link\" [innerHTML]=\"rowItem.Content\"></a>\r\n </td>\r\n </ng-container>\r\n\r\n <!-- Casistica bodyRef, quindi con componenti per i td (NON RouterLink) DEPRECATO -->\r\n <ng-container *ngIf=\"!rowItem.RouterLink && rowItem.Visible && bodyRef\">\r\n <td es-td=\"{{rowItem.ID}}\" class=\"{{rowItem.Class}}\" [class.est-nowrap]=\"Hierarchy || !rowItem.Wraps\" [class.est-pointer]=\"UseCustomCellActions && CustomCellActionsOn.indexOf('$' + $any(rowItem).ID + '$') != -1\" (click)=\"cellClicked(rowItem.ID, item) && !CellActionPropagates && $event.stopPropagation()\" [Internal]=\"true\">\r\n <ng-container *ngIf=\"Hierarchy && i == 0\">\r\n <ng-container *ngTemplateOutlet=\"HierarchyNavigator; context: { $implicit: item }\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"rowItem.Template\">\r\n <ng-container *ngTemplateOutlet=\"rowItem.Template; context: { $implicit: item }\"></ng-container>\r\n </ng-container>\r\n <span *ngIf=\"!rowItem.Template\" [innerHTML]=\"rowItem.Content\"></span>\r\n </td>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<ng-template #HierarchyNavigator let-item>\r\n <span *ngIf=\"!item.parent\" class=\"fa fa-chevron-down\" style=\"visibility:hidden\"></span>\r\n <span *ngIf=\"item.parent && item._expanded\" class=\"fa fa-chevron-down est-pointer est-no-selection\" (click)=\"collapseParent(item[this.OwnKey])\"></span>\r\n <span *ngIf=\"item.parent && !item._expanded\" class=\"fa fa-chevron-up est-pointer est-no-selection\" (click)=\"expandParent(item[this.OwnKey])\"></span>\r\n &nbsp;\r\n</ng-template>\r\n\r\n<!-- Questo template contiene i pulsanti di eliminazione/undo eliminazione ed esportazione che vanno in fondo ad un record edlla tabella -->\r\n<ng-template #bodyDeleteAndExport let-options>\r\n <ng-container *ngIf=\"Removal && !RemovalCondition\">\r\n <td class=\"est-sticky-last-column{{options.even? '-alt' : ''}} {{Export || HiddenColumns || CornerMenuOptions ? 'est-right-10' : ''}}\" *ngIf=\"!(options.item.removed || options.item.deleted)\"><span class=\"fa fa-remove est-pointer text-danger\" [hidden]=\"options.item.removable != undefined && !options.item.removable\" (click)=\"onRemoval.emit(options.item)\"></span></td>\r\n <td class=\"est-sticky-last-column{{options.even? '-alt' : ''}} {{Export || HiddenColumns || CornerMenuOptions ? 'est-right-10' : ''}}\" *ngIf=\"(options.item.removed || options.item.deleted)\"><span class=\"fa fa-undo text-warning est-pointer\" (click)=\"onAbortRemoval.emit(options.item)\"></span></td>\r\n </ng-container>\r\n <ng-container *ngIf=\"Removal && RemovalCondition\">\r\n <td class=\"est-sticky-last-column{{options.even? '-alt' : ''}} {{Export || HiddenColumns || CornerMenuOptions ? 'est-right-10' : ''}}\" *ngIf=\"!(options.item.removed || options.item.deleted) && options.item[RemovalCondition]\"><span class=\"fa fa-remove est-pointer text-danger\" [hidden]=\"options.item.removable != undefined && !options.item.removable\" (click)=\"onRemoval.emit(options.item)\"></span></td>\r\n <td class=\"est-sticky-last-column{{options.even? '-alt' : ''}} {{Export || HiddenColumns || CornerMenuOptions ? 'est-right-10' : ''}}\" *ngIf=\"(options.item.removed || options.item.deleted) && options.item[RemovalCondition]\"><span class=\"fa fa-undo text-warning est-pointer\" (click)=\"onAbortRemoval.emit(options.item)\"></span></td>\r\n <td class=\"est-sticky-last-column{{options.even? '-alt' : ''}} {{Export || HiddenColumns || CornerMenuOptions ? 'est-right-10' : ''}}\" *ngIf=\"!options.item[RemovalCondition]\"><span class=\"fa fa-remove est-hidden-view\"></span></td>\r\n </ng-container>\r\n <td *ngIf=\"Export || HiddenColumns || CornerMenuOptions\" class=\"est-sticky-last-column{{options.even && !Hierarchy ? '-alt' : ''}}\"></td>\r\n</ng-template>\r\n\r\n<!-- Context menu vuoto default per tutte le tabella che non ce l'hanno, in modo che al click destro appaia \"nessuna op disponibile\" -->\r\n<context-menu #emptyMenu>\r\n <ng-template contextMenuItem>\r\n <span>\r\n <em>{{'No operations available' | localize : lc}}...</em>\r\n </span>\r\n </ng-template>\r\n</context-menu>\r\n\r\n<!-- Modal per cambiare posizione e visibilit\u00E0 delle colonne dell'es-table -->\r\n<div bsModal #changeColumnVisibilityModal=\"bs-modal\" class=\"modal fade\" role=\"dialog\" aria-hidden=\"true\">\r\n <div class=\"modal-dialog modal-lg\">\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h5 class=\"modal-title pull-left\">\r\n <ng-container *ngIf=\"!HiddenColumns && ColumnsOrdering\">\r\n {{'Columns Order' | localize : lc}}\r\n </ng-container>\r\n <ng-container *ngIf=\"HiddenColumns && !ColumnsOrdering\">\r\n {{'Columns Visibility' | localize : lc}}\r\n </ng-container>\r\n <ng-container *ngIf=\"HiddenColumns && ColumnsOrdering\">\r\n {{'Columns Visibility and Order' | localize : lc}}\r\n </ng-container>\r\n </h5>\r\n <button type=\"button\" class=\"close pull-right\" (click)=\"changeColumnVisibilityModal.hide();\" aria-label=\"Close\">\r\n <span aria-hidden=\"true\">&times;</span>\r\n </button>\r\n </div>\r\n <div class=\"modal-body\">\r\n <div *ngIf=\"!TMPColumnsList || TMPColumnsList.length == 0\" class=\"card card-info est-padding-10 est-margin-bottom-0\">\r\n {{'There are no columns configured to be hidden/shown in this view' | localize : lc}}\r\n </div>\r\n <div *ngIf=\"TMPColumnsList && TMPColumnsList.length > 0\" style=\"max-height:500px; overflow-y:auto\">\r\n <!--Aaaaaaah la tristezza... qui mi servirebbe l'es-table per facilitare la selezione multipla ecc... peccato che se la linko qui entro in un loop impressionante-->\r\n <table class=\"table table-striped table-sm est-margin-bottom-0\">\r\n <thead>\r\n <tr>\r\n <th class=\"est-col-min\" *ngIf=\"HiddenColumns\">\r\n <input class=\"est-pointer\" type=\"checkbox\" [(ngModel)]=\"globalColVisCheck\" [ngModelOptions]=\"{'standalone': true}\" (ngModelChange)=\"globalColVisCheckChanged();\">\r\n </th>\r\n <th class=\"est-col-min\" *ngIf=\"ColumnsOrdering\"></th>\r\n <th class=\"est-col-min est-nowrap\">{{'Column Name' | localize : lc}}</th>\r\n <!--Filler-->\r\n <th></th>\r\n <!-- Pinner -->\r\n <th class=\"est-col-min\"></th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let item of TMPColumnsList; let i = index; let last = last\" class=\"est-pointer\" [class.est-white-selected]=\"lastSelectedItemID == item.id\" [class.est-no-selection]=\"!item.visible\">\r\n <td *ngIf=\"HiddenColumns\">\r\n <input type=\"checkbox\" [class.est-hidden-view]=\"item.fixed\" class=\"est-pointer\" [(ngModel)]=\"item.visible\" name=\"visible{{i}}\" (ngModelChange)=\"updateGlobalColVisCheck();\" />\r\n </td>\r\n <td class=\"est-nowrap\" *ngIf=\"ColumnsOrdering\">\r\n <span class=\"fa fa-arrow-up\" [class.est-hidden-view]=\"item.fixed || item.pinned\" (click)=\"lastSelectedItemID = item.id; i != 0 && !item.fixed && sendUp(item); $event.stopPropagation();\"></span>\r\n <span class=\"fa fa-arrow-down\" [class.est-hidden-view]=\"item.fixed || item.pinned\" (click)=\"lastSelectedItemID = item.id; !last && !item.fixed && sendDown(item); $event.stopPropagation();\"></span>\r\n </td>\r\n <td class=\"est-nowrap\" (click)=\"columnClicked(item);\">\r\n <ng-container *ngIf=\"item.template\">\r\n <ng-container *ngTemplateOutlet=\"item.template\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!item.template\">{{item.description}}</ng-container>\r\n </td>\r\n <!--Filler-->\r\n <td (click)=\"columnClicked(item);\"></td>\r\n <!-- Pinner -->\r\n <td><span *ngIf=\"!item.fixed\" class=\"fa fa-thumb-tack\" [class.text-success]=\"item.pinned\" (click)=\"pinOrUnpinColumn(item)\"></span></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n </div>\r\n <div class=\"modal-footer\">\r\n <button type=\"button\" class=\"btn btn-secondary est-margin-right-10\" (click)=\"lastSelectedItemID = null; changeColumnVisibilityModal.hide();\">{{'Close' | localize : lc}}</button>\r\n <button type=\"button\" [disabled]=\"!TMPColumnsList || TMPColumnsList.length == 0\" class=\"btn btn-primary\" (click)=\"confirmColumnVisibilitySelection() && changeColumnVisibilityModal.hide()\">{{'Confirm' | localize : lc}}</button>\r\n </div>\r\n </div>\r\n </div>\r\n</div>",
4535
+ styles: [".est-loading-box{height:200px;text-align:center;position:relative;background:#ccc}.est-loading-content{margin:0;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:35px}.est-scrollable{max-height:600px;overflow:auto}.est-pointer{cursor:pointer}.est-high-density td,.est-high-density th{padding:0 .2rem}.est-no-selection{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none}.est-hidden-view{visibility:hidden}.est-no-border{border:none!important}.est-nowrap{white-space:nowrap}.est-white-selected{background-color:#ddd!important}.est-line-through{text-decoration:line-through}.est-no-side-padding{padding-left:0;padding-right:0}.est-no-left-padding,.est-no-right-padding{padding-left:0}.est-col-min{width:1px}.est-margin-bottom-0{margin-bottom:0!important}.est-margin-right-10{margin-right:10px!important}.est-right-10{right:10px!important}.est-table-dotted-menu{padding:0 0 2px!important;color:#999}.est-fs-18{font-size:18px}.est-fs-14{font-size:14px}.est-padding-3{padding:3px!important}.est-page-container{position:relative}.est-bring-to-front-strong{z-index:99999999!important}.est-switch{position:relative;display:inline-block;width:30px;height:17px;margin-bottom:0;margin-right:5px;margin-left:5px}.est-switch input{display:none}.est-slider{cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#ccc}.est-slider,.est-slider:before{position:absolute;transition:.4s}.est-slider:before{content:\"\";height:13px;width:13px;left:3px;bottom:2px;background-color:#fff}input:checked+.est-slider{background-color:#2196f3}input:focus+.est-slider{box-shadow:0 0 1px #2196f3}input:checked+.est-slider:before{transform:translateX(11px)}.est-slider.round{border-radius:10px}.est-slider.round:before{border-radius:50%}.est-custom-input{width:30px;display:inline;padding:1px;height:20px}.est-row-lvl-1 td:first-child{padding-left:5px}.est-row-lvl-2 td:first-child{padding-left:20px}.est-row-lvl-3 td:first-child{padding-left:35px}.est-row-lvl-4 td:first-child{padding-left:50px}.est-row-lvl-5 td:first-child{padding-left:65px}.est-row-lvl-6 td:first-child{padding-left:80px}.est-row-lvl-7 td:first-child{padding-left:95px}.est-row-lvl-8 td:first-child{padding-left:110px}.est-row-lvl-9 td:first-child{padding-left:125px}.est-row-lvl-10 td:first-child{padding-left:140px}.est-row-lvl-11 td:first-child{padding-left:155px}.est-row-lvl-12 td:first-child{padding-left:170px}.est-row-lvl-13 td:first-child{padding-left:185px}.est-row-lvl-14 td:first-child{padding-left:200px}.est-row-lvl-15 td:first-child{padding-left:215px}.est-row-lvl-16 td:first-child{padding-left:230px}.est-row-lvl-17 td:first-child{padding-left:245px}.est-row-lvl-18 td:first-child{padding-left:260px}.est-row-lvl-19 td:first-child{padding-left:275px}.est-row-lvl-20 td:first-child{padding-left:290px}.est-row-lvl-21 td:first-child{padding-left:305px}.est-row-lvl-22 td:first-child{padding-left:320px}.est-row-lvl-23 td:first-child{padding-left:335px}.est-row-lvl-24 td:first-child{padding-left:350px}.est-row-lvl-25 td:first-child{padding-left:365px}.est-row-lvl-26 td:first-child{padding-left:380px}.est-row-lvl-27 td:first-child{padding-left:395px}.est-row-lvl-28 td:first-child{padding-left:410px}.est-row-lvl-29 td:first-child{padding-left:425px}.est-row-lvl-30 td:first-child{padding-left:440px}.est-row-lvl-31 td:first-child{padding-left:455px}.est-row-lvl-32 td:first-child{padding-left:470px}.est-row-lvl-33 td:first-child{padding-left:485px}.est-row-lvl-34 td:first-child{padding-left:500px}.est-row-lvl-35 td:first-child{padding-left:515px}.est-row-lvl-36 td:first-child{padding-left:530px}.est-row-lvl-37 td:first-child{padding-left:545px}.est-row-lvl-38 td:first-child{padding-left:560px}.est-row-lvl-39 td:first-child{padding-left:575px}.est-row-lvl-40 td:first-child{padding-left:590px}.est-row-lvl-41 td:first-child{padding-left:605px}.est-row-lvl-42 td:first-child{padding-left:620px}.est-row-lvl-43 td:first-child{padding-left:635px}.est-row-lvl-44 td:first-child{padding-left:650px}.est-row-lvl-45 td:first-child{padding-left:665px}.est-row-lvl-46 td:first-child{padding-left:680px}.est-row-lvl-47 td:first-child{padding-left:695px}.est-row-lvl-48 td:first-child{padding-left:710px}.est-row-lvl-49 td:first-child{padding-left:725px}.est-row-lvl-50 td:first-child{padding-left:740px}.est-row-lvl-51 td:first-child{padding-left:755px}.est-row-lvl-52 td:first-child{padding-left:770px}.est-row-lvl-53 td:first-child{padding-left:785px}.est-row-lvl-54 td:first-child{padding-left:800px}.est-row-lvl-55 td:first-child{padding-left:815px}.est-row-lvl-56 td:first-child{padding-left:830px}.est-row-lvl-57 td:first-child{padding-left:845px}.est-row-lvl-58 td:first-child{padding-left:860px}.est-row-lvl-59 td:first-child{padding-left:875px}.est-row-lvl-60 td:first-child{padding-left:890px}.est-row-lvl-61 td:first-child{padding-left:905px}.est-row-lvl-62 td:first-child{padding-left:920px}.est-row-lvl-63 td:first-child{padding-left:935px}.est-row-lvl-64 td:first-child{padding-left:950px}.est-row-lvl-65 td:first-child{padding-left:965px}.est-row-lvl-66 td:first-child{padding-left:980px}.est-row-lvl-67 td:first-child{padding-left:995px}.est-row-lvl-68 td:first-child{padding-left:1010px}.est-row-lvl-69 td:first-child{padding-left:1025px}.est-row-lvl-70 td:first-child{padding-left:1040px}.est-row-lvl-71 td:first-child{padding-left:1055px}.est-row-lvl-72 td:first-child{padding-left:1070px}.est-row-lvl-73 td:first-child{padding-left:1085px}.est-row-lvl-74 td:first-child{padding-left:1100px}.est-row-lvl-75 td:first-child{padding-left:1115px}.est-row-lvl-76 td:first-child{padding-left:1130px}.est-row-lvl-77 td:first-child{padding-left:1145px}.est-row-lvl-78 td:first-child{padding-left:1160px}.est-row-lvl-79 td:first-child{padding-left:1175px}.est-row-lvl-80 td:first-child{padding-left:1190px}.est-row-lvl-81 td:first-child{padding-left:1205px}.est-row-lvl-82 td:first-child{padding-left:1220px}.est-row-lvl-83 td:first-child{padding-left:1235px}.est-row-lvl-84 td:first-child{padding-left:1250px}.est-row-lvl-85 td:first-child{padding-left:1265px}.est-row-lvl-86 td:first-child{padding-left:1280px}.est-row-lvl-87 td:first-child{padding-left:1295px}.est-row-lvl-88 td:first-child{padding-left:1310px}.est-row-lvl-89 td:first-child{padding-left:1325px}.est-row-lvl-90 td:first-child{padding-left:1340px}.est-row-lvl-91 td:first-child{padding-left:1355px}.est-row-lvl-92 td:first-child{padding-left:1370px}.est-row-lvl-93 td:first-child{padding-left:1385px}.est-row-lvl-94 td:first-child{padding-left:1400px}.est-row-lvl-95 td:first-child{padding-left:1415px}.est-row-lvl-96 td:first-child{padding-left:1430px}.est-row-lvl-97 td:first-child{padding-left:1445px}.est-row-lvl-98 td:first-child{padding-left:1460px}.est-row-lvl-99 td:first-child{padding-left:1475px}.est-right-10{right:10px}.est-hidden{visibility:hidden}.est-padding-10{padding:10px!important}.est-margin-right-50{margin-right:50px}.est-page-sel{color:#000;margin-left:3px;margin-right:3px;padding:0 5px;font-size:inherit;border:none;border-radius:15px}.est-page-next,.est-page-prev{color:#000;font-size:inherit;padding:3px 0 0}.est-pinned-header{background-color:#fff;left:0;top:0;position:sticky;z-index:1;border-bottom:1px solid #dee2e6!important;padding:0!important}.est-pinned-border{border-right:2px solid #dee2e6!important}.est-cell-padding{padding:.3rem}.est-pinned-body{background-color:#fff;left:0;position:sticky;z-index:1;border-top:1px solid #dee2e6!important;padding:0!important}.est-inline{display:inline!important}.est-inline-block{display:inline-block!important}.est-link{color:#0275d8!important;cursor:pointer;text-decoration:none;display:block}.est-link:hover{color:#23527c!important;cursor:pointer;text-decoration:underline!important}.est-sticky-last-column{right:-1px;position:sticky;z-index:0;background-color:#fff}.est-sticky-last-column-alt{right:-1px;position:sticky;z-index:0;background-color:#f2f2f2}.est-ltab-border{border-left:2px solid #bbb}.est-rtab-border{border-right:2px solid #bbb}.est-cell-group-padding{padding:calc(.3rem + 1px);position:absolute;top:0;left:0;height:100%;width:100%}.est-margin-bottom-10{margin-bottom:10px}.est-text-center{text-align:center}.est-rg-sep-flex-right{display:flex;flex-direction:row-reverse;width:100%;margin:-5px}.est-rg-sep-flex-left{display:flex;flex-direction:row;width:100%;margin:-5px}.est-rg-hdr{font-weight:700}.est-rg-agg{font-style:italic}.est-rg{background-color:hsla(0,0%,46.7%,.4666666666666667)!important}.est-rg-sep{font-size:12px;padding-right:20px!important;background-color:hsla(0,0%,73.3%,.7333333333333333)!important}.est-rg-ipp{text-align:left;display:inline-flex;margin-right:25px}.est-rg-page{text-align:right;display:inline-flex;font-size:inherit;padding-top:5px}"]
2867
4536
  },] }
2868
4537
  ];
2869
4538
  EsTableComponent.ctorParameters = function () { return [
2870
4539
  { type: forms.NgControl, decorators: [{ type: core.Self }, { type: core.Optional }] },
2871
4540
  { type: preferences.PreferencesService, decorators: [{ type: core.Optional }] },
4541
+ { type: EsTableDefaultable, decorators: [{ type: core.Optional }, { type: core.Inject, args: [EST_DEFAULTS,] }] },
4542
+ { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [EST_LOCALE,] }] },
2872
4543
  { type: localizations.LocalizationService },
2873
4544
  { type: core.ChangeDetectorRef },
2874
4545
  { type: extensions.HashingService },
2875
4546
  { type: extensions.UtilityService },
2876
- { type: extensions.ExportService }
4547
+ { type: extensions.ExportService },
4548
+ { type: extensions.DateService },
4549
+ { type: extensions.MessageService }
2877
4550
  ]; };
2878
4551
  EsTableComponent.propDecorators = {
2879
4552
  EsTdsDirective: [{ type: core.ContentChildren, args: [EsTdDirective,] }],
@@ -2892,7 +4565,7 @@
2892
4565
  CellActionPropagates: [{ type: core.Input }],
2893
4566
  UseCustomCells: [{ type: core.Input }],
2894
4567
  MaxHeight: [{ type: core.Input }],
2895
- Class: [{ type: core.Input }],
4568
+ ContainerClass: [{ type: core.Input }],
2896
4569
  XLSXExport: [{ type: core.Input }],
2897
4570
  CSVExport: [{ type: core.Input }],
2898
4571
  AllSearch: [{ type: core.Input }],
@@ -2903,14 +4576,12 @@
2903
4576
  RemovalCondition: [{ type: core.Input }],
2904
4577
  Export: [{ type: core.Input }],
2905
4578
  ShiftClick: [{ type: core.Input }],
2906
- ShowPaging: [{ type: core.Input }],
2907
4579
  HidePaging: [{ type: core.Input }],
2908
4580
  HidePagingCount: [{ type: core.Input }],
2909
4581
  HidePagingButtons: [{ type: core.Input }],
2910
4582
  ContextMenu: [{ type: core.Input }],
2911
4583
  ExportFileName: [{ type: core.Input }],
2912
4584
  TableClass: [{ type: core.Input }],
2913
- CountLabel: [{ type: core.Input }],
2914
4585
  ExportFunction: [{ type: core.Input }],
2915
4586
  HasHeaderGroup: [{ type: core.Input }],
2916
4587
  HasSecondaryHeaderGroup: [{ type: core.Input }],
@@ -2936,9 +4607,12 @@
2936
4607
  OwnKey: [{ type: core.Input }],
2937
4608
  StartsExpanded: [{ type: core.Input }],
2938
4609
  SavePreferences: [{ type: core.Input }],
4610
+ PagingStyle: [{ type: core.Input }],
4611
+ RowGroupingPagingStyle: [{ type: core.Input }],
2939
4612
  SecondarySource: [{ type: core.Input }],
2940
4613
  TertiarySource: [{ type: core.Input }],
2941
4614
  UseSelectionCache: [{ type: core.Input }],
4615
+ ShowItemGroupsColumns: [{ type: core.Input }],
2942
4616
  onOrderChanged: [{ type: core.Output }],
2943
4617
  onSearchRequest: [{ type: core.Output }],
2944
4618
  onSelectionChanged: [{ type: core.Output }],
@@ -2952,26 +4626,22 @@
2952
4626
  ArraymodeItemsPerPage: [{ type: core.Input }]
2953
4627
  };
2954
4628
 
2955
- /**
2956
- * Modello di configurazione per L'EsTable
2957
- */
4629
+ /** Modello di configurazione per L'EsTable */
2958
4630
  var EsTableModuleConfig = /** @class */ (function () {
2959
4631
  function EsTableModuleConfig() {
2960
4632
  }
2961
4633
  return EsTableModuleConfig;
2962
4634
  }());
2963
4635
 
2964
- /**
2965
- * Classe di localizzazione per il componente **TablePagerComponent**
2966
- */
4636
+ /** Classe di localizzazione per il componente **TablePagerComponent** */
2967
4637
  var TablePagerLoc = /** @class */ (function (_super) {
2968
4638
  __extends(TablePagerLoc, _super);
2969
- /**
2970
- * @ignore
2971
- */
4639
+ /** @ignore */
2972
4640
  function TablePagerLoc(LOC_LOCALE) {
2973
4641
  var _this = _super.call(this, LOC_LOCALE !== null && LOC_LOCALE !== void 0 ? LOC_LOCALE : 'it-IT') || this;
2974
4642
  _super.prototype.set.call(_this, "en->it", "All", ["Tutto"]);
4643
+ _super.prototype.set.call(_this, "en->it", "Shown Elements", ["Elementi visualizzati"]);
4644
+ _super.prototype.set.call(_this, "en->it", "Shown Groups", ["Gruppi visualizzati"]);
2975
4645
  _super.prototype.set.call(_this, "en->it", "Are you sure you want to retrieve all results?", ["Si è sicuri di voler caricare tutti i risultati?"]);
2976
4646
  _super.prototype.set.call(_this, "en->it", "This might slow down the page and possibly crash the entire application", ["L'operazione potrebbe rallentare la pagina fino al crash dell'applicazione"]);
2977
4647
  return _this;
@@ -2986,33 +4656,36 @@
2986
4656
  ]; };
2987
4657
 
2988
4658
  // Angular
2989
- /**
2990
- * Componente che si occupa della paginazione di una tabella
2991
- */
4659
+ /** Componente che si occupa della paginazione di una tabella */
2992
4660
  var TablePagerComponent = /** @class */ (function () {
2993
- /**
2994
- * @ignore
2995
- */
2996
- function TablePagerComponent(msgExts, lc) {
4661
+ /** @ignore */
4662
+ function TablePagerComponent(msgExts, lc, cdr, locale) {
2997
4663
  this.msgExts = msgExts;
2998
4664
  this.lc = lc;
2999
- /**
3000
- * Indica se deve mostrare un warning quando si cercano di solezionare come elementi da visualizzare "Tutti"
3001
- */
4665
+ this.cdr = cdr;
4666
+ this.locale = locale;
4667
+ /** Indica se deve mostrare un warning quando si cercano di solezionare come elementi da visualizzare "Tutti" */
3002
4668
  this.WarnOnAll = true;
3003
- /**
3004
- * Indica se dare la possibilità o meno di selezionare "Tutti" nelle opzioni di paginazione
3005
- */
4669
+ /** Indica se dare la possibilità o meno di selezionare "Tutti" nelle opzioni di paginazione */
3006
4670
  this.AllSearch = true;
3007
- /**
3008
- * Placeholder che identifica il "Tutti"
3009
- */
4671
+ /** Placeholder che identifica il "Tutti" */
3010
4672
  this.DefaultAll = 999999;
3011
- /**
3012
- * Output invocato quando il numero di elementi per pagina viene modificato da un click utente
3013
- */
4673
+ /** Indica se attivare la modalità gruppo con stili più snelli per apparire sotto ai raggruppamenti */
4674
+ this.GroupMode = false;
4675
+ /** Indica se utilizzare il conteggio dei gruppi o degli oggetti */
4676
+ this.GroupCount = false;
4677
+ /** Indica se visualizzare il numero totale di oggeti presenti */
4678
+ this.ShowCount = true;
4679
+ /** Output invocato quando il numero di elementi per pagina viene modificato da un click utente */
3014
4680
  this.pagingSelected = new core.EventEmitter();
4681
+ /** Opzioni di paginazione */
4682
+ this.PagingOptions = [10, 15, 30, 45, 100];
3015
4683
  }
4684
+ TablePagerComponent.prototype.ngOnInit = function () {
4685
+ this.Model = this.View ? this.View.itemsperpageoverride : this.CurrentPageSize;
4686
+ if (this.AllSearch)
4687
+ this.PagingOptions.push(this.DefaultAll);
4688
+ };
3016
4689
  /**
3017
4690
  * Funzione richiamata dal template quando un utente clicca su un numero di paginazione.
3018
4691
  *
@@ -3023,10 +4696,19 @@
3023
4696
  TablePagerComponent.prototype.choice = function (pageSize) {
3024
4697
  var _this = this;
3025
4698
  if (pageSize == this.DefaultAll && this.WarnOnAll) {
3026
- this.msgExts.simpleWarningWithChoice(this.lc.loc("Are you sure you want to retrieve all results?"), this.lc.loc("This might slow down the page and possibly crash the entire application"), function () { _this.pagingSelected.emit(pageSize); });
4699
+ this.msgExts.simpleWarningWithChoice(this.lc.loc("Are you sure you want to retrieve all results?"), this.lc.loc("This might slow down the page and possibly crash the entire application"), function () { _this.pagingSelected.emit(pageSize); _this.Model = pageSize; }, function () {
4700
+ // Dio solo sa perché mi tocca fare sta roba... qui dentro per qualche motivo la CD non prende
4701
+ var prevModel = _this.Model;
4702
+ _this.Model = null;
4703
+ _this.cdr.detectChanges();
4704
+ _this.Model = prevModel;
4705
+ _this.cdr.detectChanges();
4706
+ });
3027
4707
  }
3028
- else
4708
+ else {
3029
4709
  this.pagingSelected.emit(pageSize);
4710
+ this.Model = pageSize;
4711
+ }
3030
4712
  };
3031
4713
  return TablePagerComponent;
3032
4714
  }());
@@ -3034,20 +4716,29 @@
3034
4716
  { type: core.Component, args: [{
3035
4717
  selector: "app-paging",
3036
4718
  viewProviders: [{ provide: localizations.LocalizationService, useClass: TablePagerLoc }],
3037
- template: "<!--Se non ho almeno 10 elementi non ha senso far vedere le opzioni di paginazione-->\r\n<ng-container *ngIf=\"View ? ((View.objectcount && View.objectcount >= 10) || View.pagingavailable) : !Hidden\">\r\n {{'Paging' | localize : lc}}:&nbsp;\r\n <span class=\"app-link app-inline\"\r\n [class.app-bold]=\"View ? View.itemsperpageoverride && View.itemsperpageoverride == 10 : CurrentPageSize == 10\"\r\n (click)=\"choice(10);\">\r\n 10\r\n </span>&nbsp;|&nbsp;\r\n\r\n <span class=\"app-link app-inline\"\r\n [class.app-bold]=\"View ? View.itemsperpageoverride && View.itemsperpageoverride == 15 : CurrentPageSize == 15\"\r\n (click)=\"choice(15);\">\r\n 15\r\n </span>&nbsp;|&nbsp;\r\n\r\n <span class=\"app-link app-inline\"\r\n [class.app-bold]=\"View ? View.itemsperpageoverride && View.itemsperpageoverride == 30 : CurrentPageSize == 30\"\r\n (click)=\"choice(30);\">\r\n 30\r\n </span>&nbsp;|&nbsp;\r\n\r\n <span class=\"app-link app-inline\"\r\n [class.app-bold]=\"View ? View.itemsperpageoverride && View.itemsperpageoverride == 45 : CurrentPageSize == 45\"\r\n (click)=\"choice(45);\">\r\n 45\r\n </span>&nbsp;|&nbsp;\r\n\r\n <span class=\"app-link app-inline\"\r\n [class.app-bold]=\"View ? View.itemsperpageoverride && View.itemsperpageoverride == 100 : CurrentPageSize == 100\"\r\n (click)=\"choice(100);\">\r\n 100\r\n </span><span *ngIf=\"AllSearch\">&nbsp;|&nbsp;</span>\r\n <span *ngIf=\"AllSearch\" class=\"app-link app-inline\"\r\n [class.app-bold]=\"View ? View.itemsperpageoverride && View.itemsperpageoverride == DefaultAll : CurrentPageSize == DefaultAll\"\r\n (click)=\"choice(DefaultAll);\">\r\n {{'All' | localize : lc}}\r\n </span>\r\n</ng-container>"
4719
+ template: "<ng-container *ngIf=\"!Hidden\">\r\n <span class=\"est-fs-14\"> {{(GroupMode ? 'Shown Groups' : 'Shown Elements') | localize : lc}}:&nbsp;</span>\r\n <mat-form-field [appearance]=\"'legacy'\" class=\"mat-paginator-page-size-select est-fs-14 est-ipp-bold\" *ngIf=\"Model\">\r\n <select matNativeControl [ngModel]=\"Model\" name=\"input\" (ngModelChange)=\"choice($event)\">\r\n <ng-container *ngFor=\"let pOpt of PagingOptions\">\r\n <option *ngIf=\"pOpt == DefaultAll || PagerCount > pOpt\" [value]=\"pOpt\">{{ pOpt == DefaultAll ? ('All' | localize : lc) : pOpt.toString()}}</option>\r\n </ng-container>\r\n </select>\r\n </mat-form-field>\r\n <span class=\"est-fs-14 est-ipp-bold\" *ngIf=\"ShowCount\">&nbsp;/&nbsp;{{PagerCount | number : '0.0-0' : locale}}\r\n </span>\r\n</ng-container>",
4720
+ encapsulation: core.ViewEncapsulation.None,
4721
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
4722
+ styles: [".est-ipp-sel,.est-ipp-sel-all,.est-rg-ipp-sel,.est-rg-ipp-sel-all{color:#0275d8!important;cursor:pointer;text-decoration:none;display:block;display:inline}.est-ipp-bold{font-weight:700}.mat-paginator-page-size-select{margin:6px 4px 0;width:50px}.mat-paginator-page-size-select .mat-form-field-wrapper{height:52px!important;margin-top:-15px!important;padding:0!important}.mat-form-field-type-mat-native-select .mat-form-field-infix:after{margin-top:-5.5px!important}"]
3038
4723
  },] }
3039
4724
  ];
3040
4725
  TablePagerComponent.ctorParameters = function () { return [
3041
4726
  { type: extensions.MessageService },
3042
- { type: localizations.LocalizationService }
4727
+ { type: localizations.LocalizationService },
4728
+ { type: core.ChangeDetectorRef },
4729
+ { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [EST_LOCALE,] }] }
3043
4730
  ]; };
3044
4731
  TablePagerComponent.propDecorators = {
3045
4732
  CurrentPageSize: [{ type: core.Input }],
3046
4733
  View: [{ type: core.Input }],
3047
- Hidden: [{ type: core.Input }],
3048
4734
  WarnOnAll: [{ type: core.Input }],
3049
4735
  AllSearch: [{ type: core.Input }],
3050
4736
  DefaultAll: [{ type: core.Input }],
4737
+ GroupMode: [{ type: core.Input }],
4738
+ GroupCount: [{ type: core.Input }],
4739
+ ShowCount: [{ type: core.Input }],
4740
+ PagerCount: [{ type: core.Input }],
4741
+ Hidden: [{ type: core.Input }],
3051
4742
  pagingSelected: [{ type: core.Output }]
3052
4743
  };
3053
4744
 
@@ -3058,7 +4749,8 @@
3058
4749
  return {
3059
4750
  ngModule: EsTableModule,
3060
4751
  providers: [
3061
- { provide: EST_LOCALE, useValue: (config === null || config === void 0 ? void 0 : config.locale) || 'it-IT' }
4752
+ { provide: EST_LOCALE, useValue: (config === null || config === void 0 ? void 0 : config.locale) || 'it-IT' },
4753
+ { provide: EST_DEBUG, useValue: (config === null || config === void 0 ? void 0 : config.debugMode) || false }
3062
4754
  ]
3063
4755
  };
3064
4756
  };
@@ -3074,7 +4766,9 @@
3074
4766
  modal.ModalModule,
3075
4767
  dropdown.BsDropdownModule,
3076
4768
  ngxCsv.CsvModule,
3077
- ngxContextmenu.ContextMenuModule
4769
+ ngxContextmenu.ContextMenuModule,
4770
+ select.MatSelectModule,
4771
+ input.MatInputModule
3078
4772
  ],
3079
4773
  declarations: [EsTh, EsTd, EsTableComponent, EsTdDirective, EsThDirective, TablePagerComponent],
3080
4774
  providers: [extensions.UtilityService, extensions.ExportService, extensions.HashingService, extensions.MessageService],
@@ -3093,15 +4787,19 @@
3093
4787
  exports.AppOrdering = AppOrdering;
3094
4788
  exports.AppSearch = AppSearch;
3095
4789
  exports.CornerMenuOption = CornerMenuOption;
3096
- exports.EsTableColumn = EsTableColumn;
3097
4790
  exports.EsTableColumnsDefinition = EsTableColumnsDefinition;
3098
4791
  exports.EsTableComponent = EsTableComponent;
4792
+ exports.EsTableDefaultable = EsTableDefaultable;
3099
4793
  exports.EsTableModule = EsTableModule;
3100
4794
  exports.EsTableModuleConfig = EsTableModuleConfig;
3101
4795
  exports.EsTableOperationDefinition = EsTableOperationDefinition;
3102
4796
  exports.EsTd = EsTd;
3103
4797
  exports.EsTh = EsTh;
3104
4798
  exports.GenericItem = GenericItem;
4799
+ exports.Group = Group;
4800
+ exports.GroupAggregation = GroupAggregation;
4801
+ exports.GroupFilter = GroupFilter;
4802
+ exports.GroupOrAggregation = GroupOrAggregation;
3105
4803
  exports.ItemsSelection = ItemsSelection;
3106
4804
  exports.ReportColumn = ReportColumn;
3107
4805
  exports.ReportDefinition = ReportDefinition;
@@ -3111,10 +4809,12 @@
3111
4809
  exports.ReportRow = ReportRow;
3112
4810
  exports.ɵa = EsTableLoc;
3113
4811
  exports.ɵb = EST_LOCALE;
3114
- exports.ɵc = EsTdDirective;
3115
- exports.ɵd = EsThDirective;
3116
- exports.ɵe = TablePagerComponent;
3117
- exports.ɵf = TablePagerLoc;
4812
+ exports.ɵc = EST_DEBUG;
4813
+ exports.ɵd = EST_DEFAULTS;
4814
+ exports.ɵe = EsTdDirective;
4815
+ exports.ɵf = EsThDirective;
4816
+ exports.ɵg = TablePagerComponent;
4817
+ exports.ɵh = TablePagerLoc;
3118
4818
 
3119
4819
  Object.defineProperty(exports, '__esModule', { value: true });
3120
4820