dashboard more fine height layout

This commit is contained in:
Yuri Kuznetsov
2024-12-13 21:04:57 +02:00
parent 740f8bfaa6
commit bc0f135291
4 changed files with 25 additions and 16 deletions
@@ -21,7 +21,7 @@
}
}
},
"dashboardCellHeight": 155,
"dashboardCellHeight": 40,
"dashboardCellMargin": 16,
"navbarHeight": 43,
"modalFooterAtTheTop": true,
+2 -2
View File
@@ -70,8 +70,8 @@ class ThemeManager {
*/
defaultParams = {
screenWidthXs: 768,
dashboardCellHeight: 155,
dashboardCellMargin: 19,
dashboardCellHeight: 40,
dashboardCellMargin: 16,
}
/**
+15 -7
View File
@@ -38,7 +38,14 @@ class DashboardView extends View {
dashboardLayout = null
currentTab = null
/**
* @private
* @type {number}
*/
cellHeight
WIDTH_MULTIPLIER = 3
HEIGHT_MULTIPLIER = 4
events = {
/** @this DashboardView */
@@ -144,6 +151,8 @@ class DashboardView extends View {
this.currentTab = this.getStorage().get('state', 'dashboardTab') || 0;
this.setupCurrentTabLayout();
this.cellHeight = this.getThemeManager().getParam('dashboardCellHeight');
this.dashletIdList = [];
this.screenWidthXs = this.getThemeManager().getParam('screenWidthXs');
@@ -343,7 +352,7 @@ class DashboardView extends View {
disableResize = true;
}
const paramCellHeight = this.getThemeManager().getParam('dashboardCellHeight');
const paramCellHeight = this.cellHeight;
const paramCellMargin = this.getThemeManager().getParam('dashboardCellMargin');
const factor = this.getThemeManager().getFontSizeFactor();
@@ -386,9 +395,9 @@ class DashboardView extends View {
$item.get(0),
{
x: o.x * this.WIDTH_MULTIPLIER,
y: o.y,
y: o.y * this.HEIGHT_MULTIPLIER,
w: o.width * this.WIDTH_MULTIPLIER,
h: o.height,
h: o.height * this.HEIGHT_MULTIPLIER,
}
);
});
@@ -448,9 +457,9 @@ class DashboardView extends View {
id: $el.data('id'),
name: $el.data('name'),
x: x / this.WIDTH_MULTIPLIER,
y: y,
y: y / this.HEIGHT_MULTIPLIER,
width: w / this.WIDTH_MULTIPLIER,
height: h,
height: h / this.HEIGHT_MULTIPLIER,
};
});
}
@@ -480,8 +489,7 @@ class DashboardView extends View {
$container.attr('data-y', o.y);
$container.attr('data-height', o.height);
$container.attr('data-width', o.width);
$container.css('height', (o.height *
this.getThemeManager().getParam('dashboardCellHeight')) + 'px');
$container.css('height', (o.height * this.cellHeight) + 'px');
$item.attr('data-id', o.id);
$item.attr('data-name', o.name);
@@ -37,6 +37,7 @@ export default class SettingsDashboardLayoutFieldView extends BaseFieldView {
validationElementSelector = 'button[data-action="addDashlet"]'
WIDTH_MULTIPLIER = 3
HEIGHT_MULTIPLIER = 4
data() {
return {
@@ -170,7 +171,7 @@ export default class SettingsDashboardLayoutFieldView extends BaseFieldView {
x: 0,
y: 0,
w: 2 * this.WIDTH_MULTIPLIER,
h: 2,
h: 2 * this.HEIGHT_MULTIPLIER,
}
);
}
@@ -383,9 +384,9 @@ export default class SettingsDashboardLayoutFieldView extends BaseFieldView {
id: $el.data('id'),
name: $el.data('name'),
x: x / this.WIDTH_MULTIPLIER,
y: y,
y: y / this.HEIGHT_MULTIPLIER,
width: w / this.WIDTH_MULTIPLIER,
height: h,
height: h / this.HEIGHT_MULTIPLIER,
};
});
@@ -398,7 +399,7 @@ export default class SettingsDashboardLayoutFieldView extends BaseFieldView {
const grid = this.grid = GridStack.init({
minWidth: 4,
cellHeight: 60,
cellHeight: 20,
margin: 10,
column: 12,
resizable: {
@@ -421,9 +422,9 @@ export default class SettingsDashboardLayoutFieldView extends BaseFieldView {
$item.get(0),
{
x: o.x * this.WIDTH_MULTIPLIER,
y: o.y,
y: o.y * this.HEIGHT_MULTIPLIER,
w: o.width * this.WIDTH_MULTIPLIER,
h: o.height,
h: o.height * this.HEIGHT_MULTIPLIER,
}
);
});