@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,157 @@
1
+ import { Component, ElementRef, OnInit } from '@angular/core';
2
+ import { metaDark, metaLight } from '../common/utils/colorThemes';
3
+ import { MetaResourceService } from '../services/metaResource';
4
+
5
+ @Component({
6
+ templateUrl: './view.html',
7
+ styleUrls: ['./style.scss'],
8
+ standalone: false
9
+ })
10
+ export class MetaRefDialog implements OnInit {
11
+ modal: HTMLElement;
12
+ onComplete: (result?) => undefined;
13
+ fullResource: any;
14
+ resources: any = {};
15
+ models: any = {};
16
+ reference: any;
17
+ currentResource: string;
18
+ services: any = {};
19
+ integrationCode: string;
20
+ resource: any;
21
+ metaResource: MetaResourceService;
22
+ integrationIcon: string;
23
+ preferResourceType: string;
24
+ theme: string;
25
+
26
+ constructor(
27
+ private el: ElementRef
28
+ ) { }
29
+
30
+ get isEditable() {
31
+ return this.resources[this.currentResource].meta.layout.editable !== false;
32
+ }
33
+
34
+ get isPersistent() {
35
+ return this.resource && (this.resource.externalId || this.resource.id);
36
+ }
37
+
38
+ ngOnInit() {
39
+ let references = (this.reference instanceof Array) ? this.reference : [this.reference];
40
+ /* eslint-disable no-underscore-dangle */
41
+ if (this.resource && this.resource._vgis) {
42
+ this.fullResource = this.resource;
43
+ this.resource = this.resource._vgis;
44
+ }
45
+ /* eslint-enable no-underscore-dangle */
46
+ if (this.resource) {
47
+ references = references.filter((r) => {
48
+ const resType = r.name || r.resourceType || '';
49
+ // comparing case insensitive, because of Zendesk comment vs Comment
50
+ return (resType.id || resType || '').toLowerCase() === (this.resource.resourceType || this.resource.type || '').toLowerCase();
51
+ });
52
+ }
53
+
54
+ for (const ref of references) {
55
+ if (!ref.name) {
56
+ ref.name = ref.resourceType; // when the resource comes from resources API, not from metadata
57
+ }
58
+ if (!this.currentResource) {
59
+ this.currentResource = ref.name;
60
+ }
61
+ if (ref.name === this.preferResourceType) {
62
+ this.currentResource = this.preferResourceType;
63
+ }
64
+ const rs: any = {
65
+ integrationCode: this.integrationCode,
66
+ resourceType: ref.resourceType || ref.name,
67
+ ref
68
+ };
69
+ if (this.resource) {
70
+ rs.externalId = this.resource.id || this.resource.externalId;
71
+ if (this.resource.eventId) {
72
+ rs.eventId = this.resource.eventId;
73
+ }
74
+ if (this.fullResource) {
75
+ rs.activity = this.fullResource;
76
+ }
77
+ if (this.resource.layoutId) {
78
+ rs.layoutId = this.resource.layoutId;
79
+ }
80
+ }
81
+ rs.parent = ref.parent;
82
+ this.resources[ref.name] = rs;
83
+ this.models[ref.name] = {};
84
+ if (this.resource) {
85
+ this.models[ref.name]._vgis = this.resource; // eslint-disable-line no-underscore-dangle
86
+ }
87
+ }
88
+
89
+ this.modal = this.el.nativeElement.childNodes[0];
90
+ this.modal.classList.remove('Vlt-modal--out');
91
+ this.modal.classList.add('Vlt-modal_visible');
92
+ document.addEventListener('keydown', this.keyEventListener);
93
+
94
+ if (this.integrationCode === 'mocks') {
95
+ this.integrationIcon = 'Brand-icon-vonage';
96
+ } else {
97
+ switch (this.integrationCode.toLowerCase()) {
98
+ case 'office365':
99
+ this.integrationIcon = 'Brand-icon-office-color';
100
+ break;
101
+ case 'sugar':
102
+ this.integrationIcon = 'Brand-icon-sugarcrm-color';
103
+ break;
104
+ case 'msdynamics':
105
+ this.integrationIcon = 'Brand-icon-dynamics-color';
106
+ break;
107
+ default:
108
+ this.integrationIcon = `Brand-icon-${(this.integrationCode || '').toLowerCase()}-color`;
109
+ }
110
+ }
111
+
112
+ this.applyTheme();
113
+ }
114
+
115
+ close() {
116
+ this.modal.classList.remove('Vlt-modal_visible');
117
+ this.modal.classList.add('Vlt-modal--out');
118
+ }
119
+
120
+ dismiss(ev?) {
121
+ this.close();
122
+ this.onComplete(null);
123
+ if (ev) {
124
+ ev.preventDefault();
125
+ ev.stopPropagation();
126
+ return false;
127
+ }
128
+ }
129
+
130
+ onResourceDone(result) {
131
+ this.close();
132
+ this.onComplete(result);
133
+ }
134
+
135
+ selectResource(ev, resource) {
136
+ this.currentResource = resource;
137
+ ev.preventDefault();
138
+ ev.stopPropagation();
139
+ return false;
140
+ }
141
+
142
+ keepOrder = (a) => a;
143
+
144
+ private keyEventListener = (event) => {
145
+ if (event && event.key === 'Escape') {
146
+ document.removeEventListener('keydown', this.keyEventListener);
147
+ this.dismiss();
148
+ }
149
+ };
150
+
151
+ private applyTheme() {
152
+ const metaTheme = this.theme === 'dark' ? metaDark : metaLight;
153
+ for (const key of Object.keys(metaTheme.properties)) {
154
+ this.el.nativeElement.style.setProperty(key, metaTheme.properties[key]);
155
+ }
156
+ }
157
+ }
@@ -0,0 +1,154 @@
1
+ .Vlt-modal_visible {
2
+ background: var(--vgip-meta-overlay-background);
3
+ }
4
+ .Vlt-modal__panel {
5
+ padding: 0;
6
+ // border: 1px solid var(--vgip-meta-separator-color);
7
+ background: var(--vgip-meta-resource-bg-color);
8
+ overflow: hidden;
9
+ @media only screen and (max-width: 575px) {
10
+ height: 100%;
11
+ width: 100%;
12
+ max-height: none;
13
+ border-bottom-left-radius: 0;
14
+ border-bottom-right-radius: 0;
15
+ margin: 10px 6px 0 6px;
16
+ ::ng-deep .busy-mask {
17
+ min-height: calc(100vh - 58px);
18
+ }
19
+ }
20
+ .Vlt-tabs__header--background {
21
+ border-top-left-radius: 5px;
22
+ border-top-right-radius: 5px;
23
+ }
24
+ .Vlt-tabs__header {
25
+ background: var(--vgip-meta-resource-bar-color);
26
+ padding-left: 52px;
27
+ padding-right: 45px;
28
+ border-bottom: 0;
29
+ flex-wrap: wrap;
30
+ min-height: 52px;
31
+ max-height: 52px;
32
+ align-items: center;
33
+ > .Vlt-icon {
34
+ position: absolute;
35
+ left: 14px;
36
+ }
37
+ h5 {
38
+ margin-bottom: 0;
39
+ font-weight: initial;
40
+ }
41
+ .Vlt-tabs__link {
42
+ padding-top: 4px;
43
+ padding-bottom: 2px;
44
+ color: var(--vgip-meta-input-label-color);
45
+ text-transform: capitalize;
46
+ }
47
+ .Vlt-tabs__link_active {
48
+ color: var(--vgip-meta-input-accent-color);
49
+ &:after {
50
+ background: var(--vgip-meta-input-accent-color);
51
+ }
52
+ }
53
+ .Vlt-modal__dismiss {
54
+ background-image: none;
55
+ width: 18px;
56
+ height: 18px;
57
+ opacity: initial;
58
+ svg {
59
+ width: 16px;
60
+ height: 16px;
61
+ fill: var(--vgip-meta-input-label-color);
62
+ }
63
+ &:hover svg {
64
+ fill: var(--vgip-meta-input-accent-color);
65
+ }
66
+ }
67
+ &::-webkit-scrollbar {
68
+ width: 8px;
69
+ }
70
+ &::-webkit-scrollbar-thumb {
71
+ background-color: var(--vgip-meta-scrollbar-color);
72
+ border: 2px solid transparent;
73
+ border-radius: 6px;
74
+ background-clip: content-box;
75
+ }
76
+ }
77
+ .Vlt-tabs__content {
78
+ margin-top: 0;
79
+ // border-top: 1px solid #e7ebee;
80
+ .Vlt-tabs__link {
81
+ font-size: 1.8rem;
82
+ }
83
+ }
84
+ .Vlt-callout--banner {
85
+ // padding-left: 16px;
86
+ // padding-right: 20px;
87
+ -webkit-box-pack: initial;
88
+ justify-content: initial;
89
+ text-align: initial;
90
+ overflow-y: auto;
91
+ &.Vlt-callout--dismissed {
92
+ padding: 0;
93
+ }
94
+ &:not(.Vlt-callout--dismissed) {
95
+ min-height: 78px;
96
+ }
97
+ }
98
+ .Vlt-modal__cancel {
99
+ z-index: 899;
100
+ }
101
+ .Vlt-modal__dismiss {
102
+ right: 16px;
103
+ top: 14px;
104
+ // color: #c4cdd5;
105
+ // &:hover {
106
+ // color: #f8fafc;
107
+ // }
108
+ // background-image: url('data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0A%3Csvg%20width%3D%2220px%22%20height%3D%2220px%22%20viewBox%3D%220%200%2020%2020%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%0A%20%20%20%20%3C!--%20Generator%3A%20Sketch%2048.2%20(47327)%20-%20http%3A%2F%2Fwww.bohemiancoding.com%2Fsketch%20--%3E%0A%20%20%20%20%3Ctitle%3Eicn-close%3C%2Ftitle%3E%0A%20%20%20%20%3Cdesc%3ECreated%20with%20Sketch.%3C%2Fdesc%3E%0A%20%20%20%20%3Cdefs%3E%3C%2Fdefs%3E%0A%20%20%20%20%3Cg%20id%3D%22Modals---Desktop%22%20stroke%3D%22none%22%20stroke-width%3D%221%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%20transform%3D%22translate(-512.000000%2C%20-62.000000)%22%3E%0A%20%20%20%20%20%20%20%20%3Cg%20id%3D%22Modal%22%20transform%3D%22translate(156.000000%2C%2040.000000)%22%20fill%3D%22%23f8fafc%22%20fill-rule%3D%22nonzero%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20id%3D%22icn-close%22%20transform%3D%22translate(356.000000%2C%2022.000000)%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20id%3D%22Group-12%22%20transform%3D%22translate(2.083333%2C%202.500000)%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpolygon%20id%3D%22Path-252%22%20points%3D%221.42258898%2015.115968%2015.115968%201.42258898%2013.9374567%200.244077682%200.244077682%2013.9374567%22%3E%3C%2Fpolygon%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpolygon%20id%3D%22Path-252-Copy%22%20points%3D%220.244077682%201.42258898%2013.9374567%2015.115968%2015.115968%2013.9374567%201.42258898%200.244077682%22%3E%3C%2Fpolygon%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E');
109
+ }
110
+ .Vlt-card__footer button {
111
+ margin-top: 0;
112
+ margin-bottom: 0;
113
+ }
114
+ .Vlt-select select:disabled {
115
+ background: initial;
116
+ cursor: not-allowed;
117
+ }
118
+ ::ng-deep .form-content {
119
+ min-height: 0;
120
+ max-height: calc(95vh - 172px);
121
+ @media only screen and (max-width: 575px) {
122
+ min-height: calc(100vh - 113px);
123
+ }
124
+ }
125
+ }
126
+
127
+ .resource-menu {
128
+ button {
129
+ margin: 0 -10px 0;
130
+ &:not(:hover) .Vlt-icon {
131
+ color: #616266;
132
+ fill: #616266;
133
+ }
134
+ }
135
+ }
136
+
137
+ .busy-mask {
138
+ position: absolute;
139
+ top: 0;
140
+ right: 0;
141
+ bottom: 0;
142
+ left: 0;
143
+ background: rgba(0,0,0,.32);
144
+ opacity: 1;
145
+ z-index: 898;
146
+ display: none;
147
+ border-bottom-left-radius: 6px;
148
+ border-bottom-right-radius: 6px;
149
+ margin: 1px;
150
+ cursor: progress;
151
+ &.active {
152
+ display: block;
153
+ }
154
+ }
@@ -0,0 +1,24 @@
1
+ <div class='Vlt-modal Vlt-modal--large'>
2
+ <div class="Vlt-modal__panel">
3
+ <div class="Vlt-tabs">
4
+ <div class='Vlt-tabs__header--background'>
5
+ <div class="Vlt-tabs__header Vlt-tabs__header--shadow">
6
+ <svg class="Vlt-icon" [ngStyle]="{fill: integrationIcon === 'Brand-icon-vonage' ? 'var(--vgip-meta-input-color)' : ''}"><use attr.xlink:href="volta/volta-brand-icons.svg#{{integrationIcon}}" /></svg>
7
+ <a href='#' *ngFor='let r of resources | keyvalue: keepOrder' (click)='selectResource($event, r.key)' class="Vlt-tabs__link" [ngClass]="{ 'Vlt-tabs__link_active': currentResource === r.key}">
8
+ {{r.key}}
9
+ </a>
10
+ <a href='#' class="Vlt-modal__dismiss" (click)="dismiss($event)">
11
+ <svg class="Vlt-icon"><use xlink:href="volta/volta-icons.svg#Vlt-icon-cross" /></svg>
12
+ </a>
13
+ </div>
14
+ </div>
15
+ <div class="Vlt-tabs__content" style='min-height: 90px;'>
16
+ <ng-container *ngFor='let r of resources | keyvalue: keepOrder'>
17
+ <div *ngIf='currentResource === r.key' class="Vlt-tabs__panel Vlt-tabs__panel_active">
18
+ <vgip-meta-resource [resource]='r.value' [model]='models[r.key]' [metaResourceServiceDelegated]='metaResource' (done)='onResourceDone($event)' theme='inherit' [attr.data-theme]='theme'></vgip-meta-resource>
19
+ </div>
20
+ </ng-container>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </div>