@vgip/meta-ui 2.1.1 → 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.
Files changed (118) hide show
  1. package/.eslintrc.json +57 -0
  2. package/karma.conf.js +35 -0
  3. package/ng-package.json +10 -0
  4. package/package.json +4 -16
  5. package/src/lib/common/fieldNormalizer/boolean.ts +11 -0
  6. package/src/lib/common/fieldNormalizer/datetime.ts +8 -0
  7. package/src/lib/common/fieldNormalizer/index.ts +171 -0
  8. package/src/lib/common/fieldNormalizer/number.ts +13 -0
  9. package/src/lib/common/fieldNormalizer/options.ts +48 -0
  10. package/src/lib/common/fieldNormalizer/radio.ts +29 -0
  11. package/src/lib/common/fieldNormalizer/reference.ts +32 -0
  12. package/src/lib/common/fieldNormalizer/richtext.ts +15 -0
  13. package/src/lib/common/fieldNormalizer/string.ts +23 -0
  14. package/src/lib/common/fieldNormalizer/text.ts +17 -0
  15. package/src/lib/common/fieldNormalizer/uniqueNameFilter.ts +21 -0
  16. package/src/lib/common/metaAutofocus.directive.ts +31 -0
  17. package/src/lib/common/metaContext.resolver.ts +25 -0
  18. package/src/lib/common/metaIcons.pipe.spec.ts +15 -0
  19. package/src/lib/common/metaIcons.pipe.ts +29 -0
  20. package/src/lib/common/metaModel.pipe.ts +19 -0
  21. package/src/lib/common/metaNormalizer.ts +366 -0
  22. package/src/lib/common/metaStripHtml.pipe.ts +18 -0
  23. package/src/lib/common/utils/colorThemes.ts +86 -0
  24. package/src/lib/common/utils/indexedDbStore/index.ts +244 -0
  25. package/src/lib/common/utils/indexedDbStore/indexedDbStore.spec.ts +149 -0
  26. package/src/lib/common/utils/relativeTimeBuilder.ts +49 -0
  27. package/src/lib/common/utils/resourceCardLabel.ts +25 -0
  28. package/src/lib/common/utils/smartProp.spec.ts +24 -0
  29. package/src/lib/common/utils/smartProp.ts +28 -0
  30. package/src/lib/common/utils/templateBuilder.ts +99 -0
  31. package/src/lib/field.scss +207 -0
  32. package/src/lib/fieldAbstract.ts +327 -0
  33. package/src/lib/fieldBoolean/index.ts +55 -0
  34. package/src/lib/fieldBoolean/style.scss +22 -0
  35. package/src/lib/fieldBoolean/test.spec.ts +43 -0
  36. package/src/lib/fieldBoolean/view.html +30 -0
  37. package/src/lib/fieldComposite/index.ts +86 -0
  38. package/src/lib/fieldComposite/style.scss +6 -0
  39. package/src/lib/fieldComposite/test.spec.ts +43 -0
  40. package/src/lib/fieldComposite/view.html +9 -0
  41. package/src/lib/fieldDatetime/index.ts +359 -0
  42. package/src/lib/fieldDatetime/style.scss +81 -0
  43. package/src/lib/fieldDatetime/test.spec.ts +43 -0
  44. package/src/lib/fieldDatetime/view.html +26 -0
  45. package/src/lib/fieldHidden/index.ts +15 -0
  46. package/src/lib/fieldHidden/view.html +0 -0
  47. package/src/lib/fieldInput/index.ts +477 -0
  48. package/src/lib/fieldInput/style.scss +128 -0
  49. package/src/lib/fieldInput/test.spec.ts +43 -0
  50. package/src/lib/fieldInput/view.html +81 -0
  51. package/src/lib/fieldList/index.ts +73 -0
  52. package/src/lib/fieldList/style.scss +26 -0
  53. package/src/lib/fieldList/test.spec.ts +43 -0
  54. package/src/lib/fieldList/view.html +25 -0
  55. package/src/lib/fieldRadio/index.ts +93 -0
  56. package/src/lib/fieldRadio/style.scss +32 -0
  57. package/src/lib/fieldRadio/test.spec.ts +43 -0
  58. package/src/lib/fieldRadio/view.html +24 -0
  59. package/src/lib/fieldReference/index.ts +871 -0
  60. package/src/lib/fieldReference/style.scss +273 -0
  61. package/src/lib/fieldReference/test.spec.ts +44 -0
  62. package/src/lib/fieldReference/view.html +163 -0
  63. package/src/lib/fieldRichtext/index.ts +98 -0
  64. package/src/lib/fieldRichtext/quill.scss +6 -0
  65. package/src/lib/fieldRichtext/style.scss +87 -0
  66. package/src/lib/fieldRichtext/test.spec.ts +43 -0
  67. package/src/lib/fieldRichtext/view.html +17 -0
  68. package/src/lib/fieldSelect/index.ts +597 -0
  69. package/src/lib/fieldSelect/style.scss +165 -0
  70. package/src/lib/fieldSelect/test.spec.ts +44 -0
  71. package/src/lib/fieldSelect/view.html +128 -0
  72. package/src/lib/fieldText/index.ts +86 -0
  73. package/src/lib/fieldText/style.scss +24 -0
  74. package/src/lib/fieldText/test.spec.ts +43 -0
  75. package/src/lib/fieldText/view.html +23 -0
  76. package/src/lib/fieldUnknown/index.ts +15 -0
  77. package/src/lib/fieldUnknown/test.spec.ts +34 -0
  78. package/src/lib/fieldUnknown/view.html +9 -0
  79. package/src/lib/index.ts +127 -0
  80. package/src/lib/layout/index.ts +255 -0
  81. package/src/lib/layout/style.scss +67 -0
  82. package/src/lib/layout/view.html +45 -0
  83. package/src/lib/metaField/index.ts +133 -0
  84. package/src/lib/metaField/test.spec.ts +32 -0
  85. package/src/lib/refDialog/index.ts +157 -0
  86. package/src/lib/refDialog/style.scss +154 -0
  87. package/src/lib/refDialog/view.html +24 -0
  88. package/src/lib/resource/index.ts +559 -0
  89. package/src/lib/resource/style.scss +132 -0
  90. package/src/lib/resource/view.html +70 -0
  91. package/src/lib/resourceCard/index.ts +44 -0
  92. package/src/lib/resourceCard/style.scss +7 -0
  93. package/src/lib/resourceCard/view.html +14 -0
  94. package/src/lib/services/metaContext/index.ts +61 -0
  95. package/src/lib/services/metaMsg/index.ts +84 -0
  96. package/src/lib/services/metaReference/index.ts +98 -0
  97. package/src/lib/services/metaResource/index.ts +163 -0
  98. package/src/lib/services/metaResource/metaHttpClient.ts +76 -0
  99. package/src/lib/services/metaResource/metaResource.spec.ts +24 -0
  100. package/src/lib/services/metaTracker/index.ts +38 -0
  101. package/src/lib/services/resourceDrafts/index.ts +81 -0
  102. package/src/lib/services/resourceDrafts/resourceDrafts.spec.ts +24 -0
  103. package/src/lib/styles.scss +13 -0
  104. package/src/public-api.ts +5 -0
  105. package/src/test.ts +17 -0
  106. package/tsconfig.lib.json +25 -0
  107. package/tsconfig.lib.prod.json +9 -0
  108. package/tsconfig.spec.json +17 -0
  109. package/vendor/volta3/scss/components/_accordions.scss +5 -1
  110. package/vendor/volta3/scss/components/_callouts.scss +6 -2
  111. package/vendor/volta3/scss/components/_card.scss +1 -1
  112. package/vendor/volta3/scss/components/_form-elements.scss +1 -1
  113. package/vendor/volta3/scss/components/_modals.scss +1 -1
  114. package/vendor/volta3/scss/components/_tables.scss +1 -1
  115. package/vendor/volta3/scss/lib/_variables.scss +1 -1
  116. package/fesm2022/vgip-meta-ui.mjs +0 -6076
  117. package/fesm2022/vgip-meta-ui.mjs.map +0 -1
  118. 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
