@esfaenza/es-table 20.3.31 → 20.3.32
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.
- package/fesm2022/esfaenza-es-table.mjs +37 -52
- package/fesm2022/esfaenza-es-table.mjs.map +1 -1
- package/index.d.ts +10 -1
- package/package.json +1 -1
|
@@ -7787,6 +7787,7 @@ class EsTable2Component {
|
|
|
7787
7787
|
sel.exclusions = sel.exclusions.filter(i => i !== item);
|
|
7788
7788
|
else if (!sel.exclusions.includes(item))
|
|
7789
7789
|
sel.exclusions.push(item);
|
|
7790
|
+
this.selectionAnchor = item;
|
|
7790
7791
|
}
|
|
7791
7792
|
else {
|
|
7792
7793
|
item._selected = !item._selected;
|
|
@@ -7885,76 +7886,60 @@ class EsTable2Component {
|
|
|
7885
7886
|
this.toggleRow(item);
|
|
7886
7887
|
return;
|
|
7887
7888
|
}
|
|
7888
|
-
|
|
7889
|
-
|
|
7889
|
+
const shift = !!event?.shiftKey;
|
|
7890
|
+
const ctrl = !!(event?.ctrlKey || event?.metaKey);
|
|
7891
|
+
// Con [ShiftClick] lo Shift+click estende il range dall'ancora (stile Esplora
|
|
7892
|
+
// risorse) e il Ctrl+click fa il toggle della singola riga. Il click SEMPLICE
|
|
7893
|
+
// invece NON è mai "seleziona solo questa": vedi sotto.
|
|
7894
|
+
if (this.ShiftClick() && !this.Hierarchy() && (shift || ctrl)) {
|
|
7890
7895
|
this.windowsSelect(item, event);
|
|
7891
7896
|
return;
|
|
7892
7897
|
}
|
|
7893
|
-
//
|
|
7894
|
-
if (
|
|
7898
|
+
// Senza [ShiftClick] il Ctrl+click lascia il default del browser (link, ecc.)
|
|
7899
|
+
if (ctrl)
|
|
7895
7900
|
return;
|
|
7901
|
+
// Click semplice (con o senza [ShiftClick]): riga già selezionata → deseleziona,
|
|
7902
|
+
// riga non selezionata → si AGGIUNGE alla selezione. `toggleRow` aggiorna anche
|
|
7903
|
+
// l'ancora per un eventuale Shift+click successivo.
|
|
7896
7904
|
this.toggleRow(item);
|
|
7897
7905
|
}
|
|
7898
|
-
/**
|
|
7906
|
+
/**
|
|
7907
|
+
* Shift/Ctrl+click stile Esplora risorse, attivo solo con `[ShiftClick]`.
|
|
7908
|
+
*
|
|
7909
|
+
* Lo **Shift+click** estende il range dall'ancora (l'ultima riga cliccata); senza
|
|
7910
|
+
* Ctrl il range SOSTITUISCE la selezione, con Ctrl la somma a quella esistente.
|
|
7911
|
+
* Ogni altro caso (Ctrl+click, o Shift senza un'ancora valida) è un toggle della
|
|
7912
|
+
* singola riga: passa da `toggleRow`, che è il percorso canonico usato anche dalle
|
|
7913
|
+
* checkbox e che gestisce correttamente la modalità "tutto selezionato"
|
|
7914
|
+
* (`sel.all` → toggle dell'esclusione invece di azzerare la selezione).
|
|
7915
|
+
*/
|
|
7899
7916
|
windowsSelect(item, event) {
|
|
7900
7917
|
if (this.SelectionDisabled() || item?._sep)
|
|
7901
7918
|
return;
|
|
7902
7919
|
const rows = this.selectableRows();
|
|
7903
|
-
const sel = this.currentSelection();
|
|
7904
7920
|
const shift = !!event?.shiftKey;
|
|
7905
7921
|
const ctrl = !!(event?.ctrlKey || event?.metaKey);
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
// dalle esclusioni, mantenendo sel.all. `toggleRow` gestisce già esattamente
|
|
7909
|
-
// questo caso (come fa la checkbox). Senza questo ramo, il reset di sel.all/
|
|
7910
|
-
// exclusions in coda a questa funzione collasserebbe la selezione a 0.
|
|
7911
|
-
if (sel.all && ctrl && !shift) {
|
|
7922
|
+
const anchor = this.selectionAnchor != null ? rows.indexOf(this.selectionAnchor) : -1;
|
|
7923
|
+
if (!shift || anchor < 0) {
|
|
7912
7924
|
this.toggleRow(item);
|
|
7913
7925
|
return;
|
|
7914
7926
|
}
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
for (const r of rows)
|
|
7922
|
-
r._selected = false;
|
|
7923
|
-
sel.items = [];
|
|
7924
|
-
}
|
|
7925
|
-
for (let i = lo; i <= hi; i++) {
|
|
7926
|
-
rows[i]._selected = true;
|
|
7927
|
-
if (!sel.items.includes(rows[i]))
|
|
7928
|
-
sel.items.push(rows[i]);
|
|
7929
|
-
}
|
|
7930
|
-
// l'ancora resta invariata per estensioni successive
|
|
7931
|
-
}
|
|
7932
|
-
}
|
|
7933
|
-
else if (ctrl) {
|
|
7934
|
-
item._selected = !item._selected;
|
|
7935
|
-
if (item._selected) {
|
|
7936
|
-
if (!sel.items.includes(item))
|
|
7937
|
-
sel.items.push(item);
|
|
7938
|
-
}
|
|
7939
|
-
else
|
|
7940
|
-
sel.items = sel.items.filter(i => i !== item);
|
|
7941
|
-
this.selectionAnchor = item;
|
|
7942
|
-
}
|
|
7943
|
-
else {
|
|
7944
|
-
// Re-click sull'unica riga selezionata => deseleziona; altrimenti seleziona solo questa
|
|
7945
|
-
const onlyThisSelected = item._selected && !sel.all && sel.items.length === 1 && sel.items[0] === item;
|
|
7927
|
+
const b = rows.indexOf(item);
|
|
7928
|
+
if (b < 0)
|
|
7929
|
+
return;
|
|
7930
|
+
const sel = this.currentSelection();
|
|
7931
|
+
const [lo, hi] = anchor <= b ? [anchor, b] : [b, anchor];
|
|
7932
|
+
if (!ctrl) {
|
|
7946
7933
|
for (const r of rows)
|
|
7947
7934
|
r._selected = false;
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
sel.items
|
|
7954
|
-
item._selected = true;
|
|
7955
|
-
this.selectionAnchor = item;
|
|
7956
|
-
}
|
|
7935
|
+
sel.items = [];
|
|
7936
|
+
}
|
|
7937
|
+
for (let i = lo; i <= hi; i++) {
|
|
7938
|
+
rows[i]._selected = true;
|
|
7939
|
+
if (!sel.items.includes(rows[i]))
|
|
7940
|
+
sel.items.push(rows[i]);
|
|
7957
7941
|
}
|
|
7942
|
+
// l'ancora resta invariata, così Shift+click successivi ri-estendono da lì
|
|
7958
7943
|
sel.all = false;
|
|
7959
7944
|
sel.exclusions = [];
|
|
7960
7945
|
this.refreshSelectionCount(sel);
|