@vgip/meta-ui 2.1.2 → 2.1.3
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/.eslintrc.json +57 -0
- package/karma.conf.js +35 -0
- package/ng-package.json +10 -0
- package/package.json +3 -15
- package/src/lib/common/fieldNormalizer/boolean.ts +11 -0
- package/src/lib/common/fieldNormalizer/datetime.ts +8 -0
- package/src/lib/common/fieldNormalizer/index.ts +171 -0
- package/src/lib/common/fieldNormalizer/number.ts +13 -0
- package/src/lib/common/fieldNormalizer/options.ts +48 -0
- package/src/lib/common/fieldNormalizer/radio.ts +29 -0
- package/src/lib/common/fieldNormalizer/reference.ts +32 -0
- package/src/lib/common/fieldNormalizer/richtext.ts +15 -0
- package/src/lib/common/fieldNormalizer/string.ts +23 -0
- package/src/lib/common/fieldNormalizer/text.ts +17 -0
- package/src/lib/common/fieldNormalizer/uniqueNameFilter.ts +21 -0
- package/src/lib/common/metaAutofocus.directive.ts +31 -0
- package/src/lib/common/metaContext.resolver.ts +25 -0
- package/src/lib/common/metaIcons.pipe.spec.ts +15 -0
- package/src/lib/common/metaIcons.pipe.ts +29 -0
- package/src/lib/common/metaModel.pipe.ts +19 -0
- package/src/lib/common/metaNormalizer.ts +366 -0
- package/src/lib/common/metaStripHtml.pipe.ts +18 -0
- package/src/lib/common/utils/colorThemes.ts +86 -0
- package/src/lib/common/utils/indexedDbStore/index.ts +244 -0
- package/src/lib/common/utils/indexedDbStore/indexedDbStore.spec.ts +149 -0
- package/src/lib/common/utils/relativeTimeBuilder.ts +49 -0
- package/src/lib/common/utils/resourceCardLabel.ts +25 -0
- package/src/lib/common/utils/smartProp.spec.ts +24 -0
- package/src/lib/common/utils/smartProp.ts +28 -0
- package/src/lib/common/utils/templateBuilder.ts +99 -0
- package/src/lib/field.scss +207 -0
- package/src/lib/fieldAbstract.ts +327 -0
- package/src/lib/fieldBoolean/index.ts +55 -0
- package/src/lib/fieldBoolean/style.scss +22 -0
- package/src/lib/fieldBoolean/test.spec.ts +43 -0
- package/src/lib/fieldBoolean/view.html +30 -0
- package/src/lib/fieldComposite/index.ts +86 -0
- package/src/lib/fieldComposite/style.scss +6 -0
- package/src/lib/fieldComposite/test.spec.ts +43 -0
- package/src/lib/fieldComposite/view.html +9 -0
- package/src/lib/fieldDatetime/index.ts +359 -0
- package/src/lib/fieldDatetime/style.scss +81 -0
- package/src/lib/fieldDatetime/test.spec.ts +43 -0
- package/src/lib/fieldDatetime/view.html +26 -0
- package/src/lib/fieldHidden/index.ts +15 -0
- package/src/lib/fieldHidden/view.html +0 -0
- package/src/lib/fieldInput/index.ts +477 -0
- package/src/lib/fieldInput/style.scss +128 -0
- package/src/lib/fieldInput/test.spec.ts +43 -0
- package/src/lib/fieldInput/view.html +81 -0
- package/src/lib/fieldList/index.ts +73 -0
- package/src/lib/fieldList/style.scss +26 -0
- package/src/lib/fieldList/test.spec.ts +43 -0
- package/src/lib/fieldList/view.html +25 -0
- package/src/lib/fieldRadio/index.ts +93 -0
- package/src/lib/fieldRadio/style.scss +32 -0
- package/src/lib/fieldRadio/test.spec.ts +43 -0
- package/src/lib/fieldRadio/view.html +24 -0
- package/src/lib/fieldReference/index.ts +871 -0
- package/src/lib/fieldReference/style.scss +273 -0
- package/src/lib/fieldReference/test.spec.ts +44 -0
- package/src/lib/fieldReference/view.html +163 -0
- package/src/lib/fieldRichtext/index.ts +98 -0
- package/src/lib/fieldRichtext/quill.scss +6 -0
- package/src/lib/fieldRichtext/style.scss +87 -0
- package/src/lib/fieldRichtext/test.spec.ts +43 -0
- package/src/lib/fieldRichtext/view.html +17 -0
- package/src/lib/fieldSelect/index.ts +597 -0
- package/src/lib/fieldSelect/style.scss +165 -0
- package/src/lib/fieldSelect/test.spec.ts +44 -0
- package/src/lib/fieldSelect/view.html +128 -0
- package/src/lib/fieldText/index.ts +86 -0
- package/src/lib/fieldText/style.scss +24 -0
- package/src/lib/fieldText/test.spec.ts +43 -0
- package/src/lib/fieldText/view.html +23 -0
- package/src/lib/fieldUnknown/index.ts +15 -0
- package/src/lib/fieldUnknown/test.spec.ts +34 -0
- package/src/lib/fieldUnknown/view.html +9 -0
- package/src/lib/index.ts +127 -0
- package/src/lib/layout/index.ts +255 -0
- package/src/lib/layout/style.scss +67 -0
- package/src/lib/layout/view.html +45 -0
- package/src/lib/metaField/index.ts +133 -0
- package/src/lib/metaField/test.spec.ts +32 -0
- package/src/lib/refDialog/index.ts +157 -0
- package/src/lib/refDialog/style.scss +154 -0
- package/src/lib/refDialog/view.html +24 -0
- package/src/lib/resource/index.ts +559 -0
- package/src/lib/resource/style.scss +132 -0
- package/src/lib/resource/view.html +70 -0
- package/src/lib/resourceCard/index.ts +44 -0
- package/src/lib/resourceCard/style.scss +7 -0
- package/src/lib/resourceCard/view.html +14 -0
- package/src/lib/services/metaContext/index.ts +61 -0
- package/src/lib/services/metaMsg/index.ts +84 -0
- package/src/lib/services/metaReference/index.ts +98 -0
- package/src/lib/services/metaResource/index.ts +163 -0
- package/src/lib/services/metaResource/metaHttpClient.ts +76 -0
- package/src/lib/services/metaResource/metaResource.spec.ts +24 -0
- package/src/lib/services/metaTracker/index.ts +38 -0
- package/src/lib/services/resourceDrafts/index.ts +81 -0
- package/src/lib/services/resourceDrafts/resourceDrafts.spec.ts +24 -0
- package/src/lib/styles.scss +13 -0
- package/src/public-api.ts +5 -0
- package/src/test.ts +17 -0
- package/tsconfig.lib.json +25 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +17 -0
- package/fesm2022/vgip-meta-ui.mjs +0 -6079
- package/fesm2022/vgip-meta-ui.mjs.map +0 -1
- package/index.d.ts +0 -709
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: Alexander.Vangelov@vonage.com
|
|
3
|
+
* @Date: 2019-09-19 17:35:19
|
|
4
|
+
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
5
|
+
* @Last Modified time: 2020-03-23 17:08:23
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Injectable, EventEmitter } from '@angular/core';
|
|
9
|
+
|
|
10
|
+
export interface IMetaTrackerEvent {
|
|
11
|
+
integration?: string;
|
|
12
|
+
resource?: string;
|
|
13
|
+
field?: string;
|
|
14
|
+
action?: string;
|
|
15
|
+
value?: string;
|
|
16
|
+
isContactable?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Injectable({
|
|
20
|
+
providedIn: 'root'
|
|
21
|
+
})
|
|
22
|
+
export class MetaTrackerService {
|
|
23
|
+
integrationCode: string;
|
|
24
|
+
resourceType: string;
|
|
25
|
+
events: EventEmitter<IMetaTrackerEvent> = new EventEmitter();
|
|
26
|
+
|
|
27
|
+
constructor() {}
|
|
28
|
+
|
|
29
|
+
emit(event: IMetaTrackerEvent) {
|
|
30
|
+
if (!event.integration) {
|
|
31
|
+
event.integration = this.integrationCode || 'N/A';
|
|
32
|
+
}
|
|
33
|
+
if (!event.resource) {
|
|
34
|
+
event.resource = this.resourceType || 'N/A';
|
|
35
|
+
}
|
|
36
|
+
this.events.emit(event);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: Alexander.Vangelov@vonage.com
|
|
3
|
+
* @Date: 2020-02-10 17:35:19
|
|
4
|
+
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
5
|
+
* @Last Modified time: 2020-02-13 06:17:24
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Injectable } from '@angular/core';
|
|
9
|
+
|
|
10
|
+
import { IndexedDbStore } from '../../common/utils/indexedDbStore';
|
|
11
|
+
import { MetaContextService } from '../metaContext';
|
|
12
|
+
|
|
13
|
+
const COLLECTION = 'Draft';
|
|
14
|
+
|
|
15
|
+
export interface IDraft {
|
|
16
|
+
id: string | number;
|
|
17
|
+
integrationCode: string;
|
|
18
|
+
resourceType: string;
|
|
19
|
+
contextUid: string;
|
|
20
|
+
timestamp: number;
|
|
21
|
+
data?: string;
|
|
22
|
+
}
|
|
23
|
+
@Injectable({
|
|
24
|
+
providedIn: 'root'
|
|
25
|
+
})
|
|
26
|
+
export class ResourceDraftsService {
|
|
27
|
+
store: IndexedDbStore;
|
|
28
|
+
db: any;
|
|
29
|
+
constructor(private context: MetaContextService) {
|
|
30
|
+
this.store = new IndexedDbStore('vgip');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
init(cb?: (err, db?) => void) {
|
|
34
|
+
if (!this.db) {
|
|
35
|
+
this.store.initCollection(COLLECTION, (err, db) => {
|
|
36
|
+
this.db = db;
|
|
37
|
+
cb(err, this.db);
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
cb(null, this.db);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
list(integrationCode, resourceType, cb: (err, drafts?: Array<IDraft>) => void) {
|
|
45
|
+
console.log('list drafts', this.context.uid, integrationCode, resourceType);
|
|
46
|
+
cb([]);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
save(integrationCode, resourceType, draft, cb?: (err, draft?: IDraft) => void) {
|
|
50
|
+
const now = new Date().getTime();
|
|
51
|
+
this.store.save(COLLECTION, {
|
|
52
|
+
context: this.context.uid || '',
|
|
53
|
+
integration: integrationCode || '',
|
|
54
|
+
resource: resourceType || '',
|
|
55
|
+
timestamp: now,
|
|
56
|
+
data: draft
|
|
57
|
+
}, cb);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
findOne(integrationCode, resourceType, cb: (err, drafts?: IDraft) => void) {
|
|
61
|
+
this.store.findOne(COLLECTION, {
|
|
62
|
+
context: this.context.uid || '',
|
|
63
|
+
integration: integrationCode || '',
|
|
64
|
+
resource: resourceType || ''
|
|
65
|
+
}, null, cb);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
find(params, cb: (err, drafts?: Array<IDraft>) => void) {
|
|
69
|
+
this.store.find(COLLECTION, params, null, cb);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
findById(draftId, cb?: (err, drafts?: IDraft) => void) {
|
|
73
|
+
this.store.findById(COLLECTION, draftId, cb);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
destroyDraft(draft, cb?: (err, drafts?: IDraft) => void) {
|
|
77
|
+
if (draft?.id) {
|
|
78
|
+
this.store.destroyById(COLLECTION, draft.id, cb);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: Alexander.Vangelov@vonage.com
|
|
3
|
+
* @Date: 2019-09-19 17:35:19
|
|
4
|
+
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
5
|
+
* @Last Modified time: 2020-02-10 14:22:36
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { TestBed } from '@angular/core/testing';
|
|
9
|
+
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
|
10
|
+
|
|
11
|
+
import { ResourceDraftsService } from '.';
|
|
12
|
+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
13
|
+
|
|
14
|
+
describe('MetaResourceService', () => {
|
|
15
|
+
beforeEach(() => TestBed.configureTestingModule({
|
|
16
|
+
imports: [],
|
|
17
|
+
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
it('should be created', () => {
|
|
21
|
+
const service: ResourceDraftsService = ((TestBed as any).inject || (TestBed as any).get)(ResourceDraftsService);
|
|
22
|
+
expect(service).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
});
|
package/src/test.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
+
|
|
3
|
+
import 'zone.js';
|
|
4
|
+
import 'zone.js/testing';
|
|
5
|
+
import { getTestBed } from '@angular/core/testing';
|
|
6
|
+
import {
|
|
7
|
+
BrowserDynamicTestingModule,
|
|
8
|
+
platformBrowserDynamicTesting
|
|
9
|
+
} from '@angular/platform-browser-dynamic/testing';
|
|
10
|
+
|
|
11
|
+
// First, initialize the Angular testing environment.
|
|
12
|
+
getTestBed().initTestEnvironment(
|
|
13
|
+
BrowserDynamicTestingModule,
|
|
14
|
+
platformBrowserDynamicTesting(), {
|
|
15
|
+
teardown: { destroyAfterEach: false }
|
|
16
|
+
}
|
|
17
|
+
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../out-tsc/lib",
|
|
5
|
+
"declarationMap": true,
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"inlineSources": true,
|
|
8
|
+
"types": [],
|
|
9
|
+
"lib": [
|
|
10
|
+
"dom",
|
|
11
|
+
"es2018"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"angularCompilerOptions": {
|
|
15
|
+
"skipTemplateCodegen": true,
|
|
16
|
+
"strictMetadataEmit": true,
|
|
17
|
+
"fullTemplateTypeCheck": true,
|
|
18
|
+
"strictInjectionParameters": true,
|
|
19
|
+
"enableResourceInlining": true
|
|
20
|
+
},
|
|
21
|
+
"exclude": [
|
|
22
|
+
"src/test.ts",
|
|
23
|
+
"**/*.spec.ts"
|
|
24
|
+
]
|
|
25
|
+
}
|