Skip to content

Commit 7e8551a

Browse files
committed
Add targetFormGroup to ConditionMatcherResult
1 parent 2bc5a2f commit 7e8551a

File tree

10 files changed

+221
-157
lines changed

10 files changed

+221
-157
lines changed

package-lock.json

+27-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
"@angular/platform-browser": "~11.2.1",
2525
"@angular/platform-browser-dynamic": "~11.2.1",
2626
"@angular/router": "~11.2.1",
27-
"mfx-advanced-condition-matcher": "^1.1.0",
28-
"mfx-field-presence-matcher": "2.0.0",
29-
"mfx-key-value-matcher": "1.0.0",
27+
"mfx-advanced-condition-matcher": "latest",
28+
"mfx-field-presence-matcher": "latest",
29+
"mfx-key-value-matcher": "latest",
3030
"ng-dynamic-component": "^8.0.1",
3131
"rxjs": "~6.6.0",
3232
"tslib": "^2.0.0",

projects/mf-dynamic-form-demo/src/app/app.component.html

+14
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,17 @@ <h3>Form</h3>
1717
</pre>
1818
</div>
1919

20+
<div>
21+
<h1>External Form Group</h1>
22+
<form [formGroup]="externalFormGroup">
23+
<label for="first-name">First Name: </label>
24+
<input id="first-name" type="text" formControlName="firstName">
25+
26+
<label for="last-name">Last Name: </label>
27+
<input id="last-name" type="text" formControlName="lastName">
28+
</form>
29+
30+
31+
<p>Target Form Group: {{ externalFormGroup.value | json }}</p>
32+
</div>
33+

projects/mf-dynamic-form-demo/src/app/app.component.ts

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {Component, OnInit, ViewChild} from '@angular/core';
1+
import {Component, ViewChild} from '@angular/core';
22
import {PURCHASE_ORDER_FORM_DEFINITION} from './order-form-definition';
3-
import {MfForm} from 'mf-dynamic-form';
4-
import {DynamicFormComponent} from 'mf-dynamic-form';
5-
import {FormApi} from 'mf-dynamic-form';
3+
import {DynamicFormComponent, FormApi, MfForm} from 'mf-dynamic-form';
4+
import {FormBuilder} from '@angular/forms';
5+
66

77
@Component({
88
selector: 'app-root',
@@ -13,10 +13,19 @@ export class AppComponent {
1313
@ViewChild(DynamicFormComponent)
1414
dynamicForm: DynamicFormComponent;
1515

16-
form: MfForm = PURCHASE_ORDER_FORM_DEFINITION;
16+
externalFormGroup = this.fb.group({
17+
firstName: [''],
18+
lastName: ['']
19+
});
20+
21+
form: MfForm = PURCHASE_ORDER_FORM_DEFINITION(this.externalFormGroup);
1722
api: FormApi;
1823
formData: any;
1924

25+
26+
27+
constructor(private fb: FormBuilder) { }
28+
2029
onSubmit(formData: any) {
2130
console.log(formData)
2231
this.formData = formData;

projects/mf-dynamic-form-demo/src/app/app.module.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ import {MfDynamicFormModule} from 'mf-dynamic-form';
44

55
import {AppComponent} from './app.component';
66
import {ExempleCustomFormControlComponent} from './custom-form-controls/exemple-custom-form-control.component';
7+
import {ReactiveFormsModule} from '@angular/forms';
78

89
@NgModule({
910
declarations: [
1011
AppComponent,
1112
ExempleCustomFormControlComponent
1213
],
13-
imports: [
14-
BrowserModule, MfDynamicFormModule
15-
],
14+
imports: [
15+
BrowserModule, MfDynamicFormModule, ReactiveFormsModule
16+
],
1617
providers: [],
1718
bootstrap: [AppComponent]
1819
})

0 commit comments

Comments
 (0)