@pepperi-addons/ngx-composite-lib 0.4.2-beta.86 → 0.4.2-beta.87

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.
@@ -981,36 +981,85 @@ class SectionComponent extends BaseDestroyerDirective {
981
981
  setIfHideForCurrentScreenType() {
982
982
  this.hideForCurrentScreenType = this.layoutBuilderInternalService.getIsHidden(this.hideIn, this.screenType);
983
983
  }
984
- getCssSplitString() {
984
+ // private getCssSplitString() {
985
+ // switch (this.split) {
986
+ // case '1/2 1/2':
987
+ // return '1fr 1fr';
988
+ // case '1/2 1/4 1/4':
989
+ // return '2fr 1fr 1fr';
990
+ // case '1/3 1/3 1/3':
991
+ // return '1fr 1fr 1fr';
992
+ // case '1/3 2/3':
993
+ // return '1fr 2fr';
994
+ // case '1/4 1/2 1/4':
995
+ // return '1fr 2fr 1fr';
996
+ // case '1/4 1/4 1/2':
997
+ // return '1fr 1fr 2fr';
998
+ // case '1/4 1/4 1/4 1/4':
999
+ // return '1fr 1fr 1fr 1fr';
1000
+ // case '1/4 3/4':
1001
+ // return '1fr 3fr';
1002
+ // case '2/3 1/3':
1003
+ // return '2fr 1fr';
1004
+ // case '3/4 1/4':
1005
+ // return '3fr 1fr';
1006
+ // default: // For one column.
1007
+ // return '1fr';
1008
+ // }
1009
+ // }
1010
+ getCssGridColumn(columnIndex) {
1011
+ let res = '1/13';
1012
+ let gridColumnValueArr = ['1/13'];
985
1013
  switch (this.split) {
986
1014
  case '1/2 1/2':
987
- return '1fr 1fr';
1015
+ gridColumnValueArr = ['1/7', '7/13'];
1016
+ break;
988
1017
  case '1/2 1/4 1/4':
989
- return '2fr 1fr 1fr';
1018
+ gridColumnValueArr = ['1/7', '7/10', '10/13'];
1019
+ break;
990
1020
  case '1/3 1/3 1/3':
991
- return '1fr 1fr 1fr';
1021
+ gridColumnValueArr = ['1/5', '5/9', '9/13'];
1022
+ break;
992
1023
  case '1/3 2/3':
993
- return '1fr 2fr';
1024
+ gridColumnValueArr = ['1/5', '5/13'];
1025
+ break;
994
1026
  case '1/4 1/2 1/4':
995
- return '1fr 2fr 1fr';
1027
+ gridColumnValueArr = ['1/4', '4/10', '10/13'];
1028
+ break;
996
1029
  case '1/4 1/4 1/2':
997
- return '1fr 1fr 2fr';
1030
+ gridColumnValueArr = ['1/4', '4/7', '7/13'];
1031
+ break;
998
1032
  case '1/4 1/4 1/4 1/4':
999
- return '1fr 1fr 1fr 1fr';
1033
+ gridColumnValueArr = ['1/4', '4/7', '7/10', '10/13'];
1034
+ break;
1000
1035
  case '1/4 3/4':
1001
- return '1fr 3fr';
1036
+ gridColumnValueArr = ['1/4', '4/13'];
1037
+ break;
1002
1038
  case '2/3 1/3':
1003
- return '2fr 1fr';
1039
+ gridColumnValueArr = ['1/9', '9/13'];
1040
+ break;
1004
1041
  case '3/4 1/4':
1005
- return '3fr 1fr';
1006
- default: // For one column.
1007
- return '1fr';
1042
+ gridColumnValueArr = ['1/10', '10/13'];
1043
+ break;
1044
+ }
1045
+ if (gridColumnValueArr.length > columnIndex) {
1046
+ res = gridColumnValueArr[columnIndex];
1047
+ }
1048
+ return res;
1049
+ }
1050
+ setSectionColumnStyle(sectionColumn, columnIndex, isHorizontalView) {
1051
+ if (isHorizontalView) {
1052
+ const gridColumnValue = this.getCssGridColumn(columnIndex);
1053
+ this.renderer.setStyle(sectionColumn.nativeElement, 'grid-column', gridColumnValue);
1054
+ }
1055
+ else {
1056
+ this.renderer.setStyle(sectionColumn.nativeElement, 'grid-column', 'unset');
1008
1057
  }
1009
1058
  }
1010
1059
  refreshSplit() {
1011
1060
  setTimeout(() => {
1012
1061
  if (this.sectionContainerRef) {
1013
- const cssSplitString = this.getCssSplitString();
1062
+ // const cssSplitString = this.getCssSplitString();
1014
1063
  // Go for all the columns in the columnsWrapper
1015
1064
  this.columnsElementRef.toArray().map((section, sectionIndex) => {
1016
1065
  // Horizontal (true) for large screens, false for small screens.
@@ -1018,25 +1067,30 @@ class SectionComponent extends BaseDestroyerDirective {
1018
1067
  if (isHorizontalView) {
1019
1068
  this.renderer.setStyle(section.nativeElement, 'grid-auto-flow', 'column');
1020
1069
  this.renderer.setStyle(section.nativeElement, 'grid-template-rows', 'unset');
1021
- this.renderer.setStyle(section.nativeElement, 'grid-template-columns', cssSplitString);
1070
+ // this.renderer.setStyle(section.nativeElement, 'grid-template-columns', cssSplitString);
1022
1071
  }
1023
1072
  else {
1024
1073
  this.renderer.setStyle(section.nativeElement, 'grid-auto-flow', 'row');
1025
1074
  this.renderer.setStyle(section.nativeElement, 'grid-template-columns', 'unset');
1026
- this.renderer.setStyle(section.nativeElement, 'grid-template-rows', 'unset');
1075
+ // this.renderer.setStyle(section.nativeElement, 'grid-template-rows', 'unset');
1027
1076
  // In runtime (or preview mode).
1028
1077
  if (!this.editable) {
1029
- const cssSplitArray = cssSplitString.split(' ');
1030
- // If there are some hidden columns change the column width to 0 (for cut the spacing in the grid-template-rows).
1031
- this.columns.forEach((column, index) => {
1032
- if (!column.BlockContainer) {
1033
- cssSplitArray[index] = '0';
1034
- }
1035
- });
1036
- this.renderer.setStyle(section.nativeElement, 'grid-template-rows', 'auto');
1078
+ // const cssSplitArray = cssSplitString.split(' ');
1079
+ // // If there are some hidden columns change the column width to 0 (for cut the spacing in the grid-template-rows).
1080
+ // this.columns.forEach((column, index) => {
1081
+ // if (!column.BlockContainer) {
1082
+ // cssSplitArray[index] = '0';
1083
+ // }
1084
+ // });
1037
1085
  //this.renderer.setStyle(section.nativeElement, 'grid-template-rows', cssSplitArray.join(' '));
1086
+ this.renderer.setStyle(section.nativeElement, 'grid-template-rows', 'auto');
1038
1087
  }
1039
1088
  }
1089
+ // Go for all the columns in the section and set there style.
1090
+ const sectionColumns = section.nativeElement.querySelectorAll('.section-column');
1091
+ for (var columnIndex = 0; columnIndex < sectionColumns.length; columnIndex++) {
1092
+ this.setSectionColumnStyle(sectionColumns[columnIndex], columnIndex, isHorizontalView);
1093
+ }
1040
1094
  });
1041
1095
  }
1042
1096
  }, 0);