-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 'master'
Develop See merge request papers/airgap/airgap-wallet!666
- Loading branch information
Showing
45 changed files
with
2,662 additions
and
559 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/app/components/widget-input-delay/widget-input-delay.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<form [formGroup]="widgetForm"> | ||
<ion-row class="ion-padding-horizontal padding-top ion-align-items-center value__container"> | ||
<ion-col size="9" class="value--container__input ion-no-padding"> | ||
<ion-item class="ion-no-padding" lines="none"> | ||
<ion-label color="blackLight" class="ion-no-margin" position="stacked">{{ widget.label | translate }}</ion-label> | ||
<ion-input [type]="widget.inputType" [placeholder]="widget.fixedMinValue" [formControlName]="widget.id"></ion-input> | ||
</ion-item> | ||
</ion-col> | ||
</ion-row> | ||
<ion-row class="ion-padding-horizontal"> | ||
<ion-col size="12"> | ||
<ion-range | ||
[min]="widget.fixedMinValue" | ||
[max]="widget.maxValue" | ||
[value]="value" | ||
step="1" | ||
(ionChange)="onRangeChange($event)" | ||
></ion-range> | ||
<ion-text class="ion-no-margin ion-no-padding" color="blackLight" *ngIf="widget.extraLabel || widget.createExtraLabel"> | ||
<p [innerHTML]="widget.extraLabel | translate"></p> | ||
</ion-text> | ||
</ion-col> | ||
</ion-row> | ||
<ion-row class="ion-padding-horizontal ion-padding-bottom" *ngIf="widget.formControl && (widget.errorLabel)"> | ||
<ion-col size="12" *ngIf="widget.formControl.invalid"> | ||
<ion-text class="ion-no-margin" color="danger"> | ||
<p class="ion-no-margin">{{ widget.errorLabel | translate }}</p> | ||
</ion-text> | ||
</ion-col> | ||
</ion-row> | ||
</form> |
17 changes: 17 additions & 0 deletions
17
src/app/components/widget-input-delay/widget-input-delay.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.value__container { | ||
.item-inner { | ||
border-bottom-color: transparent !important; | ||
box-shadow: none !important; | ||
} | ||
ion-input { | ||
font-size: 1.4em; | ||
font-weight: bold; | ||
margin: 0; | ||
--padding-top: 12px; | ||
--padding-bottom: 12px; | ||
} | ||
.value--container__input, | ||
.value--container__input .item-inner { | ||
padding-right: 0; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/app/components/widget-input-delay/widget-input-delay.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core' | ||
import { FormGroup } from '@angular/forms' | ||
import BigNumber from 'bignumber.js' | ||
import { Subscription } from 'rxjs' | ||
import { UIInputDelay } from 'src/app/models/widgets/input/UIInputDelay' | ||
|
||
@Component({ | ||
selector: 'widget-input-delay', | ||
templateUrl: 'widget-input-delay.html', | ||
styleUrls: ['widget-input-delay.scss'] | ||
}) | ||
export class WidgetInputDelay implements OnChanges { | ||
@Input() | ||
public widget: UIInputDelay | ||
|
||
@Input() | ||
public widgetForm: FormGroup | ||
|
||
public value: string | undefined | ||
|
||
private valueSubscription: Subscription | undefined | ||
|
||
public ngOnChanges(changes: SimpleChanges): void { | ||
const currentWidget = changes.widget.currentValue as UIInputDelay | ||
this.value = currentWidget.fixedMinValue | ||
|
||
if (changes.widgetForm.previousValue !== changes.widgetForm.currentValue) { | ||
this.valueSubscription?.unsubscribe() | ||
const currentWidgetForm = changes.widgetForm.currentValue as FormGroup | ||
this.valueSubscription = currentWidgetForm.get(this.widget.id).valueChanges.subscribe((value) => { | ||
const control = currentWidgetForm.get(this.widget.id) | ||
if (control.dirty && control.valid && new BigNumber(value).gte(currentWidget.fixedMinValue)) { | ||
this.value = value | ||
} | ||
}) | ||
} | ||
} | ||
|
||
public onRangeChange(event) { | ||
const value: number = event.detail.value | ||
if (isNaN(value)) { | ||
return | ||
} | ||
|
||
this.widgetForm.get(this.widget.id).markAsPristine() | ||
this.widgetForm.patchValue({ [this.widget.id]: event.detail.value.toString() }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.