@vgip/meta-ui 2.0.0 → 2.1.0
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/fesm2022/vgip-meta-ui.mjs +5614 -78
- package/fesm2022/vgip-meta-ui.mjs.map +1 -1
- package/index.d.ts +709 -5
- package/package.json +5 -8
- package/vendor/volta3/README.md +1 -0
- package/vendor/volta3/fonts/Spezia-Regular.eot +0 -0
- package/vendor/volta3/fonts/Spezia-Regular.ttf +0 -0
- package/vendor/volta3/fonts/Spezia-Regular.woff +0 -0
- package/vendor/volta3/fonts/Spezia-Regular.woff2 +0 -0
- package/vendor/volta3/fonts/Spezia-SemiBold.eot +0 -0
- package/vendor/volta3/fonts/Spezia-SemiBold.ttf +0 -0
- package/vendor/volta3/fonts/Spezia-SemiBold.woff +0 -0
- package/vendor/volta3/fonts/Spezia-SemiBold.woff2 +0 -0
- package/vendor/volta3/fonts/Spezia-SemiMonoSemiBold.eot +0 -0
- package/vendor/volta3/fonts/Spezia-SemiMonoSemiBold.ttf +0 -0
- package/vendor/volta3/fonts/Spezia-SemiMonoSemiBold.woff +0 -0
- package/vendor/volta3/fonts/Spezia-SemiMonoSemiBold.woff2 +0 -0
- package/vendor/volta3/fonts/Spezia-WideMedium.eot +0 -0
- package/vendor/volta3/fonts/Spezia-WideMedium.ttf +0 -0
- package/vendor/volta3/fonts/Spezia-WideMedium.woff +0 -0
- package/vendor/volta3/fonts/Spezia-WideMedium.woff2 +0 -0
- package/vendor/volta3/scss/components/_accordions.scss +165 -0
- package/vendor/volta3/scss/components/_badge.scss +325 -0
- package/vendor/volta3/scss/components/_blockquote.scss +35 -0
- package/vendor/volta3/scss/components/_boxes.scss +113 -0
- package/vendor/volta3/scss/components/_buttons.scss +794 -0
- package/vendor/volta3/scss/components/_callouts.scss +427 -0
- package/vendor/volta3/scss/components/_card.scss +421 -0
- package/vendor/volta3/scss/components/_color-classes.scss +186 -0
- package/vendor/volta3/scss/components/_dialpad.scss +224 -0
- package/vendor/volta3/scss/components/_dropdowns.scss +495 -0
- package/vendor/volta3/scss/components/_empties.scss +77 -0
- package/vendor/volta3/scss/components/_flash-messages.scss +39 -0
- package/vendor/volta3/scss/components/_form-elements.scss +879 -0
- package/vendor/volta3/scss/components/_lists.scss +427 -0
- package/vendor/volta3/scss/components/_modals.scss +227 -0
- package/vendor/volta3/scss/components/_popups.scss +173 -0
- package/vendor/volta3/scss/components/_progress.scss +28 -0
- package/vendor/volta3/scss/components/_spinner.scss +105 -0
- package/vendor/volta3/scss/components/_steps.scss +242 -0
- package/vendor/volta3/scss/components/_switch.scss +353 -0
- package/vendor/volta3/scss/components/_tables.scss +739 -0
- package/vendor/volta3/scss/components/_tabs.scss +296 -0
- package/vendor/volta3/scss/components/_text-separator.scss +61 -0
- package/vendor/volta3/scss/components/_tooltips.scss +152 -0
- package/vendor/volta3/scss/components/side-navigation/_side-nav--aqua.scss +179 -0
- package/vendor/volta3/scss/components/side-navigation/_side-nav--collapsible.scss +381 -0
- package/vendor/volta3/scss/components/side-navigation/_side-nav--dark.scss +196 -0
- package/vendor/volta3/scss/components/side-navigation/_side-nav--light.scss +174 -0
- package/vendor/volta3/scss/components/side-navigation/_side-nav--structure.scss +631 -0
- package/vendor/volta3/scss/components/side-navigation/_side-nav--tabs.scss +88 -0
- package/vendor/volta3/scss/flatpickr/_flatpickr-volta.scss +407 -0
- package/vendor/volta3/scss/flatpickr/_flatpickr.css +785 -0
- package/vendor/volta3/scss/layout/_article.scss +119 -0
- package/vendor/volta3/scss/layout/_utils.scss +174 -0
- package/vendor/volta3/scss/lib/_grid.scss +374 -0
- package/vendor/volta3/scss/lib/_mediaqueries.scss +52 -0
- package/vendor/volta3/scss/lib/_reset.scss +110 -0
- package/vendor/volta3/scss/lib/_type.scss +345 -0
- package/vendor/volta3/scss/lib/_utils.scss +26 -0
- package/vendor/volta3/scss/lib/_variables.scss +115 -0
- package/vendor/volta3/scss/prism/_prism-volta.scss +390 -0
- package/vendor/volta3/scss/prism/_prism.css +326 -0
- package/vendor/volta3/scss/templates/volta-error-page.scss +57 -0
- package/vendor/volta3/scss/templates/volta-templates.scss +114 -0
- package/vendor/volta3/scss/volta-flatpickr.scss +10 -0
- package/vendor/volta3/scss/volta-prism.scss +7 -0
- package/vendor/volta3/scss/volta.scss +39 -0
- package/vendor/volta3/symbol/volta-brand-icons.svg +1 -0
- package/vendor/volta3/symbol/volta-flag-icons.svg +1 -0
- package/vendor/volta3/symbol/volta-icons.svg +1 -0
- package/esm2022/lib/common/fieldNormalizer/boolean.mjs +0 -12
- package/esm2022/lib/common/fieldNormalizer/datetime.mjs +0 -9
- package/esm2022/lib/common/fieldNormalizer/index.mjs +0 -183
- package/esm2022/lib/common/fieldNormalizer/number.mjs +0 -14
- package/esm2022/lib/common/fieldNormalizer/options.mjs +0 -50
- package/esm2022/lib/common/fieldNormalizer/radio.mjs +0 -30
- package/esm2022/lib/common/fieldNormalizer/reference.mjs +0 -36
- package/esm2022/lib/common/fieldNormalizer/richtext.mjs +0 -15
- package/esm2022/lib/common/fieldNormalizer/string.mjs +0 -24
- package/esm2022/lib/common/fieldNormalizer/text.mjs +0 -18
- package/esm2022/lib/common/fieldNormalizer/uniqueNameFilter.mjs +0 -23
- package/esm2022/lib/common/metaAutofocus.directive.mjs +0 -35
- package/esm2022/lib/common/metaIcons.pipe.mjs +0 -29
- package/esm2022/lib/common/metaModel.pipe.mjs +0 -23
- package/esm2022/lib/common/metaNormalizer.mjs +0 -375
- package/esm2022/lib/common/metaStripHtml.pipe.mjs +0 -22
- package/esm2022/lib/common/utils/colorThemes.mjs +0 -77
- package/esm2022/lib/common/utils/indexedDbStore/index.mjs +0 -228
- package/esm2022/lib/common/utils/relativeTimeBuilder.mjs +0 -49
- package/esm2022/lib/common/utils/resourceCardLabel.mjs +0 -24
- package/esm2022/lib/common/utils/smartProp.mjs +0 -31
- package/esm2022/lib/common/utils/templateBuilder.mjs +0 -103
- package/esm2022/lib/fieldAbstract.mjs +0 -291
- package/esm2022/lib/fieldBoolean/index.mjs +0 -53
- package/esm2022/lib/fieldComposite/index.mjs +0 -82
- package/esm2022/lib/fieldDatetime/index.mjs +0 -365
- package/esm2022/lib/fieldHidden/index.mjs +0 -18
- package/esm2022/lib/fieldInput/index.mjs +0 -475
- package/esm2022/lib/fieldList/index.mjs +0 -74
- package/esm2022/lib/fieldRadio/index.mjs +0 -88
- package/esm2022/lib/fieldReference/index.mjs +0 -836
- package/esm2022/lib/fieldRichtext/index.mjs +0 -93
- package/esm2022/lib/fieldSelect/index.mjs +0 -569
- package/esm2022/lib/fieldText/index.mjs +0 -83
- package/esm2022/lib/fieldUnknown/index.mjs +0 -19
- package/esm2022/lib/index.mjs +0 -163
- package/esm2022/lib/layout/index.mjs +0 -214
- package/esm2022/lib/metaField/index.mjs +0 -151
- package/esm2022/lib/refDialog/index.mjs +0 -135
- package/esm2022/lib/resource/index.mjs +0 -525
- package/esm2022/lib/resourceCard/index.mjs +0 -40
- package/esm2022/lib/services/metaContext/index.mjs +0 -52
- package/esm2022/lib/services/metaMsg/index.mjs +0 -84
- package/esm2022/lib/services/metaReference/index.mjs +0 -94
- package/esm2022/lib/services/metaResource/index.mjs +0 -141
- package/esm2022/lib/services/metaResource/metaHttpClient.mjs +0 -64
- package/esm2022/lib/services/metaTracker/index.mjs +0 -31
- package/esm2022/lib/services/resourceDrafts/index.mjs +0 -69
- package/esm2022/public-api.mjs +0 -5
- package/esm2022/vgip-meta-ui.mjs +0 -5
- package/fesm2022/vgip-meta-ui-fieldAbstract-baeaf24d.mjs +0 -399
- package/fesm2022/vgip-meta-ui-fieldAbstract-baeaf24d.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-0184d5ec.mjs +0 -478
- package/fesm2022/vgip-meta-ui-index-0184d5ec.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-1ddfcce0.mjs +0 -86
- package/fesm2022/vgip-meta-ui-index-1ddfcce0.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-37358620.mjs +0 -158
- package/fesm2022/vgip-meta-ui-index-37358620.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-4e9c383f.mjs +0 -95
- package/fesm2022/vgip-meta-ui-index-4e9c383f.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-4fa919c0.mjs +0 -79
- package/fesm2022/vgip-meta-ui-index-4fa919c0.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-5f68724c.mjs +0 -576
- package/fesm2022/vgip-meta-ui-index-5f68724c.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-6d502a71.mjs +0 -869
- package/fesm2022/vgip-meta-ui-index-6d502a71.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-7741951a.mjs +0 -23
- package/fesm2022/vgip-meta-ui-index-7741951a.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-80ab405f.mjs +0 -93
- package/fesm2022/vgip-meta-ui-index-80ab405f.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-926ae006.mjs +0 -58
- package/fesm2022/vgip-meta-ui-index-926ae006.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-b979685f.mjs +0 -87
- package/fesm2022/vgip-meta-ui-index-b979685f.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-c943b7c0.mjs +0 -24
- package/fesm2022/vgip-meta-ui-index-c943b7c0.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-ce185ca2.mjs +0 -2062
- package/fesm2022/vgip-meta-ui-index-ce185ca2.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-f8b00f06.mjs +0 -370
- package/fesm2022/vgip-meta-ui-index-f8b00f06.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-index-fb7f54f5.mjs +0 -154
- package/fesm2022/vgip-meta-ui-index-fb7f54f5.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-metaModel.pipe-6b803e66.mjs +0 -26
- package/fesm2022/vgip-meta-ui-metaModel.pipe-6b803e66.mjs.map +0 -1
- package/fesm2022/vgip-meta-ui-relativeTimeBuilder-31791ce4.mjs +0 -51
- package/fesm2022/vgip-meta-ui-relativeTimeBuilder-31791ce4.mjs.map +0 -1
- package/lib/common/fieldNormalizer/boolean.d.ts +0 -1
- package/lib/common/fieldNormalizer/datetime.d.ts +0 -1
- package/lib/common/fieldNormalizer/index.d.ts +0 -1
- package/lib/common/fieldNormalizer/number.d.ts +0 -1
- package/lib/common/fieldNormalizer/options.d.ts +0 -1
- package/lib/common/fieldNormalizer/radio.d.ts +0 -1
- package/lib/common/fieldNormalizer/reference.d.ts +0 -1
- package/lib/common/fieldNormalizer/richtext.d.ts +0 -1
- package/lib/common/fieldNormalizer/string.d.ts +0 -1
- package/lib/common/fieldNormalizer/text.d.ts +0 -1
- package/lib/common/fieldNormalizer/uniqueNameFilter.d.ts +0 -1
- package/lib/common/metaAutofocus.directive.d.ts +0 -10
- package/lib/common/metaIcons.pipe.d.ts +0 -10
- package/lib/common/metaModel.pipe.d.ts +0 -7
- package/lib/common/metaNormalizer.d.ts +0 -1
- package/lib/common/metaStripHtml.pipe.d.ts +0 -7
- package/lib/common/utils/colorThemes.d.ts +0 -8
- package/lib/common/utils/indexedDbStore/index.d.ts +0 -25
- package/lib/common/utils/relativeTimeBuilder.d.ts +0 -1
- package/lib/common/utils/resourceCardLabel.d.ts +0 -1
- package/lib/common/utils/smartProp.d.ts +0 -2
- package/lib/common/utils/templateBuilder.d.ts +0 -1
- package/lib/fieldAbstract.d.ts +0 -61
- package/lib/fieldBoolean/index.d.ts +0 -10
- package/lib/fieldComposite/index.d.ts +0 -14
- package/lib/fieldDatetime/index.d.ts +0 -26
- package/lib/fieldHidden/index.d.ts +0 -6
- package/lib/fieldInput/index.d.ts +0 -35
- package/lib/fieldList/index.d.ts +0 -15
- package/lib/fieldRadio/index.d.ts +0 -14
- package/lib/fieldReference/index.d.ts +0 -73
- package/lib/fieldRichtext/index.d.ts +0 -27
- package/lib/fieldSelect/index.d.ts +0 -49
- package/lib/fieldText/index.d.ts +0 -15
- package/lib/fieldUnknown/index.d.ts +0 -6
- package/lib/index.d.ts +0 -65
- package/lib/layout/index.d.ts +0 -47
- package/lib/metaField/index.d.ts +0 -29
- package/lib/refDialog/index.d.ts +0 -33
- package/lib/resource/index.d.ts +0 -68
- package/lib/resourceCard/index.d.ts +0 -17
- package/lib/services/metaContext/index.d.ts +0 -32
- package/lib/services/metaMsg/index.d.ts +0 -14
- package/lib/services/metaReference/index.d.ts +0 -11
- package/lib/services/metaResource/index.d.ts +0 -31
- package/lib/services/metaResource/metaHttpClient.d.ts +0 -15
- package/lib/services/metaTracker/index.d.ts +0 -19
- package/lib/services/resourceDrafts/index.d.ts +0 -26
- package/public-api.d.ts +0 -1
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component } from '@angular/core';
|
|
3
|
-
import * as i2 from '@angular/forms';
|
|
4
|
-
import { ControlContainer, NgForm } from '@angular/forms';
|
|
5
|
-
import { F as FieldAbstract } from './vgip-meta-ui-fieldAbstract-baeaf24d.mjs';
|
|
6
|
-
import { t as templateBuilder, M as MetaContextService } from './vgip-meta-ui-index-37358620.mjs';
|
|
7
|
-
import * as i1 from '@angular/common';
|
|
8
|
-
import { M as MetaModelPipe } from './vgip-meta-ui-metaModel.pipe-6b803e66.mjs';
|
|
9
|
-
import 'rxjs';
|
|
10
|
-
import 'rxjs/operators';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
14
|
-
* @Date: 2019-09-19 17:35:13
|
|
15
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
16
|
-
* @Last Modified time: 2020-02-26 20:00:33
|
|
17
|
-
*/
|
|
18
|
-
class FieldText extends FieldAbstract {
|
|
19
|
-
constructor(metaContext) {
|
|
20
|
-
super();
|
|
21
|
-
this.metaContext = metaContext;
|
|
22
|
-
}
|
|
23
|
-
static setup(instance, parent, meta) {
|
|
24
|
-
const d = meta.default || meta.defaultValue;
|
|
25
|
-
if (d && !parent[meta.name]) {
|
|
26
|
-
if (typeof (d) === 'string') {
|
|
27
|
-
parent[meta.name] = d;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
parent[meta.name] = d.id || d.value;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
ngOnInit() {
|
|
35
|
-
// if (typeof(this.parent[this.meta.name]) === 'string') {
|
|
36
|
-
// this.parent[this.meta.name] = templateBuilder(this.metaContext, this.parent[this.meta.name]);
|
|
37
|
-
// }
|
|
38
|
-
const origValue = this.parent[this.meta.name];
|
|
39
|
-
Object.defineProperty(this.parent, this.meta.name, {
|
|
40
|
-
set: (value) => {
|
|
41
|
-
if (value) {
|
|
42
|
-
this.model = value;
|
|
43
|
-
this.value = value;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
delete this.model;
|
|
47
|
-
delete this.value;
|
|
48
|
-
}
|
|
49
|
-
this.meta.$optional = this.isOptional;
|
|
50
|
-
},
|
|
51
|
-
get: () => this.value,
|
|
52
|
-
enumerable: this.sendToServer,
|
|
53
|
-
configurable: true
|
|
54
|
-
});
|
|
55
|
-
if (typeof (origValue) !== 'undefined') {
|
|
56
|
-
this.parent[this.meta.name] = origValue;
|
|
57
|
-
}
|
|
58
|
-
if (!this.isPersistedParent && typeof (this.meta.auto?.template) === 'string') {
|
|
59
|
-
this.metaContext.onContextChange.subscribe((context) => {
|
|
60
|
-
const autoValue = templateBuilder({ context }, this.meta.auto.template);
|
|
61
|
-
if (this.model === this.lastAutoValue && autoValue) {
|
|
62
|
-
this.lastAutoValue = autoValue;
|
|
63
|
-
this.parent[this.meta.name] = autoValue;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
onModelChangeLocal(value) {
|
|
69
|
-
if (!value && this.prevModel && this.isPersistedParent) {
|
|
70
|
-
value = '';
|
|
71
|
-
}
|
|
72
|
-
this.onModelChange(value);
|
|
73
|
-
}
|
|
74
|
-
textToSpeech() {
|
|
75
|
-
this.focus();
|
|
76
|
-
}
|
|
77
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: FieldText, deps: [{ token: MetaContextService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
78
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.11", type: FieldText, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class='vgip-meta-field-preview' *ngIf='preview && model'>\n <div class='vgip-meta-field-label' [title]='meta.label || meta.name'>{{meta.label || meta.name}}</div>\n <div class='vgip-meta-field-value __gu'>{{parent[meta.name]}}</div>\n</div>\n<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) }\">\n <label class='wrapper'>\n <div class=\"Vlt-textarea\">\n <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>\n <!-- <div class=\"Vlt-composite__append Vlt-composite__append--icon\">\n <div class=\"Vlt-composite__icon\" (click)='textToSpeech()'>\n <svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-microphone\"/></svg>\n </div>\n </div> -->\n <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 -->\n </div>\n </label>\n <small *ngIf='f.invalid && ((f | metaModel)._parent.submitted || ((f | metaModel ).touched))' class=\"Vlt-form__element__error\">\n <span *ngIf=\"f.errors.required\">Required</span>\n <span *ngIf=\"f.errors.maxlength\">Length can not exceed {{validations.maxlength}} characters</span>\n <span *ngIf=\"f.errors.custom\">{{f.errors.custom}} </span>\n </small>\n <small *ngIf='meta.helpText' class=\"Vlt-form__element__hint\">{{meta.helpText}}</small>\n</div>\n", styles: [".Vlt-composite__append--icon{bottom:7px;right:16px;padding:3px;width:initial;height:initial;cursor:pointer}.Vlt-composite__append--icon:hover svg{fill:#2c2d30}.Vlt-form__element--big .Vlt-textarea .Vlt-label{right:18px;background:transparent}.Vlt-form__element--error textarea{border-color:#f25a6b;background:var(--vgip-meta-input-bg-color)}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: MetaModelPipe, name: "metaModel" }], viewProviders: [{ provide: ControlContainer, useExisting: NgForm }] }); }
|
|
79
|
-
}
|
|
80
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: FieldText, decorators: [{
|
|
81
|
-
type: Component,
|
|
82
|
-
args: [{ viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], template: "<div class='vgip-meta-field-preview' *ngIf='preview && model'>\n <div class='vgip-meta-field-label' [title]='meta.label || meta.name'>{{meta.label || meta.name}}</div>\n <div class='vgip-meta-field-value __gu'>{{parent[meta.name]}}</div>\n</div>\n<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) }\">\n <label class='wrapper'>\n <div class=\"Vlt-textarea\">\n <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>\n <!-- <div class=\"Vlt-composite__append Vlt-composite__append--icon\">\n <div class=\"Vlt-composite__icon\" (click)='textToSpeech()'>\n <svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-microphone\"/></svg>\n </div>\n </div> -->\n <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 -->\n </div>\n </label>\n <small *ngIf='f.invalid && ((f | metaModel)._parent.submitted || ((f | metaModel ).touched))' class=\"Vlt-form__element__error\">\n <span *ngIf=\"f.errors.required\">Required</span>\n <span *ngIf=\"f.errors.maxlength\">Length can not exceed {{validations.maxlength}} characters</span>\n <span *ngIf=\"f.errors.custom\">{{f.errors.custom}} </span>\n </small>\n <small *ngIf='meta.helpText' class=\"Vlt-form__element__hint\">{{meta.helpText}}</small>\n</div>\n", styles: [".Vlt-composite__append--icon{bottom:7px;right:16px;padding:3px;width:initial;height:initial;cursor:pointer}.Vlt-composite__append--icon:hover svg{fill:#2c2d30}.Vlt-form__element--big .Vlt-textarea .Vlt-label{right:18px;background:transparent}.Vlt-form__element--error textarea{border-color:#f25a6b;background:var(--vgip-meta-input-bg-color)}\n"] }]
|
|
83
|
-
}], ctorParameters: function () { return [{ type: MetaContextService }]; } });
|
|
84
|
-
|
|
85
|
-
export { FieldText };
|
|
86
|
-
//# sourceMappingURL=vgip-meta-ui-index-1ddfcce0.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vgip-meta-ui-index-1ddfcce0.mjs","sources":["../../../projects/meta-ui/src/lib/fieldText/index.ts","../../../projects/meta-ui/src/lib/fieldText/view.html"],"sourcesContent":["/*\n * @Author: Alexander.Vangelov@vonage.com\n * @Date: 2019-09-19 17:35:13\n * @Last Modified by: Alexander.Vangelov@vonage.com\n * @Last Modified time: 2020-02-26 20:00:33\n */\n\nimport { Component, OnInit } from '@angular/core';\nimport { ControlContainer, NgForm } from '@angular/forms';\n\nimport { FieldAbstract } from '../fieldAbstract';\n// import { tMetaField } from '../../../metaTypes/tMetaField'\nimport { templateBuilder } from '../common/utils/templateBuilder';\nimport { MetaContextService } from '../services/metaContext';\n\n@Component({\n templateUrl: './view.html',\n styleUrls: ['./style.scss'],\n viewProviders: [ { provide: ControlContainer, useExisting: NgForm } ]\n})\nexport class FieldText extends FieldAbstract implements OnInit {\n // @Input() meta: any;\n value: string;\n\n constructor( private metaContext: MetaContextService ) {\n super();\n }\n\n static setup(instance, parent, meta) {\n const d = meta.default || meta.defaultValue;\n if (d && !parent[meta.name]) {\n if (typeof(d) === 'string') {\n parent[meta.name] = d;\n } else {\n parent[meta.name] = d.id || d.value;\n }\n }\n }\n\n ngOnInit() {\n // if (typeof(this.parent[this.meta.name]) === 'string') {\n // this.parent[this.meta.name] = templateBuilder(this.metaContext, this.parent[this.meta.name]);\n // }\n const origValue = this.parent[this.meta.name];\n Object.defineProperty(this.parent, this.meta.name, {\n set: (value) => {\n if (value) {\n this.model = value;\n this.value = value;\n } else {\n delete this.model;\n delete this.value;\n }\n this.meta.$optional = this.isOptional;\n },\n get: () => this.value,\n enumerable: this.sendToServer,\n configurable: true\n });\n if (typeof(origValue) !== 'undefined') {\n this.parent[this.meta.name] = origValue;\n }\n if (!this.isPersistedParent && typeof(this.meta.auto?.template) === 'string') {\n this.metaContext.onContextChange.subscribe((context) => {\n const autoValue = templateBuilder({ context }, this.meta.auto.template);\n if (this.model === this.lastAutoValue && autoValue) {\n this.lastAutoValue = autoValue;\n this.parent[this.meta.name] = autoValue;\n }\n });\n }\n }\n\n onModelChangeLocal(value) {\n if (!value && this.prevModel && this.isPersistedParent) {\n value = '';\n }\n this.onModelChange(value);\n }\n\n textToSpeech() {\n this.focus();\n }\n\n}\n","<div class='vgip-meta-field-preview' *ngIf='preview && model'>\n <div class='vgip-meta-field-label' [title]='meta.label || meta.name'>{{meta.label || meta.name}}</div>\n <div class='vgip-meta-field-value __gu'>{{parent[meta.name]}}</div>\n</div>\n<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) }\">\n <label class='wrapper'>\n <div class=\"Vlt-textarea\">\n <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>\n <!-- <div class=\"Vlt-composite__append Vlt-composite__append--icon\">\n <div class=\"Vlt-composite__icon\" (click)='textToSpeech()'>\n <svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-microphone\"/></svg>\n </div>\n </div> -->\n <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 -->\n </div>\n </label>\n <small *ngIf='f.invalid && ((f | metaModel)._parent.submitted || ((f | metaModel ).touched))' class=\"Vlt-form__element__error\">\n <span *ngIf=\"f.errors.required\">Required</span>\n <span *ngIf=\"f.errors.maxlength\">Length can not exceed {{validations.maxlength}} characters</span>\n <span *ngIf=\"f.errors.custom\">{{f.errors.custom}} </span>\n </small>\n <small *ngIf='meta.hel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AA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,qDAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,UAAA,EAAA,SAAA,EAAA,gBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,eAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAAC,aAAA,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,aAAA,EAAA,CAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,EAAE,CAAE,EAAA,CAAA,CAAA,EAAA;;4FAE1D,SAAS,EAAA,UAAA,EAAA,CAAA;kBALrB,SAAS;oCAGO,CAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,EAAE,CAAE,EAAA,QAAA,EAAA,otDAAA,EAAA,MAAA,EAAA,CAAA,yVAAA,CAAA,EAAA,CAAA;;;;;"}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable } from '@angular/core';
|
|
3
|
-
import { BehaviorSubject } from 'rxjs';
|
|
4
|
-
|
|
5
|
-
const templateBuilder = (metaContext, pattern) => {
|
|
6
|
-
const context = (metaContext || {}).context;
|
|
7
|
-
if (!context) {
|
|
8
|
-
if (!pattern || typeof (pattern) !== 'string') {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
return (pattern || '').replace(/\${\s*([\w.]+)\s*}/g, 'N/A');
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
const padTime = (t) => t < 10 ? '0' + t : t;
|
|
16
|
-
const patternBuilder = (pattern || '').replace(/\${\s*([\w.]+)\s*}/g, (match, value) => {
|
|
17
|
-
switch (value) {
|
|
18
|
-
case 'direction': {
|
|
19
|
-
return (context[value] || '').toUpperCase() === 'INBOUND' ? 'Inbound' : 'Outbound';
|
|
20
|
-
}
|
|
21
|
-
case 'name': {
|
|
22
|
-
return context.contact ? context.contact.name : (context.callerId || 'Unknown');
|
|
23
|
-
}
|
|
24
|
-
case 'contact': { // (FE-BE contract violation)
|
|
25
|
-
return context.contact ? context.contact.name : (context.callerId || 'Unknown');
|
|
26
|
-
}
|
|
27
|
-
case 'type': {
|
|
28
|
-
return context.type ? context.type : '';
|
|
29
|
-
}
|
|
30
|
-
case 'phoneNumber': {
|
|
31
|
-
return context[value];
|
|
32
|
-
}
|
|
33
|
-
case 'directionArrow': {
|
|
34
|
-
return (context.direction || '').toUpperCase() === 'INBOUND' ? '⬇' : '⬆';
|
|
35
|
-
}
|
|
36
|
-
case 'timestamp': {
|
|
37
|
-
try {
|
|
38
|
-
const callTime = new Date(context.answerTime || context.startTime || Date.now());
|
|
39
|
-
const date = callTime.toDateString();
|
|
40
|
-
const time = callTime.toLocaleTimeString();
|
|
41
|
-
return date + ', ' + time;
|
|
42
|
-
}
|
|
43
|
-
catch (e) {
|
|
44
|
-
console.error('context without startTime', e);
|
|
45
|
-
}
|
|
46
|
-
return '';
|
|
47
|
-
}
|
|
48
|
-
case 'duration': {
|
|
49
|
-
try {
|
|
50
|
-
if (typeof (context[value]) === 'number' && context.endTime) {
|
|
51
|
-
return '(' + (context[value]).toFixed() + 'ms)';
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch (e) {
|
|
55
|
-
console.error('context without duration', e);
|
|
56
|
-
}
|
|
57
|
-
return '(0ms)';
|
|
58
|
-
}
|
|
59
|
-
case 'durationSec': {
|
|
60
|
-
try {
|
|
61
|
-
if (typeof (context.duration) === 'number' && context.endTime) {
|
|
62
|
-
return '(' + (context.duration / 1000).toFixed() + 's)';
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
catch (e) {
|
|
66
|
-
console.error('call without duration', e);
|
|
67
|
-
}
|
|
68
|
-
return '(0s)';
|
|
69
|
-
}
|
|
70
|
-
case 'durationTime': {
|
|
71
|
-
try {
|
|
72
|
-
if (typeof (context.duration) === 'number' && context.endTime) {
|
|
73
|
-
const duration = context.duration / 1000; // convert it to seconds
|
|
74
|
-
if (duration < 0) {
|
|
75
|
-
return '00:00';
|
|
76
|
-
}
|
|
77
|
-
const hours = Math.floor(duration / 3600);
|
|
78
|
-
const minutes = Math.floor((duration % 3600) / 60);
|
|
79
|
-
const seconds = Math.floor(duration % 60);
|
|
80
|
-
const checkHours = hours ? padTime(hours) + ':' : '';
|
|
81
|
-
return checkHours + padTime(minutes) + ':' + padTime(seconds);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
console.error('context without duration', e);
|
|
86
|
-
}
|
|
87
|
-
return '00:00';
|
|
88
|
-
}
|
|
89
|
-
default: {
|
|
90
|
-
const nestedTagMatch = value.match(/(\S+)\.(\S+)/);
|
|
91
|
-
if (nestedTagMatch) {
|
|
92
|
-
if (typeof (context[nestedTagMatch[1]]) === 'object') {
|
|
93
|
-
return context[nestedTagMatch[1]][nestedTagMatch[2]] || '';
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
return '';
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
return context[value] || '';
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
return /^\s+$/.test(patternBuilder) ? '' : patternBuilder;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
/*
|
|
109
|
-
* @Author: Alexander.Vangelov@vonage.com
|
|
110
|
-
* @Date: 2019-09-19 17:35:19
|
|
111
|
-
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
112
|
-
* @Last Modified time: 2020-03-06 10:10:09
|
|
113
|
-
*/
|
|
114
|
-
class MetaContextService {
|
|
115
|
-
constructor() {
|
|
116
|
-
this.defaultContactables = {};
|
|
117
|
-
this.workers = {};
|
|
118
|
-
this.contactables = {};
|
|
119
|
-
this.profiles = {};
|
|
120
|
-
this.onContextChange = new BehaviorSubject({});
|
|
121
|
-
}
|
|
122
|
-
get context() {
|
|
123
|
-
return this._context;
|
|
124
|
-
}
|
|
125
|
-
set context(value) {
|
|
126
|
-
this._context = value;
|
|
127
|
-
this.onContextChange.next(this._context);
|
|
128
|
-
}
|
|
129
|
-
set(context) {
|
|
130
|
-
if (context) {
|
|
131
|
-
if (context.phoneNumber) {
|
|
132
|
-
this.phoneNumber = context.phoneNumber;
|
|
133
|
-
}
|
|
134
|
-
if (context.displayName) {
|
|
135
|
-
this.displayName = context.displayName;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
setOnClick2Dial(callback) {
|
|
140
|
-
if (typeof (callback) === 'function') {
|
|
141
|
-
this.onClick2Dial = callback;
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
delete this.onClick2Dial;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaContextService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
148
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaContextService, providedIn: 'root' }); }
|
|
149
|
-
}
|
|
150
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.11", ngImport: i0, type: MetaContextService, decorators: [{
|
|
151
|
-
type: Injectable,
|
|
152
|
-
args: [{
|
|
153
|
-
providedIn: 'root'
|
|
154
|
-
}]
|
|
155
|
-
}], ctorParameters: function () { return []; } });
|
|
156
|
-
|
|
157
|
-
export { MetaContextService as M, templateBuilder as t };
|
|
158
|
-
//# sourceMappingURL=vgip-meta-ui-index-37358620.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vgip-meta-ui-index-37358620.mjs","sources":["../../../projects/meta-ui/src/lib/common/utils/templateBuilder.ts","../../../projects/meta-ui/src/lib/services/metaContext/index.ts"],"sourcesContent":["export const templateBuilder = (metaContext, pattern) => {\n const context = (metaContext || {}).context;\n if (!context) {\n if (!pattern || typeof(pattern) !== 'string') {\n return;\n } else {\n return (pattern || '').replace(/\\${\\s*([\\w.]+)\\s*}/g, 'N/A');\n }\n }\n\n const padTime = (t) => t < 10 ? '0' + t : t;\n\n const patternBuilder = (pattern || '').replace(/\\${\\s*([\\w.]+)\\s*}/g, (match, value) => {\n switch (value) {\n case 'direction': {\n return (context[value] || '').toUpperCase() === 'INBOUND' ? 'Inbound' : 'Outbound';\n }\n case 'name': {\n return context.contact ? context.contact.name : (context.callerId || 'Unknown');\n }\n case 'contact': { // (FE-BE contract violation)\n return context.contact ? context.contact.name : (context.callerId || 'Unknown');\n }\n case 'type': {\n return context.type ? context.type : '';\n }\n case 'phoneNumber': {\n return context[value];\n }\n case 'directionArrow': {\n return (context.direction || '').toUpperCase() === 'INBOUND' ? '⬇' : '⬆';\n }\n case 'timestamp': {\n try {\n const callTime = new Date(context.answerTime || context.startTime || Date.now());\n const date = callTime.toDateString();\n const time = callTime.toLocaleTimeString();\n return date + ', ' + time;\n } catch (e) {\n console.error('context without startTime', e);\n }\n return '';\n }\n case 'duration': {\n try {\n if (typeof (context[value]) === 'number' && context.endTime) {\n return '(' + (context[value]).toFixed() + 'ms)';\n }\n } catch (e) {\n console.error('context without duration', e);\n }\n return '(0ms)';\n }\n case 'durationSec': {\n try {\n if (typeof (context.duration) === 'number' && context.endTime) {\n return '(' + (context.duration / 1000).toFixed() + 's)';\n }\n } catch (e) {\n console.error('call without duration', e);\n }\n return '(0s)';\n }\n case 'durationTime': {\n try {\n if (typeof (context.duration) === 'number' && context.endTime) {\n const duration = context.duration / 1000; // convert it to seconds\n if (duration < 0) {\n return '00:00';\n }\n\n const hours = Math.floor(duration / 3600);\n const minutes = Math.floor((duration % 3600) / 60);\n const seconds = Math.floor(duration % 60);\n\n const checkHours = hours ? padTime(hours) + ':' : '';\n return checkHours + padTime(minutes) + ':' + padTime(seconds);\n }\n } catch (e) {\n console.error('context without duration', e);\n }\n return '00:00';\n }\n default: {\n const nestedTagMatch = value.match(/(\\S+)\\.(\\S+)/);\n if (nestedTagMatch) {\n if (typeof(context[nestedTagMatch[1]]) === 'object') {\n return context[nestedTagMatch[1]][nestedTagMatch[2]] || '';\n } else {\n return '';\n }\n } else {\n return context[value] || '';\n }\n }\n }\n });\n return /^\\s+$/.test(patternBuilder) ? '' : patternBuilder;\n};\n","/*\n * @Author: Alexander.Vangelov@vonage.com\n * @Date: 2019-09-19 17:35:19\n * @Last Modified by: Alexander.Vangelov@vonage.com\n * @Last Modified time: 2020-03-06 10:10:09\n */\n\nimport { Injectable } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class MetaContextService {\n phoneNumber: string;\n displayName: string;\n defaultContactables: {[integrationCode: string]: any} = {};\n workers: {[integrationCode: string]: any} = {};\n contactables: {[integrationCode: string]: any} = {};\n profiles: {[integrationCode: string]: any} = {};\n vgipEventId: string;\n vgipUserId: string;\n _context: any;\n uid: string;\n subject: string;\n onClick2Dial: (phoneNumber, vrn?: string) => void;\n onContextChange: BehaviorSubject<any>;\n\n constructor() {\n this.onContextChange = new BehaviorSubject({});\n }\n\n get context() {\n return this._context;\n }\n\n set context(value) {\n this._context = value;\n this.onContextChange.next(this._context);\n }\n\n set(context?) {\n if (context) {\n if (context.phoneNumber) {\n this.phoneNumber = context.phoneNumber;\n }\n if (context.displayName) {\n this.displayName = context.displayName;\n }\n }\n }\n\n setOnClick2Dial(callback: (phoneNumber, vrn?: string) => void) {\n if (typeof(callback) === 'function') {\n this.onClick2Dial = callback;\n } else {\n delete this.onClick2Dial;\n }\n }\n\n}\n"],"names":[],"mappings":";;;;MAAa,eAAe,GAAG,CAAC,WAAW,EAAE,OAAO,KAAI;IACtD,MA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