-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #231 from cloudnc/feat-rewrite-documentation
- Loading branch information
Showing
10 changed files
with
366 additions
and
507 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
projects/ngx-sub-form/src/lib/deprecated/ngx-automatic-root-form.component.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
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
Binary file added
BIN
+249 KB
readme-assets/assets-to-build-the-basic-api-usage-picture/address-control.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 89 additions & 0 deletions
89
readme-assets/assets-to-build-the-basic-api-usage-picture/basic-api-usages.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,89 @@ | ||
// code used for the basic api usage picture | ||
// process if we need to update this: | ||
// create 3 code snippets as pictures using carbon.now.sh | ||
// here's the exact configuration used: https://carbon.now.sh/?bg=rgba%2882%2C161%2C209%2C1%29&t=seti&wt=none&l=application%2Ftypescript&ds=false&dsyoff=20px&dsblur=68px&wc=false&wa=true&pv=56px&ph=56px&ln=false&fl=1&fm=Hack&fs=14px&lh=152%25&si=false&es=2x&wm=false&code=code%2520goes%2520here | ||
// open up `ngx-sub-form-mini-presentation.psd` here: https://www.photopea.com | ||
// replace the pictures | ||
// export the new psd file and the new png to the repo | ||
@Component({ | ||
selector: 'person-container', | ||
template: ` | ||
<person-form [person]="person$ | async" (personUpdate)="personUpdate($event)"></person-form> | ||
`, | ||
}) | ||
export class PersonContainer { | ||
public person$: Observable<Person> = this.personService.person$; | ||
|
||
constructor(private personService: PersonService) {} | ||
|
||
public personUpdate(person: Person): void { | ||
this.personService.update(person); | ||
} | ||
} | ||
|
||
// note on this one, remove the `prettier-ignore` comment once | ||
// the code is on carbon.now.sh, this is just to keep a good | ||
// ratio for the image in the readme | ||
@Component({ | ||
selector: 'person-form', | ||
// prettier-ignore | ||
template: ` | ||
<form [formGroup]="form.formGroup"> | ||
<input type="text" [formControlName]="form.formControlNames.firstName" /> | ||
<input type="text" [formControlName]="form.formControlNames.lastName" /> | ||
<address-control | ||
[formControlName]="form.formControlNames.address" | ||
></address-control> | ||
</form> | ||
` | ||
}) | ||
export class PersonForm { | ||
private input$: Subject<Person | undefined> = new Subject(); | ||
@Input() set person(person: Person | undefined) { | ||
this.input$.next(person); | ||
} | ||
|
||
private disabled$: Subject<boolean> = new Subject(); | ||
@Input() set disabled(value: boolean | undefined) { | ||
this.disabled$.next(!!value); | ||
} | ||
|
||
@Output() personUpdate: Subject<Person> = new Subject(); | ||
|
||
public form = createForm<Person>(this, { | ||
formType: FormType.ROOT, | ||
disabled$: this.disabled$, | ||
input$: this.input$, | ||
output$: this.personUpdate, | ||
formControls: { | ||
id: new FormControl(null, Validators.required), | ||
firstName: new FormControl(null, Validators.required), | ||
lastName: new FormControl(null, Validators.required), | ||
address: new FormControl(null, Validators.required), | ||
}, | ||
}); | ||
} | ||
|
||
@Component({ | ||
selector: 'address-control', | ||
template: ` | ||
<div [formGroup]="form.formGroup"> | ||
<input type="text" [formControlName]="form.formControlNames.street" /> | ||
<input type="text" [formControlName]="form.formControlNames.city" /> | ||
<input type="text" [formControlName]="form.formControlNames.state" /> | ||
<input type="number" [formControlName]="form.formControlNames.zipCode" /> | ||
</div> | ||
`, | ||
providers: subformComponentProviders(PersonForm), | ||
}) | ||
export class PersonForm { | ||
public form = createForm<Address>(this, { | ||
formType: FormType.SUB, | ||
formControls: { | ||
street: new FormControl(null, Validators.required), | ||
city: new FormControl(null, Validators.required), | ||
state: new FormControl(null, Validators.required), | ||
zipCode: new FormControl(null, Validators.required), | ||
}, | ||
}); | ||
} |
Binary file added
BIN
+13.9 MB
.../assets-to-build-the-basic-api-usage-picture/ngx-sub-form-mini-presentation.psd
Binary file not shown.
Binary file added
BIN
+149 KB
readme-assets/assets-to-build-the-basic-api-usage-picture/person-container.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+380 KB
readme-assets/assets-to-build-the-basic-api-usage-picture/person-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.