@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.
- package/.eslintrc.json +57 -0
- package/karma.conf.js +35 -0
- package/ng-package.json +10 -0
- package/package.json +4 -16
- 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/vendor/volta3/scss/components/_accordions.scss +5 -1
- package/vendor/volta3/scss/components/_callouts.scss +6 -2
- package/vendor/volta3/scss/components/_card.scss +1 -1
- package/vendor/volta3/scss/components/_form-elements.scss +1 -1
- package/vendor/volta3/scss/components/_modals.scss +1 -1
- package/vendor/volta3/scss/components/_tables.scss +1 -1
- package/vendor/volta3/scss/lib/_variables.scss +1 -1
- package/fesm2022/vgip-meta-ui.mjs +0 -6076
- package/fesm2022/vgip-meta-ui.mjs.map +0 -1
- package/index.d.ts +0 -709
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
.Vlt-form__element.no-x {
|
|
2
|
+
input.main {
|
|
3
|
+
padding-right: 40px;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.Vlt-form__element--big:not(.has-value) > .Vlt-input > .Vlt-select > label > label {
|
|
8
|
+
font-size: 1.6rem;
|
|
9
|
+
margin-top: -0.8rem;
|
|
10
|
+
top: 50%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.Vlt-form__element--big {
|
|
14
|
+
input[readonly].main:not([disabled]) {
|
|
15
|
+
background: var(--vgip-meta-input-bg-color);
|
|
16
|
+
border: 1px solid var(--vgip-meta-input-border-color);
|
|
17
|
+
}
|
|
18
|
+
&:hover, &:focus, &.active {
|
|
19
|
+
input[readonly].main, .Vlt-composite__append button {
|
|
20
|
+
border-color: var(--vgip-meta-input-active-border-color);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
&.Vlt-form__element--error {
|
|
24
|
+
input[readonly].main, .Vlt-composite__append button {
|
|
25
|
+
border-color: #f25a6b;
|
|
26
|
+
box-shadow: none;
|
|
27
|
+
}
|
|
28
|
+
// &:hover, &:focus, &.active {
|
|
29
|
+
// input[readonly].main, .Vlt-composite__append button {
|
|
30
|
+
// border-color: var(--vgip-meta-input-active-border-color);
|
|
31
|
+
// }
|
|
32
|
+
// }
|
|
33
|
+
}
|
|
34
|
+
// .Vlt-select input.main {
|
|
35
|
+
// &:hover, &:focus {
|
|
36
|
+
// border-color: var(--vgip-meta-input-active-border-color);
|
|
37
|
+
// }
|
|
38
|
+
// }
|
|
39
|
+
.Vlt-select:after {
|
|
40
|
+
background-image: var(--vgip-meta-dropdown-icon);
|
|
41
|
+
margin-right: 2px;
|
|
42
|
+
}
|
|
43
|
+
.Vlt-form__element__hint {
|
|
44
|
+
color: var(--vgip-meta-input-hint-color);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
.Vlt-composite.has-append-button {
|
|
48
|
+
input[readonly].main {
|
|
49
|
+
border-top-right-radius: 0;
|
|
50
|
+
border-bottom-right-radius: 0;
|
|
51
|
+
border-right: 0;
|
|
52
|
+
}
|
|
53
|
+
.Vlt-select:after {
|
|
54
|
+
margin-right: -10px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.Vlt-composite__append {
|
|
59
|
+
z-index: initial;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.Vlt-composite__append button {
|
|
63
|
+
height: 48px;
|
|
64
|
+
background: var(--vgip-meta-input-bg-color);
|
|
65
|
+
border-color: var(--vgip-meta-input-border-color);
|
|
66
|
+
padding-right: 16px;
|
|
67
|
+
padding-left: 16px;
|
|
68
|
+
border-left: 0;
|
|
69
|
+
border-top-right-radius: 6px;
|
|
70
|
+
border-bottom-right-radius: 6px;
|
|
71
|
+
&:hover {
|
|
72
|
+
background: var(--vgip-meta-input-action-hover-bg-color);
|
|
73
|
+
}
|
|
74
|
+
svg {
|
|
75
|
+
margin: -2px 0 0 0;
|
|
76
|
+
fill: var(--vgip-meta-input-accent-color);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.Vlt-dropdown__panel {
|
|
81
|
+
width: 100%;
|
|
82
|
+
.Vlt-dropdown__link {
|
|
83
|
+
padding: 0 20px 0 0;
|
|
84
|
+
&.Vlt-dropdown__link--selected {
|
|
85
|
+
background: rgba(44, 45, 48, 0.05);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
label {
|
|
89
|
+
margin-top: 0;
|
|
90
|
+
padding: 12px 20px;
|
|
91
|
+
top: 0;
|
|
92
|
+
left: 0;
|
|
93
|
+
pointer-events: initial;
|
|
94
|
+
position: initial;
|
|
95
|
+
color: initial;
|
|
96
|
+
font-size: inherit;
|
|
97
|
+
transition: none;
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
input {
|
|
100
|
+
height: 0;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
input.main {
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
&:disabled {
|
|
107
|
+
cursor: not-allowed;
|
|
108
|
+
}
|
|
109
|
+
padding-right: 76px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.Vlt-input.has-append-button {
|
|
113
|
+
.Vlt-composite__append.right-actions {
|
|
114
|
+
right: 42px;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
.Vlt-composite__append.right-actions {
|
|
118
|
+
position: absolute;
|
|
119
|
+
top: 5px;
|
|
120
|
+
right: 53px;
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
.Vlt-composite__append--icon {
|
|
123
|
+
width: 36px;
|
|
124
|
+
outline: none;
|
|
125
|
+
position: initial;
|
|
126
|
+
display: inline-block;
|
|
127
|
+
svg {
|
|
128
|
+
height: 14px;
|
|
129
|
+
width: 14px;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
.Vlt-composite__append--icon:hover svg, .Vlt-composite__append--icon:focus svg {
|
|
133
|
+
fill: var(--vgip-meta-input-accent-color);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.vgip-disable .Vlt-composite__append{
|
|
138
|
+
cursor: not-allowed;
|
|
139
|
+
pointer-events: none;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.Vlt-search_wrap{
|
|
143
|
+
padding-top: 10px;
|
|
144
|
+
.vgip-search_input{
|
|
145
|
+
padding: 8px 36px 8px 38px;
|
|
146
|
+
width: 100%;
|
|
147
|
+
border: 1px solid var(--vgip-meta-input-border-color) !important;
|
|
148
|
+
border-radius: 6px !important;
|
|
149
|
+
&:focus, &:active, &:hover{
|
|
150
|
+
border-color: var(--vgip-meta-input-active-border-color) !important;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
.Vlt-composite__append--icon{
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
svg {
|
|
156
|
+
height: 14px;
|
|
157
|
+
width: 14px;
|
|
158
|
+
}
|
|
159
|
+
&:focus, &:active, &:hover{
|
|
160
|
+
svg {
|
|
161
|
+
fill: var(--vgip-meta-input-accent-color);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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: 2022-01-19 08:53:34
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
9
|
+
import { RouterTestingModule } from '@angular/router/testing';
|
|
10
|
+
import { NgForm } from '@angular/forms';
|
|
11
|
+
|
|
12
|
+
import { MetaModule } from '..';
|
|
13
|
+
|
|
14
|
+
import { FieldSelect } from '../fieldSelect';
|
|
15
|
+
|
|
16
|
+
describe('FieldSelect', () => {
|
|
17
|
+
let component: FieldSelect;
|
|
18
|
+
let fixture: ComponentFixture<FieldSelect>;
|
|
19
|
+
|
|
20
|
+
beforeEach(waitForAsync(() => {
|
|
21
|
+
TestBed.configureTestingModule({
|
|
22
|
+
declarations: [],
|
|
23
|
+
imports: [
|
|
24
|
+
MetaModule, RouterTestingModule
|
|
25
|
+
],
|
|
26
|
+
providers: [
|
|
27
|
+
{ provide: NgForm, useValue: new NgForm([], []) }
|
|
28
|
+
]
|
|
29
|
+
})
|
|
30
|
+
.compileComponents();
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
beforeEach(() => {
|
|
34
|
+
fixture = TestBed.createComponent(FieldSelect);
|
|
35
|
+
component = fixture.componentInstance;
|
|
36
|
+
component.parent = {};
|
|
37
|
+
component.meta = { name: 'f1' };
|
|
38
|
+
fixture.detectChanges();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should create', () => {
|
|
42
|
+
expect(component).toBeTruthy();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<div class='vgip-meta-field-preview' *ngIf='preview && model'>
|
|
2
|
+
<div class='vgip-meta-field-label' [title]='meta.label || meta.name'>{{meta.label || meta.name}}</div>
|
|
3
|
+
<div class='vgip-meta-field-value __gu'>
|
|
4
|
+
{{showText}}
|
|
5
|
+
</div>
|
|
6
|
+
</div>
|
|
7
|
+
<div *ngIf='!preview' class="Vlt-form__element"
|
|
8
|
+
[ngClass]="{ 'Vlt-form__element--big': !meta.small ,'has-value': f.value, active: keyListenerActive, 'Vlt-form__element--error': f.invalid && ((f | metaModel)._parent.submitted || (ft | metaModel ).touched), 'no-x': meta.noX }">
|
|
9
|
+
<div class="Vlt-composite Vlt-dropdown Vlt-input" style='display: block;'
|
|
10
|
+
[ngClass]="{ 'has-append-button': isCreatable && !disabled }">
|
|
11
|
+
<div class="Vlt-select">
|
|
12
|
+
<label class='wrapper'>
|
|
13
|
+
<label class='Vlt-truncate'>{{meta.label || meta.name}}<span *ngIf='validations.required && options.length' class='Vlt-red'>*</span></label> <!-- eslint-disable-line -->
|
|
14
|
+
<input class='main' [required]='validations.required && !!options.length' readonly [ngModel]='showText'
|
|
15
|
+
#ft='ngModel' [ngModelOptions]="{standalone: true}" type="text"
|
|
16
|
+
[placeholder]="meta.placeholder || ' '" (click)='onActivated($event)' (focus)='onActivated($event)'
|
|
17
|
+
(blur)='onBlur($event)' [ngClass]="{ 'standalone': meta.standalone }"
|
|
18
|
+
[disabled]='disabled' [attr.aria-label]='meta.label' />
|
|
19
|
+
</label>
|
|
20
|
+
<select class='model' [required]='validations.required && !!options.length' style='display: none;'
|
|
21
|
+
[(ngModel)]='model' [ngModelOptions]="{standalone: meta.standalone}"
|
|
22
|
+
(ngModelChange)="onModelChange($event)" #f='ngModel' [name]='name'></select>
|
|
23
|
+
<div *ngIf='searching' class='search-progress'>
|
|
24
|
+
<div class="container">
|
|
25
|
+
<div class="bar Vlt-bg-purple"></div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<div class='Vlt-composite__append right-actions'>
|
|
29
|
+
<a href='#' *ngIf='model && !meta.noX && !disabled' class="Vlt-composite__append--icon"
|
|
30
|
+
(click)='clear($event)'>
|
|
31
|
+
<div class="Vlt-composite__icon">
|
|
32
|
+
<svg>
|
|
33
|
+
<use xlink:href="volta/volta-icons.svg#Vlt-icon-cross" />
|
|
34
|
+
</svg>
|
|
35
|
+
</div>
|
|
36
|
+
</a>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div class='Vlt-dropdown__panel'>
|
|
40
|
+
<div class="Vlt-dropdown__panel__content Vlt-dropdown__panel__content--scroll-area">
|
|
41
|
+
<!-- <div class="Vlt-dropdown__title" style='padding-left: 15px;'>
|
|
42
|
+
Select ({{options.length}})
|
|
43
|
+
<div class="Vlt-dropdown__close Vlt-white" (click)='dismissDropdown($event)'>
|
|
44
|
+
<svg class='Vlt-icon Vlt-icon--small'><use xlink:href="volta/volta-icons.svg#Vlt-icon-cross"/></svg>
|
|
45
|
+
</div>
|
|
46
|
+
</div> -->
|
|
47
|
+
<div class="Vlt-dropdown__block Vlt-search_wrap">
|
|
48
|
+
<div *ngIf="optionsBackup.length > 12" class="Vlt-composite" [ngClass]="{'vgip-disable': disabled}">
|
|
49
|
+
<div class="Vlt-composite__prepend Vlt-composite__prepend--icon"
|
|
50
|
+
style="top: 0; padding-top: 15px;">
|
|
51
|
+
<div class="Vlt-composite__icon">
|
|
52
|
+
<svg class='Vlt-grey'>
|
|
53
|
+
<use xlink:href="volta/volta-icons.svg#Vlt-icon-search"></use>
|
|
54
|
+
</svg>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="Vlt-input">
|
|
58
|
+
<input type="text" class="vgip-search_input" [(ngModel)]="searchInputText" placeholder="Search" (input)="onSearchChange()" (blur)='onBlur($event)' [ngModelOptions]="{standalone: true}">
|
|
59
|
+
</div>
|
|
60
|
+
<a href='#' class="Vlt-composite__append--icon" style="top: 2px;" (click)="clearSearchField($event)" [hidden]="!searchInputText">
|
|
61
|
+
<div class="Vlt-composite__icon">
|
|
62
|
+
<svg class='Vlt-icon Vlt-icon--small'>
|
|
63
|
+
<use xlink:href="volta/volta-icons.svg#Vlt-icon-cross"/>
|
|
64
|
+
</svg>
|
|
65
|
+
</div>
|
|
66
|
+
</a>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
<div *ngIf='dropdown' class='Vlt-dropdown__scroll'>
|
|
70
|
+
<a href='#' [ngClass]="{ 'Vlt-dropdown__link--selected': activeSuggestionIndex === i }"
|
|
71
|
+
(click)='onOptionSelect($event, option)' *ngFor='let option of options; let i = index'
|
|
72
|
+
class="Vlt-dropdown__link">
|
|
73
|
+
<div *ngIf='multiple' class="Vlt-checkbox" style='width: 100%;'>
|
|
74
|
+
<label>
|
|
75
|
+
<span class="Vlt-checkbox__button">
|
|
76
|
+
<input type="checkbox" [checked]='model && model.indexOf(option) !== -1' />
|
|
77
|
+
<span class="Vlt-checkbox__icon"></span>
|
|
78
|
+
</span>
|
|
79
|
+
{{option.label || (option.id === '' ? '--empty--' : option)}}
|
|
80
|
+
</label>
|
|
81
|
+
</div>
|
|
82
|
+
<div *ngIf='!multiple' style='padding: 12px 20px;'>{{option.label || (option.id === '' ?
|
|
83
|
+
'--empty--' : option)}}</div>
|
|
84
|
+
</a>
|
|
85
|
+
<!-- No Option Found -->
|
|
86
|
+
<div class="Vlt-dropdown__link" *ngIf="options.length === 0">
|
|
87
|
+
<span style='padding: 12px 20px;'>
|
|
88
|
+
No Option Found
|
|
89
|
+
</span>
|
|
90
|
+
<button *ngIf='isCreatable && !disabled' type="button" class="Vlt-btn Vlt-btn--link" (click)='openResource($event)'>
|
|
91
|
+
<svg>
|
|
92
|
+
<use xlink:href="volta/volta-icons.svg#Vlt-icon-plus" />
|
|
93
|
+
</svg> Add new
|
|
94
|
+
</button>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
<div *ngIf='!multiple' class="Vlt-dropdown__block"></div>
|
|
98
|
+
<div *ngIf='multiple' class="Vlt-dropdown__block Vlt-dropdown__block--nowrap"
|
|
99
|
+
style='padding: 8px 16px 16px;'>
|
|
100
|
+
<button (click)='clear($event)' type='button'
|
|
101
|
+
class="Vlt-btn Vlt-btn--secondary Vlt-btn--app Vlt-btn--small Vlt-btn--outline"
|
|
102
|
+
style='margin-right: 8px;'>Clear all</button>
|
|
103
|
+
<button (click)='dismissDropdown($event)' type='button'
|
|
104
|
+
class="Vlt-btn Vlt-btn--secondary Vlt-btn--app Vlt-btn--small">Done</button>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
<!-- <span *ngIf='isCreatable'>
|
|
109
|
+
<button type='button' (click)='openResource($event)' class="Vlt-btn Vlt-btn--secondary Vlt-btn--icon Vlt-btn--large" style='margin-left: 12px;'>
|
|
110
|
+
<svg><use xlink:href="volta/volta-icons.svg#Vlt-icon-plus"/></svg>
|
|
111
|
+
</button>
|
|
112
|
+
</span> -->
|
|
113
|
+
<div *ngIf='isCreatable && !disabled' class="Vlt-composite__append">
|
|
114
|
+
<button (focus)='onActivated($event)' (blur)='onBlur($event)' type='button' (click)='openResource($event)'
|
|
115
|
+
class="Vlt-btn Vlt-btn--white Vlt-btn--icon add-button" aria-label='Add new'>
|
|
116
|
+
<svg>
|
|
117
|
+
<use attr.xlink:href="volta/volta-icons.svg#Vlt-icon-{{ (isUpdatable && model) ? 'edit' : 'plus'}}" />
|
|
118
|
+
</svg>
|
|
119
|
+
</button>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
<small *ngIf='f.invalid && ((f | metaModel)._parent.submitted || ((ft | metaModel).touched))'
|
|
123
|
+
class="Vlt-form__element__error">
|
|
124
|
+
<span *ngIf="f.errors.required">Required. </span>
|
|
125
|
+
<span *ngIf="f.errors.custom">{{f.errors.custom}} </span>
|
|
126
|
+
</small>
|
|
127
|
+
<small *ngIf='meta.hint' class="Vlt-form__element__hint">{{meta.hint}}</small>
|
|
128
|
+
</div>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: Alexander.Vangelov@vonage.com
|
|
3
|
+
* @Date: 2019-09-19 17:35:13
|
|
4
|
+
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
5
|
+
* @Last Modified time: 2020-02-26 20:00:33
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Component, OnInit } from '@angular/core';
|
|
9
|
+
import { ControlContainer, NgForm } from '@angular/forms';
|
|
10
|
+
|
|
11
|
+
import { FieldAbstract } from '../fieldAbstract';
|
|
12
|
+
// import { tMetaField } from '../../../metaTypes/tMetaField'
|
|
13
|
+
import { templateBuilder } from '../common/utils/templateBuilder';
|
|
14
|
+
import { MetaContextService } from '../services/metaContext';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
templateUrl: './view.html',
|
|
18
|
+
styleUrls: ['./style.scss'],
|
|
19
|
+
viewProviders: [{ provide: ControlContainer, useExisting: NgForm }],
|
|
20
|
+
standalone: false
|
|
21
|
+
})
|
|
22
|
+
export class FieldText extends FieldAbstract implements OnInit {
|
|
23
|
+
// @Input() meta: any;
|
|
24
|
+
value: string;
|
|
25
|
+
|
|
26
|
+
constructor( private metaContext: MetaContextService ) {
|
|
27
|
+
super();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static setup(instance, parent, meta) {
|
|
31
|
+
const d = meta.default || meta.defaultValue;
|
|
32
|
+
if (d && !parent[meta.name]) {
|
|
33
|
+
if (typeof(d) === 'string') {
|
|
34
|
+
parent[meta.name] = d;
|
|
35
|
+
} else {
|
|
36
|
+
parent[meta.name] = d.id || d.value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
ngOnInit() {
|
|
42
|
+
// if (typeof(this.parent[this.meta.name]) === 'string') {
|
|
43
|
+
// this.parent[this.meta.name] = templateBuilder(this.metaContext, this.parent[this.meta.name]);
|
|
44
|
+
// }
|
|
45
|
+
const origValue = this.parent[this.meta.name];
|
|
46
|
+
Object.defineProperty(this.parent, this.meta.name, {
|
|
47
|
+
set: (value) => {
|
|
48
|
+
if (value) {
|
|
49
|
+
this.model = value;
|
|
50
|
+
this.value = value;
|
|
51
|
+
} else {
|
|
52
|
+
delete this.model;
|
|
53
|
+
delete this.value;
|
|
54
|
+
}
|
|
55
|
+
this.meta.$optional = this.isOptional;
|
|
56
|
+
},
|
|
57
|
+
get: () => this.value,
|
|
58
|
+
enumerable: this.sendToServer,
|
|
59
|
+
configurable: true
|
|
60
|
+
});
|
|
61
|
+
if (typeof(origValue) !== 'undefined') {
|
|
62
|
+
this.parent[this.meta.name] = origValue;
|
|
63
|
+
}
|
|
64
|
+
if (!this.isPersistedParent && typeof(this.meta.auto?.template) === 'string') {
|
|
65
|
+
this.metaContext.onContextChange.subscribe((context) => {
|
|
66
|
+
const autoValue = templateBuilder({ context }, this.meta.auto.template);
|
|
67
|
+
if (this.model === this.lastAutoValue && autoValue) {
|
|
68
|
+
this.lastAutoValue = autoValue;
|
|
69
|
+
this.parent[this.meta.name] = autoValue;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
onModelChangeLocal(value) {
|
|
76
|
+
if (!value && this.prevModel && this.isPersistedParent) {
|
|
77
|
+
value = '';
|
|
78
|
+
}
|
|
79
|
+
this.onModelChange(value);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
textToSpeech() {
|
|
83
|
+
this.focus();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.Vlt-composite__append--icon {
|
|
2
|
+
bottom: 7px;
|
|
3
|
+
right: 16px;
|
|
4
|
+
padding: 3px;
|
|
5
|
+
width: initial;
|
|
6
|
+
height: initial;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
&:hover svg {
|
|
9
|
+
fill: #2c2d30;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
.Vlt-form__element--big .Vlt-textarea {
|
|
13
|
+
.Vlt-label {
|
|
14
|
+
right: 18px;
|
|
15
|
+
background: transparent;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.Vlt-form__element--error {
|
|
20
|
+
textarea {
|
|
21
|
+
border-color: #f25a6b;
|
|
22
|
+
background: var(--vgip-meta-input-bg-color);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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: 2019-11-05 13:47:34
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
9
|
+
import { NgForm } from '@angular/forms';
|
|
10
|
+
|
|
11
|
+
import { MetaModule } from '..';
|
|
12
|
+
|
|
13
|
+
import { FieldText } from '.';
|
|
14
|
+
|
|
15
|
+
describe('FieldTextarea', () => {
|
|
16
|
+
let component: FieldText;
|
|
17
|
+
let fixture: ComponentFixture<FieldText>;
|
|
18
|
+
|
|
19
|
+
beforeEach(waitForAsync(() => {
|
|
20
|
+
TestBed.configureTestingModule({
|
|
21
|
+
declarations: [],
|
|
22
|
+
imports: [
|
|
23
|
+
MetaModule
|
|
24
|
+
],
|
|
25
|
+
providers: [
|
|
26
|
+
{ provide: NgForm, useValue: new NgForm([], []) }
|
|
27
|
+
]
|
|
28
|
+
})
|
|
29
|
+
.compileComponents();
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
fixture = TestBed.createComponent(FieldText);
|
|
34
|
+
component = fixture.componentInstance;
|
|
35
|
+
component.parent = {};
|
|
36
|
+
component.meta = { name: 'f1' };
|
|
37
|
+
fixture.detectChanges();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should create', () => {
|
|
41
|
+
expect(component).toBeTruthy();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<div class='vgip-meta-field-preview' *ngIf='preview && model'>
|
|
2
|
+
<div class='vgip-meta-field-label' [title]='meta.label || meta.name'>{{meta.label || meta.name}}</div>
|
|
3
|
+
<div class='vgip-meta-field-value __gu'>{{parent[meta.name]}}</div>
|
|
4
|
+
</div>
|
|
5
|
+
<div *ngIf='!preview' class="Vlt-form__element Vlt-form__element--big" [ngClass]="{ 'Vlt-form__element--error': f.invalid && ((f | metaModel)._parent.submitted || (f | metaModel ).touched) }">
|
|
6
|
+
<label class='wrapper'>
|
|
7
|
+
<div class="Vlt-textarea">
|
|
8
|
+
<textarea class='main model' [required]='validations.required' [maxlength]='validations.maxlength' rows="{{ meta.rows || 4 }}" placeholder=' ' [(ngModel)]='model' (ngModelChange)="onModelChangeLocal($event)" #f='ngModel' [name]='name'></textarea>
|
|
9
|
+
<!-- <div class="Vlt-composite__append Vlt-composite__append--icon">
|
|
10
|
+
<div class="Vlt-composite__icon" (click)='textToSpeech()'>
|
|
11
|
+
<svg><use xlink:href="volta/volta-icons.svg#Vlt-icon-microphone"/></svg>
|
|
12
|
+
</div>
|
|
13
|
+
</div> -->
|
|
14
|
+
<label class="Vlt-label">{{meta.label || meta.name}}<span *ngIf='validations.required' class='Vlt-red'>*</span></label> <!-- eslint-disable-line @angular-eslint/template/label-has-associated-control -->
|
|
15
|
+
</div>
|
|
16
|
+
</label>
|
|
17
|
+
<small *ngIf='f.invalid && ((f | metaModel)._parent.submitted || ((f | metaModel ).touched))' class="Vlt-form__element__error">
|
|
18
|
+
<span *ngIf="f.errors.required">Required</span>
|
|
19
|
+
<span *ngIf="f.errors.maxlength">Length can not exceed {{validations.maxlength}} characters</span>
|
|
20
|
+
<span *ngIf="f.errors.custom">{{f.errors.custom}} </span>
|
|
21
|
+
</small>
|
|
22
|
+
<small *ngIf='meta.helpText' class="Vlt-form__element__hint">{{meta.helpText}}</small>
|
|
23
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
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: 2019-11-15 13:04:01
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Component } from '@angular/core';
|
|
9
|
+
import { FieldAbstract } from '../fieldAbstract';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
templateUrl: './view.html',
|
|
13
|
+
standalone: false
|
|
14
|
+
})
|
|
15
|
+
export class FieldUnknown extends FieldAbstract {}
|
|
@@ -0,0 +1,34 @@
|
|
|
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: 2019-11-15 11:05:28
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
9
|
+
|
|
10
|
+
import { FieldUnknown } from '.';
|
|
11
|
+
|
|
12
|
+
describe('FieldUnknown', () => {
|
|
13
|
+
let component: FieldUnknown;
|
|
14
|
+
let fixture: ComponentFixture<FieldUnknown>;
|
|
15
|
+
|
|
16
|
+
beforeEach(waitForAsync(() => {
|
|
17
|
+
TestBed.configureTestingModule({
|
|
18
|
+
declarations: [ FieldUnknown ]
|
|
19
|
+
})
|
|
20
|
+
.compileComponents();
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
fixture = TestBed.createComponent(FieldUnknown);
|
|
25
|
+
component = fixture.componentInstance;
|
|
26
|
+
component.parent = {};
|
|
27
|
+
component.meta = { type: 'dummy', name: 'dummy' };
|
|
28
|
+
fixture.detectChanges();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should create', () => {
|
|
32
|
+
expect(component).toBeTruthy();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<div class="Vlt-form__element Vlt-form__element--big">
|
|
2
|
+
<div class="Vlt-input">
|
|
3
|
+
<label class='wrapper'>
|
|
4
|
+
<input class='main model' type="text" placeholder="" value="Unknown field type '{{meta.type}}'." disabled/>
|
|
5
|
+
<label class="Vlt-label Vlt-truncate" style='padding-right: 20px;'>{{meta.label || meta.name}}</label> <!-- eslint-disable-line @angular-eslint/template/label-has-associated-control -->
|
|
6
|
+
</label>
|
|
7
|
+
</div>
|
|
8
|
+
<small *ngIf='meta.hint' class="Vlt-form__element__hint">{{meta.hint}}</small>
|
|
9
|
+
</div>
|