@tehw0lf/contact-form 0.0.2 → 0.0.6
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/LICENSE +21 -0
- package/README.md +70 -4
- package/esm2020/lib/contact-form/contact-form.component.mjs +7 -4
- package/fesm2015/tehw0lf-contact-form.mjs +6 -3
- package/fesm2015/tehw0lf-contact-form.mjs.map +1 -1
- package/fesm2020/tehw0lf-contact-form.mjs +6 -3
- package/fesm2020/tehw0lf-contact-form.mjs.map +1 -1
- package/lib/contact-form/contact-form.component.d.ts +2 -1
- package/package.json +15 -1
- package/schematics/collection.json +16 -0
- package/schematics/ng-add/index.d.ts +3 -0
- package/schematics/ng-add/index.js +35 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/index.spec.d.ts +1 -0
- package/schematics/ng-add/index.spec.js +103 -0
- package/schematics/ng-add/index.spec.js.map +1 -0
- package/schematics/ng-add/package-config.d.ts +12 -0
- package/schematics/ng-add/package-config.js +48 -0
- package/schematics/ng-add/package-config.js.map +1 -0
- package/schematics/ng-add/schema.d.ts +3 -0
- package/schematics/ng-add/schema.js +3 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/schematics/ng-add/schema.json +16 -0
- package/schematics/ng-add/setup.d.ts +3 -0
- package/schematics/ng-add/setup.js +48 -0
- package/schematics/ng-add/setup.js.map +1 -0
- package/schematics/testing/file-content.d.ts +10 -0
- package/schematics/testing/file-content.js +13 -0
- package/schematics/testing/file-content.js.map +1 -0
- package/schematics/testing/test-app.d.ts +12 -0
- package/schematics/testing/test-app.js +44 -0
- package/schematics/testing/test-app.js.map +1 -0
- package/schematics/testing/test-library.d.ts +11 -0
- package/schematics/testing/test-library.js +21 -0
- package/schematics/testing/test-library.js.map +1 -0
- package/schematics/testing/test-project.d.ts +11 -0
- package/schematics/testing/test-project.js +29 -0
- package/schematics/testing/test-project.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021,2022 Robert Weyres
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -5,14 +5,43 @@ The component takes as input an API-URL.
|
|
|
5
5
|
|
|
6
6
|
Default is 'https://forwardmethis.com/tehwolf@pm.me' - please change it, as you will need to confirm the API access for the first email you will receive.
|
|
7
7
|
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
### Peer Dependencies
|
|
11
|
+
|
|
12
|
+
The following dependencies are needed:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
@angular/animations
|
|
16
|
+
@angular/cdk
|
|
17
|
+
@angular/common
|
|
18
|
+
@angular/core
|
|
19
|
+
@angular/flex-layout
|
|
20
|
+
@angular/forms
|
|
21
|
+
@angular/material
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Module
|
|
25
|
+
|
|
26
|
+
If it's not added already, please run `ng add @angular/material` prior to adding this module.
|
|
27
|
+
Run `ng add @tehw0lf/contact-form` in the workspace root of your angular application.
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
The contact form component takes an apiURL and an email as input. By default, this is set to [ForwardMeThis](https://forwardmethis.com) and the email address is blank. You can set the variables on the component tag:
|
|
32
|
+
|
|
8
33
|
```html
|
|
9
|
-
<contact-form
|
|
34
|
+
<contact-form
|
|
35
|
+
[apiURL]="emailBackendURL"
|
|
36
|
+
[email]="yourEmailAddress"
|
|
37
|
+
></contact-form>
|
|
10
38
|
```
|
|
11
39
|
|
|
12
|
-
In your component, set the `emailBackendURL`
|
|
40
|
+
In your component, set the `emailBackendURL` and `yourEmailAddress` properties. The naming of these variables is arbitrary:
|
|
13
41
|
|
|
14
42
|
```ts
|
|
15
|
-
emailBackendURL = 'https://forwardmethis.com/
|
|
43
|
+
emailBackendURL = 'https://forwardmethis.com/';
|
|
44
|
+
yourEmailAddress = 'my@mail.com'; //this is optional, if your API URL doesn't require an email address parameter
|
|
16
45
|
```
|
|
17
46
|
|
|
18
47
|
This contact form will send a POST request to the API, containing the following data structure:
|
|
@@ -25,4 +54,41 @@ This contact form will send a POST request to the API, containing the following
|
|
|
25
54
|
}
|
|
26
55
|
```
|
|
27
56
|
|
|
28
|
-
You can of course use your own backend with this data structure, as the API-URL can be overridden as shown above.
|
|
57
|
+
You can of course use your own backend with this data structure, as the API-URL and E-Mail address can be overridden as shown above.
|
|
58
|
+
|
|
59
|
+
## Theming
|
|
60
|
+
|
|
61
|
+
The colors of card background, button and text as well as the backdrop filter can be customized with optional input parameters:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
backgroundColor; //default: 'rgba(34, 34, 34, 0.75)';
|
|
65
|
+
backdropFilter; //default: 'blur(50px)';
|
|
66
|
+
buttonColor; //default: '#cc7832';
|
|
67
|
+
buttonBackgroundColor; //default: ''
|
|
68
|
+
buttonTextColor; //default: '#cc7832';
|
|
69
|
+
labelColor; //default: 'lightgray';
|
|
70
|
+
textColor; //default: 'lightgray';
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Development
|
|
74
|
+
|
|
75
|
+
### Serve
|
|
76
|
+
|
|
77
|
+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
|
78
|
+
|
|
79
|
+
### Build
|
|
80
|
+
|
|
81
|
+
Run `ng build contact-form` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build (e.g. when building to publish to npm).
|
|
82
|
+
|
|
83
|
+
### Running unit tests
|
|
84
|
+
|
|
85
|
+
Run `ng test` to execute the unit tests via [Jest](https://jestjs.io).
|
|
86
|
+
|
|
87
|
+
## To Do
|
|
88
|
+
|
|
89
|
+
Apply Material Design
|
|
90
|
+
Extract CSS variables
|
|
91
|
+
|
|
92
|
+
## Contributing
|
|
93
|
+
|
|
94
|
+
Contributions are welcome, although the library is still in an alpha stage. Feel free to open a PR and I'll have a look!
|
|
@@ -11,7 +11,8 @@ export class ContactFormComponent {
|
|
|
11
11
|
constructor(builder, emailService) {
|
|
12
12
|
this.builder = builder;
|
|
13
13
|
this.emailService = emailService;
|
|
14
|
-
this.apiURL = 'https://forwardmethis.com/
|
|
14
|
+
this.apiURL = 'https://forwardmethis.com/';
|
|
15
|
+
this.email = '';
|
|
15
16
|
this.emailSent = new Subject();
|
|
16
17
|
this.emailSent$ = this.emailSent.asObservable();
|
|
17
18
|
this.unsubscribe$ = new Subject();
|
|
@@ -28,7 +29,7 @@ export class ContactFormComponent {
|
|
|
28
29
|
}
|
|
29
30
|
submitFormData(formData) {
|
|
30
31
|
this.emailService
|
|
31
|
-
.sendEmail(this.apiURL
|
|
32
|
+
.sendEmail(`${this.apiURL}${this.email}`, formData.value)
|
|
32
33
|
.pipe(tap((response) => {
|
|
33
34
|
if (response === 'OK') {
|
|
34
35
|
this.emailSent.next(true);
|
|
@@ -41,11 +42,13 @@ export class ContactFormComponent {
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
ContactFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ContactFormComponent, deps: [{ token: i1.FormBuilder }, { token: i2.EmailApiService }], target: i0.ɵɵFactoryTarget.Component });
|
|
44
|
-
ContactFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: ContactFormComponent, selector: "contact-form", inputs: { apiURL: "apiURL" }, ngImport: i0, template: "<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n", styles: [".contact-form{background-color:#fff;max-width:500px;margin:auto;padding:40px;box-shadow:0 2px 10px #00000013;box-sizing:border-box}.form-button{display:block;border:1px solid #ced4da;border-radius:.25rem;width:96%;padding:.375rem .75rem}.form-control{display:block;width:90%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#282b2e;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;margin-top:.5rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-group{margin-bottom:1rem}.form-status{margin-top:2rem}textarea{overflow:auto;resize:vertical}\n"], directives: [{ type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe } });
|
|
45
|
+
ContactFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: ContactFormComponent, selector: "contact-form", inputs: { apiURL: "apiURL", email: "email" }, ngImport: i0, template: "<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n", styles: [".contact-form{background-color:#fff;max-width:500px;margin:auto;padding:40px;box-shadow:0 2px 10px #00000013;box-sizing:border-box}.form-button{display:block;border:1px solid #ced4da;border-radius:.25rem;width:96%;padding:.375rem .75rem}.form-control{display:block;width:90%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#282b2e;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;margin-top:.5rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-group{margin-bottom:1rem}.form-status{margin-top:2rem}textarea{overflow:auto;resize:vertical}\n"], directives: [{ type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe } });
|
|
45
46
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ContactFormComponent, decorators: [{
|
|
46
47
|
type: Component,
|
|
47
48
|
args: [{ selector: 'contact-form', template: "<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n", styles: [".contact-form{background-color:#fff;max-width:500px;margin:auto;padding:40px;box-shadow:0 2px 10px #00000013;box-sizing:border-box}.form-button{display:block;border:1px solid #ced4da;border-radius:.25rem;width:96%;padding:.375rem .75rem}.form-control{display:block;width:90%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#282b2e;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;margin-top:.5rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-group{margin-bottom:1rem}.form-status{margin-top:2rem}textarea{overflow:auto;resize:vertical}\n"] }]
|
|
48
49
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.EmailApiService }]; }, propDecorators: { apiURL: [{
|
|
49
50
|
type: Input
|
|
51
|
+
}], email: [{
|
|
52
|
+
type: Input
|
|
50
53
|
}] } });
|
|
51
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
54
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udGFjdC1mb3JtLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvY29udGFjdC1mb3JtL3NyYy9saWIvY29udGFjdC1mb3JtL2NvbnRhY3QtZm9ybS5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL2NvbnRhY3QtZm9ybS9zcmMvbGliL2NvbnRhY3QtZm9ybS9jb250YWN0LWZvcm0uY29tcG9uZW50Lmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQWEsTUFBTSxlQUFlLENBQUM7QUFDNUQsT0FBTyxFQUFFLFdBQVcsRUFBRSxXQUFXLEVBQWEsVUFBVSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDakYsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUMvQixPQUFPLEVBQUUsU0FBUyxFQUFFLEdBQUcsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBRWhELE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQzs7Ozs7QUFRdkQsTUFBTSxPQUFPLG9CQUFvQjtJQVUvQixZQUNVLE9BQW9CLEVBQ3BCLFlBQTZCO1FBRDdCLFlBQU8sR0FBUCxPQUFPLENBQWE7UUFDcEIsaUJBQVksR0FBWixZQUFZLENBQWlCO1FBWDlCLFdBQU0sR0FBRyw0QkFBNEIsQ0FBQztRQU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cnNlbmRldCB3ZXJkZW5cbiAgPC9kaXY+XG48L2Zvcm0+XG4iXX0=
|
|
@@ -39,7 +39,8 @@ class ContactFormComponent {
|
|
|
39
39
|
constructor(builder, emailService) {
|
|
40
40
|
this.builder = builder;
|
|
41
41
|
this.emailService = emailService;
|
|
42
|
-
this.apiURL = 'https://forwardmethis.com/
|
|
42
|
+
this.apiURL = 'https://forwardmethis.com/';
|
|
43
|
+
this.email = '';
|
|
43
44
|
this.emailSent = new Subject();
|
|
44
45
|
this.emailSent$ = this.emailSent.asObservable();
|
|
45
46
|
this.unsubscribe$ = new Subject();
|
|
@@ -56,7 +57,7 @@ class ContactFormComponent {
|
|
|
56
57
|
}
|
|
57
58
|
submitFormData(formData) {
|
|
58
59
|
this.emailService
|
|
59
|
-
.sendEmail(this.apiURL
|
|
60
|
+
.sendEmail(`${this.apiURL}${this.email}`, formData.value)
|
|
60
61
|
.pipe(tap((response) => {
|
|
61
62
|
if (response === 'OK') {
|
|
62
63
|
this.emailSent.next(true);
|
|
@@ -69,12 +70,14 @@ class ContactFormComponent {
|
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
ContactFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ContactFormComponent, deps: [{ token: i1$1.FormBuilder }, { token: EmailApiService }], target: i0.ɵɵFactoryTarget.Component });
|
|
72
|
-
ContactFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: ContactFormComponent, selector: "contact-form", inputs: { apiURL: "apiURL" }, ngImport: i0, template: "<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n", styles: [".contact-form{background-color:#fff;max-width:500px;margin:auto;padding:40px;box-shadow:0 2px 10px #00000013;box-sizing:border-box}.form-button{display:block;border:1px solid #ced4da;border-radius:.25rem;width:96%;padding:.375rem .75rem}.form-control{display:block;width:90%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#282b2e;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;margin-top:.5rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-group{margin-bottom:1rem}.form-status{margin-top:2rem}textarea{overflow:auto;resize:vertical}\n"], directives: [{ type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe } });
|
|
73
|
+
ContactFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: ContactFormComponent, selector: "contact-form", inputs: { apiURL: "apiURL", email: "email" }, ngImport: i0, template: "<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n", styles: [".contact-form{background-color:#fff;max-width:500px;margin:auto;padding:40px;box-shadow:0 2px 10px #00000013;box-sizing:border-box}.form-button{display:block;border:1px solid #ced4da;border-radius:.25rem;width:96%;padding:.375rem .75rem}.form-control{display:block;width:90%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#282b2e;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;margin-top:.5rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-group{margin-bottom:1rem}.form-status{margin-top:2rem}textarea{overflow:auto;resize:vertical}\n"], directives: [{ type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe } });
|
|
73
74
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ContactFormComponent, decorators: [{
|
|
74
75
|
type: Component,
|
|
75
76
|
args: [{ selector: 'contact-form', template: "<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n", styles: [".contact-form{background-color:#fff;max-width:500px;margin:auto;padding:40px;box-shadow:0 2px 10px #00000013;box-sizing:border-box}.form-button{display:block;border:1px solid #ced4da;border-radius:.25rem;width:96%;padding:.375rem .75rem}.form-control{display:block;width:90%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#282b2e;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;margin-top:.5rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-group{margin-bottom:1rem}.form-status{margin-top:2rem}textarea{overflow:auto;resize:vertical}\n"] }]
|
|
76
77
|
}], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: EmailApiService }]; }, propDecorators: { apiURL: [{
|
|
77
78
|
type: Input
|
|
79
|
+
}], email: [{
|
|
80
|
+
type: Input
|
|
78
81
|
}] } });
|
|
79
82
|
|
|
80
83
|
class ContactFormModule {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tehw0lf-contact-form.mjs","sources":["../../../../libs/contact-form/src/lib/email-api.service.ts","../../../../libs/contact-form/src/lib/contact-form/contact-form.component.ts","../../../../libs/contact-form/src/lib/contact-form/contact-form.component.html","../../../../libs/contact-form/src/lib/contact-form.module.ts","../../../../libs/contact-form/src/tehw0lf-contact-form.ts"],"sourcesContent":["import { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class EmailApiService {\n httpOptions = {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n })\n };\n constructor(private http: HttpClient) {}\n\n sendEmail(apiURL: string, data: any): Observable<any> {\n return this.http.post(apiURL, JSON.stringify(data), this.httpOptions).pipe(\n map((response: any) => {\n return response;\n }),\n catchError((error: any) => {\n return of(error.statusText);\n })\n );\n }\n}\n","import { Component, Input, OnDestroy } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';\nimport { Subject } from 'rxjs';\nimport { takeUntil, tap } from 'rxjs/operators';\n\nimport { EmailApiService } from '../email-api.service';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'contact-form',\n templateUrl: './contact-form.component.html',\n styleUrls: ['./contact-form.component.scss']\n})\nexport class ContactFormComponent implements OnDestroy {\n @Input() apiURL = 'https://forwardmethis.com/
|
|
1
|
+
{"version":3,"file":"tehw0lf-contact-form.mjs","sources":["../../../../libs/contact-form/src/lib/email-api.service.ts","../../../../libs/contact-form/src/lib/contact-form/contact-form.component.ts","../../../../libs/contact-form/src/lib/contact-form/contact-form.component.html","../../../../libs/contact-form/src/lib/contact-form.module.ts","../../../../libs/contact-form/src/tehw0lf-contact-form.ts"],"sourcesContent":["import { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class EmailApiService {\n httpOptions = {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n })\n };\n constructor(private http: HttpClient) {}\n\n sendEmail(apiURL: string, data: any): Observable<any> {\n return this.http.post(apiURL, JSON.stringify(data), this.httpOptions).pipe(\n map((response: any) => {\n return response;\n }),\n catchError((error: any) => {\n return of(error.statusText);\n })\n );\n }\n}\n","import { Component, Input, OnDestroy } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';\nimport { Subject } from 'rxjs';\nimport { takeUntil, tap } from 'rxjs/operators';\n\nimport { EmailApiService } from '../email-api.service';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'contact-form',\n templateUrl: './contact-form.component.html',\n styleUrls: ['./contact-form.component.scss']\n})\nexport class ContactFormComponent implements OnDestroy {\n @Input() apiURL = 'https://forwardmethis.com/';\n @Input() email = '';\n\n formGroup: FormGroup;\n emailSent: Subject<boolean | null> = new Subject();\n emailSent$ = this.emailSent.asObservable();\n\n private unsubscribe$: Subject<void> = new Subject();\n\n constructor(\n private builder: FormBuilder,\n private emailService: EmailApiService\n ) {\n this.emailSent.next(null);\n this.formGroup = this.builder.group({\n name: new FormControl('', [Validators.required]),\n email: new FormControl('', [Validators.required, Validators.email]),\n message: new FormControl('', [Validators.required])\n });\n }\n\n ngOnDestroy(): void {\n this.unsubscribe$.next();\n this.unsubscribe$.complete();\n }\n\n submitFormData(formData: FormGroup) {\n this.emailService\n .sendEmail(`${this.apiURL}${this.email}`, formData.value)\n .pipe(\n tap((response: string) => {\n if (response === 'OK') {\n this.emailSent.next(true);\n } else {\n this.emailSent.next(false);\n }\n }),\n takeUntil(this.unsubscribe$)\n )\n .subscribe();\n }\n}\n","<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n","import { CommonModule } from '@angular/common';\nimport { HttpClientModule } from '@angular/common/http';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { ContactFormComponent } from './contact-form/contact-form.component';\nimport { EmailApiService } from './email-api.service';\n\n@NgModule({\n imports: [CommonModule, HttpClientModule, ReactiveFormsModule],\n declarations: [ContactFormComponent],\n exports: [ContactFormComponent],\n providers: [EmailApiService],\n})\nexport class ContactFormModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;MAQa,eAAe;IAM1B,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;QALpC,gBAAW,GAAG;YACZ,OAAO,EAAE,IAAI,WAAW,CAAC;gBACvB,cAAc,EAAE,kBAAkB;aACnC,CAAC;SACH,CAAC;KACsC;IAExC,SAAS,CAAC,MAAc,EAAE,IAAS;QACjC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CACxE,GAAG,CAAC,CAAC,QAAa;YAChB,OAAO,QAAQ,CAAC;SACjB,CAAC,EACF,UAAU,CAAC,CAAC,KAAU;YACpB,OAAO,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;SAC7B,CAAC,CACH,CAAC;KACH;;4GAjBU,eAAe;gHAAf,eAAe,cAFd,MAAM;2FAEP,eAAe;kBAH3B,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;MCMY,oBAAoB;IAU/B,YACU,OAAoB,EACpB,YAA6B;QAD7B,YAAO,GAAP,OAAO,CAAa;QACpB,iBAAY,GAAZ,YAAY,CAAiB;QAX9B,WAAM,GAAG,4BAA4B,CAAC;QACtC,UAAK,GAAG,EAAE,CAAC;QAGpB,cAAS,GAA4B,I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+HAKf,MAAM;sBAAd,KAAK;gBACG,KAAK;sBAAb,KAAK;;;MEDK,iBAAiB;;8GAAjB,iBAAiB;+GAAjB,iBAAiB,iBAJb,oBAAoB,aADzB,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,aAEnD,oBAAoB;+GAGnB,iBAAiB,aAFjB,CAAC,eAAe,CAAC,YAHnB,CAAC,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,CAAC;2FAKnD,iBAAiB;kBAN7B,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,CAAC;oBAC9D,YAAY,EAAE,CAAC,oBAAoB,CAAC;oBACpC,OAAO,EAAE,CAAC,oBAAoB,CAAC;oBAC/B,SAAS,EAAE,CAAC,eAAe,CAAC;iBAC7B;;;ACbD;;;;;;"}
|
|
@@ -39,7 +39,8 @@ class ContactFormComponent {
|
|
|
39
39
|
constructor(builder, emailService) {
|
|
40
40
|
this.builder = builder;
|
|
41
41
|
this.emailService = emailService;
|
|
42
|
-
this.apiURL = 'https://forwardmethis.com/
|
|
42
|
+
this.apiURL = 'https://forwardmethis.com/';
|
|
43
|
+
this.email = '';
|
|
43
44
|
this.emailSent = new Subject();
|
|
44
45
|
this.emailSent$ = this.emailSent.asObservable();
|
|
45
46
|
this.unsubscribe$ = new Subject();
|
|
@@ -56,7 +57,7 @@ class ContactFormComponent {
|
|
|
56
57
|
}
|
|
57
58
|
submitFormData(formData) {
|
|
58
59
|
this.emailService
|
|
59
|
-
.sendEmail(this.apiURL
|
|
60
|
+
.sendEmail(`${this.apiURL}${this.email}`, formData.value)
|
|
60
61
|
.pipe(tap((response) => {
|
|
61
62
|
if (response === 'OK') {
|
|
62
63
|
this.emailSent.next(true);
|
|
@@ -69,12 +70,14 @@ class ContactFormComponent {
|
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
ContactFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ContactFormComponent, deps: [{ token: i1$1.FormBuilder }, { token: EmailApiService }], target: i0.ɵɵFactoryTarget.Component });
|
|
72
|
-
ContactFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: ContactFormComponent, selector: "contact-form", inputs: { apiURL: "apiURL" }, ngImport: i0, template: "<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n", styles: [".contact-form{background-color:#fff;max-width:500px;margin:auto;padding:40px;box-shadow:0 2px 10px #00000013;box-sizing:border-box}.form-button{display:block;border:1px solid #ced4da;border-radius:.25rem;width:96%;padding:.375rem .75rem}.form-control{display:block;width:90%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#282b2e;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;margin-top:.5rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-group{margin-bottom:1rem}.form-status{margin-top:2rem}textarea{overflow:auto;resize:vertical}\n"], directives: [{ type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe } });
|
|
73
|
+
ContactFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: ContactFormComponent, selector: "contact-form", inputs: { apiURL: "apiURL", email: "email" }, ngImport: i0, template: "<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n", styles: [".contact-form{background-color:#fff;max-width:500px;margin:auto;padding:40px;box-shadow:0 2px 10px #00000013;box-sizing:border-box}.form-button{display:block;border:1px solid #ced4da;border-radius:.25rem;width:96%;padding:.375rem .75rem}.form-control{display:block;width:90%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#282b2e;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;margin-top:.5rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-group{margin-bottom:1rem}.form-status{margin-top:2rem}textarea{overflow:auto;resize:vertical}\n"], directives: [{ type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe } });
|
|
73
74
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: ContactFormComponent, decorators: [{
|
|
74
75
|
type: Component,
|
|
75
76
|
args: [{ selector: 'contact-form', template: "<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n", styles: [".contact-form{background-color:#fff;max-width:500px;margin:auto;padding:40px;box-shadow:0 2px 10px #00000013;box-sizing:border-box}.form-button{display:block;border:1px solid #ced4da;border-radius:.25rem;width:96%;padding:.375rem .75rem}.form-control{display:block;width:90%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#282b2e;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;margin-top:.5rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-group{margin-bottom:1rem}.form-status{margin-top:2rem}textarea{overflow:auto;resize:vertical}\n"] }]
|
|
76
77
|
}], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: EmailApiService }]; }, propDecorators: { apiURL: [{
|
|
77
78
|
type: Input
|
|
79
|
+
}], email: [{
|
|
80
|
+
type: Input
|
|
78
81
|
}] } });
|
|
79
82
|
|
|
80
83
|
class ContactFormModule {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tehw0lf-contact-form.mjs","sources":["../../../../libs/contact-form/src/lib/email-api.service.ts","../../../../libs/contact-form/src/lib/contact-form/contact-form.component.ts","../../../../libs/contact-form/src/lib/contact-form/contact-form.component.html","../../../../libs/contact-form/src/lib/contact-form.module.ts","../../../../libs/contact-form/src/tehw0lf-contact-form.ts"],"sourcesContent":["import { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class EmailApiService {\n httpOptions = {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n })\n };\n constructor(private http: HttpClient) {}\n\n sendEmail(apiURL: string, data: any): Observable<any> {\n return this.http.post(apiURL, JSON.stringify(data), this.httpOptions).pipe(\n map((response: any) => {\n return response;\n }),\n catchError((error: any) => {\n return of(error.statusText);\n })\n );\n }\n}\n","import { Component, Input, OnDestroy } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';\nimport { Subject } from 'rxjs';\nimport { takeUntil, tap } from 'rxjs/operators';\n\nimport { EmailApiService } from '../email-api.service';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'contact-form',\n templateUrl: './contact-form.component.html',\n styleUrls: ['./contact-form.component.scss']\n})\nexport class ContactFormComponent implements OnDestroy {\n @Input() apiURL = 'https://forwardmethis.com/
|
|
1
|
+
{"version":3,"file":"tehw0lf-contact-form.mjs","sources":["../../../../libs/contact-form/src/lib/email-api.service.ts","../../../../libs/contact-form/src/lib/contact-form/contact-form.component.ts","../../../../libs/contact-form/src/lib/contact-form/contact-form.component.html","../../../../libs/contact-form/src/lib/contact-form.module.ts","../../../../libs/contact-form/src/tehw0lf-contact-form.ts"],"sourcesContent":["import { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class EmailApiService {\n httpOptions = {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n })\n };\n constructor(private http: HttpClient) {}\n\n sendEmail(apiURL: string, data: any): Observable<any> {\n return this.http.post(apiURL, JSON.stringify(data), this.httpOptions).pipe(\n map((response: any) => {\n return response;\n }),\n catchError((error: any) => {\n return of(error.statusText);\n })\n );\n }\n}\n","import { Component, Input, OnDestroy } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';\nimport { Subject } from 'rxjs';\nimport { takeUntil, tap } from 'rxjs/operators';\n\nimport { EmailApiService } from '../email-api.service';\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'contact-form',\n templateUrl: './contact-form.component.html',\n styleUrls: ['./contact-form.component.scss']\n})\nexport class ContactFormComponent implements OnDestroy {\n @Input() apiURL = 'https://forwardmethis.com/';\n @Input() email = '';\n\n formGroup: FormGroup;\n emailSent: Subject<boolean | null> = new Subject();\n emailSent$ = this.emailSent.asObservable();\n\n private unsubscribe$: Subject<void> = new Subject();\n\n constructor(\n private builder: FormBuilder,\n private emailService: EmailApiService\n ) {\n this.emailSent.next(null);\n this.formGroup = this.builder.group({\n name: new FormControl('', [Validators.required]),\n email: new FormControl('', [Validators.required, Validators.email]),\n message: new FormControl('', [Validators.required])\n });\n }\n\n ngOnDestroy(): void {\n this.unsubscribe$.next();\n this.unsubscribe$.complete();\n }\n\n submitFormData(formData: FormGroup) {\n this.emailService\n .sendEmail(`${this.apiURL}${this.email}`, formData.value)\n .pipe(\n tap((response: string) => {\n if (response === 'OK') {\n this.emailSent.next(true);\n } else {\n this.emailSent.next(false);\n }\n }),\n takeUntil(this.unsubscribe$)\n )\n .subscribe();\n }\n}\n","<form\n class=\"contact-form\"\n [formGroup]=\"formGroup\"\n (ngSubmit)=\"submitFormData(formGroup)\"\n>\n <div class=\"form-group\">\n <label for=\"name\">Ihr Name</label>\n <input\n class=\"form-control\"\n type=\"text\"\n name=\"name\"\n placeholder=\"Name\"\n formControlName=\"name\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"email\">Ihre E-Mail Adresse</label>\n <input\n class=\"form-control\"\n type=\"email\"\n name=\"email\"\n placeholder=\"ihre@mail.de\"\n formControlName=\"email\"\n />\n </div>\n <div class=\"form-group\">\n <label for=\"message\">Ihre Nachricht</label>\n <textarea class=\"form-control\" formControlName=\"message\" name=\"message\">\n </textarea>\n </div>\n <button class=\"form-button\" type=\"submit\" [disabled]=\"!formGroup.valid\">\n Senden\n </button>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === true\">\n E-Mail erfolgreich versendet!\n </div>\n <div class=\"form-status\" *ngIf=\"(emailSent$ | async) === false\">\n Fehler: E-Mail konnte nicht versendet werden\n </div>\n</form>\n","import { CommonModule } from '@angular/common';\nimport { HttpClientModule } from '@angular/common/http';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { ContactFormComponent } from './contact-form/contact-form.component';\nimport { EmailApiService } from './email-api.service';\n\n@NgModule({\n imports: [CommonModule, HttpClientModule, ReactiveFormsModule],\n declarations: [ContactFormComponent],\n exports: [ContactFormComponent],\n providers: [EmailApiService],\n})\nexport class ContactFormModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;MAQa,eAAe;IAM1B,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;QALpC,gBAAW,GAAG;YACZ,OAAO,EAAE,IAAI,WAAW,CAAC;gBACvB,cAAc,EAAE,kBAAkB;aACnC,CAAC;SACH,CAAC;KACsC;IAExC,SAAS,CAAC,MAAc,EAAE,IAAS;QACjC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CACxE,GAAG,CAAC,CAAC,QAA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AI,CAAC,KAAK,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC;aACxD,IAAI,CACH,GAAG,CAAC,CAAC,QAAgB;YACnB,IAAI,QAAQ,KAAK,IAAI,EAAE;gBACrB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC3B;iBAAM;gBACL,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAC5B;SACF,CAAC,EACF,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAC7B;aACA,SAAS,EAAE,CAAC;KAChB;;iHAzCU,oBAAoB;qGAApB,oBAAoB,kGCbjC,soCAwCA;2FD3Ba,oBAAoB;kBANhC,SAAS;+BAEE,cAAc;+HAKf,MAAM;sBAAd,KAAK;gBACG,KAAK;sBAAb,KAAK;;;MEDK,iBAAiB;;8GAAjB,iBAAiB;+GAAjB,iBAAiB,iBAJb,oBAAoB,aADzB,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,aAEnD,oBAAoB;+GAGnB,iBAAiB,aAFjB,CAAC,eAAe,CAAC,YAHnB,CAAC,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,CAAC;2FAKnD,iBAAiB;kBAN7B,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,CAAC;oBAC9D,YAAY,EAAE,CAAC,oBAAoB,CAAC;oBACpC,OAAO,EAAE,CAAC,oBAAoB,CAAC;oBAC/B,SAAS,EAAE,CAAC,eAAe,CAAC;iBAC7B;;;ACbD;;;;;;"}
|
|
@@ -7,6 +7,7 @@ export declare class ContactFormComponent implements OnDestroy {
|
|
|
7
7
|
private builder;
|
|
8
8
|
private emailService;
|
|
9
9
|
apiURL: string;
|
|
10
|
+
email: string;
|
|
10
11
|
formGroup: FormGroup;
|
|
11
12
|
emailSent: Subject<boolean | null>;
|
|
12
13
|
emailSent$: import("rxjs").Observable<boolean | null>;
|
|
@@ -15,5 +16,5 @@ export declare class ContactFormComponent implements OnDestroy {
|
|
|
15
16
|
ngOnDestroy(): void;
|
|
16
17
|
submitFormData(formData: FormGroup): void;
|
|
17
18
|
static ɵfac: i0.ɵɵFactoryDeclaration<ContactFormComponent, never>;
|
|
18
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ContactFormComponent, "contact-form", never, { "apiURL": "apiURL"; }, {}, never, never>;
|
|
19
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ContactFormComponent, "contact-form", never, { "apiURL": "apiURL"; "email": "email"; }, {}, never, never>;
|
|
19
20
|
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tehw0lf/contact-form",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"homepage": "https://github.com/tehw0lf/tehwol.fi.git",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/tehw0lf/tehwol.fi.git"
|
|
9
|
+
},
|
|
4
10
|
"peerDependencies": {
|
|
11
|
+
"@angular/animations": "^13.1.0",
|
|
12
|
+
"@angular/cdk": "^13.1.0",
|
|
5
13
|
"@angular/common": "^13.1.0",
|
|
6
14
|
"@angular/core": "^13.1.0",
|
|
15
|
+
"@angular/flex-layout": "^13.0.0-beta.36",
|
|
7
16
|
"@angular/forms": "^13.1.0",
|
|
17
|
+
"@angular/material": "^13.1.0",
|
|
8
18
|
"rxjs": "~7.4.0",
|
|
9
19
|
"@angular/platform-browser-dynamic": "13.1.0"
|
|
10
20
|
},
|
|
11
21
|
"dependencies": {
|
|
12
22
|
"tslib": "^2.2.0"
|
|
13
23
|
},
|
|
24
|
+
"schematics": "./schematics/collection.json",
|
|
25
|
+
"ng-add": {
|
|
26
|
+
"save": "dependencies"
|
|
27
|
+
},
|
|
14
28
|
"module": "fesm2015/tehw0lf-contact-form.mjs",
|
|
15
29
|
"es2020": "fesm2020/tehw0lf-contact-form.mjs",
|
|
16
30
|
"esm2020": "esm2020/tehw0lf-contact-form.mjs",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"ng-add": {
|
|
5
|
+
"description": "Add contact-form library to the project if material is installed.",
|
|
6
|
+
"factory": "./ng-add/index",
|
|
7
|
+
"schema": "./ng-add/schema.json"
|
|
8
|
+
},
|
|
9
|
+
"ng-add-setup": {
|
|
10
|
+
"description": "Install dependencies and add the library to the project",
|
|
11
|
+
"private": true,
|
|
12
|
+
"factory": "./ng-add/setup",
|
|
13
|
+
"schema": "./ng-add/schema.json"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
13
|
+
const schematics_1 = require("@angular/cdk/schematics");
|
|
14
|
+
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
15
|
+
const workspace_models_1 = require("@schematics/angular/utility/workspace-models");
|
|
16
|
+
const package_config_1 = require("./package-config");
|
|
17
|
+
function default_1(options) {
|
|
18
|
+
return (host, context) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const materialVersion = (0, package_config_1.getPackageVersionFromPackageJson)(host, '@angular/material');
|
|
20
|
+
const workspace = yield (0, workspace_1.getWorkspace)(host);
|
|
21
|
+
const project = (0, schematics_1.getProjectFromWorkspace)(workspace, options.project);
|
|
22
|
+
if (project.extensions.projectType !== workspace_models_1.ProjectType.Application) {
|
|
23
|
+
context.logger.error('This library needs to be added to an application project');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!materialVersion) {
|
|
27
|
+
context.logger.error(`@angular/material not found.
|
|
28
|
+
Please run 'ng add @angular/material' first`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
context.addTask(new tasks_1.RunSchematicTask('ng-add-setup', options));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.default = default_1;
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/contact-form/schematics/ng-add/index.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,4DAAoE;AACpE,wDAAkE;AAClE,qEAAqE;AACrE,mFAA2E;AAE3E,qDAAoE;AAGpE,mBAAyB,OAAe;IACtC,OAAO,CAAO,IAAU,EAAE,OAAyB,EAAE,EAAE;QACrD,MAAM,eAAe,GAAG,IAAA,iDAAgC,EACtD,IAAI,EACJ,mBAAmB,CACpB,CAAC;QACF,MAAM,SAAS,GAAG,MAAM,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,IAAA,oCAAuB,EAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAEpE,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,KAAK,8BAAW,CAAC,WAAW,EAAE;YAC9D,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,0DAA0D,CAC3D,CAAC;YACF,OAAO;SACR;QAED,IAAI,CAAC,eAAe,EAAE;YACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;mDACwB,CAAC,CAAC;YAC/C,OAAO;SACR;QAED,OAAO,CAAC,OAAO,CAAC,IAAI,wBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;IACjE,CAAC,CAAA,CAAC;AACJ,CAAC;AAxBD,4BAwBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
13
|
+
const file_content_1 = require("../testing/file-content");
|
|
14
|
+
const test_app_1 = require("../testing/test-app");
|
|
15
|
+
const test_library_1 = require("../testing/test-library");
|
|
16
|
+
describe('ng-add-setup schematic with material present', () => {
|
|
17
|
+
let runner;
|
|
18
|
+
let appTree;
|
|
19
|
+
let errorOutput;
|
|
20
|
+
let warnOutput;
|
|
21
|
+
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../collection.json'));
|
|
23
|
+
appTree = yield (0, test_app_1.createTestAppWithMaterial)(runner);
|
|
24
|
+
errorOutput = [];
|
|
25
|
+
warnOutput = [];
|
|
26
|
+
runner.logger.subscribe((e) => {
|
|
27
|
+
if (e.level === 'error') {
|
|
28
|
+
errorOutput.push(e.message);
|
|
29
|
+
}
|
|
30
|
+
else if (e.level === 'warn') {
|
|
31
|
+
warnOutput.push(e.message);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}));
|
|
35
|
+
describe('add module', () => {
|
|
36
|
+
it('should add the ContactFormModule to the project module', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
const tree = yield runner
|
|
38
|
+
.runSchematicAsync('ng-add-setup', {}, appTree)
|
|
39
|
+
.toPromise();
|
|
40
|
+
const fileContent = (0, file_content_1.getFileContent)(tree, '/projects/material/src/app/app.module.ts');
|
|
41
|
+
expect(fileContent).toContain('ContactFormModule');
|
|
42
|
+
}));
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
describe('ng-add schematic without material present', () => {
|
|
46
|
+
let runner;
|
|
47
|
+
let appTree;
|
|
48
|
+
let errorOutput;
|
|
49
|
+
let warnOutput;
|
|
50
|
+
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../collection.json'));
|
|
52
|
+
appTree = yield (0, test_app_1.createTestApp)(runner);
|
|
53
|
+
errorOutput = [];
|
|
54
|
+
warnOutput = [];
|
|
55
|
+
runner.logger.subscribe((e) => {
|
|
56
|
+
if (e.level === 'error') {
|
|
57
|
+
errorOutput.push(e.message);
|
|
58
|
+
}
|
|
59
|
+
else if (e.level === 'warn') {
|
|
60
|
+
warnOutput.push(e.message);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}));
|
|
64
|
+
describe('fail to add module', () => {
|
|
65
|
+
it('should fail if material is missing', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
const tree = yield runner
|
|
67
|
+
.runSchematicAsync('ng-add', {}, appTree)
|
|
68
|
+
.toPromise();
|
|
69
|
+
const fileContent = (0, file_content_1.getFileContent)(tree, '/projects/material/src/app/app.module.ts');
|
|
70
|
+
expect(fileContent).not.toContain('ContactFormModule');
|
|
71
|
+
expect(errorOutput.length).toBe(1);
|
|
72
|
+
expect(warnOutput.length).toBe(0);
|
|
73
|
+
expect(errorOutput[0]).toMatch(`@angular/material not found.
|
|
74
|
+
Please run 'ng add @angular/material' first`);
|
|
75
|
+
}));
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe('ng-add schematic - library project', () => {
|
|
79
|
+
let runner;
|
|
80
|
+
let libraryTree;
|
|
81
|
+
let errorOutput;
|
|
82
|
+
let warnOutput;
|
|
83
|
+
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
+
runner = new testing_1.SchematicTestRunner('schematics', require.resolve('../collection.json'));
|
|
85
|
+
libraryTree = yield (0, test_library_1.createTestLibrary)(runner);
|
|
86
|
+
errorOutput = [];
|
|
87
|
+
warnOutput = [];
|
|
88
|
+
runner.logger.subscribe((e) => {
|
|
89
|
+
if (e.level === 'error') {
|
|
90
|
+
errorOutput.push(e.message);
|
|
91
|
+
}
|
|
92
|
+
else if (e.level === 'warn') {
|
|
93
|
+
warnOutput.push(e.message);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}));
|
|
97
|
+
it('should do nothing if a library project is targeted', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
+
yield runner.runSchematicAsync('ng-add', {}, libraryTree).toPromise();
|
|
99
|
+
expect(errorOutput.length).toBe(1);
|
|
100
|
+
expect(errorOutput[0]).toMatch('This library needs to be added to an application project');
|
|
101
|
+
}));
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=index.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../../../libs/contact-form/schematics/ng-add/index.spec.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,gEAAyE;AAEzE,0DAAyD;AAC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OAAO,CAC5B,0DAA0D,CAC3D,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
9
|
+
/** Adds a package to the package.json in the given host tree. */
|
|
10
|
+
export declare function addPackageToPackageJson(host: Tree, pkg: string, version: string): Tree;
|
|
11
|
+
/** Gets the version of the specified package by looking at the package.json in the given tree. */
|
|
12
|
+
export declare function getPackageVersionFromPackageJson(tree: Tree, name: string): string | null;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPackageVersionFromPackageJson = exports.addPackageToPackageJson = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Sorts the keys of the given object.
|
|
6
|
+
* @returns A new object instance with sorted keys
|
|
7
|
+
*/
|
|
8
|
+
function sortObjectByKeys(obj) {
|
|
9
|
+
return Object.keys(obj)
|
|
10
|
+
.sort()
|
|
11
|
+
.reduce((result, key) => {
|
|
12
|
+
result[key] = obj[key];
|
|
13
|
+
return result;
|
|
14
|
+
}, {});
|
|
15
|
+
}
|
|
16
|
+
/** Adds a package to the package.json in the given host tree. */
|
|
17
|
+
function addPackageToPackageJson(host, pkg, version) {
|
|
18
|
+
if (host.exists('package.json')) {
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
|
+
const sourceText = host.read('package.json').toString('utf-8');
|
|
21
|
+
const json = JSON.parse(sourceText);
|
|
22
|
+
if (!json.dependencies) {
|
|
23
|
+
json.dependencies = {};
|
|
24
|
+
}
|
|
25
|
+
if (!json.dependencies[pkg]) {
|
|
26
|
+
json.dependencies[pkg] = version;
|
|
27
|
+
json.dependencies = sortObjectByKeys(json.dependencies);
|
|
28
|
+
}
|
|
29
|
+
host.overwrite('package.json', JSON.stringify(json, null, 2));
|
|
30
|
+
}
|
|
31
|
+
return host;
|
|
32
|
+
}
|
|
33
|
+
exports.addPackageToPackageJson = addPackageToPackageJson;
|
|
34
|
+
/** Gets the version of the specified package by looking at the package.json in the given tree. */
|
|
35
|
+
function getPackageVersionFromPackageJson(tree, name) {
|
|
36
|
+
if (!tree.exists('package.json')) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const packageJson = JSON.parse(
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
41
|
+
tree.read('package.json').toString('utf8'));
|
|
42
|
+
if (packageJson.dependencies && packageJson.dependencies[name]) {
|
|
43
|
+
return packageJson.dependencies[name];
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
exports.getPackageVersionFromPackageJson = getPackageVersionFromPackageJson;
|
|
48
|
+
//# sourceMappingURL=package-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-config.js","sourceRoot":"","sources":["../../../../../libs/contact-form/schematics/ng-add/package-config.ts"],"names":[],"mappings":";;;AAaA;;;GAGG;AACH,SAAS,gBAAgB,CAAC,GAA2B;IACnD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;SACpB,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;QACtB,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACvB,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,EAA4B,CAAC,CAAC;AACrC,CAAC;AAED,iEAAiE;AACjE,SAAgB,uBAAuB,CACrC,IAAU,EACV,GAAW,EACX,OAAe;IAEf,IAAI,IAAI,CAAC,MAAM,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act-form/schematics/ng-add/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "angular-material-ng-add",
|
|
4
|
+
"title": "Angular Material ng-add schematic",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Name of the project.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "projectName"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"required": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
+
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
14
|
+
const schematics_2 = require("@angular/cdk/schematics");
|
|
15
|
+
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
16
|
+
const package_config_1 = require("./package-config");
|
|
17
|
+
const contactFormModuleName = 'ContactFormModule';
|
|
18
|
+
const contactFormPackageName = '@tehw0lf/contact-form';
|
|
19
|
+
const flexLayoutFallbackVersion = '^13.0.0-beta.36';
|
|
20
|
+
function default_1(options) {
|
|
21
|
+
return () => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return (0, schematics_1.chain)([addDependencies(), addContactFormModule(options)]);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
exports.default = default_1;
|
|
26
|
+
function addContactFormModule(options) {
|
|
27
|
+
return (host, context) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const workspace = yield (0, workspace_1.getWorkspace)(host);
|
|
29
|
+
const project = (0, schematics_2.getProjectFromWorkspace)(workspace, options.project);
|
|
30
|
+
const appModulePath = (0, schematics_2.getAppModulePath)(host, (0, schematics_2.getProjectMainFile)(project));
|
|
31
|
+
if (!(0, schematics_2.hasNgModuleImport)(host, appModulePath, contactFormModuleName)) {
|
|
32
|
+
(0, schematics_2.addModuleImportToRootModule)(host, contactFormModuleName, contactFormPackageName, project);
|
|
33
|
+
}
|
|
34
|
+
context.logger.warn('Library is already installed, nothing to do.');
|
|
35
|
+
return;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function addDependencies() {
|
|
39
|
+
return (host, context) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const flexLayoutVersion = (0, package_config_1.getPackageVersionFromPackageJson)(host, '@angular/flex-layout');
|
|
41
|
+
if (!flexLayoutVersion || flexLayoutVersion !== flexLayoutFallbackVersion) {
|
|
42
|
+
(0, package_config_1.addPackageToPackageJson)(host, '@angular/flex-layout', flexLayoutFallbackVersion);
|
|
43
|
+
context.logger.info(`@angular/flex-layout ${flexLayoutFallbackVersion} was added to dependencies.`);
|
|
44
|
+
}
|
|
45
|
+
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../../../libs/contact-form/schematics/ng-add/setup.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DA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rB,IAAI,EACJ,sBAAsB,EACtB,yBAAyB,CAC1B,CAAC;YAEF,OAAO,CAAC,MAAM,CAAC,IAAI,CACjB,wBAAwB,yBAAyB,6BAA6B,CAC/E,CAAC;SACH;QACD,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;IAChD,CAAC,CAAA,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
9
|
+
/** Gets the content of a specified file from a schematic tree. */
|
|
10
|
+
export declare function getFileContent(tree: Tree, filePath: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFileContent = void 0;
|
|
4
|
+
/** Gets the content of a specified file from a schematic tree. */
|
|
5
|
+
function getFileContent(tree, filePath) {
|
|
6
|
+
const contentBuffer = tree.read(filePath);
|
|
7
|
+
if (!contentBuffer) {
|
|
8
|
+
throw new Error(`Cannot read "${filePath}" because it does not exist.`);
|
|
9
|
+
}
|
|
10
|
+
return contentBuffer.toString();
|
|
11
|
+
}
|
|
12
|
+
exports.getFileContent = getFileContent;
|
|
13
|
+
//# sourceMappingURL=file-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-content.js","sourceRoot":"","sources":["../../../../../libs/contact-form/schematics/testing/file-content.ts"],"names":[],"mappings":";;;AAUA,kEAAkE;AAClE,SAAgB,cAAc,CAAC,IAAU,EAAE,QAAgB;IACzD,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAE1C,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,gBAAgB,QAAQ,8BAA8B,CAAC,CAAC;KACzE;IAED,OAAO,aAAa,CAAC,QAAQ,EAAE,CAAC;AAClC,CAAC;AARD,wCAQC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6
|
+
*
|
|
7
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
8
|
+
* found in the LICENSE file at https://angular.io/license
|
|
9
|
+
*/
|
|
10
|
+
/** Create a base app used for testing. */
|
|
11
|
+
export declare function createTestApp(runner: SchematicTestRunner, appOptions?: {}, tree?: Tree): Promise<UnitTestTree>;
|
|
12
|
+
export declare function createTestAppWithMaterial(runner: SchematicTestRunner, appOptions?: {}, tree?: Tree): Promise<UnitTestTree>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createTestAppWithMaterial = exports.createTestApp = void 0;
|
|
13
|
+
const package_config_1 = require("../ng-add/package-config");
|
|
14
|
+
const file_content_1 = require("./file-content");
|
|
15
|
+
const test_project_1 = require("./test-project");
|
|
16
|
+
/**
|
|
17
|
+
* @license
|
|
18
|
+
* Copyright Google LLC All Rights Reserved.
|
|
19
|
+
*
|
|
20
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
21
|
+
* found in the LICENSE file at https://angular.io/license
|
|
22
|
+
*/
|
|
23
|
+
/** Create a base app used for testing. */
|
|
24
|
+
function createTestApp(runner, appOptions = {}, tree) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return (0, test_project_1.createTestProject)(runner, 'application', appOptions, tree);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.createTestApp = createTestApp;
|
|
30
|
+
function createTestAppWithMaterial(runner, appOptions = {}, tree) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const projectTree = yield (0, test_project_1.createTestProject)(runner, 'application', appOptions, tree);
|
|
33
|
+
const coreVersion = (0, package_config_1.getPackageVersionFromPackageJson)(projectTree, '@angular/core');
|
|
34
|
+
const packageJson = (0, file_content_1.getFileContent)(projectTree, '/package.json');
|
|
35
|
+
const updatedPackageJson = packageJson.replace(`"dependencies": {
|
|
36
|
+
"@angular/animations": "${coreVersion}",`, `"dependencies": {
|
|
37
|
+
"@angular/animations": "${coreVersion}",
|
|
38
|
+
"@angular/material": "${coreVersion}",`);
|
|
39
|
+
projectTree.overwrite('/package.json', updatedPackageJson);
|
|
40
|
+
return projectTree;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exports.createTestAppWithMaterial = createTestAppWithMaterial;
|
|
44
|
+
//# sourceMappingURL=test-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-app.js","sourceRoot":"","sources":["../../../../../libs/contact-form/schematics/testing/test-app.ts"],"names":[],"mappings":";;;;;;;;;;;;AAMA,6DAA4E;AAC5E,iDAAgD;AAChD,iDAAmD;AAEnD;;;;;;GAMG;AACH,0CAA0C;AAC1C,SAAsB,aAAa,CACjC,MAA2B,EAC3B,UAAU,GAAG,EAAE,EACf,IAAW;;QAEX,OAAO,IAAA,gCAAiB,EAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;CAAA;AAND,sCAMC;AAED,SAAsB,yBAAyB,CAC7C,MAA2B,EAC3B,UAAU,GAAG,EAAE,EACf,IAAW;;QAEX,MAAM,WAAW,GAAG,MAAM,IAAA,gCAAiB,EACzC,MAAM,EACN,aAAa,EACb,UAAU,EACV,IAAI,CACL,CAAC;QAEF,MAAM,WAAW,GAAG,IAAA,iDAAgC,EAClD,WAAW,EACX,eAAe,CAChB,CAAC;QAEF,MAAM,WAAW,GAAG,IAAA,6BAAc,EAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QAEjE,MAAM,kBAAkB,GAAG,WAAW,CAAC,OAAO,CAC5C;8BAC0B,WAAW,IAAI,EACzC;8BAC0B,WAAW;4BACb,WAAW,IAAI,CACxC,CAAC;QACF,WAAW,CAAC,SAAS,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC;QAC3D,OAAO,WAAW,CAAC;IACrB,CAAC;CAAA;AA5BD,8DA4BC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
9
|
+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
10
|
+
/** Create a base library used for testing. */
|
|
11
|
+
export declare function createTestLibrary(runner: SchematicTestRunner, appOptions?: {}, tree?: Tree): Promise<UnitTestTree>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createTestLibrary = void 0;
|
|
13
|
+
const test_project_1 = require("./test-project");
|
|
14
|
+
/** Create a base library used for testing. */
|
|
15
|
+
function createTestLibrary(runner, appOptions = {}, tree) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
return (0, test_project_1.createTestProject)(runner, 'library', appOptions, tree);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.createTestLibrary = createTestLibrary;
|
|
21
|
+
//# sourceMappingURL=test-library.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-library.js","sourceRoot":"","sources":["../../../../../libs/contact-form/schematics/testing/test-library.ts"],"names":[],"mappings":";;;;;;;;;;;;AAUA,iDAAmD;AAGnD,8CAA8C;AAC9C,SAAsB,iBAAiB,CACrC,MAA2B,EAC3B,UAAU,GAAG,EAAE,EACf,IAAW;;QAEX,OAAO,IAAA,gCAAiB,EAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC;CAAA;AAND,8CAMC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
9
|
+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
10
|
+
/** Create a base project used for testing. */
|
|
11
|
+
export declare function createTestProject(runner: SchematicTestRunner, projectType: 'application' | 'library', appOptions?: {}, tree?: Tree): Promise<UnitTestTree>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.createTestProject = void 0;
|
|
13
|
+
/** Create a base project used for testing. */
|
|
14
|
+
function createTestProject(runner, projectType, appOptions = {}, tree) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const workspaceTree = yield runner
|
|
17
|
+
.runExternalSchematicAsync('@schematics/angular', 'workspace', {
|
|
18
|
+
name: 'workspace',
|
|
19
|
+
version: '6.0.0',
|
|
20
|
+
newProjectRoot: 'projects',
|
|
21
|
+
}, tree)
|
|
22
|
+
.toPromise();
|
|
23
|
+
return runner
|
|
24
|
+
.runExternalSchematicAsync('@schematics/angular', projectType, Object.assign({ name: 'material' }, appOptions), workspaceTree)
|
|
25
|
+
.toPromise();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
exports.createTestProject = createTestProject;
|
|
29
|
+
//# sourceMappingURL=test-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-project.js","sourceRoot":"","sources":["../../../../../libs/contact-form/schematics/testing/test-project.ts"],"names":[],"mappings":";;;;;;;;;;;;AAWA,8CAA8C;AAC9C,SAAsB,iBAAiB,CACrC,MAA2B,EAC3B,WAAsC,EACtC,UAAU,GAAG,EAAE,EACf,IAAW;;QAEX,MAAM,aAAa,GAAG,MAAM,MAAM;aAC/B,yBAAyB,CACxB,qBAAqB,EACrB,WAAW,EACX;YACE,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,OAAO;YAChB,cAAc,EAAE,UAAU;SAC3B,EACD,IAAI,CACL;aACA,SAAS,EAAE,CAAC;QAEf,OAAO,MAAM;aACV,yBAAyB,CACxB,qBAAqB,EACrB,WAAW,kBACV,IAAI,EAAE,UAAU,IAAK,UAAU,GAChC,aAAa,CACd;aACA,SAAS,EAAE,CAAC;IACjB,CAAC;CAAA;AA3BD,8CA2BC"}
|