@esfaenza/es-table 11.2.18 → 11.2.22-beta1

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 (110) hide show
  1. package/bundles/esfaenza-es-table.umd.js +2243 -549
  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 +19 -9
  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 +1831 -325
  37. package/esm2015/lib/es_table.component.loc.js +6 -7
  38. package/esm2015/lib/es_td.component.js +9 -20
  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 +47 -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 +2135 -538
  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 +16 -7
  50. package/lib/domain/externals/classes/CornerMenuOption.d.ts +7 -0
  51. package/lib/domain/{classes → externals/classes}/EsTableColumnsDefinition.d.ts +2 -6
  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/{classes → externals/classes/appsearch}/AppSearch.d.ts +19 -59
  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 +470 -62
  76. package/lib/es_table.component.loc.d.ts +2 -6
  77. package/lib/es_td.component.d.ts +13 -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 +25 -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 -45
  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 -33
  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/CornerMenuOption.d.ts +0 -13
  102. package/lib/domain/classes/GenericItem.d.ts +0 -25
  103. package/lib/domain/classes/IAppSearch.d.ts +0 -67
  104. package/lib/domain/classes/ItemsSelection.d.ts +0 -27
  105. package/lib/domain/classes/ReportColumn.d.ts +0 -29
  106. package/lib/domain/classes/ReportDefinition.d.ts +0 -46
  107. package/lib/domain/classes/ReportOrder.d.ts +0 -13
  108. package/lib/domain/classes/ReportParam.d.ts +0 -76
  109. package/lib/domain/classes/ReportResult.d.ts +0 -22
  110. 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.
@@ -364,28 +364,9 @@
364
364
  this.savedstate = false;
365
365
  };
366
366
  return AppSearch;
367
- }());
368
- var Group = /** @class */ (function () {
369
- function Group(description) {
370
- this.description = description;
371
- this.aggregations = [];
372
- }
373
- return Group;
374
- }());
375
- var GroupFilter = /** @class */ (function () {
376
- function GroupFilter() {
377
- }
378
- return GroupFilter;
379
- }());
380
- var GroupOrAggregation = /** @class */ (function () {
381
- function GroupOrAggregation() {
382
- }
383
- return GroupOrAggregation;
384
367
  }());
385
368
 
