@vgip/meta-ui 1.5.6 → 1.5.7
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/esm2020/lib/fieldAbstract.mjs +6 -6
- package/esm2020/lib/fieldComposite/index.mjs +65 -0
- package/esm2020/lib/fieldList/index.mjs +68 -0
- package/esm2020/lib/fieldReference/index.mjs +823 -0
- package/esm2020/lib/fieldSelect/index.mjs +481 -0
- package/esm2020/lib/index.mjs +10 -18
- package/esm2020/lib/layout/index.mjs +151 -0
- package/esm2020/lib/metaField/index.mjs +139 -0
- package/esm2020/lib/refDialog/index.mjs +127 -0
- package/esm2020/lib/resource/index.mjs +480 -0
- package/esm2020/lib/resourceCard/index.mjs +42 -0
- package/esm2020/lib/services/metaReference/index.mjs +2 -3
- package/fesm2015/vgip-meta-ui-fieldAbstract-2d0882f1.mjs +382 -0
- package/fesm2015/vgip-meta-ui-fieldAbstract-2d0882f1.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-0068fb77.mjs +368 -0
- package/fesm2015/vgip-meta-ui-index-0068fb77.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-1911ddae.mjs +1882 -0
- package/fesm2015/vgip-meta-ui-index-1911ddae.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-3488da98.mjs +130 -0
- package/fesm2015/vgip-meta-ui-index-3488da98.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-3f6cd57a.mjs +74 -0
- package/fesm2015/vgip-meta-ui-index-3f6cd57a.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-5615e618.mjs +95 -0
- package/fesm2015/vgip-meta-ui-index-5615e618.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-65c10356.mjs +57 -0
- package/fesm2015/vgip-meta-ui-index-65c10356.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-6dcd556a.mjs +145 -0
- package/fesm2015/vgip-meta-ui-index-6dcd556a.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-8f5be5a7.mjs +24 -0
- package/fesm2015/vgip-meta-ui-index-8f5be5a7.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-934aeabf.mjs +68 -0
- package/fesm2015/vgip-meta-ui-index-934aeabf.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-9b5ee0c4.mjs +88 -0
- package/fesm2015/vgip-meta-ui-index-9b5ee0c4.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-b925a3a8.mjs +856 -0
- package/fesm2015/vgip-meta-ui-index-b925a3a8.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-dc1b440d.mjs +489 -0
- package/fesm2015/vgip-meta-ui-index-dc1b440d.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-f026e8e5.mjs +71 -0
- package/fesm2015/vgip-meta-ui-index-f026e8e5.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-index-fa0b1b8b.mjs +460 -0
- package/fesm2015/vgip-meta-ui-index-fa0b1b8b.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-metaModel.pipe-725f401c.mjs +28 -0
- package/fesm2015/vgip-meta-ui-metaModel.pipe-725f401c.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui-relativeTimeBuilder-31791ce4.mjs +51 -0
- package/fesm2015/vgip-meta-ui-relativeTimeBuilder-31791ce4.mjs.map +1 -0
- package/fesm2015/vgip-meta-ui.mjs +40 -5083
- package/fesm2015/vgip-meta-ui.mjs.map +1 -1
- package/fesm2020/vgip-meta-ui-fieldAbstract-2d0882f1.mjs +382 -0
- package/fesm2020/vgip-meta-ui-fieldAbstract-2d0882f1.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-0068fb77.mjs +368 -0
- package/fesm2020/vgip-meta-ui-index-0068fb77.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-1a54864a.mjs +70 -0
- package/fesm2020/vgip-meta-ui-index-1a54864a.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-2e6b2b56.mjs +73 -0
- package/fesm2020/vgip-meta-ui-index-2e6b2b56.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-3488da98.mjs +130 -0
- package/fesm2020/vgip-meta-ui-index-3488da98.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-5615e618.mjs +95 -0
- package/fesm2020/vgip-meta-ui-index-5615e618.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-65c10356.mjs +57 -0
- package/fesm2020/vgip-meta-ui-index-65c10356.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-7f4f2d15.mjs +142 -0
- package/fesm2020/vgip-meta-ui-index-7f4f2d15.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-8f5be5a7.mjs +24 -0
- package/fesm2020/vgip-meta-ui-index-8f5be5a7.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-934aeabf.mjs +68 -0
- package/fesm2020/vgip-meta-ui-index-934aeabf.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-9b33fba1.mjs +856 -0
- package/fesm2020/vgip-meta-ui-index-9b33fba1.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-9b590fc8.mjs +488 -0
- package/fesm2020/vgip-meta-ui-index-9b590fc8.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-9b5ee0c4.mjs +88 -0
- package/fesm2020/vgip-meta-ui-index-9b5ee0c4.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-e73dc574.mjs +1879 -0
- package/fesm2020/vgip-meta-ui-index-e73dc574.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-index-fa0b1b8b.mjs +460 -0
- package/fesm2020/vgip-meta-ui-index-fa0b1b8b.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-metaModel.pipe-725f401c.mjs +28 -0
- package/fesm2020/vgip-meta-ui-metaModel.pipe-725f401c.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui-relativeTimeBuilder-31791ce4.mjs +51 -0
- package/fesm2020/vgip-meta-ui-relativeTimeBuilder-31791ce4.mjs.map +1 -0
- package/fesm2020/vgip-meta-ui.mjs +39 -5083
- package/fesm2020/vgip-meta-ui.mjs.map +1 -1
- package/lib/fieldComposite/index.d.ts +12 -0
- package/lib/fieldList/index.d.ts +14 -0
- package/lib/fieldReference/index.d.ts +73 -0
- package/lib/fieldSelect/index.d.ts +48 -0
- package/lib/index.d.ts +31 -23
- package/lib/layout/index.d.ts +39 -0
- package/lib/metaField/index.d.ts +26 -0
- package/lib/refDialog/index.d.ts +33 -0
- package/lib/resource/index.d.ts +58 -0
- package/lib/resourceCard/index.d.ts +18 -0
- package/lib/services/metaReference/index.d.ts +1 -1
- package/package.json +1 -1
- package/esm2020/lib/field.mjs +0 -2325
- package/lib/field.d.ts +0 -292
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, Input } from '@angular/core';
|
|
3
|
+
import { F as FieldAbstract } from './vgip-meta-ui-fieldAbstract-2d0882f1.mjs';
|
|
4
|
+
import * as i1 from '@angular/common';
|
|
5
|
+
import { M as MetaField } from './vgip-meta-ui-index-6dcd556a.mjs';
|
|
6
|
+
import 'rxjs';
|
|
7
|
+
import 'rxjs/operators';
|
|
8
|
+
import 'tslib';
|
|
9
|
+
|
|
10
|
+
class FieldComposite extends FieldAbstract {
|
|
11
|
+
get isRow() {
|
|
12
|
+
return this.meta.subtype !== 'column';
|
|
13
|
+
}
|
|
14
|
+
get fields() {
|
|
15
|
+
return (this.meta.fields || []).map((f) => {
|
|
16
|
+
if (f.type === 'textarea') { // no textareas inside composite (use string)
|
|
17
|
+
delete f.type;
|
|
18
|
+
}
|
|
19
|
+
return f;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
ngOnInit() {
|
|
23
|
+
// super.ngOnInit()
|
|
24
|
+
let nestedFieldsRegex;
|
|
25
|
+
if (this.meta.name) {
|
|
26
|
+
this.value = this.parent[this.meta.name] || {};
|
|
27
|
+
nestedFieldsRegex = new RegExp(`^${this.meta.name}\\.(.*)`);
|
|
28
|
+
Object.defineProperty(this.parent, this.meta.name, {
|
|
29
|
+
set: (value) => {
|
|
30
|
+
if (value) {
|
|
31
|
+
for (const v of Object.keys(value)) {
|
|
32
|
+
this.value[v] = value[v];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
get: () => {
|
|
37
|
+
if (JSON.stringify(this.value) !== '{}') {
|
|
38
|
+
return this.value;
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
enumerable: this.sendToServer,
|
|
42
|
+
configurable: true
|
|
43
|
+
});
|
|
44
|
+
for (const f of this.meta.fields) {
|
|
45
|
+
if (this.isRow) {
|
|
46
|
+
if (f.type === 'text') {
|
|
47
|
+
f.type = 'string';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const nestedFieldMatch = f.name.match(nestedFieldsRegex);
|
|
51
|
+
if (nestedFieldMatch) {
|
|
52
|
+
f.name = nestedFieldMatch[1]; // for VGIS V2 backward compatibility normalize name with dotted syntax
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.value = this.parent;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
FieldComposite.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: FieldComposite, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
62
|
+
FieldComposite.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.0", type: FieldComposite, selector: "ng-component", inputs: { meta: "meta" }, usesInheritance: true, ngImport: i0, template: "<div [ngClass]=\"{ 'Vlt-grid Vlt-grid--narrow': isRow }\">\n <ng-container *ngFor='let field of fields'>\n <div style='margin: 0;' [ngClass]=\"{ 'Vlt-col': isRow, 'Vlt-col--1of3': isRow && fields.length > 3 }\" *ngIf=\"!field.$invisible\">\n <vgip-meta-field *ngIf='!meta.$invisible' [ngClass]=\"{ shown: !field.$invisible}\" [index]='index' [meta]='field'\n [parent]='value' [integrationCode]='integrationCode' [resourceType]='resourceType' [preview]='preview'\n theme='inherit'></vgip-meta-field>\n </div>\n </ng-container>\n</div>", styles: ["div>vgip-meta-field{display:none}div>vgip-meta-field.shown{display:initial}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MetaField, selector: "vgip-meta-field", inputs: ["meta", "parent", "integrationCode", "resourceType", "index", "preview", "theme"], outputs: ["onChange", "onLeave"] }] });
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: FieldComposite, decorators: [{
|
|
64
|
+
type: Component,
|
|
65
|
+
args: [{ template: "<div [ngClass]=\"{ 'Vlt-grid Vlt-grid--narrow': isRow }\">\n <ng-container *ngFor='let field of fields'>\n <div style='margin: 0;' [ngClass]=\"{ 'Vlt-col': isRow, 'Vlt-col--1of3': isRow && fields.length > 3 }\" *ngIf=\"!field.$invisible\">\n <vgip-meta-field *ngIf='!meta.$invisible' [ngClass]=\"{ shown: !field.$invisible}\" [index]='index' [meta]='field'\n [parent]='value' [integrationCode]='integrationCode' [resourceType]='resourceType' [preview]='preview'\n theme='inherit'></vgip-meta-field>\n </div>\n </ng-container>\n</div>", styles: ["div>vgip-meta-field{display:none}div>vgip-meta-field.shown{display:initial}\n"] }]
|
|
66
|
+
}], propDecorators: { meta: [{
|
|
67
|
+
type: Input
|
|
68
|
+
}] } });
|
|
69
|
+
|
|
70
|
+
export { FieldComposite };
|
|
71
|
+
//# sourceMappingURL=vgip-meta-ui-index-f026e8e5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vgip-meta-ui-index-f026e8e5.mjs","sources":["../../../projects/meta-ui/src/lib/fieldComposite/index.ts","../../../projects/meta-ui/src/lib/fieldComposite/view.html"],"sourcesContent":["import { Component, Input, OnInit } from '@angular/core';\nimport { FieldAbstract } from '../fieldAbstract';\n\n@Component({\n templateUrl: './view.html',\n styleUrls: ['./style.scss'],\n})\nexport class FieldComposite extends FieldAbstract implements OnInit {\n @Input() meta: any;\n value: any;\n\n get isRow() {\n return this.meta.subtype !== 'column';\n }\n\n get fields() {\n return (this.meta.fields || []).map((f) => {\n if (f.type === 'textarea') { // no textareas inside composite (use string)\n delete f.type;\n }\n return f;\n });\n }\n\n ngOnInit() {\n // super.ngOnInit()\n let nestedFieldsRegex: RegExp;\n if (this.meta.name) {\n this.value = this.parent[this.meta.name] || {};\n nestedFieldsRegex = new RegExp(`^${this.meta.name}\\\\.(.*)`);\n Object.defineProperty(this.parent, this.meta.name, {\n set: (value) => {\n if (value) {\n for (const v of Object.keys(value)) {\n this.value[v] = value[v];\n }\n }\n },\n get: () => {\n if (JSON.stringify(this.value) !== '{}') {\n return this.value;\n }\n },\n enumerable: this.sendToServer,\n configurable: true\n });\n for (const f of this.meta.fields) {\n if (this.isRow) {\n if (f.type === 'text') {\n f.type = 'string';\n }\n }\n const nestedFieldMatch = f.name.match(nestedFieldsRegex);\n if (nestedFieldMatch) {\n f.name = nestedFieldMatch[1]; // for VGIS V2 backward compatibility normalize name with dotted syntax\n }\n }\n } else {\n this.value = this.parent;\n }\n }\n\n}\n","<div [ngClass]=\"{ 'Vlt-grid Vlt-grid--narrow': isRow }\">\n <ng-container *ngFor='let field of fields'>\n <div style='margin: 0;' [ngClass]=\"{ 'Vlt-col': isRow, 'Vlt-col--1of3': isRow && fields.length > 3 }\" *ngIf=\"!field.$invisible\">\n <vgip-meta-field *ngIf='!meta.$invisible' [ngClass]=\"{ shown: !field.$invisible}\" [index]='index' [meta]='field'\n [parent]='value' [integrationCode]='integrationCode' [resourceType]='resourceType' [preview]='preview'\n theme='inherit'></vgip-meta-field>\n </div>\n </ng-container>\n</div>"],"names":["i2.MetaField"],"mappings":"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"}
|
|
@@ -0,0 +1,460 @@
|
|
|
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-2d0882f1.mjs';
|
|
6
|
+
import { t as templateBuilder, M as MetaContextService } from './vgip-meta-ui-index-3488da98.mjs';
|
|
7
|
+
import { r as relativeTimeBuilder } from './vgip-meta-ui-relativeTimeBuilder-31791ce4.mjs';
|
|
8
|
+
import * as i1 from '@angular/common';
|
|
9
|
+
import { M as MetaModelPipe } from './vgip-meta-ui-metaModel.pipe-725f401c.mjs';
|
|
10
|
+
import 'rxjs';
|
|
11
|
+
import 'rxjs/operators';
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* @Author: Alexander.Vangelov@vonage.com
|
|
15
|
+
* @Date: 2019-09-19 17:35:09
|
|
16
|
+
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
17
|
+
* @Last Modified time: 2020-05-12 17:45:46
|
|
18
|
+
*/
|
|
19
|
+
// import { MetaValidations } from '../common/decorators/metaValidations.decorator';
|
|
20
|
+
class FieldInput extends FieldAbstract {
|
|
21
|
+
constructor(metaContext) {
|
|
22
|
+
super();
|
|
23
|
+
this.metaContext = metaContext;
|
|
24
|
+
this.clickout = (event) => {
|
|
25
|
+
if (event.target.className === 'Vlt-dropdown__link' && this.elementRef.nativeElement.contains(event.target)) {
|
|
26
|
+
this.focus();
|
|
27
|
+
// this.dismissDropdown();
|
|
28
|
+
// this.parent[this.meta.name] = event.target.textContent;
|
|
29
|
+
}
|
|
30
|
+
else if (event.target !== this.input && event.target.className !== 'Vlt-dropdown__title') {
|
|
31
|
+
this.dismissDropdown();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.focus();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
this.keydown = (event) => {
|
|
38
|
+
switch (event.key) {
|
|
39
|
+
case 'ArrowDown': {
|
|
40
|
+
if (['datetime', 'time', 'date', 'datetime-local'].indexOf(this.meta.subtype || this.meta.type) !== -1) {
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
this.showDropdown();
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
if (typeof (this.activeSuggestionIndex) === 'undefined') {
|
|
46
|
+
this.activeSuggestionIndex = 0;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.activeSuggestionIndex++;
|
|
50
|
+
if (this.activeSuggestionIndex >= this.suggestions.length) {
|
|
51
|
+
this.activeSuggestionIndex = 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case 'ArrowUp': {
|
|
57
|
+
if (['datetime', 'time', 'date', 'datetime-local'].indexOf(this.meta.subtype || this.meta.type) !== -1) {
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
this.showDropdown();
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
if (typeof (this.activeSuggestionIndex) === 'undefined') {
|
|
63
|
+
this.activeSuggestionIndex = this.suggestions.length - 1;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
this.activeSuggestionIndex--;
|
|
67
|
+
if (this.activeSuggestionIndex < 0) {
|
|
68
|
+
this.activeSuggestionIndex = this.suggestions.length - 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case 'Space':
|
|
74
|
+
case 'Enter': {
|
|
75
|
+
if (typeof (this.activeSuggestionIndex) !== 'undefined') {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
event.stopPropagation();
|
|
78
|
+
this.onSuggestionSelect(event, this.suggestions[this.activeSuggestionIndex]);
|
|
79
|
+
delete this.activeSuggestionIndex;
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case 'Escape': {
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
event.stopPropagation();
|
|
86
|
+
this.dismissDropdown();
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
default: {
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
if (!this.model) {
|
|
92
|
+
delete this.activeSuggestionIndex;
|
|
93
|
+
delete this.asyncSuggestions;
|
|
94
|
+
}
|
|
95
|
+
else if (typeof (this.model) === 'string') {
|
|
96
|
+
this.asyncSuggestions = (this.meta.suggestions || []).filter((s) => {
|
|
97
|
+
const suggestionText = (s.id || s.value || s || '').toLowerCase();
|
|
98
|
+
return suggestionText.indexOf(this.model.toLowerCase()) !== -1;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
get suggestions() {
|
|
107
|
+
return this.asyncSuggestions || this.meta.suggestions || [];
|
|
108
|
+
}
|
|
109
|
+
ngOnInit() {
|
|
110
|
+
this.multiple = (this.meta.type === 'multistring') || this.meta.multiple;
|
|
111
|
+
// console.log('FieldInput init', this.meta.name);
|
|
112
|
+
this.validationAttributes = ['pattern', 'required', 'minlength', 'maxlength', 'min', 'max', 'step'];
|
|
113
|
+
if (this.meta.picklist) { // just for test! all metadata should be transformed to v3 protocol
|
|
114
|
+
this.meta.suggestions = (this.meta.picklist || []).map((s) => s.label);
|
|
115
|
+
}
|
|
116
|
+
if (this.meta.type === 'number') {
|
|
117
|
+
if (this.meta.subtype === 'float' && !this.meta.step) {
|
|
118
|
+
this.meta.step = '0.01';
|
|
119
|
+
}
|
|
120
|
+
this.meta.subtype = 'number';
|
|
121
|
+
}
|
|
122
|
+
if (['date', 'time', 'datetime'].indexOf(this.meta.type) !== -1) {
|
|
123
|
+
this.meta.subtype = this.meta.type;
|
|
124
|
+
if (this.meta.type === 'datetime') {
|
|
125
|
+
this.meta.subtype = 'datetime-local';
|
|
126
|
+
}
|
|
127
|
+
delete this.multiple; // no multiple support for timestamps
|
|
128
|
+
}
|
|
129
|
+
this.showClear = !this.multiple && [
|
|
130
|
+
'', 'string', 'url', 'email', 'password', 'tel', 'date', 'datetime-local', 'time'
|
|
131
|
+
].indexOf(this.meta.subtype || '') !== -1;
|
|
132
|
+
const origValue = this.parent[this.meta.name];
|
|
133
|
+
Object.defineProperty(this.parent, this.meta.name, {
|
|
134
|
+
set: (value) => {
|
|
135
|
+
if (this.multiple) {
|
|
136
|
+
if (typeof (value) !== 'undefined') {
|
|
137
|
+
const values = (value instanceof Array) ? value : [value];
|
|
138
|
+
this.model = [];
|
|
139
|
+
for (let v of values) {
|
|
140
|
+
if (!this.model) {
|
|
141
|
+
this.model = [];
|
|
142
|
+
}
|
|
143
|
+
if (typeof (v) === 'object' && v !== null) {
|
|
144
|
+
v = v.id || v.value;
|
|
145
|
+
}
|
|
146
|
+
this.model.push(v);
|
|
147
|
+
}
|
|
148
|
+
this.value = this.model;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
if (typeof (value) !== 'undefined'
|
|
153
|
+
&& !(value === null && ((typeof (this.meta.type) === 'undefined') || ['string', 'number'].indexOf(this.meta.type) !== -1))) {
|
|
154
|
+
if (this.meta.type === 'number' && typeof (value) === 'string') {
|
|
155
|
+
value = parseInt(value, 10);
|
|
156
|
+
}
|
|
157
|
+
else if (typeof (value) === 'object' && value !== null) {
|
|
158
|
+
value = value.id || value.value;
|
|
159
|
+
}
|
|
160
|
+
if (['datetime', 'date', 'datetime-local'].indexOf(this.meta.subtype || this.meta.type) !== -1 && value) {
|
|
161
|
+
try {
|
|
162
|
+
let date;
|
|
163
|
+
if ((typeof (value) === 'number')) {
|
|
164
|
+
date = new Date(parseInt(value, 10));
|
|
165
|
+
if ('date' === (this.meta.type || this.meta.subtype)) {
|
|
166
|
+
date = new Date(date.getTime() + (date.getTimezoneOffset() * 60000));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
if ('date' === (this.meta.subtype || this.meta.type)) {
|
|
171
|
+
date = new Date(Date.parse(value));
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
date = new Date(Date.parse(`${value}Z`) + (new Date().getTimezoneOffset() * 60000));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (typeof (value) === 'number') {
|
|
178
|
+
switch (this.meta.subtype || this.meta.type) {
|
|
179
|
+
case 'datetime-local':
|
|
180
|
+
case 'datetime': {
|
|
181
|
+
this.model = `${date.getFullYear()}-${('00' + (date.getMonth() + 1)).slice(-2)}-${('00' + date.getDate()).slice(-2)}`;
|
|
182
|
+
this.model += `T${('00' + date.getHours()).slice(-2)}:${('00' + date.getMinutes()).slice(-2)}`;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
case 'date': {
|
|
186
|
+
this.model = date.toISOString().split('T')[0];
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (this.meta.valueType === 'string') {
|
|
192
|
+
if ((this.meta.subtype || this.meta.type) === 'date') {
|
|
193
|
+
this.value = date.toISOString().split('T')[0];
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
this.value = date.toISOString();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
if ((this.meta.subtype || this.meta.type) === 'date') {
|
|
201
|
+
date.setFullYear(date.getUTCFullYear());
|
|
202
|
+
date.setMonth(date.getUTCMonth());
|
|
203
|
+
date.setDate(date.getUTCDate());
|
|
204
|
+
date.setMinutes(0);
|
|
205
|
+
date.setHours(0);
|
|
206
|
+
date.setSeconds(0);
|
|
207
|
+
date.setMilliseconds(0);
|
|
208
|
+
this.value = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).getTime();
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
this.value = date.getTime();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
catch (e) {
|
|
216
|
+
console.error('Date parse error', e.message, `"${value}"`, `(${typeof (value)})`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else if ('time' === (this.meta.subtype || this.meta.type)) {
|
|
220
|
+
try {
|
|
221
|
+
let date;
|
|
222
|
+
if (typeof (value) === 'number') {
|
|
223
|
+
date = new Date(parseInt(value, 10));
|
|
224
|
+
if (value < 86400000) {
|
|
225
|
+
date = new Date(date.getTime() + (date.getTimezoneOffset() * 60000));
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
date = new Date(Date.parse(new Date().toISOString().replace(/T.*Z/, `T${value}Z`)) + (new Date().getTimezoneOffset() * 60000));
|
|
230
|
+
}
|
|
231
|
+
this.model = date.toTimeString().split(' ')[0];
|
|
232
|
+
date.setFullYear(1970);
|
|
233
|
+
date.setMonth(0);
|
|
234
|
+
date.setDate(1);
|
|
235
|
+
date.setMilliseconds(0);
|
|
236
|
+
this.value = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).getTime();
|
|
237
|
+
}
|
|
238
|
+
catch (e) {
|
|
239
|
+
console.error('Date parse error', e.message, `"${value}"`, `(${typeof (value)})`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
if (!value && (typeof (this.prevModel) === 'string') && this.isPersistedParent) {
|
|
244
|
+
value = '';
|
|
245
|
+
}
|
|
246
|
+
this.model = value;
|
|
247
|
+
this.value = value;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
delete this.model;
|
|
252
|
+
delete this.value;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
this.meta.$optional = this.isOptional;
|
|
256
|
+
},
|
|
257
|
+
get: () => this.value,
|
|
258
|
+
enumerable: this.sendToServer,
|
|
259
|
+
configurable: true
|
|
260
|
+
});
|
|
261
|
+
if (typeof (origValue) !== 'undefined') {
|
|
262
|
+
this.parent[this.meta.name] = origValue;
|
|
263
|
+
}
|
|
264
|
+
const d = this.meta.default || this.meta.defaultValue;
|
|
265
|
+
if (d && typeof (this.model) === 'undefined') {
|
|
266
|
+
if (this.multiple) {
|
|
267
|
+
this.parent[this.meta.name] = [];
|
|
268
|
+
if (d.length) {
|
|
269
|
+
for (const dv of this.default) { // TODO ???
|
|
270
|
+
const defaultValueItem = (typeof (dv) === 'string' || dv === null) ? dv : (dv.id || dv.value);
|
|
271
|
+
if (defaultValueItem || defaultValueItem === 0) {
|
|
272
|
+
this.parent[this.meta.name].push(defaultValueItem);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
const defaultValue = (typeof (d) === 'string') ? d : (d.id || d.value);
|
|
279
|
+
if (defaultValue || defaultValue === 0) {
|
|
280
|
+
if (/^(date|time)/.test(this.meta.subtype) && typeof (defaultValue) === 'string') {
|
|
281
|
+
this.parent[this.meta.name] = relativeTimeBuilder(this.meta.subtype, defaultValue, this.validations.step);
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
if (this.meta.type === 'string' && defaultValue) {
|
|
285
|
+
this.parent[this.meta.name] = templateBuilder(this.metaContext, defaultValue);
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
this.parent[this.meta.name] = defaultValue;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
onActivated(ev) {
|
|
296
|
+
this.input = ev.srcElement;
|
|
297
|
+
if (!this.dropdown) {
|
|
298
|
+
this.dropdown = ev.srcElement.parentNode.parentNode;
|
|
299
|
+
}
|
|
300
|
+
this.showDropdown();
|
|
301
|
+
}
|
|
302
|
+
clear(ev) {
|
|
303
|
+
delete this.model;
|
|
304
|
+
delete this.activeSuggestionIndex;
|
|
305
|
+
delete this.asyncSuggestions;
|
|
306
|
+
this.onModelChange(this.model);
|
|
307
|
+
if (ev) {
|
|
308
|
+
ev.preventDefault();
|
|
309
|
+
ev.stopPropagation();
|
|
310
|
+
this.focus();
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
onBlur(ev) {
|
|
315
|
+
let internalControl = false;
|
|
316
|
+
if (ev.relatedTarget) {
|
|
317
|
+
if (!this.elementRef.nativeElement.contains(ev.relatedTarget)) {
|
|
318
|
+
this.dismissDropdown();
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
internalControl = true;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (this.keyListenerActive && !internalControl) {
|
|
325
|
+
this.input.removeEventListener('keydown', this.keydown);
|
|
326
|
+
setTimeout(() => {
|
|
327
|
+
if (!this.keyListenerActive) {
|
|
328
|
+
document.removeEventListener('click', this.clickout);
|
|
329
|
+
}
|
|
330
|
+
}, 400);
|
|
331
|
+
delete this.keyListenerActive;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
onAdd(ev) {
|
|
335
|
+
console.log('onAdd', this.addText);
|
|
336
|
+
if (this.addText) {
|
|
337
|
+
if ((this.model || []).indexOf(this.addText) === -1) {
|
|
338
|
+
this.onSuggestionSelect(ev, this.addText);
|
|
339
|
+
if (!this.meta.suggestions) {
|
|
340
|
+
this.meta.suggestions = [];
|
|
341
|
+
}
|
|
342
|
+
this.meta.suggestions.unshift(this.addText);
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
ev.preventDefault();
|
|
346
|
+
ev.stopPropagation();
|
|
347
|
+
this.focus();
|
|
348
|
+
}
|
|
349
|
+
delete this.addText;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
remove(ev, item) {
|
|
353
|
+
ev.preventDefault();
|
|
354
|
+
ev.stopPropagation();
|
|
355
|
+
const optionIndex = this.model.indexOf(item);
|
|
356
|
+
if (optionIndex !== -1) {
|
|
357
|
+
this.model.splice(optionIndex, 1);
|
|
358
|
+
if (!this.model.length) {
|
|
359
|
+
delete this.model;
|
|
360
|
+
delete this.value;
|
|
361
|
+
}
|
|
362
|
+
this.onModelChange(this.model);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
onSuggestionSelect(ev, suggestion) {
|
|
366
|
+
if (!suggestion) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
ev.preventDefault();
|
|
370
|
+
ev.stopPropagation();
|
|
371
|
+
this.focus();
|
|
372
|
+
let suggestionValue = suggestion.id || suggestion.value || suggestion;
|
|
373
|
+
if (typeof (suggestionValue) === 'string') {
|
|
374
|
+
if (/^(date|time)/.test(this.meta.subtype)) {
|
|
375
|
+
suggestionValue = relativeTimeBuilder(this.meta.subtype, suggestionValue, this.validations.step);
|
|
376
|
+
}
|
|
377
|
+
else if (this.meta.type === 'string') {
|
|
378
|
+
suggestionValue = templateBuilder(this.metaContext, suggestionValue);
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
suggestionValue = suggestion;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (this.multiple) {
|
|
385
|
+
if (!this.model) {
|
|
386
|
+
this.model = [];
|
|
387
|
+
}
|
|
388
|
+
let existingItemIndex = this.model.indexOf(suggestionValue);
|
|
389
|
+
if (existingItemIndex === -1) {
|
|
390
|
+
this.model.push(suggestionValue);
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
this.model.splice(existingItemIndex, 1);
|
|
394
|
+
existingItemIndex = undefined;
|
|
395
|
+
}
|
|
396
|
+
this.onModelChange(this.model);
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
this.dismissDropdown();
|
|
400
|
+
this.model = suggestionValue;
|
|
401
|
+
this.onModelChange(suggestionValue);
|
|
402
|
+
this.activeSuggestionIndex = this.suggestions.indexOf(suggestion);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
textToSpeech() { }
|
|
406
|
+
dismissDropdown(event) {
|
|
407
|
+
if (event) {
|
|
408
|
+
this.focus();
|
|
409
|
+
}
|
|
410
|
+
if (this.dropdown) {
|
|
411
|
+
this.dropdown.classList.remove('Vlt-dropdown--expanded');
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
ensureDropdownIsVisible() {
|
|
415
|
+
setTimeout(() => {
|
|
416
|
+
const holder = this.dropdown.closest('.Vlt-card__content');
|
|
417
|
+
const el = this.elementRef.nativeElement.querySelector('.Vlt-dropdown__panel');
|
|
418
|
+
if (el) {
|
|
419
|
+
const elRect = el.getBoundingClientRect();
|
|
420
|
+
const holderRect = holder.getBoundingClientRect();
|
|
421
|
+
if (holderRect.top + holderRect.height < elRect.top + elRect.height) {
|
|
422
|
+
el.scrollIntoView({ block: 'end' });
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}, 400);
|
|
426
|
+
}
|
|
427
|
+
showDropdown() {
|
|
428
|
+
if (this.meta.suggestions && this.meta.suggestions.length) {
|
|
429
|
+
this.dropdown.classList.add('Vlt-dropdown--expanded');
|
|
430
|
+
this.ensureDropdownIsVisible();
|
|
431
|
+
}
|
|
432
|
+
if (!this.keyListenerActive) {
|
|
433
|
+
this.input.addEventListener('keydown', this.keydown);
|
|
434
|
+
setTimeout(() => {
|
|
435
|
+
document.addEventListener('click', this.clickout);
|
|
436
|
+
}, 200);
|
|
437
|
+
this.keyListenerActive = true;
|
|
438
|
+
}
|
|
439
|
+
if (typeof (this.activeSuggestionIndex) === 'undefined') {
|
|
440
|
+
if (this.model && this.suggestions.length) {
|
|
441
|
+
for (let suggestionIndex = 0; suggestionIndex < this.suggestions.length; suggestionIndex++) {
|
|
442
|
+
if (this.model === this.suggestions[suggestionIndex]) {
|
|
443
|
+
this.activeSuggestionIndex = suggestionIndex;
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
delete this.activeSuggestionIndex;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
FieldInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: FieldInput, deps: [{ token: MetaContextService }], target: i0.ɵɵFactoryTarget.Component });
|
|
453
|
+
FieldInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.0", type: FieldInput, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div class='vgip-meta-field-preview' *ngIf='preview && model'>\n <div class='vgip-meta-field-label'>{{meta.label || meta.name}}</div>\n <div class='vgip-meta-field-value __gu'>{{model}}</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), 'multiple': multiple, 'has-value': f.value, active: keyListenerActive }\">\n <div *ngIf='multiple' class='items-container'>\n <div *ngIf='model' class='badges-container keep-focus' (click)='focus()'>\n <div *ngFor='let item of model' class=\"Vlt-badge Vlt-badge--app Vlt-badge--large keep-focus\">\n {{item}}\n <button class=\"Vlt-badge__dismiss keep-focus\" (click)='remove($event, item)'></button>\n </div>\n </div>\n </div>\n <div class=\"Vlt-input Vlt-dropdown\" style='display: block;'>\n <label class='wrapper'>\n <input class='main model' [pattern]=\"validations.pattern ? validations.pattern.value || validations.pattern : null\" [required]='validations.required' [minlength]='validations.minlength' [maxlength]='validations.maxlength' [min]='validations.min' [max]='validations.max' [step]='validations.step' [disabled]='disabled' [readonly]=\"readonly\" [(ngModel)]='model' (ngModelChange)=\"onModelChange($event)\" #f='ngModel' [name]='name' [type]=\"multiple ? 'hidden' : (meta.subtype || 'text')\" placeholder=\" \" (click)='onActivated($event)' (focus)='onActivated($event)' (blur)='onBlur($event)'/>\n <input *ngIf='multiple' class='main' [pattern]=\"validations.pattern ? validations.pattern.value || validations.pattern : null\" [minlength]='validations.minlength' [maxlength]='validations.maxlength' [min]='validations.min' [max]='validations.max' [(ngModel)]='addText' [ngModelOptions]=\"{ standalone: true }\" [type]=\"meta.subtype || 'text'\" [disabled]='disabled' [readonly]='readonly' placeholder=\"+Add\" (keydown.enter)='onAdd($event)' (click)='onActivated($event)' (focus)='onActivated($event)' (blur)='onBlur($event)'/>\n <label class='Vlt-truncate'>{{meta.label || meta.name}}<span *ngIf='validations.required' class='Vlt-red'>*</span> <span class='Vlt-black' *ngIf='model && multiple'>({{model.length}})</span></label>\n </label>\n <div class='Vlt-composite__append right-actions'>\n <div *ngIf='model && showClear' class=\"Vlt-composite__append--icon\" (click)='clear($event)'>\n <div class=\"Vlt-composite__icon\">\n <svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-cross\"/></svg>\n </div>\n </div>\n </div>\n <!-- <div *ngIf=\"!meta.subtype || meta.subtype == 'text'\" class=\"Vlt-composite__append Vlt-composite__append--icon\" style='bottom: 7px; right: 10px; padding: 3px; width: initial; height: initial; cursor: pointer;'>\n <div *ngIf=\"!meta.type || meta.type === 'string'\" class=\"Vlt-composite__icon\" (click)='textToSpeech()'>\n <svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-microphone\"/></svg>\n </div>\n </div> -->\n <div *ngIf=\"suggestions.length\" class=\"Vlt-dropdown__panel\">\n <div class=\"Vlt-dropdown__panel__content Vlt-dropdown__panel__content--scroll-area suggestions\">\n <!-- <div class=\"Vlt-dropdown__title\" style='padding-left: 13px;'>\n Suggestions\n <div class=\"Vlt-dropdown__close Vlt-white\" (click)='dismissDropdown($event)'>\n <svg class='Vlt-icon Vlt-icon--small'><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-cross\"/></svg>\n </div>\n </div> -->\n <div class=\"Vlt-dropdown__block\"></div>\n <div *ngIf='dropdown' class=\"Vlt-dropdown__scroll\">\n <div [ngClass]=\"{ 'Vlt-dropdown__link--selected': (activeSuggestionIndex === i) }\" (click)='onSuggestionSelect($event, suggestion)' *ngFor='let suggestion of suggestions; let i = index' class=\"Vlt-dropdown__link\" style='padding: 0;'>\n <div *ngIf='multiple' class=\"Vlt-checkbox\" style='width: 100%;'>\n <label [title]='suggestion.label || suggestion'>\n <span class=\"Vlt-checkbox__button\">\n <input type=\"checkbox\" [checked]='model && model.indexOf(suggestion) !== -1'/>\n <span class=\"Vlt-checkbox__icon\"></span>\n </span>\n {{suggestion.label || suggestion}}\n </label>\n </div>\n <div *ngIf='!multiple' style='padding: 12px 20px;'>\n {{suggestion.label || suggestion}}\n </div>\n </div>\n </div>\n <div *ngIf='!multiple' class=\"Vlt-dropdown__block\"></div>\n <div *ngIf='multiple' class=\"Vlt-dropdown__block Vlt-dropdown__block--nowrap\" style='padding: 8px 16px 16px;'>\n <button (click)='clear($event)' type='button' class=\"Vlt-btn Vlt-btn--secondary Vlt-btn--app Vlt-btn--small Vlt-btn--outline\">Clear all</button>\n <button (click)='dismissDropdown($event)' type='button' class=\"Vlt-btn Vlt-btn--secondary Vlt-btn--app Vlt-btn--small\">Done</button>\n </div>\n </div>\n </div>\n </div>\n <small *ngIf='f.invalid && ((f | metaModel)._parent.submitted || ((f | metaModel ).touched && keyListenerActive))' class=\"Vlt-form__element__error\">\n <span *ngIf=\"f.errors.required\">Required. </span>\n <span *ngIf=\"f.errors.minlength\">Must be longer than {{validations.minlength}} characters. </span>\n <span *ngIf=\"f.errors.maxlength\">Must be lest than {{validations.maxlength}} characters. </span>\n <span *ngIf=\"f.errors.pattern\">{{ validations.pattern.text || \"Should match '\"+validations.pattern+\"' pattern.\" }}. </span>\n <span *ngIf=\"f.errors.custom\">{{f.errors.custom}} </span>\n </small>\n <small *ngIf='meta.hint' class=\"Vlt-form__element__hint\">{{meta.hint}}</small>\n</div>\n", styles: [".Vlt-form__element--big .Vlt-input input{padding-right:40px;text-overflow:ellipsis}@media screen and (-webkit-min-device-pixel-ratio: 0){.Vlt-form__element--big .Vlt-input input{line-height:20px}}.Vlt-form__element--big .Vlt-input input:disabled{cursor:not-allowed}.Vlt-form__element--big:hover .items-container,.Vlt-form__element--big:hover .main,.Vlt-form__element--big:hover input,.Vlt-form__element--big.active .items-container,.Vlt-form__element--big.active .main,.Vlt-form__element--big.active input{border-color:var(--vgip-meta-input-active-border-color)}.Vlt-form__element--big.multiple .Vlt-composite.Vlt-dropdown{margin-top:3px}.Vlt-form__element--big.multiple:hover:not(.Vlt-form__element--error) .items-container,.Vlt-form__element--big.multiple:hover:not(.Vlt-form__element--error) .main,.Vlt-form__element--big.multiple:hover:not(.Vlt-form__element--error) input,.Vlt-form__element--big.multiple.active:not(.Vlt-form__element--error) .items-container,.Vlt-form__element--big.multiple.active:not(.Vlt-form__element--error) .main,.Vlt-form__element--big.multiple.active:not(.Vlt-form__element--error) input{border-color:var(--vgip-meta-input-active-border-color)}.Vlt-form__element--big.multiple .items-container{background-color:var(--vgip-meta-input-bg-color);border:1px solid var(--vgip-meta-input-border-color);border-bottom:0;border-top-left-radius:6px;border-top-right-radius:6px}.Vlt-form__element--big.multiple .items-container.creatable{margin-right:62px}.Vlt-form__element--big.multiple .items-container .badges-container{overflow:auto;max-height:140px;padding:6px 4px 0 6px}.Vlt-form__element--big.multiple .items-container .badges-container .Vlt-badge{margin-bottom:3px;margin-left:0;margin-right:3px;overflow:hidden;max-width:100%}.Vlt-form__element--big.multiple:not(.has-value) .items-container{border:0}.Vlt-form__element--big.multiple.has-value .main,.Vlt-form__element--big.multiple.has-value input{border-top:0;border-top-left-radius:0;border-top-right-radius:0;box-shadow:none}.Vlt-form__element--big.Vlt-form__element--error .items-container,.Vlt-form__element--big.Vlt-form__element--error .main,.Vlt-form__element--big.Vlt-form__element--error input{border-color:#f25a6b;background:var(--vgip-meta-input-bg-color)}label.Vlt-truncate{padding-right:42px}.Vlt-dropdown__panel{width:100%}.Vlt-dropdown__panel .Vlt-dropdown__link--selected{background:rgba(44,45,48,.05)}.Vlt-dropdown__panel label{margin-top:0;padding:12px 20px;top:0;left:0;pointer-events:initial;position:initial;color:initial;font-size:inherit;transition:none;cursor:pointer}.Vlt-dropdown__panel label input{height:0}.Vlt-composite__append.right-actions{position:absolute;top:5px;right:10px;cursor:pointer}.Vlt-composite__append.right-actions .Vlt-composite__append--icon{width:36px;outline:none;position:initial;display:inline-block}.Vlt-composite__append.right-actions .Vlt-composite__append--icon svg{height:14px;width:14px}.Vlt-composite__append.right-actions .Vlt-composite__append--icon:hover svg,.Vlt-composite__append.right-actions .Vlt-composite__append--icon:focus svg{fill:var(--vgip-meta-input-accent-color)}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { 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 }] });
|
|
454
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: FieldInput, decorators: [{
|
|
455
|
+
type: Component,
|
|
456
|
+
args: [{ viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], template: "<div class='vgip-meta-field-preview' *ngIf='preview && model'>\n <div class='vgip-meta-field-label'>{{meta.label || meta.name}}</div>\n <div class='vgip-meta-field-value __gu'>{{model}}</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), 'multiple': multiple, 'has-value': f.value, active: keyListenerActive }\">\n <div *ngIf='multiple' class='items-container'>\n <div *ngIf='model' class='badges-container keep-focus' (click)='focus()'>\n <div *ngFor='let item of model' class=\"Vlt-badge Vlt-badge--app Vlt-badge--large keep-focus\">\n {{item}}\n <button class=\"Vlt-badge__dismiss keep-focus\" (click)='remove($event, item)'></button>\n </div>\n </div>\n </div>\n <div class=\"Vlt-input Vlt-dropdown\" style='display: block;'>\n <label class='wrapper'>\n <input class='main model' [pattern]=\"validations.pattern ? validations.pattern.value || validations.pattern : null\" [required]='validations.required' [minlength]='validations.minlength' [maxlength]='validations.maxlength' [min]='validations.min' [max]='validations.max' [step]='validations.step' [disabled]='disabled' [readonly]=\"readonly\" [(ngModel)]='model' (ngModelChange)=\"onModelChange($event)\" #f='ngModel' [name]='name' [type]=\"multiple ? 'hidden' : (meta.subtype || 'text')\" placeholder=\" \" (click)='onActivated($event)' (focus)='onActivated($event)' (blur)='onBlur($event)'/>\n <input *ngIf='multiple' class='main' [pattern]=\"validations.pattern ? validations.pattern.value || validations.pattern : null\" [minlength]='validations.minlength' [maxlength]='validations.maxlength' [min]='validations.min' [max]='validations.max' [(ngModel)]='addText' [ngModelOptions]=\"{ standalone: true }\" [type]=\"meta.subtype || 'text'\" [disabled]='disabled' [readonly]='readonly' placeholder=\"+Add\" (keydown.enter)='onAdd($event)' (click)='onActivated($event)' (focus)='onActivated($event)' (blur)='onBlur($event)'/>\n <label class='Vlt-truncate'>{{meta.label || meta.name}}<span *ngIf='validations.required' class='Vlt-red'>*</span> <span class='Vlt-black' *ngIf='model && multiple'>({{model.length}})</span></label>\n </label>\n <div class='Vlt-composite__append right-actions'>\n <div *ngIf='model && showClear' class=\"Vlt-composite__append--icon\" (click)='clear($event)'>\n <div class=\"Vlt-composite__icon\">\n <svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-cross\"/></svg>\n </div>\n </div>\n </div>\n <!-- <div *ngIf=\"!meta.subtype || meta.subtype == 'text'\" class=\"Vlt-composite__append Vlt-composite__append--icon\" style='bottom: 7px; right: 10px; padding: 3px; width: initial; height: initial; cursor: pointer;'>\n <div *ngIf=\"!meta.type || meta.type === 'string'\" class=\"Vlt-composite__icon\" (click)='textToSpeech()'>\n <svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-microphone\"/></svg>\n </div>\n </div> -->\n <div *ngIf=\"suggestions.length\" class=\"Vlt-dropdown__panel\">\n <div class=\"Vlt-dropdown__panel__content Vlt-dropdown__panel__content--scroll-area suggestions\">\n <!-- <div class=\"Vlt-dropdown__title\" style='padding-left: 13px;'>\n Suggestions\n <div class=\"Vlt-dropdown__close Vlt-white\" (click)='dismissDropdown($event)'>\n <svg class='Vlt-icon Vlt-icon--small'><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-cross\"/></svg>\n </div>\n </div> -->\n <div class=\"Vlt-dropdown__block\"></div>\n <div *ngIf='dropdown' class=\"Vlt-dropdown__scroll\">\n <div [ngClass]=\"{ 'Vlt-dropdown__link--selected': (activeSuggestionIndex === i) }\" (click)='onSuggestionSelect($event, suggestion)' *ngFor='let suggestion of suggestions; let i = index' class=\"Vlt-dropdown__link\" style='padding: 0;'>\n <div *ngIf='multiple' class=\"Vlt-checkbox\" style='width: 100%;'>\n <label [title]='suggestion.label || suggestion'>\n <span class=\"Vlt-checkbox__button\">\n <input type=\"checkbox\" [checked]='model && model.indexOf(suggestion) !== -1'/>\n <span class=\"Vlt-checkbox__icon\"></span>\n </span>\n {{suggestion.label || suggestion}}\n </label>\n </div>\n <div *ngIf='!multiple' style='padding: 12px 20px;'>\n {{suggestion.label || suggestion}}\n </div>\n </div>\n </div>\n <div *ngIf='!multiple' class=\"Vlt-dropdown__block\"></div>\n <div *ngIf='multiple' class=\"Vlt-dropdown__block Vlt-dropdown__block--nowrap\" style='padding: 8px 16px 16px;'>\n <button (click)='clear($event)' type='button' class=\"Vlt-btn Vlt-btn--secondary Vlt-btn--app Vlt-btn--small Vlt-btn--outline\">Clear all</button>\n <button (click)='dismissDropdown($event)' type='button' class=\"Vlt-btn Vlt-btn--secondary Vlt-btn--app Vlt-btn--small\">Done</button>\n </div>\n </div>\n </div>\n </div>\n <small *ngIf='f.invalid && ((f | metaModel)._parent.submitted || ((f | metaModel ).touched && keyListenerActive))' class=\"Vlt-form__element__error\">\n <span *ngIf=\"f.errors.required\">Required. </span>\n <span *ngIf=\"f.errors.minlength\">Must be longer than {{validations.minlength}} characters. </span>\n <span *ngIf=\"f.errors.maxlength\">Must be lest than {{validations.maxlength}} characters. </span>\n <span *ngIf=\"f.errors.pattern\">{{ validations.pattern.text || \"Should match '\"+validations.pattern+\"' pattern.\" }}. </span>\n <span *ngIf=\"f.errors.custom\">{{f.errors.custom}} </span>\n </small>\n <small *ngIf='meta.hint' class=\"Vlt-form__element__hint\">{{meta.hint}}</small>\n</div>\n", styles: [".Vlt-form__element--big .Vlt-input input{padding-right:40px;text-overflow:ellipsis}@media screen and (-webkit-min-device-pixel-ratio: 0){.Vlt-form__element--big .Vlt-input input{line-height:20px}}.Vlt-form__element--big .Vlt-input input:disabled{cursor:not-allowed}.Vlt-form__element--big:hover .items-container,.Vlt-form__element--big:hover .main,.Vlt-form__element--big:hover input,.Vlt-form__element--big.active .items-container,.Vlt-form__element--big.active .main,.Vlt-form__element--big.active input{border-color:var(--vgip-meta-input-active-border-color)}.Vlt-form__element--big.multiple .Vlt-composite.Vlt-dropdown{margin-top:3px}.Vlt-form__element--big.multiple:hover:not(.Vlt-form__element--error) .items-container,.Vlt-form__element--big.multiple:hover:not(.Vlt-form__element--error) .main,.Vlt-form__element--big.multiple:hover:not(.Vlt-form__element--error) input,.Vlt-form__element--big.multiple.active:not(.Vlt-form__element--error) .items-container,.Vlt-form__element--big.multiple.active:not(.Vlt-form__element--error) .main,.Vlt-form__element--big.multiple.active:not(.Vlt-form__element--error) input{border-color:var(--vgip-meta-input-active-border-color)}.Vlt-form__element--big.multiple .items-container{background-color:var(--vgip-meta-input-bg-color);border:1px solid var(--vgip-meta-input-border-color);border-bottom:0;border-top-left-radius:6px;border-top-right-radius:6px}.Vlt-form__element--big.multiple .items-container.creatable{margin-right:62px}.Vlt-form__element--big.multiple .items-container .badges-container{overflow:auto;max-height:140px;padding:6px 4px 0 6px}.Vlt-form__element--big.multiple .items-container .badges-container .Vlt-badge{margin-bottom:3px;margin-left:0;margin-right:3px;overflow:hidden;max-width:100%}.Vlt-form__element--big.multiple:not(.has-value) .items-container{border:0}.Vlt-form__element--big.multiple.has-value .main,.Vlt-form__element--big.multiple.has-value input{border-top:0;border-top-left-radius:0;border-top-right-radius:0;box-shadow:none}.Vlt-form__element--big.Vlt-form__element--error .items-container,.Vlt-form__element--big.Vlt-form__element--error .main,.Vlt-form__element--big.Vlt-form__element--error input{border-color:#f25a6b;background:var(--vgip-meta-input-bg-color)}label.Vlt-truncate{padding-right:42px}.Vlt-dropdown__panel{width:100%}.Vlt-dropdown__panel .Vlt-dropdown__link--selected{background:rgba(44,45,48,.05)}.Vlt-dropdown__panel label{margin-top:0;padding:12px 20px;top:0;left:0;pointer-events:initial;position:initial;color:initial;font-size:inherit;transition:none;cursor:pointer}.Vlt-dropdown__panel label input{height:0}.Vlt-composite__append.right-actions{position:absolute;top:5px;right:10px;cursor:pointer}.Vlt-composite__append.right-actions .Vlt-composite__append--icon{width:36px;outline:none;position:initial;display:inline-block}.Vlt-composite__append.right-actions .Vlt-composite__append--icon svg{height:14px;width:14px}.Vlt-composite__append.right-actions .Vlt-composite__append--icon:hover svg,.Vlt-composite__append.right-actions .Vlt-composite__append--icon:focus svg{fill:var(--vgip-meta-input-accent-color)}\n"] }]
|
|
457
|
+
}], ctorParameters: function () { return [{ type: MetaContextService }]; } });
|
|
458
|
+
|
|
459
|
+
export { FieldInput };
|
|
460
|
+
//# sourceMappingURL=vgip-meta-ui-index-fa0b1b8b.mjs.map
|