@esfaenza/es-table 19.2.21 → 19.2.22
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.
|
@@ -4357,15 +4357,15 @@ class EsTableComponent {
|
|
|
4357
4357
|
if (usesThsAndTdsDirectives || hasNoContentProjection) {
|
|
4358
4358
|
if (this.UseCustomCells() == null)
|
|
4359
4359
|
this.UseCustomCells.set(true);
|
|
4360
|
-
if (this.HiddenColumns() == null && this.UseCustomCells)
|
|
4360
|
+
if (this.HiddenColumns() == null && this.UseCustomCells())
|
|
4361
4361
|
this.HiddenColumns.set(true);
|
|
4362
|
-
if (this.ColumnsOrdering() == null && this.UseCustomCells)
|
|
4362
|
+
if (this.ColumnsOrdering() == null && this.UseCustomCells())
|
|
4363
4363
|
this.ColumnsOrdering.set(true);
|
|
4364
|
-
if (this.OrderByColumn() == null && this.UseCustomCells)
|
|
4364
|
+
if (this.OrderByColumn() == null && this.UseCustomCells())
|
|
4365
4365
|
this.OrderByColumn.set(true);
|
|
4366
|
-
if (this.SelectAll() == null && this.Selection)
|
|
4366
|
+
if (this.SelectAll() == null && this.Selection())
|
|
4367
4367
|
this.SelectAll.set(true);
|
|
4368
|
-
if (this.ShiftClick() == null && this.Selection)
|
|
4368
|
+
if (this.ShiftClick() == null && this.Selection())
|
|
4369
4369
|
this.ShiftClick.set(true);
|
|
4370
4370
|
this.DirectivesBased.set(true);
|
|
4371
4371
|
}
|
|
@@ -4426,13 +4426,14 @@ class EsTableComponent {
|
|
|
4426
4426
|
else if (this.SearchView() && typeof this.SearchView().itemsperpageoverride != 'undefined' && !(this.SearchView() instanceof AppSearch))
|
|
4427
4427
|
this.SearchView().__proto__ = new AppSearch();
|
|
4428
4428
|
// -------------------------------------------------------------------------------------------------------------------------
|
|
4429
|
+
let isp = this.ItemSourceProperty();
|
|
4429
4430
|
if (this.View && this.View instanceof AppSearch) {
|
|
4430
4431
|
// Se cambia l'oggetto intero significa che ho rimandato la ricerca
|
|
4431
4432
|
this.setMode('view');
|
|
4432
4433
|
let firstItemGroupOrNoGrouping = (this.View.requestedgroups?.length || 0) == 0;
|
|
4433
4434
|
// Queste sono item source custom. Le valorizzo al default se non esistono
|
|
4434
|
-
if (
|
|
4435
|
-
this.View[
|
|
4435
|
+
if (isp && !this.View[isp])
|
|
4436
|
+
this.View[isp] = [];
|
|
4436
4437
|
// Se vengo da una ricerca interna mantengo lo stato di selezione precedente (quindi su cambio pagina, cambio ipp, ecc...)
|
|
4437
4438
|
// se invece l'utente ha fatto una ricerca lui (quindi cambiando filtri), secco le info di selezione
|
|
4438
4439
|
if (!this.View.selection || (!this.View.internalsearchrequest && firstItemGroupOrNoGrouping) || !this.UseSelectionCache())
|
|
@@ -4491,7 +4492,7 @@ class EsTableComponent {
|
|
|
4491
4492
|
}
|
|
4492
4493
|
}
|
|
4493
4494
|
if (firstItemGroupOrNoGrouping)
|
|
4494
|
-
this.arrayPulsanti.set(this.utilities_H.getPagesArray(6, this.View.page, this.View.pages || 1, (
|
|
4495
|
+
this.arrayPulsanti.set(this.utilities_H.getPagesArray(6, this.View.page, this.View.pages || 1, (isp ? this.View[isp] : this.View.items).length, this.View.itemsperpageoverride));
|
|
4495
4496
|
}
|
|
4496
4497
|
else if (this.View && (this.View.length != null && this.View.length != undefined)) {
|
|
4497
4498
|
this.setMode('array');
|
|
@@ -4541,12 +4542,14 @@ class EsTableComponent {
|
|
|
4541
4542
|
}
|
|
4542
4543
|
this.finalizeContext();
|
|
4543
4544
|
this.postBoundSourceCalculation();
|
|
4544
|
-
if (
|
|
4545
|
+
if (!this.EsTableHandledSearch() || !this.View)
|
|
4546
|
+
return;
|
|
4547
|
+
if (!this.View.selfsearch && !this.View.firstsearch) {
|
|
4545
4548
|
this.View.selfsearch = true;
|
|
4546
4549
|
this.changed(true);
|
|
4547
4550
|
this.onSearchRequest.emit(false);
|
|
4548
4551
|
}
|
|
4549
|
-
else if (this.View
|
|
4552
|
+
else if (this.View.selfsearch) {
|
|
4550
4553
|
this.View.selfsearch = false;
|
|
4551
4554
|
this.changed();
|
|
4552
4555
|
}
|
|
@@ -4585,22 +4588,23 @@ class EsTableComponent {
|
|
|
4585
4588
|
this.PagerOptions.ShowButtons = !this.HidePagingButtons();
|
|
4586
4589
|
this.PagerOptions.ShowPaging = !this.HidePaging();
|
|
4587
4590
|
this.PagerOptions.UsesView = true;
|
|
4588
|
-
|
|
4591
|
+
let sv = this.SearchView();
|
|
4592
|
+
if (this.arrayMode() && this.UseArrayModePaging() && !sv) {
|
|
4589
4593
|
this.PagerOptions.PagerCount = this.View.length || 0;
|
|
4590
4594
|
this.PagerOptions.ShowButtons = this.PagerOptions.ShowButtons && this.View.length > 10;
|
|
4591
4595
|
this.PagerOptions.View = this.View;
|
|
4592
4596
|
this.PagerOptions.UsesView = false;
|
|
4593
4597
|
this.PagerOptions.ShowPagingOptions = this.PagerOptions.ShowButtons;
|
|
4594
4598
|
}
|
|
4595
|
-
else if (this.arrayMode() && (!this.UseArrayModePaging() ||
|
|
4596
|
-
if (
|
|
4597
|
-
this.PagerOptions.View =
|
|
4598
|
-
this.PagerOptions.PagerCount =
|
|
4599
|
+
else if (this.arrayMode() && (!this.UseArrayModePaging() || sv)) {
|
|
4600
|
+
if (sv) {
|
|
4601
|
+
this.PagerOptions.View = sv;
|
|
4602
|
+
this.PagerOptions.PagerCount = sv.objectcount || 0;
|
|
4599
4603
|
}
|
|
4600
4604
|
else
|
|
4601
4605
|
this.PagerOptions.PagerCount = this.View.length || 0;
|
|
4602
|
-
this.PagerOptions.ShowButtons = this.PagerOptions.ShowButtons && (this.View.length > 10 || (
|
|
4603
|
-
this.PagerOptions.ShowCount = this.PagerOptions.ShowCount || (this.View && this.View.length) || (
|
|
4606
|
+
this.PagerOptions.ShowButtons = this.PagerOptions.ShowButtons && (this.View.length > 10 || (sv?.objectcount || 0) > 10);
|
|
4607
|
+
this.PagerOptions.ShowCount = this.PagerOptions.ShowCount || (this.View && this.View.length) || (sv && sv.objectcount && sv.objectcount != -1);
|
|
4604
4608
|
this.PagerOptions.ShowPaging = this.PagerOptions.ShowPaging && (this.PagerOptions.ShowButtons || this.PagerOptions.ShowCount);
|
|
4605
4609
|
this.PagerOptions.ShowPagingOptions = this.PagerOptions.ShowButtons;
|
|
4606
4610
|
}
|
|
@@ -4629,6 +4633,11 @@ class EsTableComponent {
|
|
|
4629
4633
|
/** 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 */
|
|
4630
4634
|
async internalPostBoundSource() {
|
|
4631
4635
|
let View = this.View;
|
|
4636
|
+
let viewMode = this.viewMode();
|
|
4637
|
+
let arrayMode = this.arrayMode();
|
|
4638
|
+
let isp = this.ItemSourceProperty();
|
|
4639
|
+
let customCells = this.UseCustomCells();
|
|
4640
|
+
let dynColDefs = this.DynamicRowColumnsDefinition();
|
|
4632
4641
|
let thsTdsProviders = [...(this.EsThTdProvider ? [this.EsThTdProvider] : []), ...this.ThTdProvider];
|
|
4633
4642
|
if (thsTdsProviders?.length > 0)
|
|
4634
4643
|
await forkJoin(thsTdsProviders.map(t => t.LoadedSignal)).toPromise();
|
|
@@ -4639,14 +4648,14 @@ class EsTableComponent {
|
|
|
4639
4648
|
// Questo dev'essere per forza lanciato dopo **bindDisplayToLoadedItemsOrGroups** dato che è lì che alcune cose vengono valorizzate
|
|
4640
4649
|
this.setupPagingInformations();
|
|
4641
4650
|
// Molte cose sono ovviamente disponibili solo in modalità View
|
|
4642
|
-
if ((
|
|
4643
|
-
let view =
|
|
4644
|
-
let itemsAndGroups =
|
|
4645
|
-
let si =
|
|
4651
|
+
if ((viewMode || arrayMode) && customCells) {
|
|
4652
|
+
let view = viewMode ? View : null;
|
|
4653
|
+
let itemsAndGroups = viewMode ? [...((isp ? view[isp] : view.items) || []), ...(view.groups || [])] : View;
|
|
4654
|
+
let si = viewMode ? view.selection : this.arraymodeSelection;
|
|
4646
4655
|
// N.B: Rispettare l'ordine di queste 3 macrocategorie è VITALE
|
|
4647
4656
|
// ************************************* Sistemazioni di TH, TD, e visibilità varie *************************************
|
|
4648
4657
|
// Se ho definizioni dinamiche, prima di qualsiasi altra cosa devo trasformarle in th/td in modo che poi il codice qui sotto faccia le sue magie
|
|
4649
|
-
if ((
|
|
4658
|
+
if ((dynColDefs?.length || 0) > 0) {
|
|
4650
4659
|
this.logger.log("Generating ths and tds from Dynamic definition");
|
|
4651
4660
|
let ret = this.dynamicMode_H.emitThsAndTdsBasedOnDynamicDefinition();
|
|
4652
4661
|
this.EsThs = ret.ths;
|
|
@@ -4672,7 +4681,7 @@ class EsTableComponent {
|
|
|
4672
4681
|
// Prepassaggio per tirare fuori tutte le info utili sugli headers in modo da non ricacolarseli sempre dopo
|
|
4673
4682
|
let hI = this.columnMetadata_H.evaluateHeadersGroupingInfos(this.EsThs);
|
|
4674
4683
|
// Valuta lo stato iniziale di selezione a range
|
|
4675
|
-
this.selection_H.evaluateSingleCellSelection(itemsAndGroups, hI.leafs,
|
|
4684
|
+
this.selection_H.evaluateSingleCellSelection(itemsAndGroups, hI.leafs, dynColDefs);
|
|
4676
4685
|
if (this.arrayMode()) // In modalità array non ho un backend...
|
|
4677
4686
|
this.rowGrouping_H.arrayModeReviewGroupings(hI.leafs); // ... i raggruppamenti li devo fare lato client
|
|
4678
4687
|
this.columnMetadata_H.reviewColumnsList(hI.leafs); // Aggiorna la lista delle colonne da mostrare nella dialog per ordinamento ecc
|
|
@@ -4696,10 +4705,10 @@ class EsTableComponent {
|
|
|
4696
4705
|
this.ResearchNeeded = false;
|
|
4697
4706
|
}
|
|
4698
4707
|
}
|
|
4699
|
-
else if ((
|
|
4708
|
+
else if ((viewMode || arrayMode) && !customCells) {
|
|
4700
4709
|
// Riallineo le info di selezione degli elementi della View
|
|
4701
|
-
let items =
|
|
4702
|
-
let si =
|
|
4710
|
+
let items = viewMode ? (isp ? View[isp] : View.items) : View;
|
|
4711
|
+
let si = viewMode ? View.selection : this.arraymodeSelection;
|
|
4703
4712
|
this.selection_H.evaluateSelection(items, si);
|
|
4704
4713
|
}
|
|
4705
4714
|
// Per essere sicuro che dopo un bind di oggetti la es-table aggiorni la grafica
|
|
@@ -4853,11 +4862,12 @@ class EsTableComponent {
|
|
|
4853
4862
|
columnsCache[col.id] = col;
|
|
4854
4863
|
}
|
|
4855
4864
|
this.TMPRowTDs = {};
|
|
4865
|
+
let bs = this.boundSource();
|
|
4866
|
+
let defaultAlignment = this.DefaultAlignment();
|
|
4856
4867
|
// Variabile d'appoggio per permettermi di inserire tutte le colonne "Fixed" davanti
|
|
4857
4868
|
let contextFixeds = {};
|
|
4858
4869
|
for (let i = 0; i < tds.length; i++) {
|
|
4859
4870
|
let td = tds[i];
|
|
4860
|
-
let bs = this.boundSource();
|
|
4861
4871
|
for (let i = 0; i < bs.length; i++) {
|
|
4862
4872
|
let item = bs[i];
|
|
4863
4873
|
let ctx = item._hash;
|
|
@@ -4890,7 +4900,7 @@ class EsTableComponent {
|
|
|
4890
4900
|
Multi: td._multi,
|
|
4891
4901
|
MultiProp: td._multi ? td.td.split('_')[0] : null,
|
|
4892
4902
|
MultiIndex: td._multi ? td.td.split('_')[1] : null,
|
|
4893
|
-
Alignment: (td.tdAlignment || th.thAlignment ||
|
|
4903
|
+
Alignment: (td.tdAlignment || th.thAlignment || defaultAlignment).toLowerCase(),
|
|
4894
4904
|
Format: td.tdFormat || th.thFormat,
|
|
4895
4905
|
PropertyName: th.thProperty,
|
|
4896
4906
|
PropertyType: th.thType,
|
|
@@ -5078,10 +5088,10 @@ class EsTableComponent {
|
|
|
5078
5088
|
* @param {boolean} forcedVal Valore forzato di check da assegnare agli oggetti
|
|
5079
5089
|
*/
|
|
5080
5090
|
globalCheckChanged(forcedVal = null) {
|
|
5081
|
-
debugger;
|
|
5082
5091
|
this.selection_H.clearSelectionStatusExcluding(null);
|
|
5092
|
+
let bs = this.boundSource();
|
|
5083
5093
|
// 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
|
|
5084
|
-
let items =
|
|
5094
|
+
let items = bs.find(t => t._group) ? bs.filter(t => t._group && !t._parent) : bs;
|
|
5085
5095
|
var itemSelection = this.selection_H.handleItemsSelection(items, forcedVal, this.globalCheck());
|
|
5086
5096
|
this.changed();
|
|
5087
5097
|
this.onSelectionChanged.emit(itemSelection);
|
|
@@ -5321,8 +5331,10 @@ class EsTableComponent {
|
|
|
5321
5331
|
* @param {any} item Item che rappresenta il contesto su cui è stato effettuato un click
|
|
5322
5332
|
*/
|
|
5323
5333
|
dbClickEditOrSingleClickRowSelection($event, rowItem, item) {
|
|
5334
|
+
let rowItm = rowItem();
|
|
5335
|
+
let selection = this.Selection();
|
|
5324
5336
|
// Prima cosa da fare è controllare se ci sono dei range lasciati da operazioni precedenti (se applicabile) e ripulirli
|
|
5325
|
-
if (this.rangeSelected && !$event.ctrlKey &&
|
|
5337
|
+
if (this.rangeSelected && !$event.ctrlKey && selection) {
|
|
5326
5338
|
this.logger.log("clearing previously selected range");
|
|
5327
5339
|
this.selection_H.clearSelectionStatusExcluding(null);
|
|
5328
5340
|
this.rangeSelected = false;
|
|
@@ -5332,11 +5344,11 @@ class EsTableComponent {
|
|
|
5332
5344
|
if (this.Editable()) {
|
|
5333
5345
|
// Secondo click: se il timer non è scaduto è un doppio click ed eseguo il resto
|
|
5334
5346
|
if (this.cellDbClickTimer) {
|
|
5335
|
-
this.logger.log("handling doubleclick on editable cell: " + (
|
|
5336
|
-
if (
|
|
5347
|
+
this.logger.log("handling doubleclick on editable cell: " + (rowItm.PropertyName ? 'edit mode for property ' + rowItm.PropertyName : 'no property set, fallback to simple click'));
|
|
5348
|
+
if (rowItm.PropertyName)
|
|
5337
5349
|
this.setupUserEdit(rowItem, item);
|
|
5338
5350
|
else
|
|
5339
|
-
this.handleRowClick($event, item,
|
|
5351
|
+
this.handleRowClick($event, item, selection, true);
|
|
5340
5352
|
this.clearCellClickTimer();
|
|
5341
5353
|
return;
|
|
5342
5354
|
}
|
|
@@ -5345,7 +5357,7 @@ class EsTableComponent {
|
|
|
5345
5357
|
this.clearCellClickTimer();
|
|
5346
5358
|
if (!this.RangeSelection() || !this.mouseIsDown) {
|
|
5347
5359
|
this.logger.log("time's up for second click, handling single click");
|
|
5348
|
-
this.handleRowClick($event, item,
|
|
5360
|
+
this.handleRowClick($event, item, selection, true);
|
|
5349
5361
|
}
|
|
5350
5362
|
}, this.doubleClickBufferMs);
|
|
5351
5363
|
}
|
|
@@ -5357,11 +5369,11 @@ class EsTableComponent {
|
|
|
5357
5369
|
if ($event.ctrlKey)
|
|
5358
5370
|
return;
|
|
5359
5371
|
// Tutti i click su una cella già in edit non devono effettuare la selezione della riga
|
|
5360
|
-
if (
|
|
5372
|
+
if (rowItm._editing)
|
|
5361
5373
|
return;
|
|
5362
5374
|
// Per evitare di rallentare a prescindere
|
|
5363
5375
|
if (!this.Editable()) {
|
|
5364
|
-
this.handleRowClick($event, item,
|
|
5376
|
+
this.handleRowClick($event, item, selection, true);
|
|
5365
5377
|
return;
|
|
5366
5378
|
}
|
|
5367
5379
|
}
|
|
@@ -5465,10 +5477,11 @@ class EsTableComponent {
|
|
|
5465
5477
|
*/
|
|
5466
5478
|
setupUserEdit(rowItem, item) {
|
|
5467
5479
|
this.selection_H.clearSelectionStatusExcluding(null);
|
|
5468
|
-
|
|
5480
|
+
let rowItm = rowItem();
|
|
5481
|
+
if (this.Editable() && rowItm.PropertyName) {
|
|
5469
5482
|
let dynMode = (this.DynamicRowColumnsDefinition()?.length || 0) > 0;
|
|
5470
|
-
let newValues = { _editing: true, old_value: dynMode ? item.properties[
|
|
5471
|
-
rowItem.set(Object.assign(
|
|
5483
|
+
let newValues = { _editing: true, old_value: dynMode ? item.properties[rowItm.PropertyName] : item[rowItm.PropertyName] };
|
|
5484
|
+
rowItem.set(Object.assign(rowItm, newValues));
|
|
5472
5485
|
}
|
|
5473
5486
|
this.cdr.detectChanges();
|
|
5474
5487
|
requestAnimationFrame(() => { this.FocusSubject.next(); });
|
|
@@ -5485,14 +5498,15 @@ class EsTableComponent {
|
|
|
5485
5498
|
requestAnimationFrame(() => {
|
|
5486
5499
|
let dynMode = (this.DynamicRowColumnsDefinition()?.length || 0) > 0;
|
|
5487
5500
|
let newValues = { _editing: false };
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
let
|
|
5501
|
+
let newRowItem = Object.assign(rowItem(), newValues);
|
|
5502
|
+
rowItem.set(newRowItem);
|
|
5503
|
+
let old = newRowItem.old_value;
|
|
5504
|
+
let niu = dynMode ? item.properties[newRowItem.PropertyName] : item[newRowItem.PropertyName];
|
|
5491
5505
|
let olddate = this.dateExts.getDateConvertion(old);
|
|
5492
5506
|
let niudate = this.dateExts.getDateConvertion(niu);
|
|
5493
5507
|
if ((olddate && niudate && olddate.isSame && olddate.isSame(niudate)) || old === niu)
|
|
5494
5508
|
return;
|
|
5495
|
-
this.onModelChange.emit([new EsTableModelChange(item,
|
|
5509
|
+
this.onModelChange.emit([new EsTableModelChange(item, newRowItem.ID, newRowItem.PropertyName, old, niu)]);
|
|
5496
5510
|
this.selectionStatus[item._ordinal][columnIndex].val_setter(niu);
|
|
5497
5511
|
});
|
|
5498
5512
|
}
|