386
- /**
387
- * Classe che identifica una colonna. Utilizzata in modalità "Colonne dinamiche"
388
- */
369
+ /** Classe che identifica una colonna. Utilizzata in modalità "Colonne dinamiche" */
389
370
  var EsTableColumnsDefinition = /** @class */ (function () {
390
371
  /**
391
372
  * Costruttore
@@ -425,88 +406,68 @@
425
406
  return EsTableColumnsDefinition;
426
407
  }());
427
408
 
428
- /**
429
- * Classe che definisce un oggetto generico come lista di proprietà-valore
430
- */
409
+ /** Classe che definisce un oggetto generico come lista di proprietà-valore */
431
410
  var GenericItem = /** @class */ (function () {
432
- /**
433
- * @ignore
434
- */
411
+ /** @ignore */
435
412
  function GenericItem() {
436
413
  this._selected = false;
437
414
  this._rowClass = null;
438
- this.hash = null;
415
+ this._hash = null;
439
416
  this.properties = {};
440
417
  }
441
418
  return GenericItem;
442
419
  }());
443
420
 
444
- /**
445
- * Indica un'opzione cliccabile nel Corner Menù della tabella (il menù richiamabile dai 3 pallini verticli in alto a destra)
446
- */
421
+ /** Indica un'opzione cliccabile nel Corner Menù della tabella (il menù richiamabile dai 3 pallini verticli in alto a destra) */
447
422
  var CornerMenuOption = /** @class */ (function () {
448
423
  function CornerMenuOption() {
449
424
  }
450
425
  return CornerMenuOption;
451
426
  }());
452
427
 
453
- /**
454
- * Definizione generica di un report che può o no disporre di paginazione/export e la cui richiesta è basata su uno o più parametri
455
- */
428
+ /** Definizione generica di un report che può o no disporre di paginazione/export e la cui richiesta è basata su uno o più parametri */
456
429
  var ReportDefinition = /** @class */ (function () {
457
430
  function ReportDefinition() {
458
431
  }
459
432
  return ReportDefinition;
460
433
  }());
461
434
 
462
- /**
463
- * Classe che identifica una direttiva di ordinamento per un report
464
- */
435
+ /** Classe che identifica una direttiva di ordinamento per un report */
465
436
  var ReportOrder = /** @class */ (function () {
466
437
  function ReportOrder() {
467
438
  }
468
439
  return ReportOrder;
469
440
  }());
470
441
 
471
- /**
472
- * Classe che rappresenta una colonna di un report
473
- */
442
+ /** Classe che rappresenta una colonna di un report */
474
443
  var ReportColumn = /** @class */ (function () {
475
444
  function ReportColumn() {
476
445
  }
477
446
  return ReportColumn;
478
447
  }());
479
448
 
480
- /**
481
- * Classe che rappresenta una lista di oggetti generati da un report
482
- */
449
+ /** Classe che rappresenta una lista di oggetti generati da un report */
483
450
  var ReportResult = /** @class */ (function () {
484
451
  function ReportResult() {
485
452
  }
486
453
  return ReportResult;
487
454
  }());
488
455
 
489
- /**
490
- * Classe che rappresenta i valori delle proprietà di un oggetto Report
491
- */
456
+ /** Classe che rappresenta i valori delle proprietà di un oggetto Report */
492
457
  var ReportRow = /** @class */ (function () {
493
458
  function ReportRow() {
494
459
  }
495
460
  return ReportRow;
496
461
  }());
497
462
 
498
- /**
499
- * Classe che identifica un parametro generico per un report
500
- */
463
+ /** Classe che identifica un parametro generico per un report */
501
464
  var ReportParam = /** @class */ (function () {
502
465
  function ReportParam() {
503
466
  }
504
467
  return ReportParam;
505
468
  }());
506
469
 
507
- /**
508
- * Indica operazioni dinamiche generiche che possono essere effettuate per riga. Appaiono come colonne extra sul lato sinistro della tabella
509
- */
470
+ /** Indica operazioni dinamiche generiche che possono essere effettuate per riga. Appaiono come colonne extra sul lato sinistro della tabella */
510
471
  var EsTableOperationDefinition = /** @class */ (function () {
511
472
  /**
512
473
  * Costruttore
@@ -529,9 +490,115 @@
529
490
  return EsTableOperationDefinition;
530
491
  }());
531
492
 
532
- /**
533
- * Definizione di una colonna
534
- */
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à */
535
602
  var EsTableColumn = /** @class */ (function () {
536
603
  /**
537
604
  * Costruttore
@@ -540,68 +607,93 @@
540
607
  * @param {string} description Descrizione (Header)
541
608
  * @param {boolean} visible Indica se di default mostrarla o meno
542
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
543
612
  * @param {TemplateRef<any>} template Indica il template da usare per mostrare il testo dell'Header
544
613
  */
545
- function EsTableColumn(id, description, visible, fixed, template) {
614
+ function EsTableColumn(id, description, visible, fixed, pinned, pinnedWidth, template) {
546
615
  this.id = id;
547
616
  this.description = description;
548
617
  this.visible = visible;
549
618
  this.fixed = fixed;
619
+ this.pinned = pinned;
620
+ this.pinnedWidth = pinnedWidth;
550
621
  this.template = template;
551
622
  }
552
623
  return EsTableColumn;
553
624
  }());
554
625
 
555
- /**
556
- * Identifica una selezione applicabile agli oggetti presentati in una tabella
557
- */
558
- 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 () {
559
628
  /**
560
629
  * Costruttore
561
630
  *
562
- * @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
563
635
  */
564
- function ItemsSelection(selected) {
565
- /**
566
- * Indica se tutti gli elementi sono da considerarsi selezionati (anche quelli di altre pagine)
567
- */
568
- this.all = false;
569
- /**
570
- * Se **all** è **true**, indica gli elementi da escludere, altrimenti è insensato
571
- */
572
- this.exclusions = [];
573
- this.count = selected.length;
574
- this.items = selected;
575
- this.all = false;
576
- 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 = [];
577
644
  }
578
- return ItemsSelection;
645
+ return GroupPager;
579
646
  }());
580
647
 
581
- //Angular
582
648
  /**
583
- * 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
584
651
  */
585
- var EsTd = /** @class */ (function () {
652
+ var GroupRouteFragment = /** @class */ (function () {
586
653
  /**
587
- * @ignore
654
+ * Costruttore
655
+ *
656
+ * @param {string} column Colonna di raggruppamento
657
+ * @param {string} value Valore della colonna di raggruppamento
588
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
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 */
589
687
  function EsTd(myself, renderer, _viewContainer, sanitizer) {
590
688
  this.myself = myself;
591
689
  this.renderer = renderer;
592
690
  this._viewContainer = _viewContainer;
593
691
  this.sanitizer = sanitizer;
594
- /**
595
- * Id della cella, dev'essere lo stesso della colonna **EsTh** relativa
596
- */
692
+ /** Id della cella, dev'essere lo stesso della colonna **EsTh** relativa */
597
693
  this.ID = "";
598
- /**
599
- * Valore da mostrare all'interno della cella. Se omesso verrà proiettato il contenuto dal template in cui è stata usata
600
- */
694
+ /** Valore da mostrare all'interno della cella. Se omesso verrà proiettato il contenuto dal template in cui è stata usata */
601
695
  this.Display = null;
602
- /**
603
- * Template Angular da istanziare per questo TD
604
- */
696
+ /** Template Angular da istanziare per questo TD */
605
697
  this.Template = null;
606
698
  }
607
699
  Object.defineProperty(EsTd.prototype, "Visible", {
@@ -630,18 +722,17 @@
630
722
  enumerable: false,
631
723
  configurable: true
632
724
  });
633
- /**
634
- * @ignore
635
- */
725
+ /** @ignore */
636
726
  EsTd.prototype.ngAfterViewInit = function () {
637
727
  // Se è Internal significa che è gestita internamente da ES-TABLE quindi evito di fare sti due passaggi di lettura del DOM
638
728
  if (this.Internal)
639
729
  return;
640
730
  // L'hash è calcolato dalla ES-table in fase di binding
641
- this.Context = this.Context || this.getTemplateContext().hash;
731
+ this.Context = this.Context || this.getTemplateContext()._hash;
642
732
  this.Content = this.Display === null || this.Display === "" ? this.sanitizer.bypassSecurityTrustHtml(this.myself.nativeElement.innerHTML) : this.sanitizer.bypassSecurityTrustHtml(this.Display);
643
733
  this.Class = this.myself.nativeElement.className.replace("app-display-none", "");
644
734
  };
735
+ /** Ottiene il contesto della view su cui è istanziato il componente */
645
736
  EsTd.prototype.getTemplateContext = function () {
646
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
647
738
  var vc = this._viewContainer;
@@ -699,23 +790,15 @@
699
790
  };
700
791
 
701
792
  //Angular
702
- /**
703
- * Componente rappresentante una Colonna della tabella
704
- */
793
+ /** Componente rappresentante una Colonna della tabella */
705
794
  var EsTh = /** @class */ (function () {
706
- /**
707
- * @ignore
708
- */
795
+ /** @ignore */
709
796
  function EsTh(myself, renderer) {
710
797
  this.myself = myself;
711
798
  this.renderer = renderer;
712
- /**
713
- * Dizionario di mappatura con ordinamento attuale e ordinamento successivo per gestire i passaggi di stato
714
- */
799
+ /** Dizionario di mappatura con ordinamento attuale e ordinamento successivo per gestire i passaggi di stato */
715
800
  this.orderNext = { "NONE": "DESC", "DESC": "ASC", "ASC": null };
716
- /**
717
- * Indica se si sta effettuando un'operazione di resize su questa colonna
718
- */
801
+ /** Indica se si sta effettuando un'operazione di resize su questa colonna */
719
802
  this.resizingThis = false;
720
803
  /**
721
804
  * Storicizza l'offset di partenza del resize dell'elemento HTML per poter calcolare la nuova dimensione richiesta durente il resize
@@ -723,21 +806,13 @@
723
806
  * nuova width = startOffset + posizione X del mouse
724
807
  */
725
808
  this.startOffset = null;
726
- /**
727
- * Id della colonna, dev'essere lo stesso per tutti gli **EsTd** relativi
728
- */
809
+ /** Id della colonna, dev'essere lo stesso per tutti gli **EsTd** relativi */
729
810
  this.ID = "";
730
- /**
731
- * Indica se questa colonna è ordinabile o meno
732
- */
811
+ /** Indica se questa colonna è ordinabile o meno */
733
812
  this.Orderable = true;
734
- /**
735
- * Valore da mostrare all'interno della colonna. Se omesso verrà proiettato il contenuto dal template in cui è stata usata
736
- */
813
+ /** Valore da mostrare all'interno della colonna. Se omesso verrà proiettato il contenuto dal template in cui è stata usata */
737
814
  this.Display = "";
738
- /**
739
- * Indica se le dimnsioni di questa colonna sono modificabili o meno
740
- */
815
+ /** Indica se le dimnsioni di questa colonna sono modificabili o meno */
741
816
  this.Resizable = false;
742
817
  /**
743
818
  * Indica se sta venendo eseguita una operazione di ricerca o meno, serve per evitare l'esecuzione di eventuale codice che potrebbe dare fastidio
@@ -748,18 +823,12 @@
748
823
  this.Wrap = false;
749
824
  /** Indica se la colonna è fixed, cioè se non può né essere nascosta, né riposizionata. Solo le prime colonne possono essere Fixed */
750
825
  this.Fixed = false;
751
- /**
752
- * Template Angular da istanziare per questo TH
753
- */
826
+ /** Template Angular da istanziare per questo TH */
754
827
  this.Template = null;
755
- /**
756
- * Evento emesso al cambio di ordinamento effettuato su questa colonna
757
- */
828
+ /** Evento emesso al cambio di ordinamento effettuato su questa colonna */
758
829
  this.onOrderChange = new core.EventEmitter();
759
- /**
760
- * Impostato dall'**EsTable**, per controllare che ci sia almeno un TD che utilizzi quest'header
761
- */
762
- this.Referenced = false;
830
+ /** Impostato dall'**EsTable**, per controllare che ci sia almeno un TD che utilizzi quest'header */
831
+ this._referenced = false;
763
832
  }
764
833
  Object.defineProperty(EsTh.prototype, "Visible", {
765
834
  /**
@@ -787,9 +856,7 @@
787
856
  enumerable: false,
788
857
  configurable: true
789
858
  });
790
- /**
791
- * @ignore
792
- */
859
+ /** @ignore */
793
860
  EsTh.prototype.ngAfterViewInit = function () {
794
861
  //Assegnare direttamente il content è più veloce che passare dal native element per qualche motivo
795
862
  this.Description = this.Display === null || this.Display === "" ? this.content.nativeElement.innerText : this.Display;
@@ -798,9 +865,7 @@
798
865
  if (this.Resizable)
799
866
  this.renderer.addClass(this.myself.nativeElement, "app-relative");
800
867
  };
801
- /**
802
- * Gestisce la modifica dell'ordinamento qualora venisse cliccato su questa colonna
803
- */
868
+ /** Gestisce la modifica dell'ordinamento qualora venisse cliccato su questa colonna */
804
869
  EsTh.prototype.setupNextOrderAndNotify = function () {
805
870
  if (!this.ID) {
806
871
  console.log("Attempt to order a column without ID. Operation ignored");
@@ -827,9 +892,7 @@
827
892
  this.resizingThis = true;
828
893
  this.startOffset = this.myself.nativeElement.offsetWidth - ev.pageX;
829
894
  };
830
- /**
831
- * Listener per la fine dell'operazione di resize
832
- */
895
+ /** Listener per la fine dell'operazione di resize */
833
896
  EsTh.prototype.onMouseUp = function () {
834
897
  if (!this.Resizable)
835
898
  return;
@@ -880,9 +943,7 @@
880
943
  onMouseMove: [{ type: core.HostListener, args: ['window:mousemove.out-zone', ['$event'],] }]
881
944
  };
882
945
 
883
- /**
884
- * Direttiva per la dichiarazione snella di un EsTd da emettere per ogni elemento, data una colonna
885
- */
946
+ /** Direttiva per la dichiarazione snella di un EsTd da emettere per ogni elemento, data una colonna */
886
947
  var EsTdDirective = /** @class */ (function () {
887
948
  /**
888
949
  * @ignore
@@ -911,23 +972,31 @@
911
972
  tdClass: [{ type: core.Input }]
912
973
  };
913
974
 
914
- /**
915
- * Direttiva per la dichiarazione snella di un EsTh da emettere come header
916
- */
975
+ /** Direttiva per la dichiarazione snella di un EsTh da emettere come header */
917
976
  var EsThDirective = /** @class */ (function () {
918
977
  /**
919
978
  * @ignore
920
979
  */
921
980
  function EsThDirective(Template) {
922
981
  this.Template = Template;
982
+ /** Variabile interna all'interno della quale viene raccolta la cache delle aggregazioni specificate in thAggregation */
983
+ this._thAggregations = null;
923
984
  /** Variabile interna che indica il fatto che questo componente è una direttiva. Serve per disambigualrlo dell'EsThComponent */
924
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;
925
988
  /** Id della colonna, dev'essere lo stesso per tutti i **td** relativi */
926
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;
927
994
  /** Indicazione sulla visibilità della colonna */
928
995
  this.thVisible = true;
929
996
  /** Indica se la colonna è fixed, cioè se non può né essere nascosta, né riposizionata. Solo le prime colonne possono essere Fixed */
930
997
  this.thFixed = false;
998
+ /** Indica che la colonna è sotto ad un raggruppamento padre, con questo nome nel **th** */
999
+ this.thParent = "";
931
1000
  /** Indica se questa colonna è ordinabile o meno */
932
1001
  this.thOrderable = true;
933
1002
  /** Indica se il testo presente in questo Header può andare a capo o meno, di default non può */
@@ -936,12 +1005,10 @@
936
1005
  this.thResizable = false;
937
1006
  /** Equivalente dell'NgIf sul th */
938
1007
  this.thIf = true;
939
- /** @ignore Sperimentale: Indica che bisogna fare un raggruppamento su questa colonna */
1008
+ /** Indica che bisogna fare un raggruppamento su questa colonna */
940
1009
  this.thGroup = false;
941
- /** @ignore Sperimentale: Indica che bisogna fare una aggregazione su questa colonna, a fronte di almeno un altra con un raggruppamento */
942
- this.thAggregation = "";
943
- /** Impostato dall'**EsTable**, per controllare che ci sia almeno un TD che utilizzi quest'header */
944
- this.Referenced = false;
1010
+ /** Indica che bisogna fare una aggregazione su questa colonna, a fronte di almeno un altra con un raggruppamento */
1011
+ this.thAggregation = null;
945
1012
  }
946
1013
  return EsThDirective;
947
1014
  }());
@@ -953,33 +1020,38 @@
953
1020
  ]; };
954
1021
  EsThDirective.propDecorators = {
955
1022
  th: [{ type: core.Input }],
1023
+ thPinned: [{ type: core.Input }],
1024
+ thPinnedWidth: [{ type: core.Input }],
956
1025
  thVisible: [{ type: core.Input }],
957
1026
  thFixed: [{ type: core.Input }],
1027
+ thParent: [{ type: core.Input }],
958
1028
  thOrder: [{ type: core.Input }],
959
1029
  thOrderable: [{ type: core.Input }],
960
1030
  thWrap: [{ type: core.Input }],
961
1031
  thResizable: [{ type: core.Input }],
962
1032
  thClass: [{ type: core.Input }],
1033
+ thGroupClass: [{ type: core.Input }],
963
1034
  thIf: [{ type: core.Input }],
964
1035
  thGroup: [{ type: core.Input }],
965
1036
  thAggregation: [{ type: core.Input }]
966
1037
  };
967
1038
 
968
- /**
969
- * Token che indica il locale da utilizzare all'interno del componente. Supportati solo "it-IT" ed "en-US"
970
- */
971
- 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');
972
1045
 
973
- /**
974
- * Classe di localizzazione per il componente **EsTableComponent**
975
- */
1046
+ /** Classe di localizzazione per il componente **EsTableComponent** */
976
1047
  var EsTableLoc = /** @class */ (function (_super) {
977
1048
  __extends(EsTableLoc, _super);
978
- /**
979
- * @ignore
980
- */
1049
+ /** @ignore */
981
1050
  function EsTableLoc(LOC_LOCALE) {
982
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"]);
983
1055
  _super.prototype.set.call(_this, "en->it", "Performing Table bootstrap", ["Sto caricando la Tabella"]);
984
1056
  _super.prototype.set.call(_this, "en->it", "Update every", ["Aggiorna ogni"]);
985
1057
  _super.prototype.set.call(_this, "en->it", "second/s", ["secondo/i"]);
@@ -1006,25 +1078,34 @@
1006
1078
  { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [EST_LOCALE,] }] }
1007
1079
  ]; };
1008
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
+
1009
1088
  /** Componente che permette di rappresentare una griglia di valori */
1010
1089
  var EsTableComponent = /** @class */ (function () {
1011
1090
  /** @ignore */
1012
- 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;
1013
1093
  this.ngControl = ngControl;
1014
1094
  this.prefService = prefService;
1095
+ this.deafults = deafults;
1096
+ this.locale = locale;
1015
1097
  this.lc = lc;
1016
1098
  this.cdr = cdr;
1017
1099
  this.hashExts = hashExts;
1018
1100
  this.utiExts = utiExts;
1019
1101
  this.expExts = expExts;
1102
+ this.dateExts = dateExts;
1103
+ this.msgExts = msgExts;
1020
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** */
1021
1105
  this.View = null;
1022
1106
  /** Indica se l'es-table deve mostrare il check globale nell'header per fare il "seleziona tutto" */
1023
1107
  this.globalCheck = false;
1024
- /**
1025
- * Tiene da conto l'ultimo elemento selezionato in modo da fare ragionamenti del tipo
1026
- * "Ho selezionato questo, l'ultimo selezionato era **lastSelected**, devo selezionare tutti quelli in mezzo", ad esempio per la selezione multipla
1027
- */
1108
+ /** Tiene da conto l'ultimo elemento selezionato in modo da poter effettuare il SHIFT+CLICK */
1028
1109
  this.lastSelected = null;
1029
1110
  /** Conteggio interno per il numero di elementi selezionati */
1030
1111
  this.selectedObjects = 0;
@@ -1063,6 +1144,10 @@
1063
1144
  this.RowTHs = null;
1064
1145
  /** Modello di appoggio temporaneo per i **RowTHs** */
1065
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;
1066
1151
  /** Cache per i routerLink generati nelle tabelle dinamiche */
1067
1152
  this.DynamicTableRouterLinkCache = {};
1068
1153
  /**
@@ -1109,7 +1194,11 @@
1109
1194
  * @deprecated Utilizzare l'Input **Template** delle es-td e assegnare un template con tutti i binding che si vuole ai click
1110
1195
  */
1111
1196
  this.CustomCellActionsOn = '';
1112
- /** 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
+ */
1113
1202
  this.CellActionPropagates = true;
1114
1203
  /**
1115
1204
  * Decide se utilizzare o meno le CustomCells. Impostandolo a **true** l'es-table diventa in grado di gestire nativamente:
@@ -1125,14 +1214,14 @@
1125
1214
  this.UseCustomCells = null;
1126
1215
  /** Permette di impostare l'altezza massima della tabella. Se null la dimensione si adatta al numero di elementi attualmente in visualizzazione */
1127
1216
  this.MaxHeight = null;
1128
- /** Classi da applicare alla tabella oltre a quelle gestite autonomamente dalla libreria */
1129
- this.Class = '';
1217
+ /** Classi da applicare al contenitore della tabella */
1218
+ this.ContainerClass = null;
1130
1219
  /** Permette o meno l'export in formato XLSX */
1131
1220
  this.XLSXExport = null;
1132
1221
  /** Permette o meno l'export in formato CSV */
1133
1222
  this.CSVExport = true;
1134
1223
  /** Permette di visualizzare o meno l'opzione di paginazione "Tutti" */
1135
- this.AllSearch = true;
1224
+ this.AllSearch = null;
1136
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 */
1137
1226
  this.HighCellDensity = null;
1138
1227
  /** Abilita o meno la possibilità di selezionare oggetti */
@@ -1151,8 +1240,6 @@
1151
1240
  this.Export = null;
1152
1241
  /** Indica se permettere la selezione multipla Windows-like cliccando un oggetto e facendo poi Shift + click su un oggetto successivo */
1153
1242
  this.ShiftClick = null;
1154
- /** Mostra o nasconde le informazioni di paginazione, sia i pulsanti, sia il selettore degli oggetti per pagina */
1155
- this.ShowPaging = true;
1156
1243
  /** Indica se nascondere o mostrare il componente di paginazione */
1157
1244
  this.HidePaging = null;
1158
1245
  /** Indica se nascondere o mostrare il conteggio degli elementi trovati */
@@ -1164,12 +1251,10 @@
1164
1251
  /** Nome dell'esportazione generata da questa tabella */
1165
1252
  this.ExportFileName = 'Export.csv';
1166
1253
  /** Classe (HTML) di default della tabella */
1167
- this.TableClass = 'table table-striped table-hover table-sm';
1168
- /** Testo da visualizzare nel conteggio. Di default: "Oggetti selezionati" */
1169
- this.CountLabel = this.lc.loc('Found objects');
1170
- /** Indica la presenza di raggruppamenti a livello di header */
1254
+ this.TableClass = null;
1255
+ /** @deprecated Indica la presenza di raggruppamenti a livello di header */
1171
1256
  this.HasHeaderGroup = null;
1172
- /** 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** */
1173
1258
  this.HasSecondaryHeaderGroup = null;
1174
1259
  /** Utilizzato per dividere la sorgente in modalità EndlessScroll */
1175
1260
  this.SliceSize = 100;
@@ -1201,11 +1286,7 @@
1201
1286
  this.HiddenColumns = null;
1202
1287
  /** Permette di riordinare le colonne in base alle impostazioni effettuate dal Menù contestuale in alto a destra */
1203
1288
  this.ColumnsOrdering = null;
1204
- /**
1205
- * Eventuale supporto alle ricerche applicate alla modalità Array
1206
- *
1207
- * @deprecated Utilizzato solo per un caso particolare del Metering
1208
- */
1289
+ /** Eventuale supporto alle ricerche applicate alla modalità Array */
1209
1290
  this.SearchView = null;
1210
1291
  /** Abilita o disabilita il sistema che permette di selezionare tutti gli elementi nella vista */
1211
1292
  this.SelectAll = null;
@@ -1225,6 +1306,10 @@
1225
1306
  this.StartsExpanded = true;
1226
1307
  /** Indica se effettuare il salvataggio delle preferenze di ricerca */
1227
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;
1228
1313
  /**
1229
1314
  * Sorgente dati secondaria
1230
1315
  *
@@ -1238,12 +1323,19 @@
1238
1323
  */
1239
1324
  this.TertiarySource = null;
1240
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 */
1241
- 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;
1242
1329
  /** Evento che viene richiamato al cambio di oridnamento di una colonna */
1243
1330
  this.onOrderChanged = new core.EventEmitter();
1244
1331
  /**
1245
1332
  * Evento che viene richiamato quando l'es-table ritiene sia necessario ri-effettuare la ricerca.
1246
- * 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à
1247
1339
  */
1248
1340
  this.onSearchRequest = new core.EventEmitter();
1249
1341
  /** Evento che parte ad ogni modifica di "checkaggio" in forma di comodo array. Espone l'oggetto con lo stato di check attuale */
@@ -1266,19 +1358,91 @@
1266
1358
  /** Numero di pagine (durante la paginazione in modalità Array) */
1267
1359
  this.arraymodePages = 1;
1268
1360
  /** Oggetti per ogni pagina (durante la paginazione in modalità Array) */
1269
- 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 = [];
1270
1368
  /**
1271
1369
  * Variabile che serve a gestire il momento in cui l'es-table aggiorna la paginazione (pulsanti ecc).
1272
1370
  * Essendo operazioni comunque costose le effettuo solo su binding esterni, non su rewrite generati internamente
1273
1371
  */
1274
1372
  this.internalWriteCall = false;
1275
- /** Cache di selezione Hash - Oggetto */
1276
- 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' };
1277
1423
  /** @ignore */
1278
1424
  this.propagateChange = function (_) { };
1279
1425
  if (ngControl)
1280
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);
1281
1444
  }
1445
+ // #region Ciclo di vita ES-Table - Inizializzazioni
1282
1446
  /** @ignore */
1283
1447
  EsTableComponent.prototype.ngOnInit = function () {
1284
1448
  var _this = this;
@@ -1288,6 +1452,9 @@
1288
1452
  throw "Es-table error: Per poter utilizzare l'es-table con [Hierarchy]=\"true\" è richiesto anche [UseCustomCells]=\"true\"";
1289
1453
  // click destro su una riga con selezione attiva: Tiro fuori il context menu e selezione l'elemento corrente
1290
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;
1291
1458
  var shouldEmit = !t.item._selected;
1292
1459
  t.item._selected = true;
1293
1460
  var itemSelection = _this.handleItemsSelection([t.item]);
@@ -1315,6 +1482,26 @@
1315
1482
  this.ShiftClick = true;
1316
1483
  }
1317
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
+ };
1318
1505
  /** @ignore */
1319
1506
  EsTableComponent.prototype.ngOnDestroy = function () {
1320
1507
  if (this.ctxMenuSubscription)
@@ -1324,7 +1511,7 @@
1324
1511
  EsTableComponent.prototype.ngOnChanges = function (changes) {
1325
1512
  return __awaiter(this, void 0, void 0, function () {
1326
1513
  var newSearchView;
1327
- return __generator(this, function (_c) {
1514
+ return __generator(this, function (_s) {
1328
1515
  newSearchView = changes['SearchView'];
1329
1516
  if (newSearchView && this.SearchView)
1330
1517
  this.arrayPulsanti = this.getPagesArray(6, this.SearchView.page, this.SearchView.pages || 1);
@@ -1332,6 +1519,7 @@
1332
1519
  });
1333
1520
  });
1334
1521
  };
1522
+ // #endregion
1335
1523
  // #region Implementazione ControlValueAccessor ignorabile
1336
1524
  /** @ignore */
1337
1525
  EsTableComponent.prototype.registerOnChange = function (fn) { this.propagateChange = fn; };
@@ -1342,6 +1530,7 @@
1342
1530
  // #endregion
1343
1531
  /** @ignore */
1344
1532
  EsTableComponent.prototype.writeValue = function (obj) {
1533
+ var _a;
1345
1534
  this.View = obj ? obj : null;
1346
1535
  // Mi è arrivata l'AppSearch quindi di sicuro non ho una ricerca in progress
1347
1536
  this.researchInProgress = false;
@@ -1374,10 +1563,11 @@
1374
1563
  else if (this.View && this.View instanceof AppSearch) {
1375
1564
  // Se cambia l'oggetto intero significa che ho rimandato la ricerca
1376
1565
  this.setMode('view');
1566
+ var firstItemGroupOrNoGrouping = (((_a = this.View.requestedgroups) === null || _a === void 0 ? void 0 : _a.length) || 0) == 0;
1377
1567
  // Se vengo da una ricerca interna mantengo lo stato di selezione precedente (quindi su cambio pagina, cambio ipp, ecc...)
1378
1568
  // se invece l'utente ha fatto una ricerca lui (quindi cambiando filtri), secco le info di selezione
1379
- if (!this.View.selection || !this.View.internalsearchrequest || !this.UseSelectionCache) {
1380
- this.selOrDeselCache = {};
1569
+ if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache) {
1570
+ this.clearSelectionCaches();
1381
1571
  this.View.selection = new ItemsSelection([]);
1382
1572
  this.onSelectionChanged.emit(this.View.selection);
1383
1573
  }
@@ -1396,63 +1586,146 @@
1396
1586
  }
1397
1587
  }
1398
1588
  }
1399
- 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);
1400
1592
  }
1401
1593
  else if (this.View && (this.View.length != null && this.View.length != undefined)) {
1402
1594
  this.setMode('array');
1403
1595
  if (!this.UseSelectionCache || !this.arraymodeSelection) {
1404
- this.selOrDeselCache = {};
1596
+ this.clearSelectionCaches();
1405
1597
  this.arraymodeSelection = new ItemsSelection([]);
1406
1598
  ;
1407
1599
  this.onSelectionChanged.emit(this.arraymodeSelection);
1408
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
+ }
1409
1615
  if (this.SearchView)
1410
1616
  this.arrayPulsanti = this.getPagesArray(6, this.SearchView.page, this.SearchView.pages || 1);
1411
1617
  }
1412
- if (this.View && !(this.View instanceof ReportDefinition)) {
1413
- /*
1414
- *Uso la tecnica di EndlessScroll se la variabile relativa è attiva e se
1415
- * 1) Ho un Array, oppure
1416
- * 2) Ho un AppSearch che sta cercando con paginazione "Tutto", oppure
1417
- * 3) Ho un AppSearch che sta cercando con paginazione diversa da "Tutto" ma con la variabile EndlessScrollOnlyForAll a false
1418
- */
1419
- var viewCasted = this.View;
1420
- var isAppSearchWithIppMax = this.viewMode && viewCasted.itemsperpageoverride == this.defaultAllPageOverride;
1421
- var isAppSearchNoMaxIpp = this.viewMode && viewCasted.itemsperpageoverride != this.defaultAllPageOverride;
1422
- this.UseEndlessscroll = this.EndlessScroll && (this.arrayMode || isAppSearchWithIppMax || (isAppSearchNoMaxIpp && !this.EndlessScrollOnlyForAll));
1423
- if (this.UseEndlessscroll) {
1424
- this.addedSlices = [];
1425
- this.boundSubSources = this.getItemSlices();
1426
- this.TMPBoundSource = this.boundSubSources[0] ? this.boundSubSources[0] : [];
1427
- if (this.boundSubSources[0])
1428
- 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 : "";
1429
1666
  }
1430
- else
1431
- this.TMPBoundSource = this.getItemsByMode(false, !this.internalWriteCall);
1432
- if (this.Hierarchy)
1433
- this.assignHierarchyLevels(this.TMPBoundSource);
1434
- this.calculateHash(this.TMPBoundSource);
1435
- // Assegno a una variabile mia l'eventuale override per la classe della riga
1436
- // Se poi sono in modalità gerarchica inietto anche la classe per la configurazione del livello della riga
1437
- if ((this.TMPBoundSource && this.RowClassAssigner) || this.Hierarchy) {
1438
- for (var i = 0; i < this.TMPBoundSource.length; i++) {
1439
- var item = this.TMPBoundSource[i];
1440
- item._rowClass = this.RowClassAssigner ? this.RowClassAssigner(item) : "";
1441
- item._rowClass += this.Hierarchy ? " est-row-lvl-" + item.level : "";
1442
- }
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;
1443
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);
1686
+ }
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;
1444
1702
  }
1445
- this.postBoundSourceCalculation();
1446
1703
  };
1447
- // #region Gestione retrieve degli oggetti da mostrare in tabella, considerando eventuali Endless Scrolls
1448
1704
  /**
1449
- * In base alla modalità specificata (ArrayMode, ViewMode, ecc...) questo metodo recupera l'array di oggetti da bindare ad interfaccia
1705
+ * Ripulisce le cache di selezione
1450
1706
  *
1451
- * @param {boolean} onlyselected [false] Indica di prendere solo gli oggetti selezionati
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();
1718
+ };
1719
+ /**
1720
+ * In base alla modalità specificata (ArrayMode, ViewMode, ecc...) questo metodo recupera l'array di oggetti da bindare ad interfaccia
1721
+ *
1722
+ * @param {boolean} onlyselected [false] Indica di prendere solo gli oggetti selezionati
1452
1723
  * @param {boolean} refreshPaging [false] Indica se aggiornare le informazioni di paginazione o meno
1453
1724
  * @param {boolean} allIfPossible [false] Indica se prendere tutti gli oggetti quaora possibile, usato solo in ArrayMode
1454
1725
  *
1455
1726
  * @returns {any[]} Lista degli oggetti su cui effettuare il bind lato interfaccia
1727
+ *
1728
+ * @todo: ITEMS
1456
1729
  */
1457
1730
  EsTableComponent.prototype.getItemsByMode = function (onlyselected, refreshPaging, allIfPossible) {
1458
1731
  if (onlyselected === void 0) { onlyselected = false; }
@@ -1463,6 +1736,8 @@
1463
1736
  items = this.getViewItemsBySource();
1464
1737
  }
1465
1738
  else if (this.arrayMode) {
1739
+ this.View.forEach(function (itm) { itm._item = true; });
1740
+ // Se faccio dei raggruppamenti ignoro la paginazione
1466
1741
  if (this.UseArrayModePaging && !allIfPossible) {
1467
1742
  // Se sono in modalità array ma la ricerca dipende da una view devo riallineare gli itemperpage
1468
1743
  if (this.SearchView)
@@ -1481,16 +1756,62 @@
1481
1756
  return items.filter(function (t) { return t._selected; });
1482
1757
  return items;
1483
1758
  };
1484
- /** @ignore */
1759
+ /**
1760
+ * @ignore
1761
+ *
1762
+ * @todo: ITEMS
1763
+ */
1485
1764
  EsTableComponent.prototype.getViewItemsBySource = function () {
1486
- return this.SecondarySource ? this.View.items2 : this.TertiarySource ? this.View.items3 : this.View.items;
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
+ }
1487
1805
  };
1488
1806
  /**
1489
1807
  * Metodo che prende tutti gli oggetti di cui dispone divisi in bucket da 100 elementi
1490
1808
  *
1491
1809
  * @returns {any[][]} Matrice di array Nx100
1810
+ *
1811
+ * @todo: ITEMS
1492
1812
  */
1493
1813
  EsTableComponent.prototype.getItemSlices = function () {
1814
+ // Se sono qui di sicuro non ho rowgrouping
1494
1815
  var items = this.getItemsByMode();
1495
1816
  if (!items)
1496
1817
  return [];
@@ -1525,8 +1846,6 @@
1525
1846
  }
1526
1847
  }
1527
1848
  };
1528
- // #endregion
1529
- // #region Gestione di tutto il ciclo di vita post binding oggetti
1530
1849
  /**
1531
1850
  * Metodo lanciato dopo che la sorgente dati è stata correttamente bindata, si occupa di ricalcolare tutto ciò che serve
1532
1851
  * all'es-table per renderizzare i valori da mostrare
@@ -1537,108 +1856,481 @@
1537
1856
  this.RowContexts = [];
1538
1857
  this.OrderDirectives = [];
1539
1858
  this.lastSelectedItemID = null;
1540
- // Set timeout e basta funzionerebbe per la modalità JIT, ma per AOT servono sia quello che detectChanges
1541
- this.cdr.detectChanges();
1542
- setTimeout(function () {
1543
- // Se non ho colonne dinamiche ma sono in modalità dinamica (lo capisco perché c'è una view piena di genericitem) metto il default delle colonne
1544
- _this.eventuallyReviewDynamicColumns();
1545
- // Molte cose sono ovviamente disponibili solo in modalità View
1546
- if (_this.viewMode && _this.UseCustomCells) {
1547
- var view = _this.View;
1548
- var ths = _this.EsThs && _this.EsThs.length > 0 ? _this.EsThs.toArray() : _this.EsThsDirective && _this.EsThsDirective.length > 0 ? _this.EsThsDirective.toArray() : [];
1549
- var tds = _this.EsTds && _this.EsTds.length > 0 ? _this.EsTds.toArray() : _this.EsTdsDirective && _this.EsTdsDirective.length > 0 ? _this.EsTdsDirective.toArray() : [];
1550
- // N.B: Rispettare l'ordine di queste 3 macrocategorie è VITALE
1551
- // ************************************* Sistemazioni di TH, TD, e visibilità varie *************************************
1552
- _this.alignColumnsIfLoadedView(view); // Se sto caricando una View da hotpotato (quindi con savedstate = true) riallineo la visibilità delle colonne e il loro ordine.
1553
- _this.refreshColumnsVisibility(ths, tds, view); // Lavoro sui TH ed eventualmente modifico la visibilità anche dei TD.
1554
- _this.alignHeadersOrdering(ths, view); // Allineo gli ordinamenti agli header
1555
- _this.reviewColumnsList(ths); // Aggiorna la lista delle colonne da mostrare nella dialog per ordinamento ecc
1556
- // ************************************* Generazione binding per righe e colonne *************************************
1557
- _this.evaluateRowThs(ths); // Raccolgo i TH
1558
- _this.evaluateRowTds(ths, tds); // Raccolgo i TD in contesti separati, un contesto per ogni item
1559
- // ************************************* Ultimi aggiustmaenti dei binding *************************************
1560
- _this.generateDefaultOrder(view); // Genero le direttive di ordinamento, che siano default o derivanti dalla AppSearch
1561
- _this.applyOrdering(view, true); // Applico l'ordinamento sulle colonne (non ASC DESC, ma "prima questa o quella colonna")
1562
- _this.MoveTemporaryVariablesToRealOnes(); // Collego TH e TD aggiustati fino ad ora alle variabili di Binding HTML
1563
- _this.evaluateSelection(view.items, view.selection); // Riallineo le info di selezione degli elementi della View
1564
- }
1565
- else if (_this.viewMode && !_this.UseCustomCells) {
1566
- // Riallineo le info di selezione degli elementi della View
1567
- var view = _this.View;
1568
- _this.evaluateSelection(view.items, view.selection);
1569
- }
1570
- else if (_this.arrayMode) {
1571
- // Riallineo le info di selezione degli elementi dell'array
1572
- _this.arrayModeEvaluateSelection(_this.View);
1573
- }
1574
- // Collego gli oggetti da mostrare
1575
- _this.boundSource = _this.TMPBoundSource;
1576
- // Per essere sicuro che dopo un bind di oggetti la es-table aggiorni la grafica
1577
- _this.cdr.markForCheck();
1578
- _this.FirstBind = false;
1579
- });
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
+ }
1580
1865
  };
1581
1866
  /**
1582
- * 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
1583
1868
  */
1584
- EsTableComponent.prototype.MoveTemporaryVariablesToRealOnes = function () {
1585
- this.RowTDs = this.TMPRowTDs;
1586
- 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;
1587
1920
  };
1588
1921
  /**
1589
- * 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
1590
1923
  *
1591
- * @param {any[]} items Oggetti di cui valutare la selezione
1592
- * @param {ItemsSelection<any>} selectionItem Oggetti di selezione derivante dalla view o dall'oggetto per Array
1924
+ * @todo: INTERNALDB
1593
1925
  */
1594
- EsTableComponent.prototype.evaluateSelection = function (items, selectionItem) {
1595
- 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)
1596
1942
  return;
1597
- 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
+ }
1598
1962
  };
1599
1963
  /**
1600
- * Valuta quali elementi devono essere marcati come selezionati nella vista attuale. Si basa sull'oggetto **arraymodeSelection** dell'es-table
1964
+ * Data la definizione dei gruppi da generare da una lista di oggetti, suddivide gli oggetti passati in gruppi e sottogruppi
1601
1965
  *
1602
- * @param {any[]} array Lista di oggetti di cui valutare la selezione in modalità array
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
1603
1974
  */
1604
- EsTableComponent.prototype.arrayModeEvaluateSelection = function (array) {
1605
- if (array.length == 0)
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;
2122
+ };
2123
+ ;
2124
+ /**
2125
+ * Effettua il binding degli oggetti pervenuti da questa chiamata con gli oggetti effettivamente da graficare
2126
+ *
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**
2128
+ */
2129
+ EsTableComponent.prototype.bindDisplayToLoadedItemsOrGroups = function (view) {
2130
+ var _a, _b;
2131
+ if (this.TMPBoundSource.length == 0) {
2132
+ this.BaseItemsCount = 0;
1606
2133
  return;
1607
- this.handleSelectionEvaluation(array, this.arraymodeSelection);
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;
2144
+ return;
2145
+ }
2146
+ this.handleNewDataOnRowGrouping(view, groupingKeys);
1608
2147
  };
1609
2148
  /**
1610
- * 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:
1611
2150
  *
1612
- * @param {any[]} items Oggetti di cui aggiornare lo stato di selezione
1613
- * @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
1614
2159
  */
1615
- EsTableComponent.prototype.handleSelectionEvaluation = function (items, selectionItem) {
1616
- var allSelected = true;
1617
- for (var i = 0; i < items.length; i++) {
1618
- var itm = items[i];
1619
- // Reidrato la cache di selezione coi nuovi oggetti altrimenti non riuscirei a beccare gli indici giusti
1620
- // Dopodiché la uso per calcolare istantaneamente se gli oggetti sono selezionati o no
1621
- if (this.selOrDeselCache[itm.hash])
1622
- this.selOrDeselCache[itm.hash] = itm;
1623
- if (selectionItem.all)
1624
- itm._selected = !this.selOrDeselCache[itm.hash];
1625
- else
1626
- itm._selected = !!this.selOrDeselCache[itm.hash];
1627
- 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;
1628
2182
  }
1629
- // Se tutti gli oggetti di questa pagina sono solezionati allora posso mettere il global check a true
1630
- // Se sono in situazione di all-select anche metto la global checkbox, nonostante ci possano essere delle esclusioni
1631
- this.globalCheck = allSelected || selectionItem.all;
1632
- this.canSelectAll = selectionItem.count > 0 && this.SelectAll;
1633
- // Potrebbe cambiare qualora qualcuno inserisse dati a manazza in modalità Array e desse il refresh manuale alla tabella
1634
- // Comunque costa 0 quindi mi permetto di refreshare
1635
- if (this.arrayMode) {
1636
- var prevSelected = this.selectedObjects;
1637
- this.finalizeSelectionInformations(selectionItem);
1638
- if (this.selectedObjects != prevSelected)
1639
- 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);
1640
2309
  }
1641
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
+ };
2322
+ /**
2323
+ * Permette di selezionare o deselezionare in maniera arbitraria degli oggetti
2324
+ *
2325
+ * @param {any[]} items Oggetti da selezionare o deselezionare
2326
+ * @param {boolean} select **true** per selezionarli, **false** per non toccarli
2327
+ *
2328
+ * @todo: SELECTION
2329
+ */
2330
+ EsTableComponent.prototype.setSelectionStatus = function (items, select) {
2331
+ this.handleItemsSelection(items, select);
2332
+ this.cdr.markForCheck();
2333
+ };
1642
2334
  /**
1643
2335
  * Se non ho l'Input **DynamicRowColumnsDefinition** in modalità dinamica lo riempio con il default nome della colonna = testo della colonna
1644
2336
  */
@@ -1667,32 +2359,118 @@
1667
2359
  * @param {EsTh[] | EsThDirective[]} ths Colonne della tabella
1668
2360
  */
1669
2361
  EsTableComponent.prototype.reviewColumnsList = function (ths) {
1670
- this.ColumnsList = [];
2362
+ var _this = this;
2363
+ this.TMPColumnsList = [];
1671
2364
  if (ths.length == 0)
1672
2365
  return;
1673
- // Appena il contentChildren è valorizzato scorro tutti gli header
1674
- for (var i = 0; i < ths.length; i++) {
2366
+ var _loop_3 = function (i) {
1675
2367
  var th = ths[i];
1676
- if (this.isEsTh(th)) {
2368
+ if (this_2.isEsTh(th)) {
1677
2369
  // Se non ho un id il th è considerato inerte
1678
2370
  if (!th.ID)
1679
- continue;
1680
- th.OrderBy = this.OrderByColumn;
2371
+ return "continue";
2372
+ th.OrderBy = this_2.OrderByColumn;
1681
2373
  // Salvo le informazioni dell'header per far parte della lista da cui scegliere quali colonne visualizzare/nascondere
1682
2374
  // Di default la visibilità è quella impostata nel componente
1683
- if (this.HiddenColumns || th.Visible)
1684
- 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));
1685
2377
  }
1686
2378
  else {
2379
+ var column_1 = th.th;
1687
2380
  // Se non ho un id il th è considerato inerte
1688
- if (!th.th)
1689
- continue;
2381
+ if (!column_1)
2382
+ return "continue";
1690
2383
  // Salvo le informazioni dell'header per far parte della lista da cui scegliere quali colonne visualizzare/nascondere
1691
2384
  // Di default la visibilità è quella impostata nel componente
1692
- if (this.HiddenColumns || th.thVisible)
1693
- 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
+ }
1694
2438
  }
1695
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]);
1696
2474
  };
1697
2475
  /**
1698
2476
  * Terminato il binding delle colonne da **reviewColumnsList** e della **View** dal **writeValue** questo metodo si occupa
@@ -1702,14 +2480,19 @@
1702
2480
  */
1703
2481
  EsTableComponent.prototype.alignColumnsIfLoadedView = function (view) {
1704
2482
  var _this = this;
1705
- var emitChanged = view.savedstate;
2483
+ var emitChanged = this.viewMode && view.savedstate;
1706
2484
  var newColset = [];
1707
2485
  if (!this.ColumnsList || this.ColumnsList.length == 0)
1708
2486
  return;
2487
+ var columns = this.viewMode ? view.columns : this.arrayColumns;
1709
2488
  this.ColumnsList.forEach(function (c) {
1710
- var exCl = view.columns.filter(function (cc) { return cc == c.id; });
1711
- // Se l'appsearch viene da uno stato precedente, uso le informaizoni sulle colonne che ha dentro, altrimenti sovrascrivo tutto **
1712
- 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)
1713
2496
  newColset.push(c.id);
1714
2497
  // Se ho una colonna lato AppSearch e nella ColumnList non è visibile, allineo all'AppSearch
1715
2498
  else if (exCl.length == 1 && !c.visible)
@@ -1719,11 +2502,15 @@
1719
2502
  c.visible = false;
1720
2503
  });
1721
2504
  // Non ho colonne nella appsearch, vuol dire che sono al primo binding
1722
- if (view.columns.length == 0)
1723
- view.columns = newColset;
1724
- if (view.savedstate && this.ColumnsOrdering && view.column_ordering.length > 0) {
1725
- 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) {
1726
2512
  // Scorro gli ordinamenti che avevo salvato e ricreo la ColumnsList in base a loro
2513
+ var newColList_1 = [];
1727
2514
  view.column_ordering.forEach(function (co) {
1728
2515
  _this.ColumnsList.forEach(function (c) {
1729
2516
  if (c.id == co)
@@ -1733,7 +2520,8 @@
1733
2520
  this.ColumnsList = newColList_1;
1734
2521
  }
1735
2522
  // In ogni caso questo non mi serve più, lo resetto **
1736
- view.savedstate = false;
2523
+ if (this.viewMode)
2524
+ view.savedstate = false;
1737
2525
  if (emitChanged)
1738
2526
  this.changed();
1739
2527
  };
@@ -1744,20 +2532,22 @@
1744
2532
  * @param {'DESC' | 'ASC'} order Nuovo ordine selezionato per la colonna
1745
2533
  */
1746
2534
  EsTableComponent.prototype.thOrderChanged = function (id, order) {
1747
- if (!this.viewMode) {
1748
- 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');
1749
2537
  return;
1750
2538
  }
1751
2539
  if (!this.OrderByColumn)
1752
2540
  return;
1753
- var appSearch = this.View;
2541
+ var orders = this.viewMode ? this.View.orders : this.arrayOrders;
1754
2542
  var orderToAdd = true;
1755
2543
  var orderToRemove = null;
1756
2544
  // Se per qualche motivo il costruttore non è passato (cache tarpate o simila) fixo
1757
- if (!appSearch.orders)
1758
- appSearch.orders = [];
1759
- for (var i = 0; i < appSearch.orders.length; i++) {
1760
- 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];
1761
2551
  if (t.id == id) {
1762
2552
  if (order) {
1763
2553
  t.order = order;
@@ -1768,27 +2558,46 @@
1768
2558
  }
1769
2559
  }
1770
2560
  if (orderToRemove != null) {
1771
- appSearch.orders.splice(orderToRemove, 1);
2561
+ orders.splice(orderToRemove, 1);
1772
2562
  }
1773
2563
  else if (orderToAdd) {
1774
2564
  if (this.MultipleOrderingDirectives)
1775
- appSearch.orders.push(new AppOrdering(id, order));
1776
- else
1777
- 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
+ }
1778
2572
  }
1779
2573
  this.onOrderChanged.emit({ id: id, order: order });
1780
- 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();
1781
2582
  };
1782
2583
  /**
1783
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
1784
2588
  */
1785
- EsTableComponent.prototype.emitSearchRequest = function (value) {
1786
- if (this.viewMode) {
2589
+ EsTableComponent.prototype.emitSearchRequest = function (resetsPage, viewOverride) {
2590
+ if (this.viewMode && !viewOverride) {
1787
2591
  this.View.internalsearchrequest = true;
1788
2592
  this.changed();
1789
2593
  }
2594
+ if (viewOverride) {
2595
+ if (resetsPage)
2596
+ viewOverride.page = 1;
2597
+ viewOverride.internalsearchrequest = true;
2598
+ }
1790
2599
  this.researchInProgress = true;
1791
- this.onSearchRequest.emit(value);
2600
+ this.onSearchRequest.emit(viewOverride ? viewOverride : resetsPage);
1792
2601
  };
1793
2602
  /**
1794
2603
  * In base alla visibilità registrata nelle **ColumnsList** questo metodo si occupa di prendere tutti i **EsThs** ed **EsTds** relativi e nasonderli/mostrarli
@@ -1800,16 +2609,19 @@
1800
2609
  * @param {AppSearch<any>} view AppSearch da utilizzare per questa operazione
1801
2610
  */
1802
2611
  EsTableComponent.prototype.refreshColumnsVisibility = function (ths, tds, view) {
1803
- var columnsCache = {};
1804
2612
  var newColset = [];
1805
2613
  var fixedThs = {};
2614
+ var columnsCache = {};
1806
2615
  for (var coli = 0; coli < this.ColumnsList.length; coli++) {
1807
2616
  var col = this.ColumnsList[coli];
1808
2617
  columnsCache[col.id] = col;
1809
2618
  if (col.visible)
1810
- newColset.push(col.id);
2619
+ newColset.push((col.pinned ? "§" : "") + col.id);
1811
2620
  }
1812
- view.columns = newColset;
2621
+ if (view)
2622
+ view.columns = newColset;
2623
+ else
2624
+ this.arrayColumns = newColset;
1813
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
1814
2626
  if (ths) {
1815
2627
  // Definisco se la colonna è visibile in base alla sua rappresentazione locale in ColumnsList
@@ -1822,7 +2634,7 @@
1822
2634
  }
1823
2635
  else {
1824
2636
  th.thVisible = th.thFixed || (columnsCache[th.th] ? columnsCache[th.th].visible : th.thVisible);
1825
- if (th.thFixed)
2637
+ if (th.thFixed || th.thGroup)
1826
2638
  fixedThs[th.th] = true;
1827
2639
  }
1828
2640
  }
@@ -1839,18 +2651,6 @@
1839
2651
  }
1840
2652
  this.changed();
1841
2653
  };
1842
- /**
1843
- *
1844
- */
1845
- EsTableComponent.prototype.isEsTd = function (td) {
1846
- return !td._directive;
1847
- };
1848
- /**
1849
- *
1850
- */
1851
- EsTableComponent.prototype.isEsTh = function (th) {
1852
- return !th._directive;
1853
- };
1854
2654
  /**
1855
2655
  * Allinea gli ordinamenti dati fra le **EsThs** e le informazioni all'interno della View bindata
1856
2656
  *
@@ -1858,30 +2658,28 @@
1858
2658
  * @param {EsTh[] | EsThDirective[]} ths Colonne della tabella
1859
2659
  */
1860
2660
  EsTableComponent.prototype.alignHeadersOrdering = function (ths, view) {
1861
- var researchNeeded = false;
2661
+ var orders = view ? view.orders : this.arrayOrders;
1862
2662
  for (var i = 0; i < ths.length; i++) {
1863
2663
  var th = ths[i];
1864
2664
  if (this.isEsTh(th)) {
1865
2665
  th.Order = null;
1866
2666
  // Assegno tutti gli ordinamenti che mi vengono da AppSearch. Sono i più importanti. Non faccio cache o cose strano perché tanto questa
1867
2667
  // variabile sarà sempre massimo 3 elementi
1868
- for (var i_1 = 0; i_1 < view.orders.length; i_1++) {
1869
- var or = view.orders[i_1];
2668
+ for (var i_1 = 0; i_1 < orders.length; i_1++) {
2669
+ var or = orders[i_1];
1870
2670
  if (or.id == th.ID)
1871
2671
  th.Order = or.order;
1872
2672
  }
1873
2673
  }
1874
2674
  else {
1875
2675
  th.thOrder = null;
1876
- for (var i_2 = 0; i_2 < view.orders.length; i_2++) {
1877
- var or = view.orders[i_2];
2676
+ for (var i_2 = 0; i_2 < orders.length; i_2++) {
2677
+ var or = orders[i_2];
1878
2678
  if (or.id == th.th)
1879
2679
  th.thOrder = or.order;
1880
2680
  }
1881
2681
  }
1882
2682
  }
1883
- if (researchNeeded)
1884
- this.emitSearchRequest(false);
1885
2683
  };
1886
2684
  /**
1887
2685
  * Partendo dagli **EsTds** bindati genera, all'interno del dizionario **TMPRowTDs** tutti i contesti dei vari oggetti.
@@ -1897,6 +2695,11 @@
1897
2695
  if (tds.length == 0)
1898
2696
  return;
1899
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
+ }
1900
2703
  for (var i = 0; i < ths.length; i++) {
1901
2704
  var th = ths[i];
1902
2705
  thsCache[this.isEsTh(th) ? th.ID : th.th] = th;
@@ -1909,11 +2712,11 @@
1909
2712
  if (this.isEsTd(td)) {
1910
2713
  var th = thsCache[td.ID];
1911
2714
  if (!!th)
1912
- th.Referenced = true;
2715
+ th._referenced = true;
1913
2716
  else
1914
2717
  throw "ID dell'oggeto EsTd non compatibile con gli ID dicharati negli EsTh: " + td.ID;
1915
- var isFixed = (this.isEsTh(th) && th.Fixed) || (!this.isEsTh(th) && th.thFixed);
1916
- 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 };
1917
2720
  var ctx = td.Context;
1918
2721
  if (this.TMPRowTDs[ctx]) {
1919
2722
  if (isFixed)
@@ -1928,22 +2731,27 @@
1928
2731
  }
1929
2732
  }
1930
2733
  else {
1931
- for (var i_3 = 0; i_3 < this.TMPBoundSource.length; i_3++) {
1932
- 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;
1933
2737
  var key = td.td;
1934
2738
  var th = thsCache[td.td];
1935
2739
  if (!!th)
1936
- th.Referenced = true;
2740
+ th._referenced = true;
1937
2741
  else
1938
2742
  throw "ID dell'oggeto EsTd non compatibile con gli ID dicharati negli EsTh: " + td.td;
1939
- if (td.tdIf) {
1940
- var isFixed = (this.isEsTh(th) && th.Fixed) || (!this.isEsTh(th) && th.thFixed);
1941
- 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) };
1942
2749
  if (this.TMPRowTDs[ctx]) {
1943
- if (isFixed)
1944
- this.TMPRowTDs[ctx].splice(0 + (contextFixeds[ctx]++), 0, itemToAdd);
1945
- else
1946
- 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);
1947
2755
  }
1948
2756
  else {
1949
2757
  this.RowContexts.push(ctx);
@@ -1960,7 +2768,7 @@
1960
2768
  var errs = [];
1961
2769
  for (var i = 0; i < ths.length; i++) {
1962
2770
  var th = ths[i];
1963
- if (!th.Referenced)
2771
+ if (!th._referenced)
1964
2772
  errs.push(this.isEsTh(th) ? th.ID : th.th);
1965
2773
  }
1966
2774
  if (errs.length > 0) {
@@ -1978,46 +2786,234 @@
1978
2786
  * @param {EsTh[] | EsThDirective[]} ths Colonne della tabella
1979
2787
  */
1980
2788
  EsTableComponent.prototype.evaluateRowThs = function (ths) {
2789
+ var _s;
1981
2790
  if (ths.length == 0)
1982
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
+ }
1983
2799
  this.TMPRowTHs = [];
1984
2800
  var fixed = 0;
1985
2801
  for (var i = 0; i < ths.length; i++) {
1986
2802
  var th = ths[i];
1987
2803
  var toAdd = void 0;
1988
2804
  if (this.isEsTh(th)) {
1989
- 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 };
1990
2806
  if (th.Fixed)
1991
2807
  this.TMPRowTHs.splice(0 + (fixed++), 0, toAdd);
1992
2808
  else
1993
2809
  this.TMPRowTHs.push(toAdd);
1994
2810
  }
1995
- else if (th.thIf) {
1996
- // 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
1997
- // (Questo probabilmente diventerà il comportamento di default anche per le colonne "Pinned")
1998
- 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 };
1999
- if (th.thFixed)
2000
- this.TMPRowTHs.splice(0 + (fixed++), 0, toAdd);
2001
- else
2002
- 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;
2003
2854
  }
2004
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
+ }
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
+ });
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;
2005
2997
  };
2006
2998
  /**
2007
2999
  * Metodo che genera l'ordine di default delle colonne
2008
3000
  *
2009
3001
  * @param {AppSearch<any>} view AppSearch da utilizzare per questa operazione
2010
3002
  */
2011
- EsTableComponent.prototype.generateDefaultOrder = function (view) {
2012
- if (this.TMPRowTHs.length == 0)
3003
+ EsTableComponent.prototype.generateDefaultOrder = function (ths, view) {
3004
+ if (ths.length == 0)
2013
3005
  return;
3006
+ var orderings = this.viewMode ? view.column_ordering : this.arrayColumnOrdering;
2014
3007
  // Genero ordinamento di default da 0 fino a dove deve arrivare. Situazione attuale senza hotpotato
2015
- if (!view.column_ordering || view.column_ordering.length == 0) {
2016
- for (var i = 0; i < this.TMPRowTHs.length; i++)
2017
- 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
+ }
2018
3014
  }
2019
3015
  else
2020
- this.OrderDirectives = view.column_ordering;
3016
+ this.OrderDirectives = orderings;
2021
3017
  };
2022
3018
  /**
2023
3019
  * Applica l'ordine specificato alle varie colonne
@@ -2026,37 +3022,220 @@
2026
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
2027
3023
  * Senza finalize significa che mi aspetto altre operazioni che prima o poi richiameranno questa funzione col finalize.
2028
3024
  *
2029
- * 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.
2030
- * Mettendo solo la chiamata da "writeValue" come "finalizzante" mi assicuro che smanattamenti a frontend non causino flickering fino a quando non servono
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
+ newHeaders.push(heaedrItem);
3037
+ });
3038
+ this.TMPRowTHs = newHeaders;
3039
+ var _loop_4 = function (i) {
3040
+ var context = this_3.TMPRowTDs[this_3.RowContexts[i]];
3041
+ var newContext = [];
3042
+ this_3.OrderDirectives.forEach(function (o) {
3043
+ var contextItem = context.filter(function (t) { return t.ID == o; })[0];
3044
+ newContext.push(contextItem);
3045
+ });
3046
+ this_3.TMPRowTDs[this_3.RowContexts[i]] = newContext;
3047
+ };
3048
+ var this_3 = this;
3049
+ // Genero ordinamento per le celle
3050
+ for (var i = 0; i < this.RowContexts.length; i++) {
3051
+ _loop_4(i);
3052
+ }
3053
+ }
3054
+ if (this.viewMode)
3055
+ view.column_ordering = this.OrderDirectives;
3056
+ else
3057
+ this.arrayColumnOrdering = this.OrderDirectives;
3058
+ this.changed();
3059
+ };
3060
+ // #endregion
3061
+ // #region Gestione raggruppamenti per riga
3062
+ /**
3063
+ * Ottiene un elemento di separazione fra Gruppi che serve per paginare le ricerche all'interno di ogni singolo gruppo
3064
+ *
3065
+ * @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
3066
+ * facenti riferimento allo stesso contesto
3067
+ * @param {string} parent Parent path che rappresenta a quale gruppo è affibbiato questo separatore
3068
+ * @param {GroupRouteFragment[]} route Route path che rappresenta a quale gruppo è affibbiato questo separatore
3069
+ * @param {number} level Livello del gruppo di cui questo elemento è separatore, viene usato per applicare la classe "est-lvl-{{level}}"
3070
+ *
3071
+ * @returns {any} Elemento di separazione contenente tutti i bind per presentare una paginazione sotto questo gruppo lato interfaccia
3072
+ */
3073
+ EsTableComponent.prototype.getGroupSeparator = function (view, parent, route, level, searches) {
3074
+ var item = new GroupPager(level, route, parent, Object.assign({}, view), searches);
3075
+ item.buttons = this.getPagesArray(6, view.page, view.pages);
3076
+ this.calculateHash([item]);
3077
+ return item;
3078
+ };
3079
+ /**
3080
+ * Sposta la ricerca di una pagina in avanti (o indietro)
3081
+ *
3082
+ * @param {number} page Numero di pagine da aggiungere (o sottrarre, se negativo) alla pagina attuale
3083
+ * @param {any} pager Elemento di separazione su cui è effettuata la ricerca
3084
+ */
3085
+ EsTableComponent.prototype.addToPageGroup = function (page, pager) {
3086
+ this.goToPageGroup(pager.view.page + page, pager);
3087
+ };
3088
+ /**
3089
+ * Sposta la ricerca alla pagina specificata
3090
+ *
3091
+ * @param {number} page Pagina a cui navigare
3092
+ * @param {any} pager Elemento di separazione su cui è effettuata la ricerca
3093
+ */
3094
+ EsTableComponent.prototype.goToPageGroup = function (page, pager) {
3095
+ var appSearchElement = pager.view;
3096
+ if (page === 0 || page > appSearchElement.pages)
3097
+ return;
3098
+ appSearchElement.page = page;
3099
+ pager.buttons = this.getPagesArray(6, appSearchElement.page, appSearchElement.pages);
3100
+ this.emitSearchRequest(false, appSearchElement);
3101
+ };
3102
+ /**
3103
+ * Data una colonna effettua la riemissione di tutte le ricerche relative.
3104
+ *
3105
+ * Es. Ho 2 campi di gruppo e ho espanso fino a vedere i valori fino ad un livello qualsiasi.
3106
+ * Clicco l'ordinamento sul secondo gruppo.
3107
+ * Tutte le ricerche relative ai primi gruppi devono essere rieseguite. Quando i risultati arriveranno ci penserà il metodo **bindDisplayToLoadedItemsOrGroups**
3108
+ * a tagliare via gli oggetti non più visualizzati
3109
+ *
3110
+ * @param {string} column Colonna su cui si è effettuata un'operazione di ordinamento
3111
+ * @param {AppOrdering[]} orderings Direttive di ordinamento da applicare alle varie sottoricerche
3112
+ *
3113
+ * @todo: Testare
3114
+ */
3115
+ EsTableComponent.prototype.emitRowGroupingSearches = function (column, orderings) {
3116
+ var _this = this;
3117
+ // Per tutte le ricerche intermedie che devo rivalutare le re-emitto in modo da aggiornargli i dati
3118
+ var meaningfulAppSearches = this.groupSearchRequestsCache.filter(function (t) { return t.group_column == column; }).map(function (t) { return t.view; });
3119
+ // Se non ne trovo significa che ho fatto l'ordinamento o sugli item, o su colonne relative a un sottogruppo non caricato
3120
+ if (!meaningfulAppSearches || meaningfulAppSearches.length == 0)
3121
+ meaningfulAppSearches = this.groupSearchRequestsCache.filter(function (t) { return !t.group_column; }).map(function (t) { return t.view; });
3122
+ // Se non ne trovo qui significa che sto ordinando su colonne relative a un sottogruppo non caricato
3123
+ if (!meaningfulAppSearches || meaningfulAppSearches.length == 0)
3124
+ return;
3125
+ meaningfulAppSearches.forEach(function (as) {
3126
+ // Ovviamente gli oridnamenti devono essere quelli appena generati
3127
+ as.orders = orderings;
3128
+ as.savedstate = true;
3129
+ _this.emitSearchRequest(false, as);
3130
+ });
3131
+ };
3132
+ /**
3133
+ * Helper che calcola il contenuto di una cella relativa a un gruppo riga, tenendo conto del formato delle eventuali aggregazioni
3134
+ *
3135
+ * @param {Group} grp Gruppo di cui mostrare le celle
3136
+ * @param {string} cell Cella attuale di cui calcolare il testo
3137
+ * @param {EsThDirective} header Header relativo alla cella attuale, utilizzata per identificare le informazioni di aggregazione
3138
+ *
3139
+ * @returns {string} Testo finale calcolato per la **cell** corrente, in base alle aggregazioni di **header**
3140
+ */
3141
+ EsTableComponent.prototype.getGroupCellDisplay = function (grp, cell, header) {
3142
+ var _this = this;
3143
+ if (grp._sep)
3144
+ return "";
3145
+ var display = header.thAggregation;
3146
+ if (grp.column == cell) {
3147
+ var groupsPart = grp._groupscount ? " - " + grp._groupscount + " " + this.lc.loc("Groups") : "";
3148
+ return grp.value + " (" + grp.count + groupsPart + ")";
3149
+ }
3150
+ else {
3151
+ var agg_1 = grp._aggregationsCache.get(cell);
3152
+ if (!agg_1)
3153
+ return "";
3154
+ this.getEsThDirectiveListOfAggregations(header).forEach(function (itm) {
3155
+ display = display.replace(itm.match, _this.formatAggregationValue(agg_1.get(itm.func), itm.format));
3156
+ });
3157
+ return display;
3158
+ }
3159
+ };
3160
+ /**
3161
+ * Gestisce i click sulla tabella solo per le righe a gruppo.
3162
+ * O rimuove gli elementi attualmente presenti o carica il contenuto del gruppo
3163
+ *
3164
+ * @param {any} group Gruppo bindato su cui si è effettuato il click
3165
+ *
3166
+ * @returns {boolean} **true** se l'operaizone è andata a buon fine, **false** altrimenti
3167
+ */
3168
+ EsTableComponent.prototype.handleGroupClick = function (group) {
3169
+ var casted = this.View;
3170
+ var anyG = group;
3171
+ anyG._expanded = !anyG._expanded;
3172
+ // Sono in modalità raggruppamento virtuale da array: Espandere significa rendere visibili tutti gli oggetti relativi a questo gruppo, viceversa il contrarre
3173
+ if (this.ArrayGrouping) {
3174
+ 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)))) ||
3175
+ (t._item && ((anyG._expanded && t._thisKey == anyG._thisKey) || (!anyG._expanded && t._thisKey.startsWith(anyG._thisKey)))); });
3176
+ allRelatives.forEach(function (t) {
3177
+ t._visible = anyG._expanded;
3178
+ if (t._group)
3179
+ t._expanded = false;
3180
+ });
3181
+ return;
3182
+ }
3183
+ if (anyG._expanded) {
3184
+ // Resetto ipp
3185
+ casted.itemsperpageoverride = 15;
3186
+ if (!casted.requestedgroups)
3187
+ casted.requestedgroups = [new GroupFilter(group.column, group.value)];
3188
+ else {
3189
+ var level = anyG._grouplevel;
3190
+ // se il gruppo cliccato non ha un livello è il primo gruppo, quindi ordinamento unico
3191
+ // altrimenti devo rimuovere tutti i filtri su livelli superiori al level cliccato e aggiungere il level cliccato
3192
+ if (!level)
3193
+ casted.requestedgroups = [new GroupFilter(group.column, group.value)];
3194
+ else {
3195
+ casted.requestedgroups = [];
3196
+ anyG._parentRoute.forEach(function (step) {
3197
+ casted.requestedgroups.push(new GroupFilter(step.column, step.value));
3198
+ });
3199
+ casted.requestedgroups.push(new GroupFilter(group.column, group.value));
3200
+ }
3201
+ }
3202
+ this.changed();
3203
+ this.emitSearchRequest(true);
3204
+ }
3205
+ else {
3206
+ var path_1 = (anyG._parent || '') + group.value;
3207
+ // Se ho chiuso un gruppo non mi serve rieffettuare ricerce, mi basta eliminare dagli oggetti bindati tutti gli elementi sottostanti a quel gruppo
3208
+ this.boundSource = this.boundSource.filter(function (t) { return !t._parent || !t._parent.startsWith(path_1); });
3209
+ // devo però anche rimuovere eventuali cache relative
3210
+ this.groupSearchRequestsCache = this.groupSearchRequestsCache.filter(function (t) { return t.path != path_1; });
3211
+ }
3212
+ return true;
3213
+ };
3214
+ /**
3215
+ * Funzione che dato un valore lo formatta in base al tipo
3216
+ *
3217
+ * @param {string} value Valore che generalemnte può essere una data o un numero
3218
+ * @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
3219
+ *
3220
+ * @returns {string} Valore dell'aggregazione formattato come si deve
2031
3221
  */
