@pepperi-addons/ngx-composite-lib 0.4.2-beta.85 → 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.
- package/esm2020/layout-builder/layout-builder-internal.service.mjs +1 -2
- package/esm2020/layout-builder/layout-builder.component.mjs +6 -2
- package/esm2020/layout-builder/section/section.component.mjs +79 -25
- package/fesm2015/pepperi-addons-ngx-composite-lib-layout-builder.mjs +83 -26
- package/fesm2015/pepperi-addons-ngx-composite-lib-layout-builder.mjs.map +1 -1
- package/fesm2020/pepperi-addons-ngx-composite-lib-layout-builder.mjs +83 -26
- package/fesm2020/pepperi-addons-ngx-composite-lib-layout-builder.mjs.map +1 -1
- package/layout-builder/layout-builder.component.d.ts +3 -2
- package/layout-builder/section/section.component.d.ts +2 -1
- package/package.json +1 -1
|
@@ -459,7 +459,6 @@ class LayoutBuilderInternalService {
|
|
|
459
459
|
return this.getScreenType(this._screenSizeSubject?.getValue() || PepScreenSizeType.LG);
|
|
460
460
|
}
|
|
461
461
|
getScreenType(size) {
|
|
462
|
-
//TODO:
|
|
463
462
|
const screenType = size < PepScreenSizeType.MD ? 'Landscape' :
|
|
464
463
|
(size === PepScreenSizeType.MD || size === PepScreenSizeType.SM ? 'Tablet' : 'Phablet');
|
|
465
464
|
return screenType;
|
|
@@ -982,36 +981,85 @@ class SectionComponent extends BaseDestroyerDirective {
|
|
|
982
981
|
setIfHideForCurrentScreenType() {
|
|
983
982
|
this.hideForCurrentScreenType = this.layoutBuilderInternalService.getIsHidden(this.hideIn, this.screenType);
|
|
984
983
|
}
|
|
985
|
-
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'];
|
|
986
1013
|
switch (this.split) {
|
|
987
1014
|
case '1/2 1/2':
|
|
988
|
-
|
|
1015
|
+
gridColumnValueArr = ['1/7', '7/13'];
|
|
1016
|
+
break;
|
|
989
1017
|
case '1/2 1/4 1/4':
|
|
990
|
-
|
|
1018
|
+
gridColumnValueArr = ['1/7', '7/10', '10/13'];
|
|
1019
|
+
break;
|
|
991
1020
|
case '1/3 1/3 1/3':
|
|
992
|
-
|
|
1021
|
+
gridColumnValueArr = ['1/5', '5/9', '9/13'];
|
|
1022
|
+
break;
|
|
993
1023
|
case '1/3 2/3':
|
|
994
|
-
|
|
1024
|
+
gridColumnValueArr = ['1/5', '5/13'];
|
|
1025
|
+
break;
|
|
995
1026
|
case '1/4 1/2 1/4':
|
|
996
|
-
|
|
1027
|
+
gridColumnValueArr = ['1/4', '4/10', '10/13'];
|
|
1028
|
+
break;
|
|
997
1029
|
case '1/4 1/4 1/2':
|
|
998
|
-
|
|
1030
|
+
gridColumnValueArr = ['1/4', '4/7', '7/13'];
|
|
1031
|
+
break;
|
|
999
1032
|
case '1/4 1/4 1/4 1/4':
|
|
1000
|
-
|
|
1033
|
+
gridColumnValueArr = ['1/4', '4/7', '7/10', '10/13'];
|
|
1034
|
+
break;
|
|
1001
1035
|
case '1/4 3/4':
|
|
1002
|
-
|
|
1036
|
+
gridColumnValueArr = ['1/4', '4/13'];
|
|
1037
|
+
break;
|
|
1003
1038
|
case '2/3 1/3':
|
|
1004
|
-
|
|
1039
|
+
gridColumnValueArr = ['1/9', '9/13'];
|
|
1040
|
+
break;
|
|
1005
1041
|
case '3/4 1/4':
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
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');
|
|
1009
1057
|
}
|
|
1010
1058
|
}
|
|
1011
1059
|
refreshSplit() {
|
|
1012
1060
|
setTimeout(() => {
|
|
1013
1061
|
if (this.sectionContainerRef) {
|
|
1014
|
-
const cssSplitString = this.getCssSplitString();
|
|
1062
|
+
// const cssSplitString = this.getCssSplitString();
|
|
1015
1063
|
// Go for all the columns in the columnsWrapper
|
|
1016
1064
|
this.columnsElementRef.toArray().map((section, sectionIndex) => {
|
|
1017
1065
|
// Horizontal (true) for large screens, false for small screens.
|
|
@@ -1019,25 +1067,30 @@ class SectionComponent extends BaseDestroyerDirective {
|
|
|
1019
1067
|
if (isHorizontalView) {
|
|
1020
1068
|
this.renderer.setStyle(section.nativeElement, 'grid-auto-flow', 'column');
|
|
1021
1069
|
this.renderer.setStyle(section.nativeElement, 'grid-template-rows', 'unset');
|
|
1022
|
-
this.renderer.setStyle(section.nativeElement, 'grid-template-columns', cssSplitString);
|
|
1070
|
+
// this.renderer.setStyle(section.nativeElement, 'grid-template-columns', cssSplitString);
|
|
1023
1071
|
}
|
|
1024
1072
|
else {
|
|
1025
1073
|
this.renderer.setStyle(section.nativeElement, 'grid-auto-flow', 'row');
|
|
1026
1074
|
this.renderer.setStyle(section.nativeElement, 'grid-template-columns', 'unset');
|
|
1027
|
-
this.renderer.setStyle(section.nativeElement, 'grid-template-rows', 'unset');
|
|
1075
|
+
// this.renderer.setStyle(section.nativeElement, 'grid-template-rows', 'unset');
|
|
1028
1076
|
// In runtime (or preview mode).
|
|
1029
1077
|
if (!this.editable) {
|
|
1030
|
-
const cssSplitArray = cssSplitString.split(' ');
|
|
1031
|
-
// If there are some hidden columns change the column width to 0 (for cut the spacing in the grid-template-rows).
|
|
1032
|
-
this.columns.forEach((column, index) => {
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
});
|
|
1037
|
-
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
|
+
// });
|
|
1038
1085
|
//this.renderer.setStyle(section.nativeElement, 'grid-template-rows', cssSplitArray.join(' '));
|
|
1086
|
+
this.renderer.setStyle(section.nativeElement, 'grid-template-rows', 'auto');
|
|
1039
1087
|
}
|
|
1040
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
|
+
}
|
|
1041
1094
|
});
|
|
1042
1095
|
}
|
|
1043
1096
|
}, 0);
|
|
@@ -1944,7 +1997,6 @@ class PepLayoutBuilderComponent extends BaseDestroyerDirective {
|
|
|
1944
1997
|
this.viewportWidth = 0;
|
|
1945
1998
|
this.pepAddonService.setShellRouterData({ showSidebar: false, addPadding: false });
|
|
1946
1999
|
this.renderer.addClass(this.hostElement.nativeElement, 'pep-layout-builder');
|
|
1947
|
-
this.layoutBuilderInternalService.setEditMode(true);
|
|
1948
2000
|
}
|
|
1949
2001
|
set availableBlocksForDrag(value) {
|
|
1950
2002
|
this._availableBlocksForDrag = value;
|
|
@@ -2039,6 +2091,7 @@ class PepLayoutBuilderComponent extends BaseDestroyerDirective {
|
|
|
2039
2091
|
});
|
|
2040
2092
|
}
|
|
2041
2093
|
ngOnInit() {
|
|
2094
|
+
this.layoutBuilderInternalService.setEditMode(true);
|
|
2042
2095
|
// Get the first translation for load all translations.
|
|
2043
2096
|
this.translate.get('LAYOUT_BUILDER.DESKTOP').subscribe((res) => {
|
|
2044
2097
|
this.screenTypes = [
|
|
@@ -2049,6 +2102,10 @@ class PepLayoutBuilderComponent extends BaseDestroyerDirective {
|
|
|
2049
2102
|
});
|
|
2050
2103
|
this.subscribeEvents();
|
|
2051
2104
|
}
|
|
2105
|
+
ngOnDestroy() {
|
|
2106
|
+
super.ngOnDestroy();
|
|
2107
|
+
this.layoutBuilderInternalService.setEditMode(false);
|
|
2108
|
+
}
|
|
2052
2109
|
onResize(event) {
|
|
2053
2110
|
this.updateViewportWidth();
|
|
2054
2111
|
}
|