diff --git a/projects/ui/src/lib/components/po-field/po-upload/po-upload-base.component.ts b/projects/ui/src/lib/components/po-field/po-upload/po-upload-base.component.ts index 74b597587..68167fc20 100644 --- a/projects/ui/src/lib/components/po-field/po-upload/po-upload-base.component.ts +++ b/projects/ui/src/lib/components/po-field/po-upload/po-upload-base.component.ts @@ -255,7 +255,7 @@ export abstract class PoUploadBaseComponent implements ControlValueAccessor, Val * two-way binding no componente deve se utilizar da seguinte forma: * * ``` - * + * * ``` * */ diff --git a/projects/ui/src/lib/components/po-field/po-upload/po-upload.component.ts b/projects/ui/src/lib/components/po-field/po-upload/po-upload.component.ts index 6311a4bab..c01c8b65e 100644 --- a/projects/ui/src/lib/components/po-field/po-upload/po-upload.component.ts +++ b/projects/ui/src/lib/components/po-field/po-upload/po-upload.component.ts @@ -43,6 +43,11 @@ import { PoUploadStatus } from './po-upload-status.enum'; * * * + * + * + * + * + * * * * diff --git a/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-labs/sample-po-upload-labs.component.html b/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-labs/sample-po-upload-labs.component.html index 6d79d295b..f1c5bae8e 100644 --- a/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-labs/sample-po-upload-labs.component.html +++ b/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-labs/sample-po-upload-labs.component.html @@ -1,6 +1,7 @@ @@ -135,8 +136,9 @@ ; - restrictions: PoUploadFileRestrictions; - upload: Array; - url: string; - headers: { [name: string]: string | Array }; - headersLabs: string; + allowedExtensions!: string; + customLiterals!: PoUploadLiterals; + dragDropHeight!: number | undefined; + event!: string; + formField!: string; + help!: string; + label!: string; + literals!: string; + maxFiles!: number | undefined; + maxSize!: number | undefined; + minSize!: number | undefined; + properties!: Array; + restrictions!: PoUploadFileRestrictions; + upload!: Array | undefined; + url!: string; + headers!: { [name: string]: string | Array }; + headersLabs!: string; + public readonly propertiesOptions: Array = [ { value: 'autoupload', label: 'Automatic upload' }, { value: 'directory', label: 'Directory' }, @@ -37,6 +38,8 @@ export class SamplePoUploadLabsComponent implements OnInit { { value: 'sendButton', label: 'Hide Send Files Button' } ]; + constructor() {} + ngOnInit() { this.restore(); } @@ -78,13 +81,13 @@ export class SamplePoUploadLabsComponent implements OnInit { } restore() { - this.allowedExtensions = undefined; - this.customLiterals = undefined; + this.allowedExtensions = ''; + this.customLiterals = {}; this.dragDropHeight = undefined; - this.event = undefined; - this.formField = undefined; - this.label = undefined; - this.help = undefined; + this.event = ''; + this.formField = ''; + this.label = ''; + this.help = ''; this.literals = ''; this.maxFiles = undefined; this.maxSize = undefined; @@ -93,8 +96,8 @@ export class SamplePoUploadLabsComponent implements OnInit { this.restrictions = {}; this.upload = undefined; this.url = 'https://po-sample-api.herokuapp.com/v1/uploads/addFile'; - this.headers = undefined; - this.headersLabs = undefined; + this.headers = {}; + this.headersLabs = ''; } private getValueInBytes(value: number) { diff --git a/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-resume-drag-drop/sample-po-upload-resume-drag-drop.component.html b/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-resume-drag-drop/sample-po-upload-resume-drag-drop.component.html index bc368a5ec..ec94e4c55 100644 --- a/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-resume-drag-drop/sample-po-upload-resume-drag-drop.component.html +++ b/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-resume-drag-drop/sample-po-upload-resume-drag-drop.component.html @@ -4,7 +4,8 @@
- + +
@@ -15,15 +16,16 @@
diff --git a/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-resume-drag-drop/sample-po-upload-resume-drag-drop.component.ts b/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-resume-drag-drop/sample-po-upload-resume-drag-drop.component.ts index 4b9e05cc5..67f668c4e 100644 --- a/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-resume-drag-drop/sample-po-upload-resume-drag-drop.component.ts +++ b/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-resume-drag-drop/sample-po-upload-resume-drag-drop.component.ts @@ -10,11 +10,11 @@ import { PoNotificationService } from '@po-ui/ng-components'; export class SamplePoUploadResumeDragDropComponent implements OnInit { @ViewChild('formOpportunity', { static: true }) formOpportunity: UntypedFormControl; - biograph: string; - linkedin: string; - name: string; - resume: string; - uploadedResume: boolean; + biograph!: string; + linkedin!: string; + name!: string; + resume!: string; + uploadedResume!: boolean; constructor(private poNotification: PoNotificationService) {} @@ -29,11 +29,11 @@ export class SamplePoUploadResumeDragDropComponent implements OnInit { this.poNotification.success('You were applied successfully'); } - resumeUploadError() { + resumeUploadError(event: any) { this.uploadedResume = false; } - resumeUploadSuccess() { + resumeUploadSuccess(event: any) { this.uploadedResume = true; } } diff --git a/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-resume/sample-po-upload-resume.component.html b/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-resume/sample-po-upload-resume.component.html index f5ffeeee7..94e6e4f63 100644 --- a/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-resume/sample-po-upload-resume.component.html +++ b/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-resume/sample-po-upload-resume.component.html @@ -4,7 +4,8 @@
- + +
@@ -15,20 +16,21 @@
-
+

Welcome, TOTVER!

Let's submit your project?

-
+
@@ -51,12 +51,14 @@

Welcome, TOTVER!

#upload class="po-sm-12" name="project" - [(ngModel)]="project" - p-hide-select-button - p-hide-send-button - p-required + [ngModel]="project" + (ngModelChange)="project = $event" + [p-hide-select-button]="true" + [p-hide-send-button]="true" + [p-required]="true" p-url="https://po-sample-api.herokuapp.com/v1/uploads/addFile" [p-restrictions]="restrictions" + (p-success)="eventSuccess($event)" >
@@ -69,7 +71,7 @@

Welcome, TOTVER!

p-label="Title" p-placeholder="Be creative" p-required - [p-disabled]="project.length < 1" + p-disabled="{{ project.length < 1 }}" >
@@ -80,19 +82,19 @@

Welcome, TOTVER!

name="description" [(ngModel)]="description" p-label="Description" - p-maxlength="140" + [p-maxlength]="140" p-placeholder="Resume on few words" - p-required + [p-required]="true" [p-disabled]="project.length < 1" >
-
+
@@ -103,7 +105,7 @@

Welcome, TOTVER!

-
+

Confirm informations

diff --git a/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-rs/sample-po-upload-rs.component.ts b/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-rs/sample-po-upload-rs.component.ts index bd644c1ee..41227f2a5 100644 --- a/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-rs/sample-po-upload-rs.component.ts +++ b/projects/ui/src/lib/components/po-field/po-upload/samples/sample-po-upload-rs/sample-po-upload-rs.component.ts @@ -1,17 +1,23 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { NgForm } from '@angular/forms'; -import { PoModalAction, PoModalComponent, PoStepperComponent, PoUploadComponent } from '@po-ui/ng-components'; +import { + PoModalAction, + PoModalComponent, + PoStepperComponent, + PoStepperOrientation, + PoUploadComponent +} from '@po-ui/ng-components'; @Component({ selector: 'sample-po-upload-rs', templateUrl: 'sample-po-upload-rs.component.html' }) export class SamplePoUploadRsComponent implements OnInit { - @ViewChild('upload', { static: true }) upload: PoUploadComponent; - @ViewChild('stepper', { static: true }) stepper: PoStepperComponent; - @ViewChild('submitForm', { static: true }) submitForm: NgForm; - @ViewChild('sucessData', { static: true }) sucessData: PoModalComponent; + @ViewChild('upload', { static: true }) upload!: PoUploadComponent; + @ViewChild('stepper', { static: true }) stepper!: PoStepperComponent; + @ViewChild('submitForm', { static: true }) submitForm!: NgForm; + @ViewChild('sucessData', { static: true }) sucessData!: PoModalComponent; confirm: PoModalAction = { action: () => { @@ -20,17 +26,20 @@ export class SamplePoUploadRsComponent implements OnInit { label: 'Return' }; - description: string; + description!: any; + orientation = PoStepperOrientation.Vertical; project: Array = []; restrictions = { allowedExtensions: ['.zip', '.7z', '.tar', '.wim'] }; - title: string; + title!: any; + + constructor() {} ngOnInit() { this.newSubmit(); } canSubmitProject() { - return !!(this.project && this.project.length) && this.title && this.description; + return !!(this.project && this.project.length) && !!this.title && !!this.description; } confirmSubmit() { @@ -41,11 +50,15 @@ export class SamplePoUploadRsComponent implements OnInit { submitProject() { this.upload.sendFiles(); + } + + eventSuccess(event: any) { this.stepper.next(); } private newSubmit() { this.project = []; + this.upload.clear(); this.title = undefined; this.description = undefined; }