2032
- EsTableComponent.prototype.applyOrdering = function (view, finalize) {
2033
- var _this = this;
2034
- // Genero ordinamento per gli header
2035
- var newHeaders = [];
2036
- // Se devo finalizzare aggancio tutte le variabili di bind
2037
- if (finalize) {
2038
- this.OrderDirectives.forEach(function (o) {
2039
- var heaedrItem = _this.TMPRowTHs.filter(function (t) { return t.ID == o; })[0];
2040
- newHeaders.push(heaedrItem);
2041
- });
2042
- this.TMPRowTHs = newHeaders;
2043
- var _loop_1 = function (i) {
2044
- var context = this_1.TMPRowTDs[this_1.RowContexts[i]];
2045
- var newContext = [];
2046
- this_1.OrderDirectives.forEach(function (o) {
2047
- var contextItem = context.filter(function (t) { return t.ID == o; })[0];
2048
- newContext.push(contextItem);
2049
- });
2050
- this_1.TMPRowTDs[this_1.RowContexts[i]] = newContext;
2051
- };
2052
- var this_1 = this;
2053
- // Genero ordinamento per le celle
2054
- for (var i = 0; i < this.RowContexts.length; i++) {
2055
- _loop_1(i);
2056
- }
3222
+ EsTableComponent.prototype.formatAggregationValue = function (value, format) {
3223
+ if (!format)
3224
+ return value;
3225
+ var isNumber = !Number.isNaN(value) && (!format || format.startsWith("F"));
3226
+ if (isNumber && format.startsWith("F") && !Number.isNaN(format.substr(1)))
3227
+ return parseFloat(value).toFixed(parseInt(format.substr(1)));
3228
+ var date = null;
3229
+ // Alcune versione di extensions rischiano di crashare con cose non date... è stato risolto dopo quindi questo try - catch in realtà
3230
+ // torna utile solo con versioni vecchie/deprecate della libreria @esfaenza/extensions
3231
+ try {
3232
+ date = this.dateExts.getDateConvertion(value);
2057
3233
  }
2058
- view.column_ordering = this.OrderDirectives;
2059
- this.changed();
3234
+ catch (_a) { }
3235
+ if (date)
3236
+ return this.dateExts.getFormatted(date, format == 'small', format == 'verylong');
3237
+ // Qui ci finisco sia per input che non sono né date né numeri, sia per formati non riconosciuti
3238
+ return value;
2060
3239
  };
2061
3240
  // #endregion
2062
3241
  // #region Gestione Operaizoni dialog ordinamento/visibilità colonne
@@ -2067,7 +3246,7 @@
2067
3246
  */
2068
3247
  EsTableComponent.prototype.sendUp = function (columnItem) {
2069
3248
  var itemIndex = this.TMPColumnsList.indexOf(columnItem);
2070
- if (this.TMPColumnsList[itemIndex - 1].fixed)
3249
+ if (this.TMPColumnsList[itemIndex - 1].fixed || this.TMPColumnsList[itemIndex - 1].pinned)
2071
3250
  return;
2072
3251
  this.utiExts.swap(this.TMPColumnsList, itemIndex, itemIndex - 1);
2073
3252
  // Non posso fare JSON.parse(JSON.stringify(this.ColumnsList)) perché contiene riferimenti a TemplateRef
@@ -2088,6 +3267,25 @@
2088
3267
  this.TMPColumnsList.forEach(function (c) { tmp.push(Object.assign({}, c)); });
2089
3268
  this.TMPColumnsList = tmp;
2090
3269
  };
3270
+ /**
3271
+ * All'interno della dialog "Ordinamento e Visibilità Colonne" pinna la colonna specificata
3272
+ *
3273
+ * @param {EsTableColumn} columnItem Colonna da spostare
3274
+ */
3275
+ EsTableComponent.prototype.pinOrUnpinColumn = function (columnItem) {
3276
+ var itemIndex = this.TMPColumnsList.indexOf(columnItem);
3277
+ // Sposto la colonna alla fine di tutte quelle pinnate. La cosa funziona in entrambi sensi:
3278
+ // 1) Se sto pinnando, devo metterla come ultima pinnata
3279
+ // 2) Se sto spinnando devo metterla come prima non pinnata
3280
+ // Coincidenza vuole che il punto 1 e 2 siano equivalenti
3281
+ for (var i = 0; i < this.TMPColumnsList.length; i++) {
3282
+ if (!this.TMPColumnsList[i].pinned) {
3283
+ this.arrayMove(this.TMPColumnsList, itemIndex, i);
3284
+ break;
3285
+ }
3286
+ }
3287
+ columnItem.pinned = !columnItem.pinned;
3288
+ };
2091
3289
  /**
2092
3290
  * All'interno della dialog "Ordinamento e Visibilità Colonne" inverte le impostazioni di visibilità della colonna
2093
3291
  *
@@ -2148,12 +3346,12 @@
2148
3346
  // Non permetto di non selezionare nulla
2149
3347
  if (this.TMPColumnsList.every(function (t) { return !t.visible; }))
2150
3348
  return false;
2151
- var castedView = this.View;
3349
+ var castedView = this.viewMode ? this.View : null;
2152
3350
  this.ColumnsList = [];
2153
3351
  this.TMPColumnsList.forEach(function (c) { _this.ColumnsList.push(Object.assign({}, c)); });
2154
3352
  this.refreshColumnOrdering();
2155
- this.refreshColumnsVisibility(null, null, castedView);
2156
3353
  this.applyOrdering(castedView, false);
3354
+ this.refreshColumnsVisibility(null, null, castedView);
2157
3355
  //Salvo le preferences di questa view
2158
3356
  //Di default registro ordinamento e visibilità delle colonne nella vista. Solo le cose di UI
2159
3357
  if (this.SavePreferences) {
@@ -2165,11 +3363,17 @@
2165
3363
  console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
2166
3364
  return false;
2167
3365
  }
2168
- var toStore = { columns: JSON.parse(JSON.stringify(castedView.columns)), column_ordering: JSON.parse(JSON.stringify(castedView.column_ordering)) };
3366
+ var columns = this.arrayMode ? this.arrayColumns : castedView.columns;
3367
+ var columnsOrderings = this.arrayMode ? this.arrayColumnOrdering : castedView.column_ordering;
3368
+ var toStore = { columns: JSON.parse(JSON.stringify(columns)), column_ordering: JSON.parse(JSON.stringify(columnsOrderings)) };
2169
3369
  this.prefService.store(this.ngControl.name, toStore);
2170
3370
  }
3371
+ // Rieseguo l'ultima ricerca bindata alla tabella
2171
3372
  // Mi assicuro di farlo dopo l'espansione del changed o rischio che la ricerca mi ridia colonne che in realtà non esistono
2172
- setTimeout(function () { _this.emitSearchRequest(false); });
3373
+ if (this.viewMode)
3374
+ setTimeout(function () { _this.emitSearchRequest(false); });
3375
+ else if (this.arrayMode)
3376
+ setTimeout(function () { _this.internalWriteValue(); });
2173
3377
  // Lo vorrei mettere lato template ma no
2174
3378
  this.lastSelectedItemID = null;
2175
3379
  return true;
@@ -2179,7 +3383,10 @@
2179
3383
  */
2180
3384
  EsTableComponent.prototype.globalColVisCheckChanged = function () {
2181
3385
  var _this = this;
2182
- this.TMPColumnsList.forEach(function (t) { t.visible = _this.globalColVisCheck; });
3386
+ this.TMPColumnsList.forEach(function (t) {
3387
+ if (!t.fixed)
3388
+ t.visible = _this.globalColVisCheck;
3389
+ });
2183
3390
  };
2184
3391
  // #endregion
2185
3392
  // #region Gestione data source gerarchici
@@ -2227,9 +3434,9 @@
2227
3434
  var obj = objs[i];
2228
3435
  // Se la parentKey non è valorizzata, questo è il livello 0 (1... perché gli 0 son perciolosi)
2229
3436
  if (!obj[this.ParentKey] && levelToAssign == 1) {
2230
- obj.level = 1;
2231
- obj.visible = true;
2232
- obj.expanded = this.StartsExpanded;
3437
+ obj._level = 1;
3438
+ obj._visible = true;
3439
+ obj._expanded = this.StartsExpanded;
2233
3440
  assigned++;
2234
3441
  continue;
2235
3442
  }
@@ -2239,13 +3446,13 @@
2239
3446
  for (var p = 0; p < objs.length; p++) {
2240
3447
  var possibleParent = objs[p];
2241
3448
  // Trovato il parent dell'item, assegno all'item il livello giusto
2242
- if (possibleParent[this.OwnKey] == obj[this.ParentKey] && possibleParent.level == levelToAssign - 1) {
2243
- obj.level = levelToAssign;
3449
+ if (possibleParent[this.OwnKey] == obj[this.ParentKey] && possibleParent._level == levelToAssign - 1) {
3450
+ obj._level = levelToAssign;
2244
3451
  // So che questo item ha un parent. Ribadisco che il parent è espanso in base alle impostazione e stessa logica
2245
3452
  // per la visibilità del figlio
2246
- possibleParent.expanded = this.StartsExpanded;
3453
+ possibleParent._expanded = this.StartsExpanded;
2247
3454
  possibleParent.parent = true;
2248
- obj.visible = this.StartsExpanded;
3455
+ obj._visible = this.StartsExpanded;
2249
3456
  assigned++;
2250
3457
  break;
2251
3458
  }
@@ -2264,12 +3471,12 @@
2264
3471
  var obj = this.boundSource[i];
2265
3472
  // Trovo il parent con quell'id e lo espando
2266
3473
  if (obj[this.OwnKey] == key) {
2267
- obj.expanded = true;
3474
+ obj._expanded = true;
2268
3475
  for (var ic = 0; ic < this.boundSource.length; ic++) {
2269
3476
  var child = this.boundSource[ic];
2270
3477
  // Trovo tutti i child di quel parent e li rendo visibili
2271
3478
  if (child[this.ParentKey] == key)
2272
- child.visible = true;
3479
+ child._visible = true;
2273
3480
  }
2274
3481
  return;
2275
3482
  }
@@ -2285,7 +3492,7 @@
2285
3492
  var obj = this.boundSource[i];
2286
3493
  // Trovo il parent con quell'id e lo collasso
2287
3494
  if (obj[this.OwnKey] == key) {
2288
- obj.expanded = false;
3495
+ obj._expanded = false;
2289
3496
  // Collasso/nascondo tutti i child del parent
2290
3497
  this.collapseChildOfParent(key);
2291
3498
  return;
@@ -2303,16 +3510,115 @@
2303
3510
  // Trovo tutti i child di quel parent e li rendo invisibili. Se il child trovato è a sua volta un parent,
2304
3511
  // lo collasso e vado in ricorsione sui figli
2305
3512
  if (child[this.ParentKey] == parentKey && !child.parent)
2306
- child.visible = false;
3513
+ child._visible = false;
2307
3514
  else if (child[this.ParentKey] == parentKey && child.parent) {
2308
- child.expanded = false;
2309
- child.visible = false;
3515
+ child._expanded = false;
3516
+ child._visible = false;
2310
3517
  this.collapseChildOfParent(child[this.OwnKey]);
2311
3518
  }
2312
3519
  }
2313
3520
  };
2314
3521
  // #endregion
2315
3522
  // #region Gestione Selezione
3523
+ /**
3524
+ * Valuta quali elementi devono essere marcati come selezionati nella vista attuale. Si basa sull'oggetto **selection** interno all'AppSearch
3525
+ *
3526
+ * @param {any[]} items Oggetti di cui valutare la selezione
3527
+ * @param {ItemsSelection<any>} selectionItem Oggetti di selezione derivante dalla view o dall'oggetto per Array
3528
+ */
3529
+ EsTableComponent.prototype.evaluateSelection = function (items, selectionItem) {
3530
+ if (!selectionItem)
3531
+ return;
3532
+ this.handleSelectionEvaluation(items, selectionItem);
3533
+ };
3534
+ /**
3535
+ * Valuta quali elementi devono essere marcati come selezionati nella vista attuale. Si basa sull'oggetto **arraymodeSelection** dell'es-table
3536
+ *
3537
+ * @param {any[]} array Lista di oggetti di cui valutare la selezione in modalità array
3538
+ */
3539
+ EsTableComponent.prototype.arrayModeEvaluateSelection = function (array) {
3540
+ if (array.length == 0)
3541
+ return;
3542
+ this.handleSelectionEvaluation(array, this.arraymodeSelection);
3543
+ };
3544
+ /**
3545
+ * Implementazione agnostica della valutazione delle selezioni degli oggetti. Richiede gli oggetti della vista attuale e l'itemSelector
3546
+ *
3547
+ * @param {any[]} items Oggetti di cui aggiornare lo stato di selezione
3548
+ * @param {ItemsSelection<any>} selectionItem Oggetto contenente lo stato attuale di selezione
3549
+ */
3550
+ EsTableComponent.prototype.handleSelectionEvaluation = function (items, selectionItem) {
3551
+ for (var i = 0; i < items.length; i++) {
3552
+ var itm = items[i];
3553
+ var hash = itm._hash;
3554
+ var itemGroup = itm._group ? null : this.getItemGroup(itm);
3555
+ // Reidrato la cache di selezione coi nuovi oggetti altrimenti non riuscirei a beccare gli indici giusti
3556
+ // Dopodiché la uso per calcolare istantaneamente se gli oggetti sono selezionati o no
3557
+ this.rehidrateCache(itm);
3558
+ if (itm._item) {
3559
+ if (selectionItem.all)
3560
+ 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));
3561
+ else
3562
+ 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)));
3563
+ }
3564
+ else if (itm._group) {
3565
+ if (selectionItem.all)
3566
+ itm._selected = !this.group_exclusionsCache.has(hash) && this.parentTreeStatus(itm) != 'excluded';
3567
+ else
3568
+ itm._selected = this.groupsCache.has(hash) || (this.parentTreeStatus(itm) == 'included' && !this.group_exclusionsCache.has(hash));
3569
+ }
3570
+ }
3571
+ // Se tutti gli oggetti di questa pagina sono solezionati allora posso mettere il global check a true
3572
+ // Se sono in situazione di all-select anche metto la global checkbox, nonostante ci possano essere delle esclusioni
3573
+ this.globalCheck = this.boundSource.filter(function (t) { return t._group || t._item; }).every(function (t) { return t._selected; });
3574
+ this.canSelectAll = selectionItem.count > 0 && this.SelectAll;
3575
+ // Potrebbe cambiare qualora qualcuno inserisse dati a manazza in modalità Array e desse il refresh manuale alla tabella
3576
+ // Comunque costa 0 quindi mi permetto di refreshare
3577
+ if (this.arrayMode) {
3578
+ var prevSelected = this.selectedObjects;
3579
+ this.finalizeSelectionInformations(selectionItem);
3580
+ if (this.selectedObjects != prevSelected)
3581
+ this.onSelectionChanged.emit(selectionItem);
3582
+ }
3583
+ };
3584
+ /**
3585
+ * Dato un oggetto trova la cella di cache in cui è registrato e aggiorna il contenuto
3586
+ *
3587
+ * @param {any} item Oggetto da aggiornare
3588
+ */
3589
+ EsTableComponent.prototype.rehidrateCache = function (item) {
3590
+ var ctx = item._hash;
3591
+ if (this.itemsCache.has(ctx))
3592
+ this.itemsCache.set(ctx, item);
3593
+ if (this.group_exclusionsCache.has(ctx))
3594
+ this.group_exclusionsCache.set(ctx, item);
3595
+ if (this.groupsCache.has(ctx))
3596
+ this.groupsCache.set(ctx, item);
3597
+ if (this.exclusionsCache.has(ctx))
3598
+ this.exclusionsCache.set(ctx, item);
3599
+ };
3600
+ /**
3601
+ * Dato un gruppo controlla ricorsivamente l'albero di cui fa parte se c'è stata una inclusione o esclusione diretta
3602
+ *
3603
+ * @param {any} grp Gruppo da controllare
3604
+ *
3605
+ * @returns {'none' | 'excluded' | 'included'}
3606
+ * 'none' se non ci sono informazioni su inclusioni o esclusioni
3607
+ * 'included' se il gruppo controllato è stato incluso in maniera esplicita dall'albero dei gruppi padri
3608
+ * 'excluded' se il gruppo controllato è stato escluso in maniera esplicita dall'albero dei gruppi padri
3609
+ */
3610
+ EsTableComponent.prototype.parentTreeStatus = function (grp) {
3611
+ if (!grp)
3612
+ return 'none';
3613
+ var parentGroup = this.rgGroupCache.get(grp._parent);
3614
+ if (!parentGroup)
3615
+ return 'none';
3616
+ if (this.group_exclusionsCache.has(parentGroup._hash))
3617
+ return 'excluded';
3618
+ if (this.groupsCache.has(parentGroup._hash))
3619
+ return 'included';
3620
+ return this.parentTreeStatus(parentGroup);
3621
+ };
2316
3622
  /**
2317
3623
  * Gestisce la selezione globale degli oggetti, sia per pagina che a livello di **SelectAll**
2318
3624
  *
@@ -2320,7 +3626,8 @@
2320
3626
  */
