@syncfusion/ej2-layouts 20.3.57 → 20.4.38

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,19 @@ 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
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
141
+ if (this.isReact) {
142
+ let cPaneCount = 0;
143
+ for (let k = 0; k < this.paneSettings.length; k++) {
144
+ if (typeof (this.paneSettings[k].content) === 'function') {
145
+ cPaneCount = cPaneCount + 1;
146
+ }
147
+ }
148
+ const hasAllContent = cPaneCount === this.paneSettings.length;
149
+ if (hasAllContent) {
150
+ this.clearTemplate();
151
+ }
152
+ }
140
153
  for (let i = 0; i < paneCounts.length; i++) {
141
154
  const index = parseInt(Object.keys(newProp.paneSettings)[i], 10);
142
155
  const changedPropsCount = Object.keys(newProp.paneSettings[index]).length;
@@ -144,7 +157,7 @@ let Splitter = class Splitter extends Component {
144
157
  const property = Object.keys(newProp.paneSettings[index])[j];
145
158
  switch (property) {
146
159
  case 'content': {
147
- const newValue = Object(newProp.paneSettings[index])[property];
160
+ const newValue = Object(newProp.paneSettings[index])[`${property}`];
148
161
  if (!isNullOrUndefined(newValue)) {
149
162
  this.allPanes[index].innerHTML = '';
150
163
  this.setTemplate(newValue, this.allPanes[index]);
@@ -152,7 +165,7 @@ let Splitter = class Splitter extends Component {
152
165
  break;
153
166
  }
154
167
  case 'resizable': {
155
- const newVal = Object(newProp.paneSettings[index])[property];
168
+ const newVal = Object(newProp.paneSettings[index])[`${property}`];
156
169
  this.resizableModel(index, newVal);
157
170
  break;
158
171
  }
@@ -164,10 +177,11 @@ let Splitter = class Splitter extends Component {
164
177
  newProp.paneSettings[index].collapsed ? this.isCollapsed(index) : this.collapsedOnchange(index);
165
178
  break;
166
179
  case 'cssClass':
180
+ // eslint-disable-next-line max-len
167
181
  this.setCssClass(this.allPanes[index], newProp.paneSettings[index].cssClass);
168
182
  break;
169
183
  case 'size': {
170
- const newValSize = Object(newProp.paneSettings[index])[property];
184
+ const newValSize = Object(newProp.paneSettings[index])[`${property}`];
171
185
  if (newValSize !== '' && !isNullOrUndefined(newValSize)) {
172
186
  this.updatePaneSize(newValSize, index);
173
187
  }
@@ -377,7 +391,6 @@ let Splitter = class Splitter extends Component {
377
391
  }
378
392
  }
379
393
  getMinInPixel(minValue) {
380
- let min;
381
394
  if (isNullOrUndefined(minValue)) {
382
395
  return 0;
383
396
  }
@@ -385,7 +398,7 @@ let Splitter = class Splitter extends Component {
385
398
  if (minValue.indexOf('%') > 0) {
386
399
  paneMinRange = this.convertPercentageToPixel(minValue);
387
400
  }
388
- min = this.convertPixelToNumber((paneMinRange).toString());
401
+ const min = this.convertPixelToNumber((paneMinRange).toString());
389
402
  return min;
390
403
  }
391
404
  /**
@@ -618,6 +631,7 @@ let Splitter = class Splitter extends Component {
618
631
  this.updateIsCollapsed(index, this.targetArrows().collapseArrow, this.targetArrows().lastBarArrow);
619
632
  for (let i = 0; i < collapsedindex.length; i++) {
620
633
  if (!this.allPanes[collapsedindex[i]].classList.contains(COLLAPSE_PANE)) {
634
+ // eslint-disable-next-line max-len
621
635
  this.updateIsCollapsed(collapsedindex[i], this.targetArrows().collapseArrow, this.targetArrows().lastBarArrow);
622
636
  }
623
637
  }
@@ -1005,6 +1019,7 @@ let Splitter = class Splitter extends Component {
1005
1019
  }
1006
1020
  for (let j = 0, len = this.allBars.length; j < len; j++) {
1007
1021
  totalWidth += this.orientation === 'Horizontal' ? parseInt(getComputedStyle(this.allBars[j]).marginLeft, 10) +
1022
+ // eslint-disable-next-line max-len
1008
1023
  parseInt(getComputedStyle(this.allBars[j]).marginLeft, 10) : parseInt(getComputedStyle(this.allBars[j]).marginTop, 10) +
1009
1024
  parseInt(getComputedStyle(this.allBars[j]).marginBottom, 10);
1010
1025
  }
@@ -1020,9 +1035,11 @@ let Splitter = class Splitter extends Component {
1020
1035
  }
1021
1036
  const avgDiffWidth = diff / flexPaneIndexes.length;
1022
1037
  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';
1038
+ if (this.allPanes[flexPaneIndexes[j]].style.flexBasis !== '') {
1039
+ this.allPanes[flexPaneIndexes[j]].style.flexBasis = this.orientation === 'Horizontal' ?
1040
+ (this.allPanes[flexPaneIndexes[j]].offsetWidth + avgDiffWidth) + 'px' :
1041
+ (this.allPanes[flexPaneIndexes[j]].offsetHeight + avgDiffWidth) + 'px';
1042
+ }
1026
1043
  }
1027
1044
  if (this.allPanes.length === 2 && iswindowResize) {
1028
1045
  const paneCount = this.allPanes.length;
@@ -1050,10 +1067,10 @@ let Splitter = class Splitter extends Component {
1050
1067
  const sizeDiff = minValue - (this.orientation === 'Horizontal' ?
1051
1068
  this.allPanes[i].offsetWidth : this.allPanes[i].offsetHeight);
1052
1069
  const isPercent = updatePane.style.flexBasis.indexOf('%') > -1;
1053
- let updatePaneOffset = this.orientation === 'Horizontal' ? updatePane.offsetWidth : updatePane.offsetHeight;
1070
+ const updatePaneOffset = this.orientation === 'Horizontal' ? updatePane.offsetWidth : updatePane.offsetHeight;
1054
1071
  updatePane.style.flexBasis = isPercent ? this.convertPixelToPercentage(updatePaneOffset + sizeDiff) + '%'
1055
1072
  : (updatePaneOffset + sizeDiff) + 'px';
1056
- let flexPaneOffset = this.orientation === 'Horizontal' ? flexPane.offsetWidth : flexPane.offsetHeight;
1073
+ const flexPaneOffset = this.orientation === 'Horizontal' ? flexPane.offsetWidth : flexPane.offsetHeight;
1057
1074
  flexPane.style.flexBasis = flexPane.style.flexBasis.indexOf('%') > -1 ?
1058
1075
  this.convertPixelToPercentage(flexPaneOffset - sizeDiff) + '%' : (flexPaneOffset - sizeDiff) + 'px';
1059
1076
  }
@@ -1542,6 +1559,7 @@ let Splitter = class Splitter extends Component {
1542
1559
  return (value / offsetValue) * 100;
1543
1560
  }
1544
1561
  convertPixelToNumber(value) {
1562
+ value = value.toString();
1545
1563
  if (value.indexOf('p') > -1) {
1546
1564
  return parseFloat(value.slice(0, value.indexOf('p')));
1547
1565
  }
@@ -1695,7 +1713,10 @@ let Splitter = class Splitter extends Component {
1695
1713
  this.nextPaneHeightWidth =
1696
1714
  (typeof (this.nextPaneHeightWidth) === 'string' && this.nextPaneHeightWidth.indexOf('p') > -1) ?
1697
1715
  this.convertPixelToNumber(this.nextPaneHeightWidth) : parseInt(this.nextPaneHeightWidth, 10);
1698
- this.prevPaneCurrentWidth = separatorNewPosition + this.convertPixelToNumber(this.previousPaneHeightWidth);
1716
+ this.previousPaneHeightWidth =
1717
+ (typeof (this.previousPaneHeightWidth) === 'string' && this.previousPaneHeightWidth.indexOf('p') > -1) ?
1718
+ this.convertPixelToNumber(this.previousPaneHeightWidth) : parseInt(this.previousPaneHeightWidth, 10);
1719
+ this.prevPaneCurrentWidth = separatorNewPosition + this.previousPaneHeightWidth;
1699
1720
  this.nextPaneCurrentWidth = this.nextPaneHeightWidth - separatorNewPosition;
1700
1721
  this.validateMinMaxValues();
1701
1722
  if (this.nextPaneCurrentWidth < 0) {
@@ -1722,9 +1743,45 @@ let Splitter = class Splitter extends Component {
1722
1743
  }
1723
1744
  this.calculateCurrentDimensions();
1724
1745
  this.addStaticPaneClass();
1725
- this.previousPane.style.flexBasis = this.prevPaneCurrentWidth;
1726
- this.nextPane.style.flexBasis = this.nextPaneCurrentWidth;
1727
- if (!(this.allPanes.length > 2)) {
1746
+ let flexPaneCount = 0;
1747
+ for (let i = 0; i < this.paneSettings.length; i++) {
1748
+ if (this.paneSettings[i].size === '') {
1749
+ flexPaneCount = flexPaneCount + 1;
1750
+ }
1751
+ }
1752
+ const allFlexiblePanes = flexPaneCount === this.allPanes.length;
1753
+ // Two flexible Pane Case.
1754
+ if (this.previousPane.style.flexBasis === '' && this.nextPane.style.flexBasis == '' && !allFlexiblePanes) {
1755
+ const middlePaneIndex = this.allPanes.length % this.allBars.length;
1756
+ if (this.prevPaneIndex === middlePaneIndex) {
1757
+ this.nextPane.style.flexBasis = this.nextPaneCurrentWidth;
1758
+ addClass([this.nextPane], STATIC_PANE);
1759
+ }
1760
+ else if (this.nextPaneIndex === middlePaneIndex) {
1761
+ this.previousPane.style.flexBasis = this.prevPaneCurrentWidth;
1762
+ addClass([this.previousPane], STATIC_PANE);
1763
+ }
1764
+ else {
1765
+ this.nextPane.style.flexBasis = this.nextPaneCurrentWidth;
1766
+ addClass([this.nextPane], STATIC_PANE);
1767
+ }
1768
+ } // All panes are flexible
1769
+ else if (allFlexiblePanes) {
1770
+ this.previousPane.style.flexBasis = this.prevPaneCurrentWidth;
1771
+ addClass([this.previousPane], STATIC_PANE);
1772
+ this.nextPane.style.flexBasis = this.nextPaneCurrentWidth;
1773
+ addClass([this.nextPane], STATIC_PANE);
1774
+ } // Two Panesa are Static Pane
1775
+ else {
1776
+ if (this.previousPane.style.flexBasis !== '' && this.previousPane.classList.contains(STATIC_PANE)) {
1777
+ this.previousPane.style.flexBasis = this.prevPaneCurrentWidth;
1778
+ }
1779
+ if (this.nextPane.style.flexBasis !== '' && this.nextPane.classList.contains(STATIC_PANE)) {
1780
+ this.nextPane.style.flexBasis = this.nextPaneCurrentWidth;
1781
+ }
1782
+ }
1783
+ const isStaticPanes = this.previousPane.style.flexBasis !== '' && this.nextPane.style.flexBasis !== '';
1784
+ if (!(this.allPanes.length > 2) && isStaticPanes) {
1728
1785
  this.updateSplitterSize();
1729
1786
  }
1730
1787
  }
@@ -1828,10 +1885,10 @@ let Splitter = class Splitter extends Component {
1828
1885
  }
1829
1886
  }
1830
1887
  addStaticPaneClass() {
1831
- if (!this.previousPane.classList.contains(STATIC_PANE)) {
1888
+ if (!this.previousPane.classList.contains(STATIC_PANE) && !(this.previousPane.style.flexBasis === '') && !this.previousPane.classList.contains(EXPAND_PANE)) {
1832
1889
  this.previousPane.classList.add(STATIC_PANE);
1833
1890
  }
1834
- if (!this.nextPane.classList.contains(STATIC_PANE)) {
1891
+ if (!this.nextPane.classList.contains(STATIC_PANE) && !(this.nextPane.style.flexBasis === '') && !this.nextPane.classList.contains(EXPAND_PANE)) {
1835
1892
  this.nextPane.classList.add(STATIC_PANE);
1836
1893
  }
1837
1894
  }
@@ -2850,7 +2907,12 @@ let DashboardLayout = class DashboardLayout extends Component {
2850
2907
  currentX = this.getMaxWidth(panelModel) - this.elementWidth;
2851
2908
  this.mOffX = dX - currentX;
2852
2909
  }
2910
+ let initialWidth = this.elementWidth;
2853
2911
  this.elementWidth += currentX;
2912
+ let newSizeX = this.pixelsToColumns(this.elementWidth - (panelModel.sizeX) * this.cellSpacing[1], true);
2913
+ if (this.columns < panelModel.col + newSizeX) {
2914
+ this.elementWidth = initialWidth;
2915
+ }
2854
2916
  }
2855
2917
  el.style.top = this.elementY + 'px';
2856
2918
  el.style.left = this.elementX + 'px';
@@ -2947,8 +3009,8 @@ let DashboardLayout = class DashboardLayout extends Component {
2947
3009
  sizeY = this.pixelsToRows(this.elementHeight - (sizeY) * this.cellSpacing[0], true);
2948
3010
  }
2949
3011
  }
2950
- if (item.col + item.sizeX > this.columns) {
2951
- item.sizeX = item.sizeX - 1;
3012
+ if (item.col + sizeX > this.columns) {
3013
+ item.sizeX = sizeX - 1;
2952
3014
  }
2953
3015
  const canOccupy = row > -1 && col > -1 && sizeX + col <= this.maxCol() && sizeY + row <= this.maxRow();
2954
3016
  if (canOccupy && (this.collisions(row, col, sizeX, sizeY, this.getPanelBase(item.id)).length === 0)
@@ -3944,7 +4006,7 @@ let DashboardLayout = class DashboardLayout extends Component {
3944
4006
  if (this.collisionChecker[this.panels[i].id] && this.collisionChecker[this.panels[i].id] !== null) {
3945
4007
  this.overlapElement = [this.collisionChecker[this.panels[i].id].ele];
3946
4008
  const key = this.panels[i].id;
3947
- this.updateRowColumn(this.collisionChecker[key].row, this.overlapElement, this.collisionChecker[key].srcEle);
4009
+ this.updateRowColumn(this.collisionChecker[`${key}`].row, this.overlapElement, this.collisionChecker[`${key}`].srcEle);
3948
4010
  }
3949
4011
  }
3950
4012
  }
@@ -4329,7 +4391,7 @@ let DashboardLayout = class DashboardLayout extends Component {
4329
4391
  }
4330
4392
  // eslint-disable-next-line guard-for-in
4331
4393
  for (const k in source[i]) {
4332
- target[i][k] = source[i][k];
4394
+ target[i][`${k}`] = source[i][`${k}`];
4333
4395
  }
4334
4396
  }
4335
4397
  return target;