added panelAutoHeight option to Layout.js

pull/2613/head
REJack 2020-03-10 09:28:26 +01:00
parent 21641f7c7c
commit 14719bdd88
6 changed files with 40 additions and 18 deletions

View File

@ -55,6 +55,7 @@ const Layout = (($) => {
const Default = {
scrollbarTheme : 'os-theme-light',
scrollbarAutoHide: 'l',
panelAutoHeight: true,
loginRegisterAutoHeight: true,
}
@ -89,17 +90,26 @@ const Layout = (($) => {
}
const max = this._max(heights)
let offset = this._config.panelAutoHeight
if (offset === true) {
offset = 0;
}
if (offset !== false) {
if (max == heights.control_sidebar) {
$(Selector.CONTENT).css('min-height', max)
$(Selector.CONTENT).css('min-height', (max + offset))
} else if (max == heights.window) {
$(Selector.CONTENT).css('min-height', max - heights.header - heights.footer)
$(Selector.CONTENT).css('min-height', (max + offset) - heights.header - heights.footer)
} else {
$(Selector.CONTENT).css('min-height', max - heights.header)
$(Selector.CONTENT).css('min-height', (max + offset) - heights.header)
}
}
if ($('body').hasClass(ClassName.LAYOUT_FIXED)) {
$(Selector.CONTENT).css('min-height', max - heights.header - heights.footer)
if (offset !== false) {
$(Selector.CONTENT).css('min-height', (max + offset) - heights.header - heights.footer)
}
if (typeof $.fn.overlayScrollbars !== 'undefined') {
$(Selector.SIDEBAR).overlayScrollbars({

19
dist/js/adminlte.js vendored
View File

@ -327,6 +327,7 @@
var Default = {
scrollbarTheme: 'os-theme-light',
scrollbarAutoHide: 'l',
panelAutoHeight: true,
loginRegisterAutoHeight: true
};
/**
@ -368,16 +369,26 @@
var max = this._max(heights);
var offset = this._config.panelAutoHeight;
if (offset === true) {
offset = 0;
}
if (offset !== false) {
if (max == heights.control_sidebar) {
$(Selector.CONTENT).css('min-height', max);
$(Selector.CONTENT).css('min-height', max + offset);
} else if (max == heights.window) {
$(Selector.CONTENT).css('min-height', max - heights.header - heights.footer);
$(Selector.CONTENT).css('min-height', max + offset - heights.header - heights.footer);
} else {
$(Selector.CONTENT).css('min-height', max - heights.header);
$(Selector.CONTENT).css('min-height', max + offset - heights.header);
}
}
if ($('body').hasClass(ClassName.LAYOUT_FIXED)) {
$(Selector.CONTENT).css('min-height', max - heights.header - heights.footer);
if (offset !== false) {
$(Selector.CONTENT).css('min-height', max + offset - heights.header - heights.footer);
}
if (typeof $.fn.overlayScrollbars !== 'undefined') {
$(Selector.SIDEBAR).overlayScrollbars({

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,8 @@ This plugin is activated automatically upon window load.
|-|-|-|-
|scrollbarTheme | Boolean | `os-theme-light` | Scrollbar Theme used while SideBar Fixed
|scrollbarAutoHide | Boolean | `l` | Scrollbar auto-hide trigger
|loginRegisterAutoHeight | Boolean|Integer | true | Login & Register Height Correction
|panelAutoHeight | Boolean|Numeric | true | Panel Height Correction (`true` = default correction on load/resize; numeric = offset the correction on load/resize)
|loginRegisterAutoHeight | Boolean|Integer | true | Login & Register Height Correction (`true` = single correction on load; integer = correction with a interval based on the interger)
|---
{: .table .table-bordered .bg-light}