2321
3627
  EsTableComponent.prototype.globalCheckChanged = function (forcedVal) {
2322
3628
  if (forcedVal === void 0) { forcedVal = null; }
2323
- var items = this.getItemsByMode();
3629
+ // 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
3630
+ var items = this.boundSource.find(function (t) { return t._group; }) ? this.boundSource.filter(function (t) { return t._group && !t._parent; }) : this.boundSource;
2324
3631
  var itemSelection = this.handleItemsSelection(items, forcedVal, this.globalCheck);
2325
3632
  this.changed();
2326
3633
  this.onSelectionChanged.emit(itemSelection);
@@ -2332,20 +3639,21 @@
2332
3639
  *
2333
3640
  * @param {any[]} items Oggetti da selezionare o deselezionare
2334
3641
  * @param {boolean} forcedVal Valore forzato di check da assegnare agli oggetti
3642
+ * @param {boolean} globalCheck Valore del check globale
2335
3643
  *
2336
3644
  * @returns {ItemsSelection<any>} Oggetto di selezione aggiornato con le informazioni sull'ultima operazione effettuata
2337
3645
  */
2338
3646
  EsTableComponent.prototype.handleItemsSelection = function (items, forcedVal, globalCheck) {
2339
3647
  if (forcedVal === void 0) { forcedVal = null; }
2340
3648
  if (globalCheck === void 0) { globalCheck = null; }
2341
- var _a, _b;
2342
- var selectionItem = ((_a = this.View) === null || _a === void 0 ? void 0 : _a.selection) || this.arraymodeSelection;
3649
+ var _a, _b, _c;
3650
+ var si = ((_a = this.View) === null || _a === void 0 ? void 0 : _a.selection) || this.arraymodeSelection;
2343
3651
  // Se sono in modalità di selezione singola e devo selezionare un'oggetto, per prima cosa devo deselezionare tutti gli altri
2344
- if (this.SingleSelection && ((_b = items[0]) === null || _b === void 0 ? void 0 : _b._selected)) {
3652
+ 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)) {
2345
3653
  if (items.length > 1 && forcedVal == null)
2346
3654
  throw "Tentativo di selezionare o deselezionare più di un elemento con SingleSelection attivo";
2347
3655
  if (items.length == 1 && forcedVal == null) {
2348
- selectionItem = this.handleItemsSelection(this.getItemsByMode(), false, null);
3656
+ si = this.handleItemsSelection(this.boundSource.filter(function (t) { return !t._group; }), false, null);
2349
3657
  items[0]._selected = true;
2350
3658
  }
2351
3659
  }
@@ -2355,59 +3663,385 @@
2355
3663
  // Se dev'essere overridato il valore di check effettuo l'override o col valore forzato o col valore globale
2356
3664
  if (toChange && !item.locked)
2357
3665
  item._selected = forcedVal != null ? forcedVal : this.globalCheck;
2358
- if (selectionItem.all) {
2359
- // In caso di "seleziona tutto"...
2360
- // N.B: la selOrDeselCache agisce come cache di DESELEZIONE in questo blocco di codice
2361
- if (item._selected && this.selOrDeselCache[item.hash]) {
2362
- // Oggetto selezionato: lo rimuovo dalle esclusioni di selezione
2363
- selectionItem.exclusions.splice(selectionItem.exclusions.indexOf(this.selOrDeselCache[item.hash]), 1);
2364
- delete this.selOrDeselCache[item.hash];
2365
- }
2366
- else if (!item._selected && !this.selOrDeselCache[item.hash]) {
2367
- // Oggetto deselezionato: lo aggiungo alle esclusioni di selezione
2368
- this.selOrDeselCache[item.hash] = item;
2369
- selectionItem.exclusions.push(item);
2370
- }
3666
+ // 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
3667
+ if (!toChange && globalCheck != null)
3668
+ continue;
3669
+ var allSelection = si.all;
3670
+ var isGroup = item._group;
3671
+ var isSelection = item._selected;
3672
+ var itemGroup = null, allItems = null, selectedItems = null, unselectedItems = null, allGroups = null, selectedGroups = null, unselectedGroups = null, parentGroupSelected = null, parentGroupUnselected = null;
3673
+ if (isGroup) {
3674
+ var pts = this.parentTreeStatus(item);
3675
+ parentGroupSelected = pts == 'included';
3676
+ parentGroupUnselected = pts == 'excluded';
3677
+ allItems = this.getGroupItems(si, item, null, true);
3678
+ selectedItems = this.getGroupItems(si, item, 'selected', true, allItems);
3679
+ unselectedItems = this.getGroupItems(si, item, 'unselected', true, allItems);
3680
+ allGroups = this.getGroupChildGroups(si, item, null, true);
3681
+ selectedGroups = this.getGroupChildGroups(si, item, 'selected', true, allGroups);
3682
+ unselectedGroups = this.getGroupChildGroups(si, item, 'unselected', true, allGroups);
2371
3683
  }
2372
3684
  else {
2373
- //In caso di non "seleziona tutto"...
2374
- // N.B: la selOrDeselCache agisce come cache di SELEZIONE in questo blocco di codice
2375
- if (item._selected && !this.selOrDeselCache[item.hash]) {
2376
- // Oggetto selezionato: lo aggiungo alla selezione attuale
2377
- this.selOrDeselCache[item.hash] = item;
2378
- selectionItem.items.push(item);
2379
- }
2380
- else if (!item._selected && this.selOrDeselCache[item.hash]) {
2381
- // Oggetto deselezionato: lo rimuovo dalla selezione attuale
2382
- selectionItem.items.splice(selectionItem.items.indexOf(this.selOrDeselCache[item.hash]), 1);
2383
- delete this.selOrDeselCache[item.hash];
2384
- }
3685
+ itemGroup = this.getItemGroup(item);
3686
+ parentGroupSelected = itemGroup == null ? null : itemGroup._selected;
3687
+ parentGroupUnselected = itemGroup == null ? null : !itemGroup._selected;
2385
3688
  }
3689
+ if (!this.ArrayGrouping)
3690
+ this.performSelectionOperations(si, item, allSelection, isGroup, isSelection, selectedItems, selectedGroups, unselectedItems, unselectedGroups, allItems, allGroups, parentGroupSelected, parentGroupUnselected);
3691
+ else
3692
+ this.performSimpleSelectionOperations(si, item, isGroup, isSelection, itemGroup, selectedItems, unselectedItems, allItems, allGroups);
2386
3693
  }
2387
3694
  // Imposto il check globale in base a se tutti gli elementi sono selezionati o meno.
2388
3695
  // Evito di fare queste operazioni se la selezione deriva proprio dal global Check
2389
- // Non è ottimizzatissimo mettere 2 some ma scrivere questo codice a for sono tipo 25 righe....
2390
3696
  if (globalCheck == null)
2391
- this.globalCheck = !items.some(function (t) { return !t._selected; }) && !this.getItemsByMode().some(function (t) { return !t._selected; });
2392
- this.finalizeSelectionInformations(selectionItem);
2393
- return selectionItem;
3697
+ this.globalCheck = !this.boundSource.some(function (t) { return !t._selected && !t._sep; });
3698
+ this.finalizeSelectionInformations(si);
3699
+ return si;
3700
+ };
3701
+ /**
3702
+ * Dato L'oggetto di selezione, l'oggetto da selezionare/deselezionare e tutti i parametri del caso effettua le operazioni che servono.
3703
+ *
3704
+ * Logica semplificata rispetto all'originale **performSelectionOperations** per lavorare in una modalità in cui tutti gli elementi sono caricati (**ArrayGrouping** = true)
3705
+ */
3706
+ EsTableComponent.prototype.performSimpleSelectionOperations = function (base, item, group, sel, itm_group, sel_itm, desel_itm, all_itms, all_grps) {
3707
+ var _this = this;
3708
+ var tripticItem = this.getTriptic('item', base);
3709
+ if (group) {
3710
+ if (sel) {
3711
+ all_grps.forEach(function (gr) { gr._selected = true; });
3712
+ if (desel_itm)
3713
+ desel_itm.forEach(function (el) { el._selected = true; _this.addItem(el, tripticItem); });
3714
+ }
3715
+ else {
3716
+ all_grps.forEach(function (gr) { gr._selected = false; });
3717
+ if (sel_itm)
3718
+ sel_itm.forEach(function (el) { el._selected = false; _this.removeItem(el, tripticItem); });
3719
+ }
3720
+ }
3721
+ else {
3722
+ if (sel) {
3723
+ this.addItem(item, tripticItem);
3724
+ if (itm_group && all_itms && all_itms.every(function (t) { return t._selected; }))
3725
+ this.selectGroup(itm_group);
3726
+ }
3727
+ else {
3728
+ this.removeItem(item, tripticItem);
3729
+ if (itm_group)
3730
+ itm_group._selected = false;
3731
+ }
3732
+ }
3733
+ };
3734
+ /**
3735
+ * Helper per selezionare un gruppo e, ricorsivamente, se tutti i gruppi sottostanti al parent sono selezionati, selezionare i gruppi padri
3736
+ *
3737
+ * @param {any} group Gruppo da selezionare
3738
+ */
3739
+ EsTableComponent.prototype.selectGroup = function (group) {
3740
+ group._selected = true;
3741
+ var parent = this.getGroupParent(group);
3742
+ if (parent && this.getGroupChildGroups(null, parent, null, true).every(function (t) { return t._selected; }))
3743
+ this.selectGroup(parent);
3744
+ };
3745
+ /**
3746
+ * Dato L'oggetto di selezione, l'oggetto da selezionare/deselezionare e tutti i parametri del caso effettua le operazioni che servono.
3747
+ *
3748
+ * La logica di questa funzione è nata essenzialmente da spam di trial & error ed è stata testata solo fino a due livelli di raggruppamento,
3749
+ * qualsiasi cosa vada oltre non è 100% detto che funzioni...
3750
+ */
3751
+ 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) {
3752
+ var _this = this;
3753
+ var tripticGroup = this.getTriptic('group', base);
3754
+ var tripticItem = this.getTriptic('item', base);
3755
+ var tripticExcl = this.getTriptic('exclusion', base);
3756
+ var tripticgrpExcl = this.getTriptic('group_exclusion', base);
3757
+ if (group) {
3758
+ if (sel) {
3759
+ if (all || parent_incl)
3760
+ this.removeItem(item, tripticgrpExcl);
3761
+ else
3762
+ this.addItem(item, tripticGroup);
3763
+ if (sel_itm)
3764
+ sel_itm.forEach(function (el) { return _this.removeItem(el, tripticItem); });
3765
+ if (sel_grp)
3766
+ sel_grp.forEach(function (gr) { return _this.removeItem(gr, tripticGroup); });
3767
+ if (all_itms)
3768
+ all_itms.forEach(function (el) { el._selected = true; _this.removeItem(el, tripticExcl); });
3769
+ if (all_grps)
3770
+ all_grps.forEach(function (gr) { gr._selected = true; _this.removeItem(gr, tripticgrpExcl); });
3771
+ }
3772
+ else {
3773
+ if (all || parent_incl)
3774
+ this.addItem(item, tripticgrpExcl);
3775
+ else
3776
+ this.removeItem(item, tripticGroup);
3777
+ if (desel_itm)
3778
+ desel_itm.forEach(function (el) { return _this.removeItem(el, tripticExcl); });
3779
+ if (desel_grp)
3780
+ desel_grp.forEach(function (gr) { return _this.removeItem(gr, tripticExcl); });
3781
+ if (all_itms)
3782
+ all_itms.forEach(function (el) { el._selected = false; _this.removeItem(el, tripticItem); });
3783
+ if (all_grps)
3784
+ all_grps.forEach(function (gr) { gr._selected = false; _this.removeItem(gr, tripticGroup); });
3785
+ }
3786
+ }
3787
+ else {
3788
+ if (sel) {
3789
+ if ((parent_excl == null && all) || parent_incl)
3790
+ this.removeItem(item, tripticExcl);
3791
+ else
3792
+ this.addItem(item, tripticItem);
3793
+ }
3794
+ else {
3795
+ if (parent_excl || (!all && parent_excl == null))
3796
+ this.removeItem(item, tripticItem);
3797
+ else
3798
+ this.addItem(item, tripticExcl);
3799
+ }
3800
+ }
3801
+ };
3802
+ /**
3803
+ * Helper per evitare di riscrivere ogni santa volta array.splice(array.indexof(item), 1);
3804
+ */
3805
+ EsTableComponent.prototype.removeItem = function (item, triptic) {
3806
+ var index = triptic.index_cache.get(item._hash);
3807
+ if (index != null) {
3808
+ triptic.cache.delete(item._hash);
3809
+ triptic.index_cache.delete(item._hash);
3810
+ triptic.array[index] = null;
3811
+ }
3812
+ return !!index;
3813
+ };
3814
+ /**
3815
+ * Helper per evitare di riscrivere ogni santa volta array.push(item); e la gestione della
3816
+ */
3817
+ EsTableComponent.prototype.addItem = function (item, triptic) {
3818
+ if (triptic.index_cache.get(item._hash) == null) {
3819
+ var i = triptic.array.push(item) - 1;
3820
+ triptic.cache.set(item._hash, item);
3821
+ triptic.index_cache.set(item._hash, i);
3822
+ return true;
3823
+ }
3824
+ return false;
3825
+ };
3826
+ /**
3827
+ * Ottiene il trittico di selezione: L'array degli oggetti e le due cache
3828
+ */
3829
+ EsTableComponent.prototype.getTriptic = function (subject, base) {
3830
+ switch (subject) {
3831
+ case 'group':
3832
+ return new CacheTriptic(this.groupsCache, this.i_groupsCache, base.groups);
3833
+ case 'item':
3834
+ return new CacheTriptic(this.itemsCache, this.i_itemsCache, base.items);
3835
+ case 'group_exclusion':
3836
+ return new CacheTriptic(this.group_exclusionsCache, this.i_group_exclusionsCache, base.group_exclusions);
3837
+ case 'exclusion':
3838
+ return new CacheTriptic(this.exclusionsCache, this.i_exclusionsCache, base.exclusions);
3839
+ }
3840
+ };
3841
+ /**
3842
+ * Dato un oggetto restituisce il gruppo di cui fa parte, se esiste
3843
+ *
3844
+ * @param {any} item Oggetto di cui trovare il gruppo
3845
+ */
3846
+ EsTableComponent.prototype.getItemGroup = function (item) {
3847
+ var parent = this.rgGroupCache.get(item._thisKey);
3848
+ if (parent)
3849
+ return parent;
3850
+ return null;
3851
+ };
3852
+ /**
3853
+ * Data la chiave di un gruppo restituisce tutti gli oggetti con quella chiave
3854
+ *
3855
+ * @param {any} group Chiave da cercare
3856
+ * @param {'selected' | 'unselected'} status Stato degli elementi, selezionati o no
3857
+ * @param {boolean} recursive Indica se cercare solo gli elementi direttamente collegati o se prendere anche quelli dei gruppi figli
3858
+ *
3859
+ * @returns {any[]} Oggetti di tipo **_item** facenti capo alla chiave **groupKey**
3860
+ */
3861
+ EsTableComponent.prototype.getGroupItems = function (sel, group, status, recursive, allbase) {
3862
+ var e_3, _s;
3863
+ if (recursive === void 0) { recursive = false; }
3864
+ if (allbase === void 0) { allbase = null; }
3865
+ var items = [];
3866
+ if (allbase)
3867
+ items = allbase;
3868
+ else {
3869
+ if (recursive) {
3870
+ try {
3871
+ // In modalità ricorsiva prendo gli oggetti di tutte le chiavi simili che trovo
3872
+ for (var _t = __values(this.rgItemCache.keys()), _u = _t.next(); !_u.done; _u = _t.next()) {
3873
+ var key = _u.value;
3874
+ if (key.startsWith(group._thisKey))
3875
+ items.push.apply(items, __spread(this.rgItemCache.get(key)));
3876
+ }
3877
+ }
3878
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
3879
+ finally {
3880
+ try {
3881
+ if (_u && !_u.done && (_s = _t.return)) _s.call(_t);
3882
+ }
3883
+ finally { if (e_3) throw e_3.error; }
3884
+ }
3885
+ }
3886
+ else
3887
+ items = this.rgItemCache.get(group._thisKey);
3888
+ }
3889
+ items = items.filter(function (t) { return !status || (t._selected && status == 'selected') || (!t._selected && status == 'unselected'); });
3890
+ // Non trovo nessun oggetto, però magari di oggetti ne ho all'interno dell'oggetto di selezione.
3891
+ // Questo può essere vero solo se NON sono in modalità array, in caso contrario gli oggetti li devo per forza avere tutti
3892
+ if (items.length != 0 || !sel || this.arrayMode)
3893
+ return items;
3894
+ if (status == 'unselected')
3895
+ items = sel.exclusions.filter(function (t) { return t != null &&
3896
+ (!recursive && t._thisKey == group._thisKey) ||
3897
+ (recursive && t._thisKey.startsWith(group._thisKey)); });
3898
+ else if (status == 'selected')
3899
+ items = sel.items.filter(function (t) { return t != null &&
3900
+ (!recursive && t._thisKey == group._thisKey) ||
3901
+ (recursive && t._thisKey.startsWith(group._thisKey)); });
3902
+ return items;
3903
+ };
3904
+ /**
3905
+ * Data la chiave di un gruppo restituisce tutti gli oggetti con quella chiave
3906
+ *
3907
+ * @param {any} group Gruppo di cui cercare il parent
3908
+ *
3909
+ * @returns {any} Oggetto di tipo **_group** rappresentante il parent del **group** attuale
3910
+ */
3911
+ EsTableComponent.prototype.getGroupParent = function (group) {
3912
+ var parent = this.rgGroupCache.get(group._parent);
3913
+ if (parent)
3914
+ return parent;
3915
+ return null;
3916
+ };
3917
+ /**
3918
+ * Data la chiave di un gruppo restituisce tutti i gruppi figli
3919
+ *
3920
+ * @param {string} group Gruppo che rappresenta il padre di cui cercare i figli
3921
+ * @param {'selected' | 'unselected'} status Stato dei gruppi, selezionati o no
3922
+ * @param {boolean} recursive Indica se cercare solo i gruppi direttamente collegati o se prendere anche quelli dei gruppi figli
3923
+ *
3924
+ * @returns {any[]} Oggetti di tipo **_group** facenti capo alla chiave **groupKey**
3925
+ */
3926
+ EsTableComponent.prototype.getGroupChildGroups = function (sel, group, status, recursive, allbase) {
3927
+ var e_4, _s;
3928
+ if (recursive === void 0) { recursive = false; }
3929
+ if (allbase === void 0) { allbase = null; }
3930
+ var thisGroup = this.rgGroupCache.get(group._thisKey);
3931
+ var items = [];
3932
+ if (allbase)
3933
+ items = allbase;
3934
+ else {
3935
+ if (recursive) {
3936
+ try {
3937
+ // In modalità ricorsiva prendo gli oggetti di tutte le chiavi simili che trovo
3938
+ for (var _t = __values(this.rgChildGroupsCache.keys()), _u = _t.next(); !_u.done; _u = _t.next()) {
3939
+ var key = _u.value;
3940
+ if (key.startsWith(group._thisKey))
3941
+ items.push.apply(items, __spread(this.rgChildGroupsCache.get(key)));
3942
+ }
3943
+ }
3944
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
3945
+ finally {
3946
+ try {
3947
+ if (_u && !_u.done && (_s = _t.return)) _s.call(_t);
3948
+ }
3949
+ finally { if (e_4) throw e_4.error; }
3950
+ }
3951
+ }
3952
+ else
3953
+ items = this.rgChildGroupsCache.get(group._thisKey);
3954
+ }
3955
+ items = items.filter(function (t) { return !status || (t._selected && status == 'selected') || (!t._selected && status == 'unselected'); });
3956
+ // Non trovo nessun oggetto, però magari di oggetti ne ho all'interno dell'oggetto di selezione
3957
+ if (items.length != 0 || !sel)
3958
+ return items;
3959
+ if (status == 'unselected')
3960
+ items = sel.group_exclusions.filter(function (t) { return t != null && ((!recursive && t._thisRoute.length == thisGroup._thisRoute.length + 1 && t._thisRoute.startsWith(group._thisKey)) ||
3961
+ (recursive && t._thisKey.startsWith(group._thisKey))); });
3962
+ else
3963
+ items = sel.groups.filter(function (t) { return t != null && ((!recursive && t._thisRoute.length == thisGroup._thisRoute.length + 1 && t._thisRoute.startsWith(group._thisKey)) ||
3964
+ (recursive && t._thisKey.startsWith(group._thisKey))); });
3965
+ return items;
2394
3966
  };
