@vgip/meta-ui 1.4.0 → 1.4.2
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/common/fieldNormalizer/index.mjs +7 -1
- package/esm2020/lib/common/metaNormalizer.mjs +45 -27
- package/esm2020/lib/common/utils/smartProp.mjs +17 -0
- package/esm2020/lib/field.mjs +5 -5
- package/esm2020/lib/fieldAbstract.mjs +51 -14
- package/esm2020/lib/fieldDatetime/index.mjs +20 -7
- package/fesm2015/vgip-meta-ui.mjs +139 -49
- package/fesm2015/vgip-meta-ui.mjs.map +1 -1
- package/fesm2020/vgip-meta-ui.mjs +139 -49
- package/fesm2020/vgip-meta-ui.mjs.map +1 -1
- package/lib/common/utils/smartProp.d.ts +1 -0
- package/package.json +1 -1
|
@@ -376,6 +376,9 @@ const fieldNormalizer = (field, uniqFieldNames) => {
|
|
|
376
376
|
if (field.selectable) {
|
|
377
377
|
f.selectable = field.selectable;
|
|
378
378
|
}
|
|
379
|
+
if (field.resourceType) {
|
|
380
|
+
f.resourceType = field.resourceType;
|
|
381
|
+
}
|
|
379
382
|
}
|
|
380
383
|
else {
|
|
381
384
|
f = {
|
|
@@ -437,6 +440,9 @@ const fieldNormalizer = (field, uniqFieldNames) => {
|
|
|
437
440
|
if (field.visible || field.alwaysVisible) {
|
|
438
441
|
f.visible = field.visible || field.alwaysVisible;
|
|
439
442
|
}
|
|
443
|
+
if (field.hidden) {
|
|
444
|
+
f.hidden = field.hidden;
|
|
445
|
+
}
|
|
440
446
|
if (field.hint || field.helpText) {
|
|
441
447
|
f.hint = field.hint || field.helpText;
|
|
442
448
|
}
|
|
@@ -522,6 +528,9 @@ const metaNormalizer = (meta, integration, resourceType) => {
|
|
|
522
528
|
if (meta.drafts) {
|
|
523
529
|
metaV3.drafts = meta.drafts;
|
|
524
530
|
}
|
|
531
|
+
if (meta.layout.children) {
|
|
532
|
+
metaV3.layout.children = meta.layout.children;
|
|
533
|
+
}
|
|
525
534
|
const fieldFixesByIntegration = (f) => {
|
|
526
535
|
if (f.type === 'boolean' && ((typeof (f.default) !== 'boolean') && f.default && !f.default.value)) {
|
|
527
536
|
delete f.default;
|
|
@@ -694,25 +703,29 @@ const metaNormalizer = (meta, integration, resourceType) => {
|
|
|
694
703
|
if (integrationCode === 'GOOGLE') {
|
|
695
704
|
if (resourceType === 'Mail') {
|
|
696
705
|
metaV3.layout.editable = false;
|
|
697
|
-
metaV3.layout.children
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
+
if (!metaV3.layout.children) {
|
|
707
|
+
metaV3.layout.children = [{
|
|
708
|
+
label: 'Comments',
|
|
709
|
+
name: 'comments',
|
|
710
|
+
reference: {
|
|
711
|
+
resourceType: 'Comment',
|
|
712
|
+
label: 'Comment',
|
|
713
|
+
editable: false
|
|
714
|
+
}
|
|
715
|
+
}];
|
|
716
|
+
}
|
|
706
717
|
}
|
|
707
718
|
else if (resourceType === 'Task') {
|
|
708
|
-
metaV3.layout.children
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
719
|
+
if (!metaV3.layout.children) {
|
|
720
|
+
metaV3.layout.children = [{
|
|
721
|
+
label: 'Subtasks',
|
|
722
|
+
name: 'subTasks',
|
|
723
|
+
reference: {
|
|
724
|
+
resourceType: 'Subtask',
|
|
725
|
+
label: 'Subtask'
|
|
726
|
+
}
|
|
727
|
+
}];
|
|
728
|
+
}
|
|
716
729
|
}
|
|
717
730
|
else if (resourceType === 'Comment') {
|
|
718
731
|
metaV3.layout.editable = false;
|
|
@@ -720,15 +733,17 @@ const metaNormalizer = (meta, integration, resourceType) => {
|
|
|
720
733
|
}
|
|
721
734
|
else if (integrationCode === 'ZENDESK') {
|
|
722
735
|
if (resourceType === 'Ticket') {
|
|
723
|
-
metaV3.layout.children
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
736
|
+
if (!metaV3.layout.children) {
|
|
737
|
+
metaV3.layout.children = [{
|
|
738
|
+
label: 'Comments',
|
|
739
|
+
name: 'comments',
|
|
740
|
+
reference: {
|
|
741
|
+
resourceType: 'Comment',
|
|
742
|
+
label: 'Comment',
|
|
743
|
+
editable: false
|
|
744
|
+
}
|
|
745
|
+
}];
|
|
746
|
+
}
|
|
732
747
|
}
|
|
733
748
|
else if (resourceType === 'Comment') {
|
|
734
749
|
metaV3.layout.editable = false;
|
|
@@ -778,6 +793,15 @@ const metaNormalizer = (meta, integration, resourceType) => {
|
|
|
778
793
|
metaV3.layout.editable = false;
|
|
779
794
|
}
|
|
780
795
|
}
|
|
796
|
+
else if (integrationCode === 'CLIO') {
|
|
797
|
+
if (resourceType === 'PhoneCommunication') {
|
|
798
|
+
for (const f of metaV3.layout.sections[0].fields) {
|
|
799
|
+
if (f.name === 'time_entries') {
|
|
800
|
+
f.hidden = 'update';
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
}
|
|
781
805
|
return sortObj(metaV3);
|
|
782
806
|
};
|
|
783
807
|
|
|
@@ -873,6 +897,23 @@ const templateBuilder = (metaContext, pattern) => {
|
|
|
873
897
|
return patternBuilder;
|
|
874
898
|
};
|
|
875
899
|
|
|
900
|
+
const extractValueBySmartProp = (rootObj, prop) => {
|
|
901
|
+
// { WhoId: { id: 1, type: 'Contact' } } // "WhoId.type" -> 'Contact'
|
|
902
|
+
if (rootObj.hasOwnProperty(prop)) {
|
|
903
|
+
return rootObj[prop];
|
|
904
|
+
}
|
|
905
|
+
else {
|
|
906
|
+
const parts = prop.split('.');
|
|
907
|
+
if (parts.length > 1) {
|
|
908
|
+
if (rootObj.hasOwnProperty(parts[0])) {
|
|
909
|
+
if (typeof (rootObj[parts[0]]) === 'object' && rootObj[parts[0]][parts[1]]) {
|
|
910
|
+
return extractValueBySmartProp(rootObj[parts[0]], prop.substring(parts[0].length + 1));
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
|
|
876
917
|
/*
|
|
877
918
|
* @Author: Alexander.Vangelov@vonage.com
|
|
878
919
|
* @Date: 2019-09-19 17:34:44
|
|
@@ -921,30 +962,60 @@ class FieldAbstract {
|
|
|
921
962
|
configurable: true,
|
|
922
963
|
enumerable: false
|
|
923
964
|
});
|
|
965
|
+
if (typeof (this.meta.hidden) !== 'undefined') {
|
|
966
|
+
if (typeof (this.meta.hidden) === 'object') {
|
|
967
|
+
const setHiddenByPropertyConfig = (par) => {
|
|
968
|
+
if (typeof (this.meta.hidden[par]) === 'boolean') { // any value makes me hidden
|
|
969
|
+
this.meta.$hidden = !!this.parent[par];
|
|
970
|
+
}
|
|
971
|
+
else {
|
|
972
|
+
const value = extractValueBySmartProp(this.parent, par);
|
|
973
|
+
const parValue = value ? (value.id || value.value || value) : value;
|
|
974
|
+
this.meta.$hidden = this.meta.hidden[par] === parValue;
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
for (const par of Object.keys(this.meta.hidden)) {
|
|
978
|
+
setHiddenByPropertyConfig(par);
|
|
979
|
+
this.parentChangeSubject.subscribe((value) => {
|
|
980
|
+
if (value && value.hasOwnProperty(par.split('.')[0])) {
|
|
981
|
+
setHiddenByPropertyConfig(par);
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
else if (this.meta.hidden === 'create') {
|
|
987
|
+
this.meta.$hidden = !this.isPersistedParent;
|
|
988
|
+
}
|
|
989
|
+
else if (this.meta.hidden === 'update') {
|
|
990
|
+
this.meta.$hidden = this.isPersistedParent;
|
|
991
|
+
}
|
|
992
|
+
else {
|
|
993
|
+
this.meta.$hidden = !!this.meta.hidden;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
924
996
|
Object.defineProperty(this.meta, '$invisible', {
|
|
925
997
|
value: false,
|
|
926
998
|
writable: true,
|
|
927
999
|
configurable: true,
|
|
928
1000
|
enumerable: false
|
|
929
1001
|
});
|
|
930
|
-
if (typeof (this.meta.visible) !== undefined) {
|
|
1002
|
+
if (typeof (this.meta.visible) !== 'undefined') {
|
|
931
1003
|
if (typeof (this.meta.visible) === 'object') {
|
|
932
|
-
|
|
933
|
-
if (typeof (this.meta.visible[par]) === 'boolean') { // any value makes me
|
|
1004
|
+
const setInvisibleByPropertyConfig = (par) => {
|
|
1005
|
+
if (typeof (this.meta.visible[par]) === 'boolean') { // any value makes me hidden
|
|
934
1006
|
this.meta.$invisible = !this.parent[par];
|
|
935
1007
|
}
|
|
936
|
-
else {
|
|
937
|
-
|
|
1008
|
+
else {
|
|
1009
|
+
const value = extractValueBySmartProp(this.parent, par);
|
|
1010
|
+
const parValue = value ? (value.id || value.value || value) : value;
|
|
1011
|
+
this.meta.$invisible = this.meta.visible[par] !== parValue;
|
|
938
1012
|
}
|
|
1013
|
+
};
|
|
1014
|
+
for (const par of Object.keys(this.meta.visible)) {
|
|
1015
|
+
setInvisibleByPropertyConfig(par);
|
|
939
1016
|
this.parentChangeSubject.subscribe((value) => {
|
|
940
|
-
if (value && value.hasOwnProperty(par)) {
|
|
941
|
-
|
|
942
|
-
if (typeof (this.meta.visible[par]) === 'boolean') { // any value makes me visible
|
|
943
|
-
this.meta.$invisible = !parValue;
|
|
944
|
-
}
|
|
945
|
-
else {
|
|
946
|
-
this.meta.$invisible = (parValue !== this.meta.visible[par]);
|
|
947
|
-
}
|
|
1017
|
+
if (value && value.hasOwnProperty(par.split('.')[0])) {
|
|
1018
|
+
setInvisibleByPropertyConfig(par);
|
|
948
1019
|
if (this.meta.$invisible) {
|
|
949
1020
|
delete this.parent[this.meta.name];
|
|
950
1021
|
}
|
|
@@ -952,6 +1023,12 @@ class FieldAbstract {
|
|
|
952
1023
|
});
|
|
953
1024
|
}
|
|
954
1025
|
}
|
|
1026
|
+
else if (this.meta.visible === 'create') {
|
|
1027
|
+
this.meta.$invisible = this.isPersistedParent;
|
|
1028
|
+
}
|
|
1029
|
+
else if (this.meta.visible === 'update') {
|
|
1030
|
+
this.meta.$invisible = !this.isPersistedParent;
|
|
1031
|
+
}
|
|
955
1032
|
}
|
|
956
1033
|
if (this.theme !== 'inherit') {
|
|
957
1034
|
const metaTheme = this.theme === 'dark' ? metaDark : metaLight;
|
|
@@ -2054,7 +2131,10 @@ class FieldDatetime extends FieldAbstract {
|
|
|
2054
2131
|
}
|
|
2055
2132
|
}
|
|
2056
2133
|
}
|
|
2057
|
-
if (this.meta.valueType === '
|
|
2134
|
+
if (this.meta.valueType === 'isostring') {
|
|
2135
|
+
this.value = date.toISOString();
|
|
2136
|
+
}
|
|
2137
|
+
else if (this.meta.valueType === 'string') {
|
|
2058
2138
|
if ((this.meta.type || this.meta.subtype) === 'date') {
|
|
2059
2139
|
this.value = date.toISOString().split('T')[0];
|
|
2060
2140
|
}
|
|
@@ -2095,11 +2175,21 @@ class FieldDatetime extends FieldAbstract {
|
|
|
2095
2175
|
date = new Date(Date.parse(new Date().toISOString().replace(/T.*Z/, `T${value}Z`)) + (new Date().getTimezoneOffset() * 60000));
|
|
2096
2176
|
}
|
|
2097
2177
|
this.model = date.toTimeString().split(' ')[0];
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2178
|
+
if (this.meta.valueType === 'isostring') {
|
|
2179
|
+
this.value = date.toISOString();
|
|
2180
|
+
}
|
|
2181
|
+
else {
|
|
2182
|
+
date.setFullYear(1970);
|
|
2183
|
+
date.setMonth(0);
|
|
2184
|
+
date.setDate(1);
|
|
2185
|
+
date.setMilliseconds(0);
|
|
2186
|
+
if (this.meta.valueType === 'string') {
|
|
2187
|
+
this.value = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().split('T')[1].substring(0, 8);
|
|
2188
|
+
}
|
|
2189
|
+
else {
|
|
2190
|
+
this.value = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).getTime();
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2103
2193
|
}
|
|
2104
2194
|
catch (e) {
|
|
2105
2195
|
console.error('Date parse error', e.message, `"${value}"`, `(${typeof (value)})`);
|
|
@@ -2879,10 +2969,10 @@ class FieldComposite extends FieldAbstract {
|
|
|
2879
2969
|
}
|
|
2880
2970
|
}
|
|
2881
2971
|
FieldComposite.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FieldComposite, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2882
|
-
FieldComposite.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: FieldComposite, selector: "ng-component", inputs: { meta: "meta" }, usesInheritance: true, ngImport: i0, template: "<div [ngClass]=\"{ 'Vlt-grid Vlt-grid--narrow': isRow }\" >\n <div style='margin: 0;' [ngClass]=\"{ 'Vlt-col': isRow, 'Vlt-col--1of3': isRow && fields.length > 3 }\" *ngFor='let field of fields'>\n <vgip-meta-field *ngIf='!meta.$invisible' class='shown' [index]='index' [meta]='field' [parent]='value' [integrationCode]='integrationCode' [preview]='preview' theme='inherit'></vgip-meta-field>\n </div>\n</div>\n", styles: ["div>vgip-meta-field{display:none}div>vgip-meta-field.shown{display:initial}\n"], components: [{ type: i0.forwardRef(function () { return MetaField; }), selector: "vgip-meta-field", inputs: ["meta", "parent", "integrationCode", "resourceType", "index", "preview", "theme"], outputs: ["onChange", "onLeave"] }], directives: [{ type: i0.forwardRef(function () { return i1.NgClass; }), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i0.forwardRef(function () { return i1.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i0.forwardRef(function () { return i1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
2972
|
+
FieldComposite.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: FieldComposite, selector: "ng-component", inputs: { meta: "meta" }, usesInheritance: true, ngImport: i0, template: "<div [ngClass]=\"{ 'Vlt-grid Vlt-grid--narrow': isRow }\" >\n <div style='margin: 0;' [ngClass]=\"{ 'Vlt-col': isRow, 'Vlt-col--1of3': isRow && fields.length > 3 }\" *ngFor='let field of fields'>\n <vgip-meta-field *ngIf='!meta.$invisible' class='shown' [index]='index' [meta]='field' [parent]='value' [integrationCode]='integrationCode' [resourceType]='resourceType' [preview]='preview' theme='inherit'></vgip-meta-field>\n </div>\n</div>\n", styles: ["div>vgip-meta-field{display:none}div>vgip-meta-field.shown{display:initial}\n"], components: [{ type: i0.forwardRef(function () { return MetaField; }), selector: "vgip-meta-field", inputs: ["meta", "parent", "integrationCode", "resourceType", "index", "preview", "theme"], outputs: ["onChange", "onLeave"] }], directives: [{ type: i0.forwardRef(function () { return i1.NgClass; }), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i0.forwardRef(function () { return i1.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i0.forwardRef(function () { return i1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
2883
2973
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FieldComposite, decorators: [{
|
|
2884
2974
|
type: Component,
|
|
2885
|
-
args: [{ template: "<div [ngClass]=\"{ 'Vlt-grid Vlt-grid--narrow': isRow }\" >\n <div style='margin: 0;' [ngClass]=\"{ 'Vlt-col': isRow, 'Vlt-col--1of3': isRow && fields.length > 3 }\" *ngFor='let field of fields'>\n <vgip-meta-field *ngIf='!meta.$invisible' class='shown' [index]='index' [meta]='field' [parent]='value' [integrationCode]='integrationCode' [preview]='preview' theme='inherit'></vgip-meta-field>\n </div>\n</div>\n", styles: ["div>vgip-meta-field{display:none}div>vgip-meta-field.shown{display:initial}\n"] }]
|
|
2975
|
+
args: [{ template: "<div [ngClass]=\"{ 'Vlt-grid Vlt-grid--narrow': isRow }\" >\n <div style='margin: 0;' [ngClass]=\"{ 'Vlt-col': isRow, 'Vlt-col--1of3': isRow && fields.length > 3 }\" *ngFor='let field of fields'>\n <vgip-meta-field *ngIf='!meta.$invisible' class='shown' [index]='index' [meta]='field' [parent]='value' [integrationCode]='integrationCode' [resourceType]='resourceType' [preview]='preview' theme='inherit'></vgip-meta-field>\n </div>\n</div>\n", styles: ["div>vgip-meta-field{display:none}div>vgip-meta-field.shown{display:initial}\n"] }]
|
|
2886
2976
|
}], propDecorators: { meta: [{
|
|
2887
2977
|
type: Input
|
|
2888
2978
|
}] } });
|
|
@@ -4168,10 +4258,10 @@ class FieldList extends FieldAbstract {
|
|
|
4168
4258
|
}
|
|
4169
4259
|
}
|
|
4170
4260
|
FieldList.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FieldList, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4171
|
-
FieldList.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: FieldList, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div *ngIf='true' class=\"Vlt-form__element\" [ngClass]=\"{ 'Vlt-form__element--error': (f | metaModel)._parent.submitted && f.invalid }\">\n <label class=\"Vlt-label\">{{meta.label || meta.name}} ({{(model || []).length}})<span *ngIf='validations.required' class='Vlt-red'>*</span></label>\n <small style='margin-bottom: 4px;' *ngIf='meta.hint' class=\"Vlt-form__element__hint\">{{meta.hint}}</small>\n <input class='model' type='hidden' [required]='validations.required' [(ngModel)]='model' #f='ngModel' [name]='name' />\n <ng-container *ngIf='model'>\n <div *ngFor='let item of model; let i = index;' style='display: flex; border-bottom: 1px solid var(--vgip-meta-separator-color);'>\n <vgip-meta-field style='flex: 1;' [index]='i' [meta]='list' [parent]='item' [integrationCode]='integrationCode' theme='inherit'></vgip-meta-field>\n <vgip-meta-field *ngIf='meta.selectable' [meta]=\"{ name: meta.selectable.name, label: ' ', type: 'radio', options: [ { id: meta.selectable.value, label: meta.selectable.label } ] }\" [parent]='item' [integrationCode]='integrationCode' theme='inherit' style='margin-left: 12px; margin-top: 12px; margin-right: -12px;'></vgip-meta-field>\n <div style='padding-left: 12px; margin-top: 3px;'>\n <button type='button' (click)='remove(i)' class=\"Vlt-btn Vlt-btn--link\" [disabled]='model.length === (validations.min || 0)'
|
|
4261
|
+
FieldList.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: FieldList, selector: "ng-component", usesInheritance: true, ngImport: i0, template: "<div *ngIf='true' class=\"Vlt-form__element\" [ngClass]=\"{ 'Vlt-form__element--error': (f | metaModel)._parent.submitted && f.invalid }\">\n <label class=\"Vlt-label\">{{meta.label || meta.name}} ({{(model || []).length}})<span *ngIf='validations.required' class='Vlt-red'>*</span></label>\n <small style='margin-bottom: 4px;' *ngIf='meta.hint' class=\"Vlt-form__element__hint\">{{meta.hint}}</small>\n <input class='model' type='hidden' [required]='validations.required' [(ngModel)]='model' #f='ngModel' [name]='name' />\n <ng-container *ngIf='model'>\n <div *ngFor='let item of model; let i = index;' style='display: flex; border-bottom: 1px solid var(--vgip-meta-separator-color);'>\n <vgip-meta-field style='flex: 1;' [index]='i' [meta]='list' [parent]='item' [integrationCode]='integrationCode' [resourceType]='meta.resourceType || resourceType' theme='inherit'></vgip-meta-field>\n <vgip-meta-field *ngIf='meta.selectable' [meta]=\"{ name: meta.selectable.name, label: ' ', type: 'radio', options: [ { id: meta.selectable.value, label: meta.selectable.label } ] }\" [parent]='item' [integrationCode]='integrationCode' theme='inherit' style='margin-left: 12px; margin-top: 12px; margin-right: -12px;'></vgip-meta-field>\n <div style='padding-left: 12px; margin-top: 3px;'>\n <button type='button' (click)='remove(i)' class=\"Vlt-btn Vlt-btn--link item-remove-button\" [disabled]='model.length === (validations.min || 0)' aria-label='Remove'>\n <svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-bin\"/></svg>\n </button>\n </div>\n </div>\n </ng-container>\n <button *ngIf='!validations.max || !model || model.length < validations.max' style='width: 100%;' type='button' (click)='add()' class=\"Vlt-btn Vlt-btn--small Vlt-btn--tertiary Vlt-btn--app Vlt-btn--no-focus item-add-button\" [disabled]='validations.max && model && model.length === validations.max'>\n <svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-plus\"/></svg>{{list.label}}\n </button>\n <small *ngIf='(f | metaModel)._parent.submitted && f.invalid' 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-btn--link:not([disabled]) svg{fill:#e84545}.Vlt-btn--link:not([disabled]):hover svg{fill:#de1c1c}.item-add-button{background-color:var(--vgip-meta-input-action-hover-bg-color);color:var(--vgip-meta-input-color)}.item-add-button svg{fill:var(--vgip-meta-input-color)}.item-add-button:hover{transform:scale(1.02);box-shadow:inset 0 0 0 1px var(--vgip-meta-input-active-border-color)}.item-remove-button{border:0}.item-remove-button:disabled{cursor:not-allowed}\n"], components: [{ type: i0.forwardRef(function () { return MetaField; }), selector: "vgip-meta-field", inputs: ["meta", "parent", "integrationCode", "resourceType", "index", "preview", "theme"], outputs: ["onChange", "onLeave"] }], directives: [{ type: i0.forwardRef(function () { return i1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i0.forwardRef(function () { return i1.NgClass; }), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i0.forwardRef(function () { return i4.DefaultValueAccessor; }), selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i0.forwardRef(function () { return i4.RequiredValidator; }), selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i0.forwardRef(function () { return i4.NgControlStatus; }), selector: "[formControlName],[ngModel],[formControl]" }, { type: i0.forwardRef(function () { return i4.NgModel; }), selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i0.forwardRef(function () { return i1.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "metaModel": i0.forwardRef(function () { return MetaModelPipe; }) }, viewProviders: [{ provide: ControlContainer, useExisting: NgForm }] });
|
|
4172
4262
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FieldList, decorators: [{
|
|
4173
4263
|
type: Component,
|
|
4174
|
-
args: [{ viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], template: "<div *ngIf='true' class=\"Vlt-form__element\" [ngClass]=\"{ 'Vlt-form__element--error': (f | metaModel)._parent.submitted && f.invalid }\">\n <label class=\"Vlt-label\">{{meta.label || meta.name}} ({{(model || []).length}})<span *ngIf='validations.required' class='Vlt-red'>*</span></label>\n <small style='margin-bottom: 4px;' *ngIf='meta.hint' class=\"Vlt-form__element__hint\">{{meta.hint}}</small>\n <input class='model' type='hidden' [required]='validations.required' [(ngModel)]='model' #f='ngModel' [name]='name' />\n <ng-container *ngIf='model'>\n <div *ngFor='let item of model; let i = index;' style='display: flex; border-bottom: 1px solid var(--vgip-meta-separator-color);'>\n <vgip-meta-field style='flex: 1;' [index]='i' [meta]='list' [parent]='item' [integrationCode]='integrationCode' theme='inherit'></vgip-meta-field>\n <vgip-meta-field *ngIf='meta.selectable' [meta]=\"{ name: meta.selectable.name, label: ' ', type: 'radio', options: [ { id: meta.selectable.value, label: meta.selectable.label } ] }\" [parent]='item' [integrationCode]='integrationCode' theme='inherit' style='margin-left: 12px; margin-top: 12px; margin-right: -12px;'></vgip-meta-field>\n <div style='padding-left: 12px; margin-top: 3px;'>\n <button type='button' (click)='remove(i)' class=\"Vlt-btn Vlt-btn--link\" [disabled]='model.length === (validations.min || 0)'
|
|
4264
|
+
args: [{ viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], template: "<div *ngIf='true' class=\"Vlt-form__element\" [ngClass]=\"{ 'Vlt-form__element--error': (f | metaModel)._parent.submitted && f.invalid }\">\n <label class=\"Vlt-label\">{{meta.label || meta.name}} ({{(model || []).length}})<span *ngIf='validations.required' class='Vlt-red'>*</span></label>\n <small style='margin-bottom: 4px;' *ngIf='meta.hint' class=\"Vlt-form__element__hint\">{{meta.hint}}</small>\n <input class='model' type='hidden' [required]='validations.required' [(ngModel)]='model' #f='ngModel' [name]='name' />\n <ng-container *ngIf='model'>\n <div *ngFor='let item of model; let i = index;' style='display: flex; border-bottom: 1px solid var(--vgip-meta-separator-color);'>\n <vgip-meta-field style='flex: 1;' [index]='i' [meta]='list' [parent]='item' [integrationCode]='integrationCode' [resourceType]='meta.resourceType || resourceType' theme='inherit'></vgip-meta-field>\n <vgip-meta-field *ngIf='meta.selectable' [meta]=\"{ name: meta.selectable.name, label: ' ', type: 'radio', options: [ { id: meta.selectable.value, label: meta.selectable.label } ] }\" [parent]='item' [integrationCode]='integrationCode' theme='inherit' style='margin-left: 12px; margin-top: 12px; margin-right: -12px;'></vgip-meta-field>\n <div style='padding-left: 12px; margin-top: 3px;'>\n <button type='button' (click)='remove(i)' class=\"Vlt-btn Vlt-btn--link item-remove-button\" [disabled]='model.length === (validations.min || 0)' aria-label='Remove'>\n <svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-bin\"/></svg>\n </button>\n </div>\n </div>\n </ng-container>\n <button *ngIf='!validations.max || !model || model.length < validations.max' style='width: 100%;' type='button' (click)='add()' class=\"Vlt-btn Vlt-btn--small Vlt-btn--tertiary Vlt-btn--app Vlt-btn--no-focus item-add-button\" [disabled]='validations.max && model && model.length === validations.max'>\n <svg><use xlink:href=\"volta/volta-icons.svg#Vlt-icon-plus\"/></svg>{{list.label}}\n </button>\n <small *ngIf='(f | metaModel)._parent.submitted && f.invalid' 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-btn--link:not([disabled]) svg{fill:#e84545}.Vlt-btn--link:not([disabled]):hover svg{fill:#de1c1c}.item-add-button{background-color:var(--vgip-meta-input-action-hover-bg-color);color:var(--vgip-meta-input-color)}.item-add-button svg{fill:var(--vgip-meta-input-color)}.item-add-button:hover{transform:scale(1.02);box-shadow:inset 0 0 0 1px var(--vgip-meta-input-active-border-color)}.item-remove-button{border:0}.item-remove-button:disabled{cursor:not-allowed}\n"] }]
|
|
4175
4265
|
}] });
|
|
4176
4266
|
//// LAYOUT
|
|
4177
4267
|
class MetaLayout {
|