@signaltree/ng-forms 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -17
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ const tree = signalTree({
|
|
|
37
37
|
newsletter: false,
|
|
38
38
|
theme: 'light',
|
|
39
39
|
},
|
|
40
|
-
})
|
|
40
|
+
});
|
|
41
41
|
|
|
42
42
|
// Automatic form generation
|
|
43
43
|
const userForm = tree.createForm('user');
|
|
@@ -80,7 +80,7 @@ class UserFormComponent {
|
|
|
80
80
|
email: '',
|
|
81
81
|
age: 0,
|
|
82
82
|
},
|
|
83
|
-
})
|
|
83
|
+
});
|
|
84
84
|
|
|
85
85
|
// Create form with automatic binding
|
|
86
86
|
userForm = this.tree.createForm('user', {
|
|
@@ -122,7 +122,7 @@ class TemplateFormComponent {
|
|
|
122
122
|
name: '',
|
|
123
123
|
email: '',
|
|
124
124
|
},
|
|
125
|
-
})
|
|
125
|
+
});
|
|
126
126
|
|
|
127
127
|
onSubmit(form: NgForm) {
|
|
128
128
|
if (form.valid) {
|
|
@@ -143,7 +143,7 @@ const tree = signalTree({
|
|
|
143
143
|
confirmPassword: '',
|
|
144
144
|
agreeToTerms: false,
|
|
145
145
|
},
|
|
146
|
-
})
|
|
146
|
+
});
|
|
147
147
|
|
|
148
148
|
// Custom validators that can access SignalTree state
|
|
149
149
|
const usernameAsyncValidator = (control: AbstractControl) => {
|
|
@@ -259,7 +259,7 @@ const tree = signalTree({
|
|
|
259
259
|
formConfig: {
|
|
260
260
|
fields: [] as FormField[],
|
|
261
261
|
},
|
|
262
|
-
})
|
|
262
|
+
});
|
|
263
263
|
|
|
264
264
|
@Injectable()
|
|
265
265
|
class DynamicFormService {
|
|
@@ -331,7 +331,7 @@ class DynamicFormComponent {
|
|
|
331
331
|
|
|
332
332
|
```typescript
|
|
333
333
|
const tree = signalTree(state).with(
|
|
334
|
-
|
|
334
|
+
/* createFormTree options can be passed here if applicable */
|
|
335
335
|
// Automatic synchronization settings
|
|
336
336
|
autoSync: true,
|
|
337
337
|
syncDirection: 'bidirectional', // 'toForm' | 'toState' | 'bidirectional'
|
|
@@ -432,7 +432,7 @@ const wizardTree = signalTree<WizardState>({
|
|
|
432
432
|
addressValid: false,
|
|
433
433
|
preferencesValid: false,
|
|
434
434
|
},
|
|
435
|
-
})
|
|
435
|
+
});
|
|
436
436
|
|
|
437
437
|
@Component({
|
|
438
438
|
template: `
|
|
@@ -619,7 +619,7 @@ const surveyTree = signalTree({
|
|
|
619
619
|
currentQuestion: 0,
|
|
620
620
|
isSubmitting: false,
|
|
621
621
|
submitError: null as string | null,
|
|
622
|
-
})
|
|
622
|
+
});
|
|
623
623
|
|
|
624
624
|
@Component({
|
|
625
625
|
template: `
|
|
@@ -851,16 +851,13 @@ Perfect for:
|
|
|
851
851
|
## Composition with other packages
|
|
852
852
|
|
|
853
853
|
```typescript
|
|
854
|
-
import {
|
|
855
|
-
import {
|
|
856
|
-
import { withValidation } from '@signaltree/validation';
|
|
857
|
-
import { withDevtools } from '@signaltree/devtools';
|
|
854
|
+
import { createFormTree } from '@signaltree/ng-forms';
|
|
855
|
+
import { withDevTools } from '@signaltree/devtools';
|
|
858
856
|
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
);
|
|
857
|
+
// Compose DevTools with your app tree separately if desired
|
|
858
|
+
const form = createFormTree(state);
|
|
859
|
+
// In development, you can enhance your app's SignalTree with DevTools
|
|
860
|
+
// const appTree = signalTree(appState).with(withDevTools());
|
|
864
861
|
```
|
|
865
862
|
|
|
866
863
|
## Performance benefits
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signaltree/ng-forms",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Complete Angular forms integration for SignalTree. FormTree creation, custom directives, validators, form state tracking, and RxJS bridge.",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/core": "^20.1.0",
|
|
7
7
|
"@angular/forms": "^20.1.0",
|
|
8
|
-
"@signaltree/core": "
|
|
8
|
+
"@signaltree/core": "^3.0.0",
|
|
9
9
|
"rxjs": "^7.0.0"
|
|
10
10
|
},
|
|
11
11
|
"sideEffects": false,
|