2395
3967
  /**
2396
3968
  * Finalizza le informazioni di selezione del **ItemsSelection** corrente
2397
3969
  */
2398
3970
  EsTableComponent.prototype.finalizeSelectionInformations = function (selectionItem) {
3971
+ // Dato che le delete sono logiche dato che tengo la cache degli indici devo renderle fisiche
3972
+ var tmpGrp = [], tmpItems = [], tmpExcl = [], tmpGrpExcl = [];
3973
+ var grpRemoved = false, itemsRemoved = false, exclRemoved = false, grpExclRemoved = false;
3974
+ for (var i = 0; i < selectionItem.items.length; i++)
3975
+ if (selectionItem.items[i] != null)
3976
+ tmpItems.push(selectionItem.items[i]);
3977
+ else
3978
+ itemsRemoved = true;
3979
+ for (var i = 0; i < selectionItem.groups.length; i++)
3980
+ if (selectionItem.groups[i] != null)
3981
+ tmpGrp.push(selectionItem.groups[i]);
3982
+ else
3983
+ grpRemoved = true;
3984
+ for (var i = 0; i < selectionItem.exclusions.length; i++)
3985
+ if (selectionItem.exclusions[i] != null)
3986
+ tmpExcl.push(selectionItem.exclusions[i]);
3987
+ else
3988
+ exclRemoved = true;
3989
+ for (var i = 0; i < selectionItem.group_exclusions.length; i++)
3990
+ if (selectionItem.group_exclusions[i] != null)
3991
+ tmpGrpExcl.push(selectionItem.group_exclusions[i]);
3992
+ else
3993
+ grpExclRemoved = true;
3994
+ selectionItem.items = tmpItems;
3995
+ selectionItem.group_exclusions = tmpGrpExcl;
3996
+ selectionItem.exclusions = tmpExcl;
3997
+ selectionItem.groups = tmpGrp;
3998
+ // Le cache degli indici potrebbero avere buchi, risolvo
3999
+ if (grpRemoved)
4000
+ this.i_groupsCache = this.compactIndexMap(this.i_groupsCache);
4001
+ if (itemsRemoved)
4002
+ this.i_itemsCache = this.compactIndexMap(this.i_itemsCache);
4003
+ if (exclRemoved)
4004
+ this.i_exclusionsCache = this.compactIndexMap(this.i_exclusionsCache);
4005
+ if (grpExclRemoved)
4006
+ this.i_group_exclusionsCache = this.compactIndexMap(this.i_group_exclusionsCache);
4007
+ // Poi riprendo a fare tutto in normalità
2399
4008
  selectionItem.count = this.evaluateSelected();
2400
4009
  // Se ho fatto selezione "all" ma poi mi sono messo a togliere tutti gli elementi fino a rimanerne 0 resetto l'oggetto di selezione
2401
- if (selectionItem.count == 0 && selectionItem.all) {
4010
+ if (selectionItem.count == 0) {
4011
+ this.boundSource.forEach(function (t) { return t._selected = false; });
2402
4012
  selectionItem.all = false;
2403
4013
  selectionItem.exclusions = [];
2404
4014
  selectionItem.items = [];
4015
+ selectionItem.groups = [];
4016
+ selectionItem.group_exclusions = [];
2405
4017
  // Ripulisco la cache altrimenti mi rimane piena di tutte le esclusioni
2406
- this.selOrDeselCache = {};
4018
+ this.clearSelectionCaches();
2407
4019
  }
2408
4020
  // Se la possibilità di fare "Seleziona tutto" è abilitata allora la considero appena mi viene selezionato qualcosa
2409
4021
  this.canSelectAll = selectionItem.count > 0 && this.SelectAll;
2410
4022
  };
4023
+ /**
4024
+ * Compatta una cache di indici
4025
+ */
4026
+ EsTableComponent.prototype.compactIndexMap = function (map) {
4027
+ var e_5, _s;
4028
+ var index = 0;
4029
+ var ret = new Map();
4030
+ try {
4031
+ for (var _t = __values(map.keys()), _u = _t.next(); !_u.done; _u = _t.next()) {
4032
+ var key = _u.value;
4033
+ ret.set(key, index++);
4034
+ }
4035
+ }
4036
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
4037
+ finally {
4038
+ try {
4039
+ if (_u && !_u.done && (_s = _t.return)) _s.call(_t);
4040
+ }
4041
+ finally { if (e_5) throw e_5.error; }
4042
+ }
4043
+ return ret;
4044
+ };
2411
4045
  /**
2412
4046
  * Gestisce i click sulla tabella, gestendo eventualmente anche gli Shift + Click per selezionare un range di oggetti
2413
4047
  *
@@ -2426,7 +4060,7 @@
2426
4060
  var selecteditems = [];
2427
4061
  if (event.shiftKey && this.ShiftClick && !this.SingleSelection) {
2428
4062
  var startSelecting = false;
2429
- var items = this.getItemsByMode();
4063
+ var items = this.boundSource.filter(function (t) { return !t._group && !t._sep; });
2430
4064
  for (var i = 0; i < items.length; i++) {
2431
4065
  var t = items[i];
2432
4066
  if (startSelecting) {
@@ -2459,8 +4093,10 @@
2459
4093
  */
2460
4094
  EsTableComponent.prototype.evaluateSelected = function () {
2461
4095
  var _a;
2462
- var selectionItem = ((_a = this.View) === null || _a === void 0 ? void 0 : _a.selection) || this.arraymodeSelection;
2463
- this.selectedObjects = selectionItem.all ? (this.View.objectcount || this.View.length) - selectionItem.exclusions.length : selectionItem.items.length;
4096
+ var si = ((_a = this.View) === null || _a === void 0 ? void 0 : _a.selection) || this.arraymodeSelection;
4097
+ var excByGroup = si.group_exclusions.reduce(function (prev, curr) { return prev + curr.count; }, 0);
4098
+ var incByGroup = si.groups.reduce(function (prev, curr) { return prev + curr.count; }, 0);
4099
+ this.selectedObjects = (si.all ? this.BaseItemsCount : incByGroup) - excByGroup + si.items.length - si.exclusions.length;
2464
4100
  return this.selectedObjects;
2465
4101
  };
2466
4102
  /**
@@ -2468,9 +4104,11 @@
2468
4104
  */
2469
4105
  EsTableComponent.prototype.selectAllOrResetSelection = function () {
2470
4106
  var selectionItem = this.View.selection || this.arraymodeSelection;
2471
- this.selOrDeselCache = {};
4107
+ this.clearSelectionCaches();
2472
4108
  selectionItem.all = !selectionItem.all;
2473
4109
  selectionItem.exclusions = [];
4110
+ selectionItem.groups = [];
4111
+ selectionItem.group_exclusions = [];
2474
4112
  selectionItem.items = [];
2475
4113
  // Ripulisco gli stati UI di selezione globale se l'ho disattivata
2476
4114
  if (!selectionItem.all) {
@@ -2480,7 +4118,7 @@
2480
4118
  this.finalizeSelectionInformations(selectionItem);
2481
4119
  this.onSelectionChanged.emit(selectionItem);
2482
4120
  // Dopo aver resettato direttamente il solo oggetto this.View.selection devo anche riallineare a tutti gli oggetti bindati
2483
- this.evaluateSelection(this.viewMode ? this.View.items : this.View, selectionItem);
4121
+ this.evaluateSelection(this.boundSource, selectionItem);
2484
4122
  };
2485
4123
  // #endregion
2486
4124
  // #region Gestione Paginazione
@@ -2490,9 +4128,9 @@
2490
4128
  * @param {number} page Numero di pagine da aggiungere (o sottrarre, se negativo) alla pagina attuale
2491
4129
  */
2492
4130
  EsTableComponent.prototype.addToPage = function (page) {
2493
- if (!(this.View instanceof AppSearch) && !(this.SearchView instanceof AppSearch) && !(this.View instanceof ReportDefinition))
2494
- return;
2495
- this.goToPage((this.SearchView || this.View).page + page);
4131
+ var _a;
4132
+ var view = this.MainGroupView ? this.MainGroupView : this.View;
4133
+ this.goToPage((((_a = (this.SearchView || view)) === null || _a === void 0 ? void 0 : _a.page) || 0) + page);
2496
4134
  };
2497
4135
  /**
2498
4136
  * Sposta la ricerca alla pagina specificata
@@ -2500,21 +4138,35 @@
2500
4138
  * @param {number} page Pagina a cui navigare
2501
4139
  */
2502
4140
  EsTableComponent.prototype.goToPage = function (page) {
2503
- if (!(this.View instanceof AppSearch) && !(this.SearchView instanceof AppSearch) && !(this.View instanceof ReportDefinition))
4141
+ var view = this.MainGroupView ? this.MainGroupView : this.View;
4142
+ if (!view.page || !view.pages)
2504
4143
  return;
2505
- var appSearchElement = this.SearchView || this.View;
4144
+ var appSearchElement = this.SearchView || view;
2506
4145
  if (page === 0 || page > appSearchElement.pages)
2507
4146
  return;
2508
4147
  appSearchElement.page = page;
2509
4148
  this.arrayPulsanti = this.getPagesArray(6, appSearchElement.page, appSearchElement.pages);
2510
- this.emitSearchRequest(false);
4149
+ var hasGroupings = !!this.MainGroupView;
4150
+ this.emitSearchRequest(false, hasGroupings ? view : null);
2511
4151
  };
2512
4152
  /**
2513
4153
  * Evento richiamato sul cambio della paginazione. Verrà richiamato l'evento **emitSearchRequest**
2514
4154
  * per comunicare al componente che utilizza questa tabella che i dati sono da aggiornare
2515
4155
  */
2516
- EsTableComponent.prototype.onItemsPerPageChanged = function () {
2517
- this.emitSearchRequest(true);
4156
+ EsTableComponent.prototype.onItemsPerPageChanged = function (newIpp) {
4157
+ this.PagerOptions.View.itemsperpageoverride = newIpp;
4158
+ this.changed();
4159
+ if (this.MainGroupView)
4160
+ this.emitSearchRequest(true, this.MainGroupView);
4161
+ else
4162
+ this.emitSearchRequest(true);
4163
+ };
4164
+ /**
4165
+ * Evento richiamato sul cambio della paginazione. Verrà richiamato l'evento **emitSearchRequest** con la vista del separatore
4166
+ */
4167
+ EsTableComponent.prototype.onGroupItemsPerPageChanged = function (pager, newIpp) {
4168
+ pager.view.itemsperpageoverride = newIpp;
4169
+ this.emitSearchRequest(true, pager.view);
2518
4170
  };
2519
4171
  // #endregion
2520
4172
  // #region Gestione Export
@@ -2534,6 +4186,10 @@
2534
4186
  if (cancel === void 0) { cancel = false; }
2535
4187
  if (cancel)
2536
4188
  return;
4189
+ if (data.length == 0) {
4190
+ _this.msgExts.simpleWarning(_this.lc.loc("Cannot export an empty dataset"));
4191
+ return;
4192
+ }
2537
4193
  _this.setupExport(data);
2538
4194
  _this.cdr.detectChanges();
2539
4195
  setTimeout(function () { _this.exportDownloader.nativeElement.click(); });
@@ -2661,12 +4317,12 @@
2661
4317
  * @returns {any} Router link generato in base al parametri
2662
4318
  */
2663
4319
  EsTableComponent.prototype.generateRouterLink = function (path, parameterProps, item) {
2664
- if (this.DynamicTableRouterLinkCache[item.hash + path]) {
2665
- return this.DynamicTableRouterLinkCache[item.hash + path];
4320
+ if (this.DynamicTableRouterLinkCache[item._hash + path]) {
4321
+ return this.DynamicTableRouterLinkCache[item._hash + path];
2666
4322
  }
2667
4323
  else {
2668
4324
  var link = this.getRouterLink(path, parameterProps, item);
2669
- this.DynamicTableRouterLinkCache[item.hash + path] = link;
4325
+ this.DynamicTableRouterLinkCache[item._hash + path] = link;
2670
4326
  return link;
2671
4327
  }
2672
4328
  };
@@ -2764,6 +4420,14 @@
2764
4420
  };
2765
4421
  // #endregion
2766
4422
  // #region Metodi di utilità
4423
+ /** Helper che identifica se il td attuale è di tipo **EsTd**. In caso contrario è da considerarsi **EsTdDirective** */
4424
+ EsTableComponent.prototype.isEsTd = function (td) {
4425
+ return !td._directive;
4426
+ };
4427
+ /** Helper che identifica se il th attuale è di tipo **EsTh**. In caso contrario è da considerarsi **EsThDirective** */
4428
+ EsTableComponent.prototype.isEsTh = function (th) {
4429
+ return !th._directive;
4430
+ };
2767
4431
  /** Impostazione modalità dell'EsTable */
2768
4432
  EsTableComponent.prototype.setMode = function (mode) {
2769
4433
  this.viewMode = mode == 'view';
@@ -2776,7 +4440,8 @@
2776
4440
  }
2777
4441
  };
2778
4442
  /**
2779
- * Helper per effettuare chiamate interne di allineamento alla funzione **writeValue**, impostando prima **internalWriteCall** in modo da non effettuare operazioni inutili
4443
+ * Helper per effettuare chiamate interne di allineamento alla funzione **writeValue**,
4444
+ * impostando prima **internalWriteCall** in modo da non effettuare operazioni inutili
2780
4445
  */
2781
4446
  EsTableComponent.prototype.internalWriteValue = function () {
2782
4447
  this.internalWriteCall = true;
@@ -2840,11 +4505,13 @@
2840
4505
  for (var i = 0; i < items.length; i++) {
2841
4506
  var item = items[i];
2842
4507
  // Prima di calcolare l'hash rimuovo le proprietà interne prima che mi scompensino i calcoli successivi
2843
- delete item._selected;
2844
- delete item.hash;
2845
- var hash = this.hashExts.hashObject(item);
4508
+ var tmp = Object.assign({}, items[i]);
4509
+ delete tmp._selected;
4510
+ delete tmp._visible;
4511
+ delete tmp._hash;
4512
+ var hash = this.hashExts.hashObject(tmp);
2846
4513
  usedHashesCache[hash] = usedHashesCache[hash] ? usedHashesCache[hash] + 1 : 1;
2847
- item.hash = hash + (usedHashesCache[hash] > 1 ? "_" + usedHashesCache[hash] : "");
4514
+ item._hash = hash + (usedHashesCache[hash] > 1 ? "_" + usedHashesCache[hash] : "");
2848
4515
  }
2849
4516
  };
2850
4517
  /**
@@ -2873,18 +4540,22 @@
2873
4540
  viewProviders: [{ provide: localizations.LocalizationService, useClass: EsTableLoc }],
2874
4541
  changeDetection: core.ChangeDetectionStrategy.OnPush,
2875
4542
  encapsulation: core.ViewEncapsulation.None,
2876
- 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 || '') + (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 <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\" [Context]=\"item.hash\">\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\" [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>\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>",
2877
- 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}"]
4543
+ 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=\"est-page-sel\" class=\"btn {{p.cssClass}}\"\r\n (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>",
4544
+ 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}.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}"]
2878
4545
  },] }
2879
4546
  ];
2880
4547
  EsTableComponent.ctorParameters = function () { return [
2881
4548
  { type: forms.NgControl, decorators: [{ type: core.Self }, { type: core.Optional }] },
2882
4549
  { type: preferences.PreferencesService, decorators: [{ type: core.Optional }] },
4550
+ { type: EsTableDefaultable, decorators: [{ type: core.Optional }, { type: core.Inject, args: [EST_DEFAULTS,] }] },
4551
+ { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [EST_LOCALE,] }] },
2883
4552
  { type: localizations.LocalizationService },
2884
4553
  { type: core.ChangeDetectorRef },
2885
4554
  { type: extensions.HashingService },
2886
4555
  { type: extensions.UtilityService },
2887
- { type: extensions.ExportService }
4556
+ { type: extensions.ExportService },
4557
+ { type: extensions.DateService },
4558
+ { type: extensions.MessageService }
2888
4559
  ]; };
2889
4560
  EsTableComponent.propDecorators = {
2890
4561
  EsTdsDirective: [{ type: core.ContentChildren, args: [EsTdDirective,] }],
@@ -2903,7 +4574,7 @@
2903
4574
  CellActionPropagates: [{ type: core.Input }],
2904
4575
  UseCustomCells: [{ type: core.Input }],
2905
4576
  MaxHeight: [{ type: core.Input }],
2906
- Class: [{ type: core.Input }],
4577
+ ContainerClass: [{ type: core.Input }],
2907
4578
  XLSXExport: [{ type: core.Input }],
2908
4579
  CSVExport: [{ type: core.Input }],
2909
4580
  AllSearch: [{ type: core.Input }],
@@ -2914,14 +4585,12 @@
2914
4585
  RemovalCondition: [{ type: core.Input }],
2915
4586
  Export: [{ type: core.Input }],
2916
4587
  ShiftClick: [{ type: core.Input }],
2917
- ShowPaging: [{ type: core.Input }],
2918
4588
  HidePaging: [{ type: core.Input }],
2919
4589
  HidePagingCount: [{ type: core.Input }],
2920
4590
  HidePagingButtons: [{ type: core.Input }],
2921
4591
  ContextMenu: [{ type: core.Input }],
2922
4592
  ExportFileName: [{ type: core.Input }],
2923
4593
  TableClass: [{ type: core.Input }],
2924
- CountLabel: [{ type: core.Input }],
2925
4594
  ExportFunction: [{ type: core.Input }],
2926
4595
  HasHeaderGroup: [{ type: core.Input }],
2927
4596
  HasSecondaryHeaderGroup: [{ type: core.Input }],
@@ -2947,9 +4616,12 @@
2947
4616
  OwnKey: [{ type: core.Input }],
2948
4617
  StartsExpanded: [{ type: core.Input }],
2949
4618
  SavePreferences: [{ type: core.Input }],
4619
+ PagingStyle: [{ type: core.Input }],
4620
+ RowGroupingPagingStyle: [{ type: core.Input }],
2950
4621
  SecondarySource: [{ type: core.Input }],
2951
4622
  TertiarySource: [{ type: core.Input }],
2952
4623
  UseSelectionCache: [{ type: core.Input }],
4624
+ ShowItemGroupsColumns: [{ type: core.Input }],
2953
4625
  onOrderChanged: [{ type: core.Output }],
2954
4626
  onSearchRequest: [{ type: core.Output }],
2955
4627
  onSelectionChanged: [{ type: core.Output }],
@@ -2963,26 +4635,22 @@
2963
4635
  ArraymodeItemsPerPage: [{ type: core.Input }]
2964
4636
  };
2965
4637
 
2966
- /**
2967
- * Modello di configurazione per L'EsTable
2968
- */
4638
+ /** Modello di configurazione per L'EsTable */
2969
4639
  var EsTableModuleConfig = /** @class */ (function () {
2970
4640
  function EsTableModuleConfig() {
2971
4641
  }
2972
4642
  return EsTableModuleConfig;
2973
4643
  }());
2974
4644
 
2975
- /**
2976
- * Classe di localizzazione per il componente **TablePagerComponent**
2977
- */
4645
+ /** Classe di localizzazione per il componente **TablePagerComponent** */
2978
4646
  var TablePagerLoc = /** @class */ (function (_super) {
2979
4647
  __extends(TablePagerLoc, _super);
2980
- /**
2981
- * @ignore
2982
- */
4648
+ /** @ignore */
2983
4649
  function TablePagerLoc(LOC_LOCALE) {
2984
4650
  var _this = _super.call(this, LOC_LOCALE !== null && LOC_LOCALE !== void 0 ? LOC_LOCALE : 'it-IT') || this;
2985
4651
  _super.prototype.set.call(_this, "en->it", "All", ["Tutto"]);
4652
+ _super.prototype.set.call(_this, "en->it", "Shown Elements", ["Elementi visualizzati"]);
4653
+ _super.prototype.set.call(_this, "en->it", "Shown Groups", ["Gruppi visualizzati"]);
2986
4654
  _super.prototype.set.call(_this, "en->it", "Are you sure you want to retrieve all results?", ["Si è sicuri di voler caricare tutti i risultati?"]);
2987
4655
  _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"]);
2988
4656
  return _this;
@@ -2997,33 +4665,36 @@
2997
4665
  ]; };
2998
4666
 
2999
4667
  // Angular
3000
- /**
3001
- * Componente che si occupa della paginazione di una tabella
3002
- */
4668
+ /** Componente che si occupa della paginazione di una tabella */
3003
4669
  var TablePagerComponent = /** @class */ (function () {
3004
- /**
3005
- * @ignore
3006
- */
3007
- function TablePagerComponent(msgExts, lc) {
4670
+ /** @ignore */
4671
+ function TablePagerComponent(msgExts, lc, cdr, locale) {
3008
4672
  this.msgExts = msgExts;
3009
4673
  this.lc = lc;
3010
- /**
3011
- * Indica se deve mostrare un warning quando si cercano di solezionare come elementi da visualizzare "Tutti"
3012
- */
4674
+ this.cdr = cdr;
4675
+ this.locale = locale;
4676
+ /** Indica se deve mostrare un warning quando si cercano di solezionare come elementi da visualizzare "Tutti" */
3013
4677
  this.WarnOnAll = true;
3014
- /**
3015
- * Indica se dare la possibilità o meno di selezionare "Tutti" nelle opzioni di paginazione
3016
- */
4678
+ /** Indica se dare la possibilità o meno di selezionare "Tutti" nelle opzioni di paginazione */
3017
4679
  this.AllSearch = true;
3018
- /**
3019
- * Placeholder che identifica il "Tutti"
3020
- */
4680
+ /** Placeholder che identifica il "Tutti" */
3021
4681
  this.DefaultAll = 999999;
3022
- /**
3023
- * Output invocato quando il numero di elementi per pagina viene modificato da un click utente
3024
- */
4682
+ /** Indica se attivare la modalità gruppo con stili più snelli per apparire sotto ai raggruppamenti */
4683
+ this.GroupMode = false;
4684
+ /** Indica se utilizzare il conteggio dei gruppi o degli oggetti */
4685
+ this.GroupCount = false;
4686
+ /** Indica se visualizzare il numero totale di oggeti presenti */
4687
+ this.ShowCount = true;
4688
+ /** Output invocato quando il numero di elementi per pagina viene modificato da un click utente */
3025
4689
  this.pagingSelected = new core.EventEmitter();
4690
+ /** Opzioni di paginazione */
4691
+ this.PagingOptions = [10, 15, 30, 45, 100];
3026
4692
  }
4693
+ TablePagerComponent.prototype.ngOnInit = function () {
4694
+ this.Model = this.View ? this.View.itemsperpageoverride : this.CurrentPageSize;
4695
+ if (this.AllSearch)
4696
+ this.PagingOptions.push(this.DefaultAll);
4697
+ };
3027
4698
  /**
3028
4699
  * Funzione richiamata dal template quando un utente clicca su un numero di paginazione.
3029
4700
  *
@@ -3034,10 +4705,19 @@
3034
4705
  TablePagerComponent.prototype.choice = function (pageSize) {
3035
4706
  var _this = this;
3036
4707
  if (pageSize == this.DefaultAll && this.WarnOnAll) {
3037
- 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); });
4708
+ 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 () {
4709
+ // Dio solo sa perché mi tocca fare sta roba... qui dentro per qualche motivo la CD non prende
4710
+ var prevModel = _this.Model;
4711
+ _this.Model = null;
4712
+ _this.cdr.detectChanges();
4713
+ _this.Model = prevModel;
4714
+ _this.cdr.detectChanges();
4715
+ });
3038
4716
  }
3039
- else
4717
+ else {
3040
4718
  this.pagingSelected.emit(pageSize);
4719
+ this.Model = pageSize;
4720
+ }
3041
4721
  };
3042
4722
  return TablePagerComponent;
3043
4723
  }());
@@ -3045,20 +4725,28 @@
3045
4725
  { type: core.Component, args: [{
3046
4726
  selector: "app-paging",
3047
4727
  viewProviders: [{ provide: localizations.LocalizationService, useClass: TablePagerLoc }],
3048
- 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>"
4728
+ template: "<!--Se non ho almeno 10 elementi non ha senso far vedere le opzioni di paginazione-->\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>",
4729
+ encapsulation: core.ViewEncapsulation.None,
4730
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
4731
+ 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}"]
3049
4732
  },] }
3050
4733
  ];
3051
4734
  TablePagerComponent.ctorParameters = function () { return [
3052
4735
  { type: extensions.MessageService },
3053
- { type: localizations.LocalizationService }
4736
+ { type: localizations.LocalizationService },
4737
+ { type: core.ChangeDetectorRef },
4738
+ { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [EST_LOCALE,] }] }
3054
4739
  ]; };
3055
4740
  TablePagerComponent.propDecorators = {
3056
4741
  CurrentPageSize: [{ type: core.Input }],
3057
4742
  View: [{ type: core.Input }],
3058
- Hidden: [{ type: core.Input }],
3059
4743
  WarnOnAll: [{ type: core.Input }],
3060
4744
  AllSearch: [{ type: core.Input }],
3061
4745
  DefaultAll: [{ type: core.Input }],
4746
+ GroupMode: [{ type: core.Input }],
4747
+ GroupCount: [{ type: core.Input }],
4748
+ ShowCount: [{ type: core.Input }],
4749
+ PagerCount: [{ type: core.Input }],
3062
4750
  pagingSelected: [{ type: core.Output }]
3063
4751
  };
3064
4752
 
@@ -3069,7 +4757,8 @@
3069
4757
  return {
3070
4758
  ngModule: EsTableModule,
3071
4759
  providers: [
3072
- { provide: EST_LOCALE, useValue: (config === null || config === void 0 ? void 0 : config.locale) || 'it-IT' }
4760
+ { provide: EST_LOCALE, useValue: (config === null || config === void 0 ? void 0 : config.locale) || 'it-IT' },
4761
+ { provide: EST_DEBUG, useValue: (config === null || config === void 0 ? void 0 : config.debugMode) || false }
3073
4762
  ]
3074
4763
  };
3075
4764
  };
@@ -3085,7 +4774,9 @@
3085
4774
  modal.ModalModule,
3086
4775
  dropdown.BsDropdownModule,
3087
4776
  ngxCsv.CsvModule,
3088
- ngxContextmenu.ContextMenuModule
4777
+ ngxContextmenu.ContextMenuModule,
4778
+ select.MatSelectModule,
4779
+ input.MatInputModule
3089
4780
  ],
3090
4781
  declarations: [EsTh, EsTd, EsTableComponent, EsTdDirective, EsThDirective, TablePagerComponent],
3091
4782
  providers: [extensions.UtilityService, extensions.ExportService, extensions.HashingService, extensions.MessageService],
@@ -3104,9 +4795,9 @@
3104
4795
  exports.AppOrdering = AppOrdering;
3105
4796
  exports.AppSearch = AppSearch;
3106
4797
  exports.CornerMenuOption = CornerMenuOption;
3107
- exports.EsTableColumn = EsTableColumn;
3108
4798
  exports.EsTableColumnsDefinition = EsTableColumnsDefinition;
3109
4799
  exports.EsTableComponent = EsTableComponent;
4800
+ exports.EsTableDefaultable = EsTableDefaultable;
3110
4801
  exports.EsTableModule = EsTableModule;
3111
4802
  exports.EsTableModuleConfig = EsTableModuleConfig;
3112
4803
  exports.EsTableOperationDefinition = EsTableOperationDefinition;
@@ -3114,6 +4805,7 @@
3114
4805
  exports.EsTh = EsTh;
3115
4806
  exports.GenericItem = GenericItem;
3116
4807
  exports.Group = Group;
4808
+ exports.GroupAggregation = GroupAggregation;
3117
4809
  exports.GroupFilter = GroupFilter;
3118
4810
  exports.GroupOrAggregation = GroupOrAggregation;
3119
4811
  exports.ItemsSelection = ItemsSelection;
@@ -3125,10 +4817,12 @@
3125
4817
  exports.ReportRow = ReportRow;
3126
4818
  exports.ɵa = EsTableLoc;
3127
4819
  exports.ɵb = EST_LOCALE;
3128
- exports.ɵc = EsTdDirective;
3129
- exports.ɵd = EsThDirective;
3130
- exports.ɵe = TablePagerComponent;
3131
- exports.ɵf = TablePagerLoc;
4820
+ exports.ɵc = EST_DEBUG;
4821
+ exports.ɵd = EST_DEFAULTS;
4822
+ exports.ɵe = EsTdDirective;
4823
+ exports.ɵf = EsThDirective;
4824
+ exports.ɵg = TablePagerComponent;
4825
+ exports.ɵh = TablePagerLoc;
3132
4826
 
3133
4827
  Object.defineProperty(exports, '__esModule', { value: true });
3134
4828