Skip to content

Commit

Permalink
fix(platform): fix form generator button group alignment
Browse files Browse the repository at this point in the history
closes [#11003](#11003)

- Rolled back changes
  • Loading branch information
khotcholava committed Nov 7, 2024
1 parent d0f9d56 commit 6d46963
Show file tree
Hide file tree
Showing 6 changed files with 413 additions and 406 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,9 @@
>
</fdp-form-generator>
@if (formCreated) {
<fdp-button (click)="openDialog(confirmationDialog)" type="submit" label="Submit form"></fdp-button>
<fdp-button (click)="submitForm()" type="submit" label="Submit form"></fdp-button>
}
<p>Form created: {{ formCreated }}</p>
@if (formValue) {
<p>Form value: {{ formValue | json }}</p>
}
<ng-template [fdDialogTemplate] let-dialog let-dialogConfig="dialogConfig" #confirmationDialog>
<fd-dialog [dialogConfig]="dialogConfig" [dialogRef]="dialog">
<fd-dialog-header>
<h1 id="fd-dialog-header-10" fd-title>The History of Pineapple</h1>
</fd-dialog-header>

<fd-dialog-body>
<fdp-form-generator
columnLayout="XL2-L2-M2-S1"
mainTitle="Default Form Generator example"
[formItems]="questions2"
(formSubmitted)="onFormSubmitted($event)"
(formCreated)="onFormCreated()"
>
</fdp-form-generator>
</fd-dialog-body>
</fd-dialog>
</ng-template>
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { Component, inject, TemplateRef, ViewChild } from '@angular/core';
import { Component, ViewChild } from '@angular/core';
import { Validators } from '@angular/forms';

import { JsonPipe } from '@angular/common';
import {
ButtonBarComponent,
DialogBodyComponent,
DialogComponent,
DialogFooterComponent,
DialogHeaderComponent,
DialogService,
TitleComponent
} from '@fundamental-ngx/core';
import { FdDate, provideDateTimeFormats } from '@fundamental-ngx/core/datetime';
import { PlatformButtonModule } from '@fundamental-ngx/platform/button';
import {
Expand All @@ -27,16 +18,6 @@ export const dummyAwaitablePromise = (timeout = 200): Promise<boolean> =>
}, timeout);
});

enum BuildTool {
Docker = 'Docker',
Golang = 'Golang',
Gradle = 'Gradle',
Maven = 'Maven',
Mta = 'Mta',
Npm = 'Npm',
Python = 'Python'
}

@Component({
selector: 'fdp-platform-form-generator-example',
templateUrl: './platform-form-generator-example.component.html',
Expand All @@ -46,21 +27,10 @@ enum BuildTool {
provideDateTimeFormats()
],
standalone: true,
imports: [
PlatformFormGeneratorModule,
PlatformButtonModule,
JsonPipe,
DialogComponent,
ButtonBarComponent,
TitleComponent,
DialogHeaderComponent,
DialogBodyComponent,
DialogFooterComponent
]
imports: [PlatformFormGeneratorModule, PlatformButtonModule, JsonPipe]
})
export class PlatformFormGeneratorExampleComponent {
@ViewChild(FormGeneratorComponent) formGenerator: FormGeneratorComponent;
private _dialogService = inject(DialogService);

loading = false;

Expand Down Expand Up @@ -258,54 +228,10 @@ export class PlatformFormGeneratorExampleComponent {
}
];

questions2: DynamicFormItem<{}, any>[] = [
{
type: 'header',
name: 'buildToolHeader',
message: '',
guiOptions: {
additionalData: {
header: 'Which build tool do you currently use?',
ignoreTopMargin: true
}
}
},
{
type: 'radio',
name: 'buildTool',
message: '',
guiOptions: {
inline: true
},
choices: [
BuildTool.Docker,
BuildTool.Golang,
BuildTool.Gradle,
BuildTool.Maven,
BuildTool.Mta,
BuildTool.Npm,
BuildTool.Python
].map((tool) => ({
label: tool.charAt(0).toUpperCase() + tool.slice(1).toLocaleLowerCase(),
value: tool
})),
validators: [Validators.required]
}
];

onFormCreated(): void {
this.formCreated = true;
}

openDialog(dialog: TemplateRef<any>): void {
const dialogRef = this._dialogService.open(dialog, {
responsivePadding: true,
ariaLabelledBy: 'fd-dialog-header-10',
ariaDescribedBy: 'fd-dialog-body-10',
focusTrapped: true
});
}

async onFormSubmitted(value: DynamicFormValue): Promise<void> {
console.log(value);

Expand Down
Loading

0 comments on commit 6d46963

Please sign in to comment.