@syncfusion/ej2-layouts 20.3.56 → 20.3.58

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.
@@ -137,6 +137,9 @@ let Splitter = class Splitter extends Component {
137
137
  case 'paneSettings': {
138
138
  if (!(newProp.paneSettings instanceof Array && oldProp.paneSettings instanceof Array)) {
139
139
  const paneCounts = Object.keys(newProp.paneSettings);
140
+ if (this.isReact) {
141
+ this.clearTemplate();
142
+ }
140
143
  for (let i = 0; i < paneCounts.length; i++) {
141
144
  const index = parseInt(Object.keys(newProp.paneSettings)[i], 10);
142
145
  const changedPropsCount = Object.keys(newProp.paneSettings[index]).length;
@@ -1020,9 +1023,11 @@ let Splitter = class Splitter extends Component {
1020
1023
  }
1021
1024
  const avgDiffWidth = diff / flexPaneIndexes.length;
1022
1025
  for (let j = 0, len = flexPaneIndexes.length; j < len; j++) {
1023
- this.allPanes[flexPaneIndexes[j]].style.flexBasis = this.orientation === 'Horizontal' ?
1024
- (this.allPanes[flexPaneIndexes[j]].offsetWidth + avgDiffWidth) + 'px' :
1025
- (this.allPanes[flexPaneIndexes[j]].offsetHeight + avgDiffWidth) + 'px';
1026
+ if (this.allPanes[flexPaneIndexes[j]].style.flexBasis !== '') {
1027
+ this.allPanes[flexPaneIndexes[j]].style.flexBasis = this.orientation === 'Horizontal' ?
1028
+ (this.allPanes[flexPaneIndexes[j]].offsetWidth + avgDiffWidth) + 'px' :
1029
+ (this.allPanes[flexPaneIndexes[j]].offsetHeight + avgDiffWidth) + 'px';
1030
+ }
1026
1031
  }
1027
1032
  if (this.allPanes.length === 2 && iswindowResize) {
1028
1033
  const paneCount = this.allPanes.length;
@@ -1542,6 +1547,7 @@ let Splitter = class Splitter extends Component {
1542
1547
  return (value / offsetValue) * 100;
1543
1548
  }
1544
1549
  convertPixelToNumber(value) {
1550
+ value = value.toString();
1545
1551
  if (value.indexOf('p') > -1) {
1546
1552
  return parseFloat(value.slice(0, value.indexOf('p')));
1547
1553
  }
@@ -1695,7 +1701,10 @@ let Splitter = class Splitter extends Component {
1695
1701
  this.nextPaneHeightWidth =
1696
1702
  (typeof (this.nextPaneHeightWidth) === 'string' && this.nextPaneHeightWidth.indexOf('p') > -1) ?
1697
1703
  this.convertPixelToNumber(this.nextPaneHeightWidth) : parseInt(this.nextPaneHeightWidth, 10);
1698
- this.prevPaneCurrentWidth = separatorNewPosition + this.convertPixelToNumber(this.previousPaneHeightWidth);
1704
+ this.previousPaneHeightWidth =
1705
+ (typeof (this.previousPaneHeightWidth) === 'string' && this.previousPaneHeightWidth.indexOf('p') > -1) ?
1706
+ this.convertPixelToNumber(this.previousPaneHeightWidth) : parseInt(this.previousPaneHeightWidth, 10);
1707
+ this.prevPaneCurrentWidth = separatorNewPosition + this.previousPaneHeightWidth;
1699
1708
  this.nextPaneCurrentWidth = this.nextPaneHeightWidth - separatorNewPosition;
1700
1709
  this.validateMinMaxValues();
1701
1710
  if (this.nextPaneCurrentWidth < 0) {
@@ -1722,9 +1731,45 @@ let Splitter = class Splitter extends Component {
1722
1731
  }
1723
1732
  this.calculateCurrentDimensions();
1724
1733
  this.addStaticPaneClass();
1725
- this.previousPane.style.flexBasis = this.prevPaneCurrentWidth;
1726
- this.nextPane.style.flexBasis = this.nextPaneCurrentWidth;
1727
- if (!(this.allPanes.length > 2)) {
1734
+ let flexPaneCount = 0;
1735
+ for (let i = 0; i < this.paneSettings.length; i++) {
1736
+ if (this.paneSettings[i].size === '') {
1737
+ flexPaneCount = flexPaneCount + 1;
1738
+ }
1739
+ }
1740
+ const allFlexiblePanes = flexPaneCount === this.allPanes.length;
1741
+ // Two flexible Pane Case.
1742
+ if (this.previousPane.style.flexBasis == '' && this.nextPane.style.flexBasis == '' && !allFlexiblePanes) {
1743
+ const middlePaneIndex = this.allPanes.length % this.allBars.length;
1744
+ if (this.prevPaneIndex === middlePaneIndex) {
1745
+ this.nextPane.style.flexBasis = this.nextPaneCurrentWidth;
1746
+ addClass([this.nextPane], STATIC_PANE);
1747
+ }
1748
+ else if (this.nextPaneIndex == middlePaneIndex) {
1749
+ this.previousPane.style.flexBasis = this.prevPaneCurrentWidth;
1750
+ addClass([this.previousPane], STATIC_PANE);
1751
+ }
1752
+ else {
1753
+ this.nextPane.style.flexBasis = this.nextPaneCurrentWidth;
1754
+ addClass([this.nextPane], STATIC_PANE);
1755
+ }
1756
+ } // All panes are flexible
1757
+ else if (allFlexiblePanes) {
1758
+ this.previousPane.style.flexBasis = this.prevPaneCurrentWidth;
1759
+ addClass([this.previousPane], STATIC_PANE);
1760
+ this.nextPane.style.flexBasis = this.nextPaneCurrentWidth;
1761
+ addClass([this.nextPane], STATIC_PANE);
1762
+ } // Two Panesa are Static Pane
1763
+ else {
1764
+ if (this.previousPane.style.flexBasis !== "" && this.previousPane.classList.contains(STATIC_PANE)) {
1765
+ this.previousPane.style.flexBasis = this.prevPaneCurrentWidth;
1766
+ }
1767
+ if (this.nextPane.style.flexBasis !== "" && this.nextPane.classList.contains(STATIC_PANE)) {
1768
+ this.nextPane.style.flexBasis = this.nextPaneCurrentWidth;
1769
+ }
1770
+ }
1771
+ const isStaticPanes = this.previousPane.style.flexBasis !== "" && this.nextPane.style.flexBasis !== "";
1772
+ if (!(this.allPanes.length > 2) && isStaticPanes) {
1728
1773
  this.updateSplitterSize();
1729
1774
  }
1730
1775
  }
@@ -1828,10 +1873,10 @@ let Splitter = class Splitter extends Component {
1828
1873
  }
1829
1874
  }
1830
1875
  addStaticPaneClass() {
1831
- if (!this.previousPane.classList.contains(STATIC_PANE)) {
1876
+ if (!this.previousPane.classList.contains(STATIC_PANE) && !(this.previousPane.style.flexBasis === '') && !this.previousPane.classList.contains(EXPAND_PANE)) {
1832
1877
  this.previousPane.classList.add(STATIC_PANE);
1833
1878
  }
1834
- if (!this.nextPane.classList.contains(STATIC_PANE)) {
1879
+ if (!this.nextPane.classList.contains(STATIC_PANE) && !(this.nextPane.style.flexBasis === '') && !this.nextPane.classList.contains(EXPAND_PANE)) {
1835
1880
  this.nextPane.classList.add(STATIC_PANE);
1836
1881
  }
1837
1882
  }
@@ -2559,6 +2604,9 @@ let DashboardLayout = class DashboardLayout extends Component {
2559
2604
  if (document.querySelectorAll(template).length) {
2560
2605
  return compile(document.querySelector(template).innerHTML.trim());
2561
2606
  }
2607
+ else {
2608
+ return compile(template);
2609
+ }
2562
2610
  }
2563
2611
  catch (error) {
2564
2612
  const sanitizedValue = SanitizeHtmlHelper.sanitize(template);
@@ -2847,7 +2895,12 @@ let DashboardLayout = class DashboardLayout extends Component {
2847
2895
  currentX = this.getMaxWidth(panelModel) - this.elementWidth;
2848
2896
  this.mOffX = dX - currentX;
2849
2897
  }
2898
+ let initialWidth = this.elementWidth;
2850
2899
  this.elementWidth += currentX;
2900
+ let newSizeX = this.pixelsToColumns(this.elementWidth - (panelModel.sizeX) * this.cellSpacing[1], true);
2901
+ if (this.columns < panelModel.col + newSizeX) {
2902
+ this.elementWidth = initialWidth;
2903
+ }
2851
2904
  }
2852
2905
  el.style.top = this.elementY + 'px';
2853
2906
  el.style.left = this.elementX + 'px';
@@ -2944,8 +2997,8 @@ let DashboardLayout = class DashboardLayout extends Component {
2944
2997
  sizeY = this.pixelsToRows(this.elementHeight - (sizeY) * this.cellSpacing[0], true);
2945
2998
  }
2946
2999
  }
2947
- if (item.col + item.sizeX > this.columns) {
2948
- item.sizeX = item.sizeX - 1;
3000
+ if (item.col + sizeX > this.columns) {
3001
+ item.sizeX = sizeX - 1;
2949
3002
  }
2950
3003
  const canOccupy = row > -1 && col > -1 && sizeX + col <= this.maxCol() && sizeY + row <= this.maxRow();
2951
3004
  if (canOccupy && (this.collisions(row, col, sizeX, sizeY, this.getPanelBase(item.id)).length === 0)