[ADF-2094] Task Form - Doesn't follow the specification (#2786)

* [ADF-2094] Task Form - Doesn't follow the specification

* Removed icon visible beside title

* Made font-size for title as semibold 20px

* Set the outcome buttons on bottom right side

* set color of Complete button as primary

* [ADF-2094] Task Form - Doesn't follow the specification
* Changed the css for the Adf-form according to zeplin design

* Removed icon visible beside title

* Made font-size for title as semibold 20px

* Set the outcome buttons on bottom right side

* set color of Complete button as primary

* [ADF-2094] Task Form - Doesn't follow the specification

* Changed the css for the adf-form according to zeplin design

* Removed icon visible beside title

* Made font-size for title as semibold 20px

* Set the outcome buttons on bottom right side

* set color of Complete button as primary
This commit is contained in:
madhukar23
2017-12-15 22:11:06 +05:30
committed by Maurizio Vitale
parent a5e6d9abcf
commit 7653e5784d
4 changed files with 86 additions and 10 deletions

View File

@@ -2,7 +2,7 @@
<ng-content select="[empty-form]"> <ng-content select="[empty-form]">
</ng-content> </ng-content>
</div> </div>
<div *ngIf="hasForm()" class="{{form.className}}"> <div *ngIf="hasForm()" class="{{form.className}} adf-form-container">
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title> <mat-card-title>
@@ -12,8 +12,7 @@
<mat-icon>refresh</mat-icon> <mat-icon>refresh</mat-icon>
</button> </button>
</div> </div>
<mat-icon>{{ form.isValid ? 'event_available' : 'event_busy' }}</mat-icon> <span class="adf-form-title">{{form.taskName}}</span>
<span>{{form.taskName}}</span>
</h4> </h4>
</mat-card-title> </mat-card-title>
@@ -29,9 +28,10 @@
</div> </div>
</div> </div>
</mat-card-content> </mat-card-content>
<mat-card-actions *ngIf="form.hasOutcomes()"> <mat-card-actions *ngIf="form.hasOutcomes()" class="adf-form-mat-card-actions">
<!--[class.mdl-button--colored]="!outcome.isSystem"--> <!--[class.mdl-button--colored]="!outcome.isSystem"-->
<button *ngFor="let outcome of form.outcomes" <button *ngFor="let outcome of form.outcomes"
[color]="getColorForOutcome(outcome.name)"
mat-button mat-button
[disabled]="!isOutcomeButtonEnabled(outcome)" [disabled]="!isOutcomeButtonEnabled(outcome)"
[class.adf-form-hide-button]="!isOutcomeButtonVisible(outcome, form.readOnly)" [class.adf-form-hide-button]="!isOutcomeButtonVisible(outcome, form.readOnly)"

View File

@@ -1,8 +1,44 @@
.adf { .adf {
&-form-container { &-form-container {
width: 100%; width: 576px !important;
min-height: 100px; min-height: 814px !important;
overflow: visible;
& .mat-card {
padding: 16px 24px;
overflow: hidden;
}
& .mat-card-header-text {
margin: 0px !important;
}
& .mat-tab-body-content {
overflow: hidden;
}
& .mat-tab-label {
font-size: 16px;
line-height: 1.5;
letter-spacing: -0.4px;
text-align: left;
color: rgba(0, 0, 0, 0.54);
text-transform: uppercase;
}
& .mat-ink-bar {
height: 4px;
}
& .mat-input-wrapper {
margin: 0px 12px 0px 0px;
}
}
&-form-title {
font-weight: 600;
font-size: 20px;
letter-spacing: -0.5px;
line-height: 32px;
} }
&-form-debug-container { &-form-debug-container {
@@ -20,8 +56,8 @@
&-form-reload-button { &-form-reload-button {
position: absolute; position: absolute;
right: 0; right: 12px;
top: 0; top: 30px;
} }
&-form-hide-button { &-form-hide-button {
@@ -31,6 +67,36 @@
&-task-title { &-task-title {
text-align: center text-align: center
} }
&-label {
width: 32px;
height: 16px;
font-size: 12px;
line-height: 1.33;
text-align: left;
white-space: nowrap;
}
&-form-mat-card-actions {
float: right;
padding-bottom: 25px !important;
padding-right: 25px !important;
& .mat-button {
width: 74px;
height: 36px;
border-radius: 5px;
}
& .mat-button-wrapper {
width: 58px;
height: 20px;
opacity: 0.54;
font-size: 14px;
font-weight: bold;
}
}
} }
form-field { form-field {

View File

@@ -77,6 +77,10 @@ describe('FormComponent', () => {
expect(formComponent.isTitleEnabled()).toBeFalsy(); expect(formComponent.isTitleEnabled()).toBeFalsy();
}); });
it('should return primary color for complete button', () => {
expect(formComponent.getColorForOutcome('Complete')).toBe('primary');
});
it('should not enable outcome button when model missing', () => { it('should not enable outcome button when model missing', () => {
expect(formComponent.isOutcomeButtonVisible(null, false)).toBeFalsy(); expect(formComponent.isOutcomeButtonVisible(null, false)).toBeFalsy();
}); });

View File

@@ -38,6 +38,8 @@ export class FormComponent implements OnInit, OnChanges {
static COMPLETE_OUTCOME_ID: string = '$complete'; static COMPLETE_OUTCOME_ID: string = '$complete';
static START_PROCESS_OUTCOME_ID: string = '$startProcess'; static START_PROCESS_OUTCOME_ID: string = '$startProcess';
static CUSTOM_OUTCOME_ID: string = '$custom'; static CUSTOM_OUTCOME_ID: string = '$custom';
static COMPLETE_BUTTON_COLOR: string = 'primary';
static COMPLETE_OUTCOME_NAME: string ='Complete'
@Input() @Input()
form: FormModel; form: FormModel;
@@ -138,6 +140,10 @@ export class FormComponent implements OnInit, OnChanges {
return false; return false;
} }
getColorForOutcome(outcomeName: string): string {
return outcomeName === FormComponent.COMPLETE_OUTCOME_NAME ? FormComponent.COMPLETE_BUTTON_COLOR : '';
}
isOutcomeButtonEnabled(outcome: FormOutcomeModel): boolean { isOutcomeButtonEnabled(outcome: FormOutcomeModel): boolean {
if (this.form.readOnly) { if (this.form.readOnly) {
return false; return false;