@esfaenza/es-table 19.2.20 → 19.2.21
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.
|
@@ -1661,29 +1661,32 @@ class HierarchyModeHandler {
|
|
|
1661
1661
|
*/
|
|
1662
1662
|
assignLevel(objs, levelToAssign) {
|
|
1663
1663
|
let assigned = 0;
|
|
1664
|
+
let own = this.est.OwnKey();
|
|
1665
|
+
let parent = this.est.ParentKey();
|
|
1666
|
+
let expanded = this.est.StartsExpanded();
|
|
1664
1667
|
for (let i = 0; i < objs.length; i++) {
|
|
1665
1668
|
let obj = objs[i];
|
|
1666
1669
|
// Se la parentKey non è valorizzata, questo è il livello 0 (1... perché gli 0 son perciolosi)
|
|
1667
|
-
if (!obj[
|
|
1670
|
+
if (!obj[parent] && levelToAssign == 1) {
|
|
1668
1671
|
obj._level = 1;
|
|
1669
1672
|
obj._visible = true;
|
|
1670
|
-
obj._expanded =
|
|
1673
|
+
obj._expanded = expanded;
|
|
1671
1674
|
assigned++;
|
|
1672
1675
|
continue;
|
|
1673
1676
|
}
|
|
1674
1677
|
// Per i livelli superiore al primo
|
|
1675
|
-
if (obj[
|
|
1678
|
+
if (obj[parent] && levelToAssign > 1) {
|
|
1676
1679
|
// trovo il parent
|
|
1677
1680
|
for (let p = 0; p < objs.length; p++) {
|
|
1678
1681
|
let possibleParent = objs[p];
|
|
1679
1682
|
// Trovato il parent dell'item, assegno all'item il livello giusto
|
|
1680
|
-
if (possibleParent[
|
|
1683
|
+
if (possibleParent[own] == obj[parent] && possibleParent._level == levelToAssign - 1) {
|
|
1681
1684
|
obj._level = levelToAssign;
|
|
1682
1685
|
// So che questo item ha un parent. Ribadisco che il parent è espanso in base alle impostazione e stessa logica
|
|
1683
1686
|
// per la visibilità del figlio
|
|
1684
|
-
possibleParent._expanded =
|
|
1687
|
+
possibleParent._expanded = expanded;
|
|
1685
1688
|
possibleParent.parent = true;
|
|
1686
|
-
obj._visible =
|
|
1689
|
+
obj._visible = expanded;
|
|
1687
1690
|
assigned++;
|
|
1688
1691
|
break;
|
|
1689
1692
|
}
|
|
@@ -1699,15 +1702,17 @@ class HierarchyModeHandler {
|
|
|
1699
1702
|
*/
|
|
1700
1703
|
expandParent(key) {
|
|
1701
1704
|
let bs = this.est.boundSource();
|
|
1705
|
+
let own = this.est.OwnKey();
|
|
1706
|
+
let parent = this.est.ParentKey();
|
|
1702
1707
|
for (let i = 0; i < bs.length; i++) {
|
|
1703
1708
|
let obj = bs[i];
|
|
1704
1709
|
// Trovo il parent con quell'id e lo espando
|
|
1705
|
-
if (obj[
|
|
1710
|
+
if (obj[own] == key) {
|
|
1706
1711
|
obj._expanded = true;
|
|
1707
1712
|
for (let ic = 0; ic < bs.length; ic++) {
|
|
1708
1713
|
let child = bs[ic];
|
|
1709
1714
|
// Trovo tutti i child di quel parent e li rendo visibili
|
|
1710
|
-
if (child[
|
|
1715
|
+
if (child[parent] == key)
|
|
1711
1716
|
child._visible = true;
|
|
1712
1717
|
}
|
|
1713
1718
|
return;
|
|
@@ -1721,10 +1726,11 @@ class HierarchyModeHandler {
|
|
|
1721
1726
|
*/
|
|
1722
1727
|
collapseParent(key) {
|
|
1723
1728
|
let bs = this.est.boundSource();
|
|
1729
|
+
let own = this.est.OwnKey();
|
|
1724
1730
|
for (let i = 0; i < bs.length; i++) {
|
|
1725
1731
|
let obj = bs[i];
|
|
1726
1732
|
// Trovo il parent con quell'id e lo collasso
|
|
1727
|
-
if (obj[
|
|
1733
|
+
if (obj[own] == key) {
|
|
1728
1734
|
obj._expanded = false;
|
|
1729
1735
|
// Collasso/nascondo tutti i child del parent
|
|
1730
1736
|
this.collapseChildOfParent(key);
|
|
@@ -1739,16 +1745,18 @@ class HierarchyModeHandler {
|
|
|
1739
1745
|
*/
|
|
1740
1746
|
collapseChildOfParent(parentKey) {
|
|
1741
1747
|
let bs = this.est.boundSource();
|
|
1748
|
+
let parent = this.est.ParentKey();
|
|
1749
|
+
let own = this.est.OwnKey();
|
|
1742
1750
|
for (let ic = 0; ic < bs.length; ic++) {
|
|
1743
1751
|
let child = bs[ic];
|
|
1744
1752
|
// Trovo tutti i child di quel parent e li rendo invisibili. Se il child trovato è a sua volta un parent,
|
|
1745
1753
|
// lo collasso e vado in ricorsione sui figli
|
|
1746
|
-
if (child[
|
|
1754
|
+
if (child[parent] == parentKey && !child.parent)
|
|
1747
1755
|
child._visible = false;
|
|
1748
|
-
else if (child[
|
|
1756
|
+
else if (child[parent] == parentKey && child.parent) {
|
|
1749
1757
|
child._expanded = false;
|
|
1750
1758
|
child._visible = false;
|
|
1751
|
-
this.collapseChildOfParent(child[
|
|
1759
|
+
this.collapseChildOfParent(child[own]);
|
|
1752
1760
|
}
|
|
1753
1761
|
}
|
|
1754
1762
|
}
|