mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
adapt to mobile layout grid
This commit is contained in:
parent
1094fb14bb
commit
853db9e941
1 changed files with 5 additions and 4 deletions
|
|
@ -59,8 +59,9 @@ const DefaultDataSourceNames: DefaultDataSourceName[] = [
|
|||
];
|
||||
const DefaultDataSourceKinds: DefaultDataSourceKind[] = ['restapi', 'runjs', 'runpy', 'tooljetdb', 'workflows'];
|
||||
|
||||
function resolveGridPositionForComponent(dimension: number) {
|
||||
return Math.round((dimension * 43) / 100);
|
||||
function resolveGridPositionForComponent(dimension: number, type: string) {
|
||||
const numberOfGrids = type === 'desktop' ? 43 : 12;
|
||||
return Math.round((dimension * numberOfGrids) / 100);
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
|
|
@ -449,7 +450,7 @@ export class AppImportExportService {
|
|||
const newLayout = new Layout();
|
||||
newLayout.type = type;
|
||||
newLayout.top = layout.top;
|
||||
newLayout.left = resolveGridPositionForComponent(layout.left);
|
||||
newLayout.left = resolveGridPositionForComponent(layout.left, type);
|
||||
newLayout.width = layout.width;
|
||||
newLayout.height = layout.height;
|
||||
newLayout.componentId = appResourceMappings.componentsMapping[componentId];
|
||||
|
|
@ -753,7 +754,7 @@ export class AppImportExportService {
|
|||
newLayout.type = layout.type;
|
||||
newLayout.top = layout.top;
|
||||
newLayout.left = shouldUpdateForGridCompatibility
|
||||
? resolveGridPositionForComponent(layout.left)
|
||||
? resolveGridPositionForComponent(layout.left, layout.type)
|
||||
: layout.left;
|
||||
newLayout.width = layout.width;
|
||||
newLayout.height = layout.height;
|
||||
|
|
|
|||
Loading…
Reference in a new issue