@osovitny/anatoly 1.0.1 → 1.2.1

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.
Files changed (146) hide show
  1. package/README.md +5 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +1 -16
  4. package/src/lib/billing/billing.module.ts +62 -0
  5. package/src/lib/billing/components/buyaccess/buyaccess-button.component.html +15 -0
  6. package/src/lib/billing/components/buyaccess/buyaccess-button.component.ts +70 -0
  7. package/src/lib/billing/components/subscriptions/subscribe-plan-button.component.html +21 -0
  8. package/src/lib/billing/components/subscriptions/subscribe-plan-button.component.ts +60 -0
  9. package/src/lib/billing/components/subscriptions/upgrade-plan-button.component.html +3 -0
  10. package/src/lib/billing/components/subscriptions/upgrade-plan-button.component.ts +47 -0
  11. package/src/lib/billing/index.ts +10 -0
  12. package/src/lib/billing/services/base-billing-api.service.ts +56 -0
  13. package/src/lib/core/consts.ts +7 -0
  14. package/src/lib/core/core.module.ts +45 -0
  15. package/src/lib/core/index.ts +10 -0
  16. package/src/lib/core/services/appcontext.service.ts +81 -0
  17. package/src/lib/core/services/base-api.service.ts +87 -0
  18. package/src/lib/core/services/base-go.service.ts +33 -0
  19. package/src/lib/core/services/base-gridedit.service.ts +124 -0
  20. package/src/lib/identity/components/signin-button.component.html +1 -0
  21. package/src/lib/identity/components/signin-button.component.ts +27 -0
  22. package/src/lib/identity/components/signout-button.component.html +1 -0
  23. package/src/lib/identity/components/signout-button.component.ts +27 -0
  24. package/src/lib/identity/components/signup-button.component.html +1 -0
  25. package/src/lib/identity/components/signup-button.component.ts +28 -0
  26. package/src/lib/identity/identity.module.ts +41 -0
  27. package/src/lib/identity/index.ts +7 -0
  28. package/src/lib/ui/components/base-edit.component.ts +77 -0
  29. package/src/lib/ui/components/base.component.ts +45 -0
  30. package/src/lib/ui/components/content-header/content-header.component.html +4 -0
  31. package/src/lib/ui/components/content-header/content-header.component.ts +32 -0
  32. package/src/lib/ui/components/html-editor/base-html-editor.component.ts +97 -0
  33. package/src/lib/ui/components/html-editor/forms-html-editor.component.html +14 -0
  34. package/src/lib/ui/components/html-editor/forms-html-editor.component.ts +35 -0
  35. package/src/lib/ui/components/html-editor/html-editor.component.html +6 -0
  36. package/src/lib/ui/components/html-editor/html-editor.component.ts +51 -0
  37. package/src/lib/ui/components/html-editor/html-editor.defaultoptions.ts +38 -0
  38. package/src/lib/ui/components/validation/form-validation-summary.component.html +4 -0
  39. package/src/lib/ui/components/validation/form-validation-summary.component.ts +36 -0
  40. package/src/lib/ui/components/validation/item-validation-summary.component.html +5 -0
  41. package/src/lib/ui/components/validation/item-validation-summary.component.ts +32 -0
  42. package/src/lib/ui/components/validation/validation-summary.component.ts +74 -0
  43. package/src/lib/ui/index.js +13 -0
  44. package/src/lib/ui/index.js.map +1 -0
  45. package/src/lib/ui/index.ts +14 -0
  46. package/src/lib/ui/ui.module.ts +83 -0
  47. package/{public-api.d.ts → src/public-api.ts} +4 -4
  48. package/tsconfig.lib.json +32 -0
  49. package/tsconfig.lib.prod.json +6 -0
  50. package/tslint.json +17 -0
  51. package/typings/osovitny-ui/index.d.ts +24 -0
  52. package/bundles/osovitny-anatoly.umd.js +0 -2065
  53. package/bundles/osovitny-anatoly.umd.js.map +0 -1
  54. package/bundles/osovitny-anatoly.umd.min.js +0 -16
  55. package/bundles/osovitny-anatoly.umd.min.js.map +0 -1
  56. package/esm2015/lib/billing/billing.module.js +0 -62
  57. package/esm2015/lib/billing/components/buyaccess/buyaccess-button.component.js +0 -123
  58. package/esm2015/lib/billing/components/subscriptions/subscribe-plan-button.component.js +0 -97
  59. package/esm2015/lib/billing/components/subscriptions/upgrade-plan-button.component.js +0 -84
  60. package/esm2015/lib/billing/index.js +0 -6
  61. package/esm2015/lib/billing/services/base-billing-api.service.js +0 -116
  62. package/esm2015/lib/core/consts.js +0 -15
  63. package/esm2015/lib/core/core.module.js +0 -47
  64. package/esm2015/lib/core/index.js +0 -12
  65. package/esm2015/lib/core/services/appcontext.service.js +0 -123
  66. package/esm2015/lib/core/services/base-api.service.js +0 -154
  67. package/esm2015/lib/core/services/base-go.service.js +0 -58
  68. package/esm2015/lib/core/services/base-gridedit.service.js +0 -202
  69. package/esm2015/lib/identity/components/signin-button.component.js +0 -38
  70. package/esm2015/lib/identity/components/signout-button.component.js +0 -38
  71. package/esm2015/lib/identity/components/signup-button.component.js +0 -39
  72. package/esm2015/lib/identity/identity.module.js +0 -43
  73. package/esm2015/lib/identity/index.js +0 -6
  74. package/esm2015/lib/ui/components/base-edit.component.js +0 -102
  75. package/esm2015/lib/ui/components/base.component.js +0 -57
  76. package/esm2015/lib/ui/components/content-header/content-header.component.js +0 -44
  77. package/esm2015/lib/ui/components/html-editor/html-editor.component.js +0 -267
  78. package/esm2015/lib/ui/components/validation/form-validation-summary.component.js +0 -51
  79. package/esm2015/lib/ui/components/validation/item-validation-summary.component.js +0 -45
  80. package/esm2015/lib/ui/components/validation/validation-summary.component.js +0 -93
  81. package/esm2015/lib/ui/index.js +0 -11
  82. package/esm2015/lib/ui/ui.module.js +0 -72
  83. package/esm2015/osovitny-anatoly.js +0 -9
  84. package/esm2015/public-api.js +0 -9
  85. package/esm5/lib/billing/billing.module.js +0 -66
  86. package/esm5/lib/billing/components/buyaccess/buyaccess-button.component.js +0 -128
  87. package/esm5/lib/billing/components/subscriptions/subscribe-plan-button.component.js +0 -100
  88. package/esm5/lib/billing/components/subscriptions/upgrade-plan-button.component.js +0 -86
  89. package/esm5/lib/billing/index.js +0 -6
  90. package/esm5/lib/billing/services/base-billing-api.service.js +0 -135
  91. package/esm5/lib/core/consts.js +0 -15
  92. package/esm5/lib/core/core.module.js +0 -51
  93. package/esm5/lib/core/index.js +0 -12
  94. package/esm5/lib/core/services/appcontext.service.js +0 -140
  95. package/esm5/lib/core/services/base-api.service.js +0 -205
  96. package/esm5/lib/core/services/base-go.service.js +0 -59
  97. package/esm5/lib/core/services/base-gridedit.service.js +0 -240
  98. package/esm5/lib/identity/components/signin-button.component.js +0 -41
  99. package/esm5/lib/identity/components/signout-button.component.js +0 -41
  100. package/esm5/lib/identity/components/signup-button.component.js +0 -41
  101. package/esm5/lib/identity/identity.module.js +0 -47
  102. package/esm5/lib/identity/index.js +0 -6
  103. package/esm5/lib/ui/components/base-edit.component.js +0 -137
  104. package/esm5/lib/ui/components/base.component.js +0 -72
  105. package/esm5/lib/ui/components/content-header/content-header.component.js +0 -51
  106. package/esm5/lib/ui/components/html-editor/html-editor.component.js +0 -309
  107. package/esm5/lib/ui/components/validation/form-validation-summary.component.js +0 -59
  108. package/esm5/lib/ui/components/validation/item-validation-summary.component.js +0 -49
  109. package/esm5/lib/ui/components/validation/validation-summary.component.js +0 -106
  110. package/esm5/lib/ui/index.js +0 -11
  111. package/esm5/lib/ui/ui.module.js +0 -76
  112. package/esm5/osovitny-anatoly.js +0 -9
  113. package/esm5/public-api.js +0 -9
  114. package/fesm2015/osovitny-anatoly.js +0 -1622
  115. package/fesm2015/osovitny-anatoly.js.map +0 -1
  116. package/fesm5/osovitny-anatoly.js +0 -1877
  117. package/fesm5/osovitny-anatoly.js.map +0 -1
  118. package/lib/billing/billing.module.d.ts +0 -2
  119. package/lib/billing/components/buyaccess/buyaccess-button.component.d.ts +0 -16
  120. package/lib/billing/components/subscriptions/subscribe-plan-button.component.d.ts +0 -15
  121. package/lib/billing/components/subscriptions/upgrade-plan-button.component.d.ts +0 -9
  122. package/lib/billing/index.d.ts +0 -1
  123. package/lib/billing/services/base-billing-api.service.d.ts +0 -9
  124. package/lib/core/consts.d.ts +0 -5
  125. package/lib/core/core.module.d.ts +0 -2
  126. package/lib/core/index.d.ts +0 -5
  127. package/lib/core/services/appcontext.service.d.ts +0 -14
  128. package/lib/core/services/base-api.service.d.ts +0 -18
  129. package/lib/core/services/base-go.service.d.ts +0 -7
  130. package/lib/core/services/base-gridedit.service.d.ts +0 -19
  131. package/lib/identity/components/signin-button.component.d.ts +0 -4
  132. package/lib/identity/components/signout-button.component.d.ts +0 -4
  133. package/lib/identity/components/signup-button.component.d.ts +0 -4
  134. package/lib/identity/identity.module.d.ts +0 -2
  135. package/lib/identity/index.d.ts +0 -1
  136. package/lib/ui/components/base-edit.component.d.ts +0 -14
  137. package/lib/ui/components/base.component.d.ts +0 -7
  138. package/lib/ui/components/content-header/content-header.component.d.ts +0 -5
  139. package/lib/ui/components/html-editor/html-editor.component.d.ts +0 -22
  140. package/lib/ui/components/validation/form-validation-summary.component.d.ts +0 -6
  141. package/lib/ui/components/validation/item-validation-summary.component.d.ts +0 -6
  142. package/lib/ui/components/validation/validation-summary.component.d.ts +0 -6
  143. package/lib/ui/index.d.ts +0 -4
  144. package/lib/ui/ui.module.d.ts +0 -2
  145. package/osovitny-anatoly.d.ts +0 -4
  146. package/osovitny-anatoly.metadata.json +0 -1
