@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.
- package/README.md +5 -0
- package/ng-package.json +7 -0
- package/package.json +1 -16
- package/src/lib/billing/billing.module.ts +62 -0
- package/src/lib/billing/components/buyaccess/buyaccess-button.component.html +15 -0
- package/src/lib/billing/components/buyaccess/buyaccess-button.component.ts +70 -0
- package/src/lib/billing/components/subscriptions/subscribe-plan-button.component.html +21 -0
- package/src/lib/billing/components/subscriptions/subscribe-plan-button.component.ts +60 -0
- package/src/lib/billing/components/subscriptions/upgrade-plan-button.component.html +3 -0
- package/src/lib/billing/components/subscriptions/upgrade-plan-button.component.ts +47 -0
- package/src/lib/billing/index.ts +10 -0
- package/src/lib/billing/services/base-billing-api.service.ts +56 -0
- package/src/lib/core/consts.ts +7 -0
- package/src/lib/core/core.module.ts +45 -0
- package/src/lib/core/index.ts +10 -0
- package/src/lib/core/services/appcontext.service.ts +81 -0
- package/src/lib/core/services/base-api.service.ts +87 -0
- package/src/lib/core/services/base-go.service.ts +33 -0
- package/src/lib/core/services/base-gridedit.service.ts +124 -0
- package/src/lib/identity/components/signin-button.component.html +1 -0
- package/src/lib/identity/components/signin-button.component.ts +27 -0
- package/src/lib/identity/components/signout-button.component.html +1 -0
- package/src/lib/identity/components/signout-button.component.ts +27 -0
- package/src/lib/identity/components/signup-button.component.html +1 -0
- package/src/lib/identity/components/signup-button.component.ts +28 -0
- package/src/lib/identity/identity.module.ts +41 -0
- package/src/lib/identity/index.ts +7 -0
- package/src/lib/ui/components/base-edit.component.ts +77 -0
- package/src/lib/ui/components/base.component.ts +45 -0
- package/src/lib/ui/components/content-header/content-header.component.html +4 -0
- package/src/lib/ui/components/content-header/content-header.component.ts +32 -0
- package/src/lib/ui/components/html-editor/base-html-editor.component.ts +97 -0
- package/src/lib/ui/components/html-editor/forms-html-editor.component.html +14 -0
- package/src/lib/ui/components/html-editor/forms-html-editor.component.ts +35 -0
- package/src/lib/ui/components/html-editor/html-editor.component.html +6 -0
- package/src/lib/ui/components/html-editor/html-editor.component.ts +51 -0
- package/src/lib/ui/components/html-editor/html-editor.defaultoptions.ts +38 -0
- package/src/lib/ui/components/validation/form-validation-summary.component.html +4 -0
- package/src/lib/ui/components/validation/form-validation-summary.component.ts +36 -0
- package/src/lib/ui/components/validation/item-validation-summary.component.html +5 -0
- package/src/lib/ui/components/validation/item-validation-summary.component.ts +32 -0
- package/src/lib/ui/components/validation/validation-summary.component.ts +74 -0
- package/src/lib/ui/index.js +13 -0
- package/src/lib/ui/index.js.map +1 -0
- package/src/lib/ui/index.ts +14 -0
- package/src/lib/ui/ui.module.ts +83 -0
- package/{public-api.d.ts → src/public-api.ts} +4 -4
- package/tsconfig.lib.json +32 -0
- package/tsconfig.lib.prod.json +6 -0
- package/tslint.json +17 -0
- package/typings/osovitny-ui/index.d.ts +24 -0
- package/bundles/osovitny-anatoly.umd.js +0 -2065
- package/bundles/osovitny-anatoly.umd.js.map +0 -1
- package/bundles/osovitny-anatoly.umd.min.js +0 -16
- package/bundles/osovitny-anatoly.umd.min.js.map +0 -1
- package/esm2015/lib/billing/billing.module.js +0 -62
- package/esm2015/lib/billing/components/buyaccess/buyaccess-button.component.js +0 -123
- package/esm2015/lib/billing/components/subscriptions/subscribe-plan-button.component.js +0 -97
- package/esm2015/lib/billing/components/subscriptions/upgrade-plan-button.component.js +0 -84
- package/esm2015/lib/billing/index.js +0 -6
- package/esm2015/lib/billing/services/base-billing-api.service.js +0 -116
- package/esm2015/lib/core/consts.js +0 -15
- package/esm2015/lib/core/core.module.js +0 -47
- package/esm2015/lib/core/index.js +0 -12
- package/esm2015/lib/core/services/appcontext.service.js +0 -123
- package/esm2015/lib/core/services/base-api.service.js +0 -154
- package/esm2015/lib/core/services/base-go.service.js +0 -58
- package/esm2015/lib/core/services/base-gridedit.service.js +0 -202
- package/esm2015/lib/identity/components/signin-button.component.js +0 -38
- package/esm2015/lib/identity/components/signout-button.component.js +0 -38
- package/esm2015/lib/identity/components/signup-button.component.js +0 -39
- package/esm2015/lib/identity/identity.module.js +0 -43
- package/esm2015/lib/identity/index.js +0 -6
- package/esm2015/lib/ui/components/base-edit.component.js +0 -102
- package/esm2015/lib/ui/components/base.component.js +0 -57
- package/esm2015/lib/ui/components/content-header/content-header.component.js +0 -44
- package/esm2015/lib/ui/components/html-editor/html-editor.component.js +0 -267
- package/esm2015/lib/ui/components/validation/form-validation-summary.component.js +0 -51
- package/esm2015/lib/ui/components/validation/item-validation-summary.component.js +0 -45
- package/esm2015/lib/ui/components/validation/validation-summary.component.js +0 -93
- package/esm2015/lib/ui/index.js +0 -11
- package/esm2015/lib/ui/ui.module.js +0 -72
- package/esm2015/osovitny-anatoly.js +0 -9
- package/esm2015/public-api.js +0 -9
- package/esm5/lib/billing/billing.module.js +0 -66
- package/esm5/lib/billing/components/buyaccess/buyaccess-button.component.js +0 -128
- package/esm5/lib/billing/components/subscriptions/subscribe-plan-button.component.js +0 -100
- package/esm5/lib/billing/components/subscriptions/upgrade-plan-button.component.js +0 -86
- package/esm5/lib/billing/index.js +0 -6
- package/esm5/lib/billing/services/base-billing-api.service.js +0 -135
- package/esm5/lib/core/consts.js +0 -15
- package/esm5/lib/core/core.module.js +0 -51
- package/esm5/lib/core/index.js +0 -12
- package/esm5/lib/core/services/appcontext.service.js +0 -140
- package/esm5/lib/core/services/base-api.service.js +0 -205
- package/esm5/lib/core/services/base-go.service.js +0 -59
- package/esm5/lib/core/services/base-gridedit.service.js +0 -240
- package/esm5/lib/identity/components/signin-button.component.js +0 -41
- package/esm5/lib/identity/components/signout-button.component.js +0 -41
- package/esm5/lib/identity/components/signup-button.component.js +0 -41
- package/esm5/lib/identity/identity.module.js +0 -47
- package/esm5/lib/identity/index.js +0 -6
- package/esm5/lib/ui/components/base-edit.component.js +0 -137
- package/esm5/lib/ui/components/base.component.js +0 -72
- package/esm5/lib/ui/components/content-header/content-header.component.js +0 -51
- package/esm5/lib/ui/components/html-editor/html-editor.component.js +0 -309
- package/esm5/lib/ui/components/validation/form-validation-summary.component.js +0 -59
- package/esm5/lib/ui/components/validation/item-validation-summary.component.js +0 -49
- package/esm5/lib/ui/components/validation/validation-summary.component.js +0 -106
- package/esm5/lib/ui/index.js +0 -11
- package/esm5/lib/ui/ui.module.js +0 -76
- package/esm5/osovitny-anatoly.js +0 -9
- package/esm5/public-api.js +0 -9
- package/fesm2015/osovitny-anatoly.js +0 -1622
- package/fesm2015/osovitny-anatoly.js.map +0 -1
- package/fesm5/osovitny-anatoly.js +0 -1877
- package/fesm5/osovitny-anatoly.js.map +0 -1
- package/lib/billing/billing.module.d.ts +0 -2
- package/lib/billing/components/buyaccess/buyaccess-button.component.d.ts +0 -16
- package/lib/billing/components/subscriptions/subscribe-plan-button.component.d.ts +0 -15
- package/lib/billing/components/subscriptions/upgrade-plan-button.component.d.ts +0 -9
- package/lib/billing/index.d.ts +0 -1
- package/lib/billing/services/base-billing-api.service.d.ts +0 -9
- package/lib/core/consts.d.ts +0 -5
- package/lib/core/core.module.d.ts +0 -2
- package/lib/core/index.d.ts +0 -5
- package/lib/core/services/appcontext.service.d.ts +0 -14
- package/lib/core/services/base-api.service.d.ts +0 -18
- package/lib/core/services/base-go.service.d.ts +0 -7
- package/lib/core/services/base-gridedit.service.d.ts +0 -19
- package/lib/identity/components/signin-button.component.d.ts +0 -4
- package/lib/identity/components/signout-button.component.d.ts +0 -4
- package/lib/identity/components/signup-button.component.d.ts +0 -4
- package/lib/identity/identity.module.d.ts +0 -2
- package/lib/identity/index.d.ts +0 -1
- package/lib/ui/components/base-edit.component.d.ts +0 -14
- package/lib/ui/components/base.component.d.ts +0 -7
- package/lib/ui/components/content-header/content-header.component.d.ts +0 -5
- package/lib/ui/components/html-editor/html-editor.component.d.ts +0 -22
- package/lib/ui/components/validation/form-validation-summary.component.d.ts +0 -6
- package/lib/ui/components/validation/item-validation-summary.component.d.ts +0 -6
- package/lib/ui/components/validation/validation-summary.component.d.ts +0 -6
- package/lib/ui/index.d.ts +0 -4
- package/lib/ui/ui.module.d.ts +0 -2
- package/osovitny-anatoly.d.ts +0 -4
- 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,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,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,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
|
+
};
|