@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
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../.eslintrc.json",
|
|
3
|
+
"ignorePatterns": [
|
|
4
|
+
"!**/*"
|
|
5
|
+
],
|
|
6
|
+
"overrides": [
|
|
7
|
+
{
|
|
8
|
+
"files": [
|
|
9
|
+
"*.ts"
|
|
10
|
+
],
|
|
11
|
+
"parserOptions": {
|
|
12
|
+
"project": [
|
|
13
|
+
"projects/meta-ui/tsconfig.lib.json",
|
|
14
|
+
"projects/meta-ui/tsconfig.spec.json"
|
|
15
|
+
],
|
|
16
|
+
"createDefaultProgram": true
|
|
17
|
+
},
|
|
18
|
+
"rules": {
|
|
19
|
+
"@angular-eslint/component-class-suffix": "off",
|
|
20
|
+
"@angular-eslint/component-selector": [
|
|
21
|
+
"error",
|
|
22
|
+
{
|
|
23
|
+
"type": "element",
|
|
24
|
+
"prefix": "vgip",
|
|
25
|
+
"style": "kebab-case"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"@angular-eslint/directive-selector": [
|
|
29
|
+
"error",
|
|
30
|
+
{
|
|
31
|
+
"type": "attribute",
|
|
32
|
+
"prefix": "meta",
|
|
33
|
+
"style": "camelCase"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"@typescript-eslint/explicit-member-accessibility": [
|
|
37
|
+
"off",
|
|
38
|
+
{
|
|
39
|
+
"accessibility": "explicit"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"arrow-parens": [
|
|
43
|
+
"off",
|
|
44
|
+
"always"
|
|
45
|
+
],
|
|
46
|
+
"import/order": "off",
|
|
47
|
+
"no-trailing-spaces": "off"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"files": [
|
|
52
|
+
"*.html"
|
|
53
|
+
],
|
|
54
|
+
"rules": {}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
package/karma.conf.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Karma configuration file, see link for more information
|
|
2
|
+
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
+
|
|
4
|
+
module.exports = function (config) {
|
|
5
|
+
config.set({
|
|
6
|
+
basePath: '',
|
|
7
|
+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
+
plugins: [
|
|
9
|
+
require('karma-jasmine'),
|
|
10
|
+
require('karma-chrome-launcher'),
|
|
11
|
+
require('karma-jasmine-html-reporter'),
|
|
12
|
+
require('karma-coverage'),
|
|
13
|
+
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
+
],
|
|
15
|
+
client: {
|
|
16
|
+
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
17
|
+
},
|
|
18
|
+
coverageReporter: {
|
|
19
|
+
dir : require('path').join(__dirname, '../../coverage/meta-ui'),
|
|
20
|
+
reporters: [
|
|
21
|
+
{ type: 'html', subdir: 'report-html' },
|
|
22
|
+
{ type: 'lcov', subdir: 'report-lcov' },
|
|
23
|
+
{ type: 'text-summary', subdir: '.', file: 'text-summary.txt' },
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
reporters: ['progress', 'kjhtml', 'coverage'],
|
|
27
|
+
port: 9876,
|
|
28
|
+
colors: true,
|
|
29
|
+
logLevel: config.LOG_INFO,
|
|
30
|
+
autoWatch: true,
|
|
31
|
+
browsers: ['Chrome'],
|
|
32
|
+
singleRun: false,
|
|
33
|
+
restartOnFileChange: true
|
|
34
|
+
});
|
|
35
|
+
};
|
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vgip/meta-ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "VGIP Meta UI",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@angular/common": "
|
|
6
|
+
"@angular/common": "^20.3.5",
|
|
7
7
|
"@angular/core": "^20.3.5",
|
|
8
8
|
"ngx-quill": "^28.0.1",
|
|
9
9
|
"quill": "^2.0.3"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"tslib": "^2.0.0"
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
"typings": "index.d.ts",
|
|
16
|
-
"exports": {
|
|
17
|
-
"./package.json": {
|
|
18
|
-
"default": "./package.json"
|
|
19
|
-
},
|
|
20
|
-
".": {
|
|
21
|
-
"types": "./index.d.ts",
|
|
22
|
-
"default": "./fesm2022/vgip-meta-ui.mjs"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"sideEffects": false
|
|
26
|
-
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: Alexander.Vangelov@vonage.com
|
|
3
|
+
* @Date: 2019-09-19 17:34:34
|
|
4
|
+
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
5
|
+
* @Last Modified time: 2021-03-22 17:13:53
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { numberFieldNormalizer } from './number';
|
|
9
|
+
import { optionsFieldNormalizer } from './options';
|
|
10
|
+
import { stringFieldNormalizer } from './string';
|
|
11
|
+
import { booleanFieldNormalizer } from './boolean';
|
|
12
|
+
import { textFieldNormalizer } from './text';
|
|
13
|
+
import { datetimeFieldNormalizer } from './datetime';
|
|
14
|
+
import { referenceFieldNormalizer } from './reference';
|
|
15
|
+
import { radioFieldNormalizer } from './radio';
|
|
16
|
+
import { richtextFieldNormalizer } from './richtext';
|
|
17
|
+
|
|
18
|
+
import { uniqueNameFilter } from './uniqueNameFilter';
|
|
19
|
+
|
|
20
|
+
export const fieldNormalizer = (field: any, uniqFieldNames: Array<string>) => {
|
|
21
|
+
if (!field) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const f: any = {
|
|
25
|
+
validations: {}
|
|
26
|
+
};
|
|
27
|
+
const fieldType = (field.type || '').toLowerCase();
|
|
28
|
+
if (['int', 'integer', 'number', 'double', 'float', 'bigdecimal', 'percent', 'currency'].indexOf(fieldType) !== -1) {
|
|
29
|
+
Object.assign(f, numberFieldNormalizer(field));
|
|
30
|
+
} else if (['picklist', 'select', 'multipicklist', 'options'].indexOf(fieldType) !== -1) {
|
|
31
|
+
Object.assign(f, optionsFieldNormalizer(field));
|
|
32
|
+
} else if (['string', null, undefined, '', 'email', 'phone', 'url', 'combobox'].indexOf(fieldType) !== -1) {
|
|
33
|
+
Object.assign(f, stringFieldNormalizer(field));
|
|
34
|
+
} else if (['bool', 'boolean', 'checkbox', 'switch'].indexOf(fieldType) !== -1) {
|
|
35
|
+
Object.assign(f, booleanFieldNormalizer(field));
|
|
36
|
+
} else if (['text', 'textarea'].indexOf(fieldType) !== -1) {
|
|
37
|
+
Object.assign(f, textFieldNormalizer(field));
|
|
38
|
+
} else if (['richtext'].indexOf(fieldType) !== -1) {
|
|
39
|
+
Object.assign(f, richtextFieldNormalizer(field));
|
|
40
|
+
} else if (['date', 'time', 'datetime', 'datetime-local'].indexOf(fieldType) !== -1) {
|
|
41
|
+
Object.assign(f, datetimeFieldNormalizer(field));
|
|
42
|
+
} else if (['reference', 'references', 'multireference'].indexOf(fieldType) !== -1) {
|
|
43
|
+
Object.assign(f, referenceFieldNormalizer(field));
|
|
44
|
+
} else if (['radio'].indexOf(fieldType) !== -1) {
|
|
45
|
+
Object.assign(f, radioFieldNormalizer(field));
|
|
46
|
+
} else if (fieldType === 'composite') {
|
|
47
|
+
Object.assign(f, {
|
|
48
|
+
type: 'composite',
|
|
49
|
+
label: field.label,
|
|
50
|
+
name: field.name,
|
|
51
|
+
fields: uniqueNameFilter(
|
|
52
|
+
field.fields || field.reference || [],
|
|
53
|
+
uniqFieldNames,
|
|
54
|
+
(typeof(field.name) !== 'undefined')
|
|
55
|
+
).map((v) => fieldNormalizer(v, uniqFieldNames))
|
|
56
|
+
});
|
|
57
|
+
if (field.subtype) {
|
|
58
|
+
f.subtype = field.subtype;
|
|
59
|
+
}
|
|
60
|
+
} else if (fieldType === 'list') {
|
|
61
|
+
const list = field.list || field.reference;
|
|
62
|
+
Object.assign(f, {
|
|
63
|
+
type: field.name ? 'list' : 'missing name',
|
|
64
|
+
label: field.label,
|
|
65
|
+
name: field.name,
|
|
66
|
+
list: fieldNormalizer(uniqueNameFilter(list, uniqFieldNames), field.name ? [] : uniqFieldNames)
|
|
67
|
+
});
|
|
68
|
+
if (field.selectable) {
|
|
69
|
+
f.selectable = field.selectable;
|
|
70
|
+
}
|
|
71
|
+
if (field.resourceType) {
|
|
72
|
+
f.resourceType = field.resourceType;
|
|
73
|
+
}
|
|
74
|
+
} else if (fieldType === 'hidden') {
|
|
75
|
+
Object.assign(f, {
|
|
76
|
+
name: field.name,
|
|
77
|
+
type: 'hidden'
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
Object.assign(f, {
|
|
81
|
+
label: field.label,
|
|
82
|
+
name: field.name,
|
|
83
|
+
type: `@v2 ${fieldType}`
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (field.validations) {
|
|
87
|
+
Object.assign(f.validations, field.validations);
|
|
88
|
+
}
|
|
89
|
+
if (field.auto) {
|
|
90
|
+
f.auto = field.auto;
|
|
91
|
+
}
|
|
92
|
+
if ((field.default || field.defaultValue) && !f.default) {
|
|
93
|
+
const d = field.default || field.defaultValue;
|
|
94
|
+
if (Array.isArray(d)) {
|
|
95
|
+
f.default = [];
|
|
96
|
+
for (const v of d) {
|
|
97
|
+
if (typeof(v) === 'object' && v !== null) {
|
|
98
|
+
const o: any = {
|
|
99
|
+
id: v.id || v.value || v.name || v.label,
|
|
100
|
+
label: v.label || 'N/A'
|
|
101
|
+
};
|
|
102
|
+
if (v.type) {
|
|
103
|
+
o.type = v.type;
|
|
104
|
+
}
|
|
105
|
+
if (!v.type && f.reference && f.reference.name) { // Bullhorn CAND PT bad metadata
|
|
106
|
+
o.type = f.reference.name;
|
|
107
|
+
}
|
|
108
|
+
f.default.push(o);
|
|
109
|
+
} else {
|
|
110
|
+
f.default = v;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
} else if (typeof(d) === 'object' && d !== null) {
|
|
114
|
+
if (field.type === 'boolean' && typeof(d.value) === 'boolean') {
|
|
115
|
+
f.default = d.value;
|
|
116
|
+
} else if (Object.keys(d).length) {
|
|
117
|
+
const id = d.id || d.value || d.name || d.label;
|
|
118
|
+
if (id) {
|
|
119
|
+
f.default = {
|
|
120
|
+
id: d.id || d.value || d.name || d.label,
|
|
121
|
+
label: d.label || 'N/A'
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (d.type) {
|
|
125
|
+
f.default.type = d.type;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
f.default = d;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (field.visible || field.alwaysVisible) {
|
|
133
|
+
f.visible = field.visible || field.alwaysVisible;
|
|
134
|
+
}
|
|
135
|
+
if (field.hidden) {
|
|
136
|
+
f.hidden = field.hidden;
|
|
137
|
+
}
|
|
138
|
+
if (field.hint || field.helpText) {
|
|
139
|
+
f.hint = field.hint || field.helpText;
|
|
140
|
+
}
|
|
141
|
+
if (field.valueType) {
|
|
142
|
+
f.valueType = field.valueType;
|
|
143
|
+
}
|
|
144
|
+
if (field.multiple) {
|
|
145
|
+
f.multiple = field.multiple;
|
|
146
|
+
}
|
|
147
|
+
if (field.suggestions && field.suggestions.length) {
|
|
148
|
+
f.suggestions = field.suggestions;
|
|
149
|
+
}
|
|
150
|
+
if (field.updateable === false || field.updatable === false) {
|
|
151
|
+
if (!f.flags) {
|
|
152
|
+
f.flags = { updatable: false };
|
|
153
|
+
} else {
|
|
154
|
+
f.flags.updatable = false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (field.createable === false || field.creatable === false) {
|
|
158
|
+
if (!f.flags) {
|
|
159
|
+
f.flags = { creatable: false };
|
|
160
|
+
} else {
|
|
161
|
+
f.flags.creatable = false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (typeof(field.enabled) !== 'undefined') {
|
|
165
|
+
f.enabled = field.enabled;
|
|
166
|
+
}
|
|
167
|
+
if (typeof(field.disabled) !== 'undefined') {
|
|
168
|
+
f.disabled = field.disabled;
|
|
169
|
+
}
|
|
170
|
+
return f;
|
|
171
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const numberFieldNormalizer = (field) => {
|
|
2
|
+
const f: any = {
|
|
3
|
+
label: field.label,
|
|
4
|
+
name: field.name
|
|
5
|
+
};
|
|
6
|
+
f.type = field.name ? 'number' : 'missing name';
|
|
7
|
+
if (field.type === 'float' || field.subtype === 'float') {
|
|
8
|
+
f.validations = {
|
|
9
|
+
step: field.step || '0.01'
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return f;
|
|
13
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const optionsFieldNormalizer = (field) => {
|
|
2
|
+
const f: any = {
|
|
3
|
+
label: field.label,
|
|
4
|
+
name: field.name,
|
|
5
|
+
options: field.options || []
|
|
6
|
+
};
|
|
7
|
+
if (field.dependentPicklist && field.controllerName) {
|
|
8
|
+
const enabled = {};
|
|
9
|
+
enabled[field.controllerName] = true;
|
|
10
|
+
f.enabled = enabled;
|
|
11
|
+
}
|
|
12
|
+
if (field.picklist) {
|
|
13
|
+
for (const o of field.picklist) {
|
|
14
|
+
const opt: any = {
|
|
15
|
+
id: o.name || o.id,
|
|
16
|
+
label: o.label
|
|
17
|
+
};
|
|
18
|
+
if (field.for) {
|
|
19
|
+
opt.for = field.for;
|
|
20
|
+
}
|
|
21
|
+
if (o.validFor && field.controllerName) {
|
|
22
|
+
const validFor = {};
|
|
23
|
+
validFor[field.controllerName] = o.validFor;
|
|
24
|
+
opt.for = validFor;
|
|
25
|
+
}
|
|
26
|
+
f.options.push(opt);
|
|
27
|
+
if (o.defaultValue && !field.default) {
|
|
28
|
+
f.default = opt.id;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
f.type = field.name ? 'select' : 'missing name';
|
|
33
|
+
if (field.type === 'multipicklist') {
|
|
34
|
+
f.multiple = true;
|
|
35
|
+
}
|
|
36
|
+
if (field.reference) {
|
|
37
|
+
f.reference = field.reference;
|
|
38
|
+
}
|
|
39
|
+
if (field.searchUrl || field.searchParams) {
|
|
40
|
+
f.search = {
|
|
41
|
+
url: field.searchUrl,
|
|
42
|
+
params: field.searchParams
|
|
43
|
+
};
|
|
44
|
+
} else if (field.search) {
|
|
45
|
+
f.search = field.search;
|
|
46
|
+
}
|
|
47
|
+
return f;
|
|
48
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const radioFieldNormalizer = (field) => {
|
|
2
|
+
const f: any = {
|
|
3
|
+
label: field.label,
|
|
4
|
+
name: field.name,
|
|
5
|
+
options: field.options || []
|
|
6
|
+
};
|
|
7
|
+
f.type = field.name ? 'radio' : 'missing name';
|
|
8
|
+
if (field.picklist) {
|
|
9
|
+
for (const o of field.picklist) {
|
|
10
|
+
const opt: any = {
|
|
11
|
+
id: o.name || o.id,
|
|
12
|
+
label: o.label
|
|
13
|
+
};
|
|
14
|
+
if (field.for) {
|
|
15
|
+
opt.for = field.for;
|
|
16
|
+
}
|
|
17
|
+
if (o.validFor && field.controllerName) {
|
|
18
|
+
const validFor = {};
|
|
19
|
+
validFor[field.controllerName] = o.validFor;
|
|
20
|
+
opt.for = validFor;
|
|
21
|
+
}
|
|
22
|
+
f.options.push(opt);
|
|
23
|
+
if (o.defaultValue && !field.default) {
|
|
24
|
+
f.default = opt.id;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return f;
|
|
29
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const referenceFieldNormalizer = (field) => {
|
|
2
|
+
const f: any = {
|
|
3
|
+
type: field.name ? 'reference' : 'missing name',
|
|
4
|
+
label: field.label,
|
|
5
|
+
name: field.name
|
|
6
|
+
};
|
|
7
|
+
f.type = field.name ? 'reference' : 'missing name';
|
|
8
|
+
if (field.reference) {
|
|
9
|
+
if (field.reference instanceof Array && field.reference.length === 1) {
|
|
10
|
+
f.reference = field.reference[0];
|
|
11
|
+
} else {
|
|
12
|
+
f.reference = field.reference;
|
|
13
|
+
}
|
|
14
|
+
} else if (field.references) {
|
|
15
|
+
f.references = field.references;
|
|
16
|
+
}
|
|
17
|
+
if (field.acceptNew) {
|
|
18
|
+
f.acceptNew = field.acceptNew;
|
|
19
|
+
}
|
|
20
|
+
if (field.searchLabel) {
|
|
21
|
+
f.searchLabel = field.searchLabel;
|
|
22
|
+
}
|
|
23
|
+
if (field.searchUrl || field.searchParams) {
|
|
24
|
+
f.search = {
|
|
25
|
+
url: field.searchUrl,
|
|
26
|
+
params: field.searchParams
|
|
27
|
+
};
|
|
28
|
+
} else if (field.search) {
|
|
29
|
+
f.search = field.search;
|
|
30
|
+
}
|
|
31
|
+
return f;
|
|
32
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: Alexander.Vangelov@vonage.com
|
|
3
|
+
* @Date: 2019-09-19 17:34:34
|
|
4
|
+
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
5
|
+
* @Last Modified time: 2021-03-22 17:11:01
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const richtextFieldNormalizer = (field) => {
|
|
9
|
+
const f: any = {
|
|
10
|
+
label: field.label,
|
|
11
|
+
name: field.name
|
|
12
|
+
};
|
|
13
|
+
f.type = field.name ? 'richtext' : 'missing name';
|
|
14
|
+
return f;
|
|
15
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const stringFieldNormalizer = (field) => {
|
|
2
|
+
const f: any = {
|
|
3
|
+
label: field.label,
|
|
4
|
+
name: field.name
|
|
5
|
+
};
|
|
6
|
+
f.type = field.name ? 'string' : 'missing name';
|
|
7
|
+
if (field.subtype) {
|
|
8
|
+
f.subtype = field.subtype;
|
|
9
|
+
}
|
|
10
|
+
if (field.picklist || field.options) {
|
|
11
|
+
f.suggestions = (field.picklist || field.options || []).map((s) => {
|
|
12
|
+
if (s.defaultValue) {
|
|
13
|
+
f.default = s.label || s.name || s.id || s;
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
id: s.id,
|
|
17
|
+
label: s.label,
|
|
18
|
+
name: s.name
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return f;
|
|
23
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: Alexander.Vangelov@vonage.com
|
|
3
|
+
* @Date: 2021-03-22 17:09:52
|
|
4
|
+
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
5
|
+
* @Last Modified time: 2021-03-22 17:09:52
|
|
6
|
+
*/
|
|
7
|
+
export const textFieldNormalizer = (field) => {
|
|
8
|
+
const f: any = {
|
|
9
|
+
label: field.label,
|
|
10
|
+
name: field.name
|
|
11
|
+
};
|
|
12
|
+
f.type = field.name ? 'text' : 'missing name';
|
|
13
|
+
if (field.rows) {
|
|
14
|
+
f.rows = field.rows;
|
|
15
|
+
}
|
|
16
|
+
return f;
|
|
17
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: Alexander.Vangelov@vonage.com
|
|
3
|
+
* @Date: 2021-03-22 17:09:12
|
|
4
|
+
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
5
|
+
* @Last Modified time: 2021-03-22 17:09:12
|
|
6
|
+
*/
|
|
7
|
+
export const uniqueNameFilter = (fields: Array<any>, uniqFieldNames: Array<string>, allowDuplicates = false) => {
|
|
8
|
+
if (fields instanceof Array) {
|
|
9
|
+
return allowDuplicates ? fields : fields.filter((f) => {
|
|
10
|
+
if (f.name) {
|
|
11
|
+
if (uniqFieldNames.indexOf(f.name) !== -1) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
uniqFieldNames.push(f.name);
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
});
|
|
18
|
+
} else {
|
|
19
|
+
return fields;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: Alexander.Vangelov@vonage.com
|
|
3
|
+
* @Date: 2021-02-11 17:25:09
|
|
4
|
+
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
5
|
+
* @Last Modified time: 2021-02-11 17:33:57
|
|
6
|
+
*/
|
|
7
|
+
import { Directive, ElementRef, AfterContentInit, Input } from '@angular/core';
|
|
8
|
+
|
|
9
|
+
@Directive({
|
|
10
|
+
// eslint-disable-next-line
|
|
11
|
+
selector: '[vgipMetaFormAutofocus]',
|
|
12
|
+
standalone: false
|
|
13
|
+
})
|
|
14
|
+
export class MetaAutofocusDirective implements AfterContentInit {
|
|
15
|
+
@Input() vgipMetaFormAutofocus: boolean;
|
|
16
|
+
|
|
17
|
+
constructor(private elementRef: ElementRef) {}
|
|
18
|
+
|
|
19
|
+
ngAfterContentInit(): void {
|
|
20
|
+
if (this.vgipMetaFormAutofocus) {
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
const firstInput = this.elementRef.nativeElement.querySelector(
|
|
23
|
+
'.Vlt-form__element:not(.has-value) .main:not(.standalone):not([value])'
|
|
24
|
+
);
|
|
25
|
+
if (firstInput) {
|
|
26
|
+
firstInput.focus();
|
|
27
|
+
}
|
|
28
|
+
}, 300);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: Alexander.Vangelov@vonage.com
|
|
3
|
+
* @Date: 2020-05-03 21:09:03
|
|
4
|
+
* @Last Modified by: Alexander.Vangelov@vonage.com
|
|
5
|
+
* @Last Modified time: 2020-05-03 21:09:36
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Injectable } from '@angular/core';
|
|
9
|
+
import { ActivatedRouteSnapshot } from '@angular/router';
|
|
10
|
+
import { Observable, EMPTY } from 'rxjs';
|
|
11
|
+
|
|
12
|
+
import { MetaContextService } from '../services/metaContext';
|
|
13
|
+
|
|
14
|
+
@Injectable({
|
|
15
|
+
providedIn: 'root'
|
|
16
|
+
})
|
|
17
|
+
export class MetaContextResolver {
|
|
18
|
+
constructor(private metaContext: MetaContextService) {}
|
|
19
|
+
|
|
20
|
+
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
|
21
|
+
this.metaContext.phoneNumber = route.queryParamMap.get('phoneNumber');
|
|
22
|
+
this.metaContext.displayName = route.queryParamMap.get('displayName');
|
|
23
|
+
return EMPTY;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -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-05 13:46:14
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { MetaIconsPipe } from './metaIcons.pipe';
|
|
9
|
+
|
|
10
|
+
describe('VoltaIconsPipe', () => {
|
|
11
|
+
it('create an instance', () => {
|
|
12
|
+
const pipe = new MetaIconsPipe({ bypassSecurityTrustHtml: (v) => v } as any);
|
|
13
|
+
expect(pipe).toBeTruthy();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
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:46:18
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Pipe, PipeTransform } from '@angular/core';
|
|
9
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
10
|
+
|
|
11
|
+
@Pipe({
|
|
12
|
+
name: 'metaIcons',
|
|
13
|
+
standalone: false
|
|
14
|
+
})
|
|
15
|
+
export class MetaIconsPipe implements PipeTransform {
|
|
16
|
+
|
|
17
|
+
constructor(protected sanitizer: DomSanitizer) { }
|
|
18
|
+
|
|
19
|
+
transform(value: any): any {
|
|
20
|
+
if (typeof(value) === 'string') {
|
|
21
|
+
value = value.replace(
|
|
22
|
+
/\${\s*icon:([\w-]+)\s*}/g,
|
|
23
|
+
(match, val) => `<svg class='Vlt-icon'><use xlink:href="volta/volta-icons.svg#${val}"/></svg>`
|
|
24
|
+
);
|
|
25
|
+
return value; //this.sanitizer.bypassSecurityTrustHtml(value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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:46:26
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Pipe, PipeTransform } from '@angular/core';
|
|
9
|
+
|
|
10
|
+
@Pipe({
|
|
11
|
+
name: 'metaModel',
|
|
12
|
+
pure: true,
|
|
13
|
+
standalone: false
|
|
14
|
+
})
|
|
15
|
+
export class MetaModelPipe implements PipeTransform {
|
|
16
|
+
transform(value: any): any {
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
}
|