+ });
@@ -0,0 +1,13 @@
1
+ @use '../../vendor/volta3/scss/volta.scss';
2
+
3
+ html, body {
4
+ height: 100%;
5
+ margin: 0;
6
+
7
+ .Vlt-modal.Vlt-modal_visible {
8
+ bottom: 0;
9
+ right: 0;
10
+ width: initial;
11
+ height: initial;
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface of meta-ui
3
+ */
4
+
5
+ export * from './lib';
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
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.lib.json",
3
+ "compilerOptions": {
4
+ "declarationMap": false
5
+ },
6
+ "angularCompilerOptions": {
7
+ "compilationMode": "partial"
8
+ }
9
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../out-tsc/spec",
5
+ "types": [
6
+ "jasmine",
7
+ "node"
8
+ ]
9
+ },
10
+ "files": [
11
+ "src/test.ts"
12
+ ],
13
+ "include": [
14
+ "**/*.spec.ts",
15
+ "**/*.d.ts"
16
+ ]
17
+ }
@@ -25,7 +25,11 @@
25
25
  border-bottom: 1px solid variables.$grey-dark;
26
26
 
27
27
  &__trigger {
28
- @extend .reset-button !optional;
28
+ appearance: none;
29
+ background: none;
30
+ border: 0;
31
+ outline: none;
32
+ padding: 0;
29
33
  border-top: 1px solid variables.$grey-dark;
30
34
  cursor: pointer;
31
35
  display: flex;
@@ -75,7 +75,11 @@
75
75
  }
