Skip to content

Commit

Permalink
fixed #44 image align and width height limit
Browse files Browse the repository at this point in the history
  • Loading branch information
asoftwareworld committed Nov 10, 2022
1 parent 4038090 commit bcc2896
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/components/form-builder/default-controls.ts

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions src/components/form-control/core/constant/constants.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,38 @@ <h4 mat-dialog-title>Edit Property</h4>
<div class="row">
<div class="col-md-6">
<mat-form-field appearance="outline" class="asw-mat-form-field">
<mat-label>Width</mat-label>
<input matInput type="number"
name="width"
placeholder="Enter width"
<mat-label>Height</mat-label>
<input matInput type="text"
name="label"
min="0"
max="600"
placeholder="Height"
(keypress)="objectUtils.keyPressNumbersWithDecimal($event)"
matTooltip="Enter width"
formControlName="width">
matTooltip="Height"
formControlName="height">
<mat-error class="asw-mat-error" *ngFor="let validation of constants.accountValidationMessages.height">
<mat-error class="asw-mat-error" *ngIf="aswDigitalForm.get('height')?.hasError(validation.type) && (aswDigitalForm.get('height')?.dirty || aswDigitalForm.get('height')?.touched)">
{{validation.message}}
</mat-error>
</mat-error>
</mat-form-field>
</div>
<div class="col-md-6">
<mat-form-field appearance="outline" class="asw-mat-form-field">
<mat-label>Height</mat-label>
<input matInput type="number"
name="height"
placeholder="Enter height"
<mat-label>Width</mat-label>
<input matInput type="text"
name="label"
min="0"
max="600"
placeholder="Width"
(keypress)="objectUtils.keyPressNumbersWithDecimal($event)"
matTooltip="Enter height"
formControlName="height">
matTooltip="Width"
formControlName="width">
<mat-error class="asw-mat-error" *ngFor="let validation of constants.accountValidationMessages.width">
<mat-error class="asw-mat-error" *ngIf="aswDigitalForm.get('width')?.hasError(validation.type) && (aswDigitalForm.get('width')?.dirty || aswDigitalForm.get('width')?.touched)">
{{validation.message}}
</mat-error>
</mat-error>
</mat-form-field>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Constants } from '../../constant/constants';
import { ObjectUtils } from './../../utils/objectutils';
Expand Down Expand Up @@ -38,8 +38,8 @@ export class AswDigitalDialog implements OnInit {
column: [],
class: [],
imageUrl: [],
width: [],
height: []
height: ['', [Validators.max(600), Validators.min(0)]],
width: ['', [Validators.max(600), Validators.min(0)]]
});
}

Expand Down
20 changes: 17 additions & 3 deletions src/components/form-control/image/image-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,35 @@ <h4 mat-dialog-title>Edit Property</h4>
<mat-label>Height</mat-label>
<input matInput type="text"
name="label"
min="0"
max="600"
placeholder="Height"
(keypress)="objectUtils.keyPressNumbersWithDecimal($event)"
matTooltip="Height"
formControlName="height">
<mat-error class="asw-mat-error" *ngFor="let validation of constants.accountValidationMessages.height">
<mat-error class="asw-mat-error" *ngIf="aswImageForm.get('height')?.hasError(validation.type) && (aswImageForm.get('height')?.dirty || aswImageForm.get('height')?.touched)">
{{validation.message}}
</mat-error>
</mat-error>
</mat-form-field>
</div>
<div class="col-md-6">
<mat-form-field appearance="outline" class="asw-mat-form-field">
<mat-label>Width</mat-label>
<input matInput type="text"
name="label"
min="0"
max="600"
placeholder="Width"
(keypress)="objectUtils.keyPressNumbersWithDecimal($event)"
matTooltip="Width"
formControlName="width">
<mat-error class="asw-mat-error" *ngFor="let validation of constants.accountValidationMessages.width">
<mat-error class="asw-mat-error" *ngIf="aswImageForm.get('width')?.hasError(validation.type) && (aswImageForm.get('width')?.dirty || aswImageForm.get('width')?.touched)">
{{validation.message}}
</mat-error>
</mat-error>
</mat-form-field>
</div>
</div>
Expand All @@ -81,13 +95,13 @@ <h4 mat-dialog-title>Edit Property</h4>
<div class="col-md-12">
Text style:
<mat-button-toggle-group formControlName="class" name="fontStyle" aria-label="Font Style">
<mat-button-toggle value="float-left float-start" aria-label="Text align left">
<mat-button-toggle value="text-left text-start" aria-label="Text align left">
<mat-icon>format_align_left</mat-icon>
</mat-button-toggle>
<mat-button-toggle value="mx-auto" aria-label="Text align center">
<mat-button-toggle value="text-center" aria-label="Text align center">
<mat-icon>format_align_center</mat-icon>
</mat-button-toggle>
<mat-button-toggle value="float-right float-end" aria-label="Text align right">
<mat-button-toggle value="text-right text-end" aria-label="Text align right">
<mat-icon>format_align_right</mat-icon>
</mat-button-toggle>
</mat-button-toggle-group>
Expand Down
4 changes: 2 additions & 2 deletions src/components/form-control/image/image-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export class AswImageDialog implements OnInit {
class: [],
imageUrl: [],
imageShape: [],
height: [],
width: []
height: ['', [Validators.max(600), Validators.min(0)]],
width: ['', [Validators.max(600), Validators.min(0)]]
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/image-drawing/image-drawing.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ <h4 mat-dialog-title>Edit Property</h4>
</div>
<div class="col-md-6 asw-buttons">
<button class="asw-clear-canvas" type="button"
(click)="clearCanvas()">Clear canvas</button>
(click)="clearCanvas()">Clear Canvas</button>
</div>
</div>
</mat-dialog-content>
Expand Down

0 comments on commit bcc2896

Please sign in to comment.