@@ -0,0 +1,124 @@
1
+ /*
2
+ <file>
3
+ Authors:
4
+ Vadim Osovitny
5
+
6
+ Created:
7
+ 29 Apr 2018
8
+
9
+ Version:
10
+ 1.0
11
+
12
+ Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
+ </file>
14
+ */
15
+
16
+ import { Injectable } from '@angular/core';
17
+ import { HttpClient } from '@angular/common/http';
18
+
19
+ //RxJs
20
+ import { Observable } from 'rxjs';
21
+ import { BehaviorSubject } from 'rxjs';
22
+ import { map } from 'rxjs/operators';
23
+
24
+ import '../consts';
25
+
26
+ @Injectable()
27
+ export class BaseGridEditService extends BehaviorSubject<any[]> {
28
+ protected baseUrl: string;
29
+ protected baseReadUrl: string;
30
+ protected savedReadParams: any;
31
+ private data: any[] = [];
32
+
33
+ constructor(protected http: HttpClient) {
34
+ super([]);
35
+
36
+ this.baseUrl = anatoly.consts.apiUrl;
37
+ this.baseReadUrl = this.baseUrl + "getAll";
38
+ }
39
+
40
+ private serializeParams(data?: any): string {
41
+ return data ? ('?' + $.param(data)) : '';
42
+ }
43
+
44
+ private reset() {
45
+ this.data = [];
46
+ }
47
+
48
+ public resetItem(dataItem: any) {
49
+ if (!dataItem) { return; }
50
+
51
+ //find orignal data item
52
+ const originalDataItem = this.data.find(item => item.Id === dataItem.Id);
53
+
54
+ //revert changes
55
+ Object.assign(originalDataItem, dataItem);
56
+ super.next(this.data);
57
+ }
58
+
59
+ public read(params?: any) {
60
+ if (this.data.length) {
61
+ return super.next(this.data);
62
+ }
63
+
64
+ var url = this.baseReadUrl;
65
+
66
+ if (typeof params === 'undefined') {
67
+ params = this.savedReadParams;
68
+ }
69
+
70
+ if (typeof params !== 'undefined') {
71
+ url = this.baseReadUrl + `${this.serializeParams(params)}`;
72
+ this.savedReadParams = params;
73
+ }
74
+
75
+ // this.http.get(url)
76
+ // .map(res => <any[]>res)
77
+ // .do(data => { this.data = data; }).subscribe(data => { super.next(data); });
78
+ //}
79
+
80
+ this.http.get(url).pipe(
81
+ map(res => <any[]>res)
82
+ ).subscribe(data => { super.next(data) });
83
+ }
84
+
85
+
86
+ public save(data: any, isNew: boolean, sucess?: Function) {
87
+ const action = isNew ? 'add' : 'update';
88
+
89
+ this.reset();
90
+ this.post(action, data).subscribe(
91
+ () => {
92
+ },
93
+ () => {
94
+ this.read();
95
+ },
96
+ () => {
97
+ this.read();
98
+ if (sucess) sucess();
99
+ }
100
+ );
101
+ }
102
+
103
+ public remove(data: any, sucess?: Function) {
104
+ this.reset();
105
+ this.post('remove', data).subscribe(
106
+ () => {
107
+ },
108
+ () => {
109
+ this.read();
110
+ },
111
+ () => {
112
+ this.read();
113
+ if (sucess) sucess();
114
+ }
115
+ );
116
+ }
117
+
118
+ post(action: any, data?: any): Observable<any[]> {
119
+ var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
120
+ return this.http.post(url, data).pipe(
121
+ map(res => <any[]>res)
122
+ );
123
+ }
124
+ }
@@ -0,0 +1 @@
1
+ <a href="identity/signIn" class="{{classbtn}}">Sign In</a>
@@ -0,0 +1,27 @@
1
+ /*
2
+ <file>
3
+ Authors:
4
+ Vadim Osovitny
5
+
6
+ Created:
7
+ 4 Jul 2018
8
+
9
+ Version:
10
+ 1.0
11
+
12
+ Copyright (c) 2018 Osovitny Inc. All rights reserved.
13
+ </file>
14
+ */
15
+
16
+ import { Component, Input } from '@angular/core';
17
+
18
+ @Component({
19
+ selector: 'anatoly-signin-button',
20
+ templateUrl: './signin-button.component.html'
21
+ })
22
+
23
+ export class SignInButtonComponent {
24
+ @Input() classbtn: string;
25
+
26
+ constructor() { }
27
+ }
@@ -0,0 +1 @@
1
+ <a href="identity/signOut" class="{{classbtn}}">Sign Out</a>
@@ -0,0 +1,27 @@
1
+ /*
2
+ <file>
3
+ Authors:
4
+ Vadim Osovitny
5
+
6
+ Created:
7
+ 4 Jul 2018
8
+
9
+ Version:
10
+ 1.0
11
+
12
+ Copyright (c) 2018 Osovitny Inc. All rights reserved.
13
+ </file>
14
+ */
15
+
16
+ import { Component, Input } from '@angular/core';
17
+
18
+ @Component({
19
+ selector: 'anatoly-signout-button',
20
+ templateUrl: './signout-button.component.html'
21
+ })
22
+
23
+ export class SignOutButtonComponent {
24
+ @Input() classbtn: string;
25
+
26
+ constructor() { }
27
+ }
@@ -0,0 +1 @@
1
+ <a href="identity/signup" class="{{classbtn}}">Sign Up</a>
@@ -0,0 +1,28 @@
1
+ /*
2
+ <file>
3
+ Authors:
4
+ Vadim Osovitny
5
+
6
+ Created:
7
+ 4 Jul 2018
8
+
9
+ Version:
10
+ 1.0
11
+
12
+ Copyright (c) 2018 Osovitny Inc. All rights reserved.
13
+ </file>
14
+ */
15
+
16
+ import { Component, Input } from '@angular/core';
17
+
18
+ @Component({
19
+ selector: 'anatoly-signup-button',
20
+ templateUrl: './signup-button.component.html'
21
+ })
22
+
23
+ export class SignUpButtonComponent {
24
+ @Input() classbtn: string;
25
+
26
+ constructor() {
27
+ }
28
+ }
@@ -0,0 +1,41 @@
1
+ /*
2
+ <file>
3
+ Authors:
4
+ Vadim Osovitny
5
+
6
+ Created:
7
+ 4 Jul 2018
8
+
9
+ Version:
10
+ 1.0
11
+
12
+ Copyright (c) 2018 Osovitny Inc. All rights reserved.
13
+ </file>
14
+ */
15
+
16
+ //System
17
+ import { NgModule } from '@angular/core';
18
+
19
+ //Custom
20
+ import { SignInButtonComponent } from './components/signin-button.component';
21
+ import { SignUpButtonComponent } from './components/signup-button.component';
22
+ import { SignOutButtonComponent } from './components/signout-button.component';
23
+
24
+ @NgModule({
25
+ imports: [
26
+ ],
27
+ exports: [
28
+ SignInButtonComponent,
29
+ SignUpButtonComponent,
30
+ SignOutButtonComponent
31
+ ],
32
+ declarations: [
33
+ SignInButtonComponent,
34
+ SignUpButtonComponent,
35
+ SignOutButtonComponent
36
+ ],
37
+ providers: []
38
+ })
39
+
40
+ export class AnatolyIdentityModule {
41
+ }
@@ -0,0 +1,7 @@
1
+ // Components
2
+ export * from './components/signin-button.component';
3
+ export * from './components/signout-button.component';
4
+ export * from './components/signup-button.component';
5
+
6
+ //Module
7
+ export { AnatolyIdentityModule } from './identity.module';
@@ -0,0 +1,77 @@
1
+ /*
2
+ <file>
3
+ Authors:
4
+ Vadim Osovitny
5
+
6
+ Created:
7
+ 20 Nov 2017
8
+
9
+ Version:
10
+ 1.0
11
+
12
+ Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
+ </file>
14
+ */
15
+
16
+ //Node
17
+ import { Component, Input } from '@angular/core';
18
+ import { FormGroup } from '@angular/forms';
19
+
20
+ //Custom
21
+ import { BaseComponent } from './base.component';
22
+
23
+ export class BaseEditComponent extends BaseComponent {
24
+ @Input()
25
+ public formGroup: FormGroup;
26
+
27
+ @Input()
28
+ public formSubmitted: boolean = false;
29
+
30
+ constructor() {
31
+ super();
32
+ }
33
+
34
+ isActionAdding() {
35
+ var id = osovitny.utils.getValueByNameInQS("id");
36
+ if (typeof id === 'undefined' || id == '') return true;
37
+
38
+ return false;
39
+ }
40
+
41
+ getEntityId() {
42
+ return this.getQSId();
43
+ }
44
+
45
+ isItemInvalid(name: string) {
46
+ if (typeof name === 'undefined' || name == '') {
47
+ return false;
48
+ }
49
+
50
+ if (!this.formGroup) {
51
+ return false;
52
+ }
53
+
54
+ if (this.formGroup.get(name)) {
55
+ return (this.formSubmitted && this.formGroup.get(name).invalid) ||
56
+ (this.formGroup.get(name).touched && this.formGroup.get(name).invalid);
57
+ }
58
+
59
+ return false;
60
+ }
61
+
62
+ getFormValue(name) {
63
+ return this.formGroup.controls[name].value;
64
+ }
65
+
66
+ setFormValue(name, value) {
67
+ this.formGroup.controls[name].setValue(value);
68
+ }
69
+
70
+ getFormGroupValue(groupName, name) {
71
+ return this.formGroup.controls[groupName].get(name).value;
72
+ }
73
+
74
+ setFormGroupValue(groupName, name, value) {
75
+ this.formGroup.controls[groupName].get(name).setValue(value);
76
+ }
77
+ }
@@ -0,0 +1,45 @@
1
+ /*
2
+ <file>
3
+ Authors:
4
+ Vadim Osovitny
5
+
6
+ Created:
7
+ 28 Aug 2018
8
+
9
+ Version:
10
+ 1.0
11
+
12
+ Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
+ </file>
14
+ */
15
+
16
+ //Node
17
+ import { Component, Input } from '@angular/core';
18
+ import { FormGroup } from '@angular/forms';
19
+
20
+ export class BaseComponent {
21
+ constructor() {
22
+ }
23
+
24
+ getQSId() {
25
+ var id = osovitny.utils.getValueByNameInQS("id");
26
+ if (typeof id === 'undefined' || id == '') return null;
27
+
28
+ return id;
29
+ }
30
+
31
+ showLoading() {
32
+ var panelLoading = $('#pnlLoading');
33
+ panelLoading.show();
34
+ }
35
+
36
+ hideLoading() {
37
+ var panelLoading = $('#pnlLoading');
38
+ panelLoading.hide();
39
+ }
40
+
41
+ handleError(e) {
42
+ this.hideLoading();
43
+ osovitny.ui.errorOccurred();
44
+ }
45
+ }
@@ -0,0 +1,4 @@
1
+ <h2 class="page-header">
2
+ {{title}}
3
+ <!--<small>Optional {{title}}</small>-->
4
+ </h2>
@@ -0,0 +1,32 @@
1
+ /*
2
+ <file>
3
+ Authors:
4
+ Anatoly Osovitny
5
+
6
+ Created:
7
+ 23 Apr 2018
8
+
9
+ Version:
10
+ 1.0
11
+
12
+ Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
13
+ </file>
14
+ */
15
+
16
+ //Node
17
+ import { Component, Input, OnInit } from '@angular/core';
18
+
19
+ @Component({
20
+ selector: 'anatoly-content-header',
21
+ templateUrl: './content-header.component.html'
22
+ })
23
+
24
+ export class ContentHeaderComponent implements OnInit {
25
+ @Input() title?: string;
26
+
27
+ ngOnInit() {
28
+ if (this.title == null) {
29
+ this.title = '';
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,97 @@
1
+ /*
2
+ <file>
3
+ Authors:
4
+ Anatoly Osovitny
5
+ Vadim Osovitny
6
+
7
+ Created:
8
+ 12 Dec 2017
9
+
10
+ Version:
11
+ 1.0
12
+
13
+ Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
14
+ </file>
15
+ */
16
+
17
+ //Node
18
+ import { Component, OnInit, Input, AfterViewInit } from '@angular/core';
19
+
20
+ //Custom
21
+ import { BaseEditComponent } from '../base-edit.component';
22
+
23
+ //Consts
24
+ import { DefaultEditorOptions } from './html-editor.defaultoptions';
25
+
26
+ export class BaseHtmlEditorComponent extends BaseEditComponent implements OnInit {
27
+ protected _control;
28
+
29
+ //Public members
30
+ public options;
31
+ public editorInitialized: boolean = false;
32
+
33
+ //General params
34
+ @Input() editorId: string = '';
35
+ @Input() editorLabelText: string = 'Html';
36
+ @Input() editorOptions: Object = {};
37
+
38
+ constructor() {
39
+ super();
40
+ }
41
+
42
+ ngOnInit() {
43
+ let opt = this.editorOptions;
44
+ if (typeof this.editorOptions == "string") {
45
+ opt = JSON.parse(this.editorOptions);
46
+ }
47
+
48
+ let newOptions: any = $.extend({}, DefaultEditorOptions, opt);
49
+ let key = (<any>window).__froalaEditor_Key;
50
+ if (key) {
51
+ newOptions = $.extend({}, newOptions, JSON.parse('{ "key": "' + key + '" }'));
52
+ }
53
+
54
+ if (newOptions.events && newOptions.events.initialized) {
55
+ newOptions.events.initialized.overridden = false;
56
+ }
57
+
58
+ this.options = newOptions;
59
+ }
60
+
61
+ protected doAfterEditorInitialized(action) {
62
+ var that = this;
63
+ var timeOut = 500;
64
+
65
+ if (this.editorInitialized) {
66
+ timeOut = 100;
67
+ }
68
+
69
+ setTimeout(function () { action(that); }, timeOut);
70
+ }
71
+
72
+ protected getEditor() {
73
+ if (this._control)
74
+ return this._control.getEditor();
75
+
76
+ return null;
77
+ }
78
+
79
+ //Public Funcs
80
+ public initializeControl(control) {
81
+ this._control = control;
82
+ this._control.initialize();
83
+ this.editorInitialized = true;
84
+ }
85
+
86
+ public setUploadParams(uploadType, uploadParentId) {
87
+ this.doAfterEditorInitialized(function (that) {
88
+ var editor = that.getEditor();
89
+ if (typeof (editor) == "undefined" || editor == null) {
90
+ return;
91
+ }
92
+
93
+ editor.opts.imageUploadParams.uploadType = uploadType;
94
+ editor.opts.imageUploadParams.uploadParentId = uploadParentId;
95
+ });
96
+ }
97
+ }
@@ -0,0 +1,14 @@
1
+ <div [formGroup]="formGroup">
2
+ <div class="form-group" [ngClass]="{'has-error': isItemInvalid(editorFormKey) }">
3
+ <label class="control-label">{{ editorLabelText }}</label>
4
+ <textarea id="htmleditor-{{editorId}}" class="htmleditor-{{editorId}}"
5
+ [formControlName]="editorFormKey"
6
+ [froalaEditor]="options" (froalaInit)="initializeControl($event)">
7
+ </textarea>
8
+ <anatoly-item-validation-summary [formGroup]="formGroup"
9
+ [formSubmitted]="formSubmitted"
10
+ [key]="editorFormKey"
11
+ [title]="editorLabelText">
12
+ </anatoly-item-validation-summary>
13
+ </div>
14
+ </div>
@@ -0,0 +1,35 @@
1
+ /*
2
+ <file>
3
+ Authors:
4
+ Anatoly Osovitny
5
+ Vadim Osovitny
6
+
7
+ Created:
8
+ 12 Dec 2017
9
+
10
+ Version:
11
+ 1.0
12
+
13
+ Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
14
+ </file>
15
+ */
16
+
17
+ //Node
18
+ import { Component, Input } from '@angular/core';
19
+
20
+ //Custom
21
+ import { BaseHtmlEditorComponent } from './base-html-editor.component';
22
+
23
+ @Component({
24
+ selector: 'anatoly-forms-html-editor',
25
+ templateUrl: './forms-html-editor.component.html'
26
+ })
27
+ export class FormsHtmlEditorComponent extends BaseHtmlEditorComponent {
28
+ content;
29
+
30
+ @Input() editorFormKey: string = 'html';
31
+
32
+ constructor() {
33
+ super();
34
+ }
35
+ }
@@ -0,0 +1,6 @@
1
+ <div>
2
+ <label>{{ editorLabelText }}</label>
3
+ <textarea id="htmleditor-{{editorId}}" class="htmleditor-{{editorId}}"
4
+ [froalaEditor]="options" (froalaInit)="initializeControl($event)">
5
+ </textarea>
6
+ </div>
@@ -0,0 +1,51 @@
1
+ /*
2
+ <file>
3
+ Authors:
4
+ Anatoly Osovitny
5
+ Vadim Osovitny
6
+
7
+ Created:
8
+ 12 Dec 2017
9
+
10
+ Version:
11
+ 1.0
12
+
13
+ Copyright (c) 2016-2019 Osovitny Inc. All rights reserved.
14
+ </file>
15
+ */
16
+
17
+ //Node
18
+ import { Component, Input } from '@angular/core';
19
+
20
+ //Custom
21
+ import { BaseHtmlEditorComponent } from './base-html-editor.component';
22
+
23
+ @Component({
24
+ selector: 'anatoly-html-editor',
25
+ templateUrl: './html-editor.component.html'
26
+ })
27
+ export class HtmlEditorComponent extends BaseHtmlEditorComponent {
28
+ constructor() {
29
+ super();
30
+ }
31
+
32
+ public setHtml(content) {
33
+ this.doAfterEditorInitialized(function (that) {
34
+ var editor = that.getEditor();
35
+ if (typeof (editor) == "undefined" || editor == null) {
36
+ return;
37
+ }
38
+
39
+ editor.html.set(content);
40
+ });
41
+ }
42
+
43
+ public getHtml() {
44
+ var editor = this.getEditor();
45
+ if (typeof (editor) == "undefined" || editor == null) {
46
+ return;
47
+ }
48
+
49
+ return editor.html.get(false);
50
+ }
51
+ }
@@ -0,0 +1,38 @@
1
+ export const DefaultEditorOptions: Object = {
2
+ placeholderText: 'Edit Your Content Here',
3
+ charCounterCount: true,
4
+ heightMin: 100,
5
+ toolbarInline: false,
6
+
7
+ toolbarButtons: {
8
+ 'moreText': {
9
+ 'buttons': ['bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript',
10
+ 'fontFamily', 'fontSize', 'textColor', 'backgroundColor', 'inlineClass', 'inlineStyle']
11
+ },
12
+ 'moreParagraph': {
13
+ 'buttons': ['alignLeft', 'alignCenter', 'formatOLSimple', 'alignRight', 'alignJustify',
14
+ 'formatOL', 'formatUL', 'paragraphFormat', 'paragraphStyle', 'lineHeight', 'outdent', 'indent', 'quote']
15
+ },
16
+ 'moreRich': {
17
+ 'buttons': ['insertLink', 'insertImage', 'insertTable', 'emoticons', 'fontAwesome',
18
+ 'specialCharacters', 'embedly']
19
+ },
20
+ 'moreMisc': {
21
+ 'buttons': ['selectAll', 'clearFormatting', 'html', 'undo', 'redo', 'fullscreen'],
22
+ 'align': 'right',
23
+ }
24
+ },
25
+
26
+ /*
27
+ Upload:
28
+ https://www.froala.com/wysiwyg-editor/docs/concepts/image/upload
29
+ */
30
+ imageUploadURL: '/api/HtmlEditor/UploadImage',
31
+ imageAllowedTypes: ['jpeg', 'jpg', 'png'],
32
+ imageUploadParams: { uploadType: '', uploadParentId: '' },
33
+
34
+ events: {
35
+ 'image.beforeUpload': function (images) {
36
+ }
37
+ }
38
+ };
@@ -0,0 +1,4 @@
1
+ <div class="callout callout-danger" *ngIf="visible">
2
+ <h4 class="box-title">There are problems with the form</h4>
3
+ <p *ngFor="let error of getErrors()"><span class="help-block " style="color:white">{{error}}</span></p>
4
+ </div>