76
76
 
77
77
  &__dismiss {
78
- @extend .reset-button !optional;
78
+ appearance: none;
79
+ background: none;
80
+ border: 0;
81
+ outline: none;
82
+ padding: 0;
79
83
  background-position: center;
80
84
  background-size: contain;
81
85
  cursor: pointer;
@@ -101,7 +105,7 @@
101
105
  @extend %Vlt-btn !optional;
102
106
  @extend %Vlt-btn--small !optional;
103
107
  @extend %Vlt-btn--secondary !optional;
104
- @extend %Vlt-btn--app !optional;
108
+ border-radius: 6px;
105
109
  line-height: 1.6rem; // needed for Safari
106
110
  margin-bottom: 0px;
107
111
  margin-top: 10px;
@@ -369,7 +369,7 @@
369
369
  text-align: center;
370
370
 
371
371
  .Vlt-btn {
372
- @extend %Vlt-btn--app !optional;
372
+ border-radius: 6px;
373
373
  }
374
374
  }
375
375
 
@@ -151,7 +151,7 @@
151
151
  .Vlt-btn,
152
152
  .Vlt-dropdown__btn,
153
153
  .Vlt-native-dropdown select {
154
- @extend %Vlt-btn--app !optional;
154
+ border-radius: 6px;
155
155
  border: 1px solid variables.$grey;
156
156
  margin: 0 !important;
157
157
  padding-bottom: 7px;
@@ -124,7 +124,7 @@
124
124
  }
125
125
 
126
126
  .Vlt-btn {
127
- @extend %Vlt-btn--app !optional;
127
+ border-radius: 6px;
128
128
  margin-bottom: 0;
129
129
  min-width: 75px;
130
130
  }
@@ -207,7 +207,7 @@
207
207
  // To deprecate in v2.0
208
208
  .Vlt-btn {
209
209
  @extend %Vlt-btn--small !optional;
210
- @extend %Vlt-btn--app !optional;
210
+ border-radius: 6px;
211
211
  margin-bottom: -(variables.$unit0);
212
212
  margin-top: -(variables.$unit0);
213
213
  }
@@ -102,7 +102,7 @@ $unit4: 32px;
102
102
  $unit5: 40px;
103
103
  $unit6: 6px;
104
104
 
105
- $Vlt-font-url: '/volta/' !default;
105
+ $Vlt-font-url: '../../meta-ui/vendor/volta3/fonts/' !default;
106
106
 
107
107
  $z-index-flash: 1000;
108
108
  $z-index-popups: 950;