Skip to content

Commit

Permalink
Merge pull request smeup#2189 from apuliasoft/feat/inp-dashboard
Browse files Browse the repository at this point in the history
feat/property for dashboard
  • Loading branch information
lucafoscili authored Nov 15, 2024
2 parents 794135a + 89b49d7 commit a81fad9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
10 changes: 10 additions & 0 deletions packages/ketchup/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2813,6 +2813,11 @@ export namespace Components {
* @see https://smeup.github.io/ketchup/#/customization
*/
"customStyle": string;
/**
* Sets verical layout if dashboardMode is true
* @default false
*/
"dashboardMode": boolean;
/**
* Actual data of the form.
* @default null
Expand Down Expand Up @@ -8251,6 +8256,11 @@ declare namespace LocalJSX {
* @see https://smeup.github.io/ketchup/#/customization
*/
"customStyle"?: string;
/**
* Sets verical layout if dashboardMode is true
* @default false
*/
"dashboardMode"?: boolean;
/**
* Actual data of the form.
* @default null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ export class KupInputPanel {
@Prop() checkValidValueCallback?: InputPanelCheckValidValueCallback = null;
//#endregion

/**
* Sets verical layout if dashboardMode is true
* @default false
*/
@Prop() dashboardMode: boolean = false;
//#endregion

//#region STATES
/*-------------------------------------------------*/
/* S t a t e s */
Expand Down Expand Up @@ -351,11 +358,15 @@ export class KupInputPanel {
.join(' ')
: `repeat(${layout.sections.length}, 1fr)`;
} else {
styleObj.gridTemplateRows = hasDim
? layout.sections
.map((sec) => sec.dim || 'auto')
.join(' ')
: `repeat(${layout.sections.length}, 1fr)`;
console.log('ELSE');
if (this.dashboardMode) {
console.log('ELSE IN');
styleObj.gridTemplateRows = hasDim
? layout.sections
.map((sec) => sec.dim || 'auto')
.join(' ')
: `repeat(${layout.sections.length}, 1fr)`;
}
}
}

Expand Down Expand Up @@ -590,7 +601,11 @@ export class KupInputPanel {
: `repeat(${section.sections.length}, 1fr)`;
}

if (!section.gridRows && !section.horizontal) {
if (
!section.gridRows &&
!section.horizontal &&
this.dashboardMode
) {
styleObj.gridTemplateRows = hasDim
? section.sections.map((sec) => sec.dim || 'auto').join(' ')
: `repeat(${section.sections.length}, 1fr)`;
Expand All @@ -601,9 +616,12 @@ export class KupInputPanel {
);
styleObj.gridTemplateColumns =
+section.gridCols > 0 ? `repeat(${section.gridCols}, 1fr)` : '';

styleObj.gridTemplateRows =
+section.gridRows > 0 ? `repeat(${section.gridRows}, 1fr)` : '';
if (this.dashboardMode) {
styleObj.gridTemplateRows =
+section.gridRows > 0
? `repeat(${section.gridRows}, 1fr)`
: '';
}
}

const sectionContent = (
Expand Down

0 comments on commit a81fad9

Please sign in to comment.