ec335931c61739298b6804c4b471ce5f9f428445
[sdc.git] /
1 <!--
2   ~ Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  * 
7  *      http://www.apache.org/licenses/LICENSE-2.0
8  * 
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  -->
15  
16  
17 <div *ngIf="!property.hidden" class="dynamic-property-row nested-level-{{nestedLevel}}" [@fadeIn]
18     [ngClass]="{'selected': selectedPropertyId && selectedPropertyId === property.propertiesName, 'readonly':  property.isDisabled ||property.isDeclared}"
19     [class.with-top-border]="property.isChildOfListOrMap"
20     (click)="onClickPropertyRow(property, $event)">
21     <!-- LEFT CELL -->
22     <ng-container *ngIf="!isPropertyFEModel">
23         <div class="table-cell" *ngIf="canBeDeclared" [ngClass]="{'filtered':property.name === propertyNameSearchText}" [class.round-checkbox]="property.isDeclared"> <!-- simple children of complex type [@checkEffect]="property.isDeclared"-->
24             <checkbox *ngIf="hasDeclareOption" [(checked)]="property.isSelected" [disabled]="property.isDisabled ||property.isDeclared || readonly" (checkedChange)="checkProperty.emit(property.propertiesName)" ></checkbox>
25             <div class="inner-cell-div" tooltip="{{property.name}}"><span>{{property.name}}</span></div>
26         </div>
27         <div class="table-cell" *ngIf="!canBeDeclared && !property.isChildOfListOrMap">{{property.name}}</div> <!-- simple children of complex type within map or list -->
28         <div class="table-cell map-entry" *ngIf="property.isChildOfListOrMap && propType == derivedPropertyTypes.MAP"><!-- map left cell -->
29             <!--<input [value]="property.mapKey" [placeholder]="property.name" (input)="mapKeyChanged.emit($event.target.value)" [readonly]="readonly" type="text" [ngClass]="{'disabled':readonly, 'error':property.mapKeyError}" required/>-->
30             <dynamic-element #mapKeyInput
31                 class="value-input"
32                 pattern="validationUtils.getValidationPattern(string)"
33                 [value]="property.mapKey"
34                 type="string"
35                 [name]="property.name"
36                 (elementChanged)="mapKeyChanged.emit($event.value)"
37                 [readonly]="readonly"
38                 [testId]="'prop-key-' + propertyTestsId"
39             ></dynamic-element>
40         </div>
41     </ng-container>
42     <!-- RIGHT CELL OR FULL WIDTH CELL-->
43     <ng-container *ngIf="propType == derivedPropertyTypes.SIMPLE || property.isDeclared || (property.isChildOfListOrMap && propType == derivedPropertyTypes.MAP && property.schema.property.isSimpleType)">
44         <div class="table-cell">
45             <dynamic-element class="value-input"
46                 pattern="validationUtils.getValidationPattern(property.type)"
47                 [value]="property.isDeclared ? property.value : property.valueObj"
48                 [type]="property.isDeclared ? 'string' : property.type"
49                 [name]="property.name"
50                 [path]="property.propertiesName"
51                 (elementChanged)="onElementChanged($event)"
52                 [readonly]="readonly || property.isDeclared || property.isDisabled"
53                 [testId]="'prop-' + propertyTestsId"
54             ></dynamic-element>
55         </div>
56     </ng-container>
57     <ng-container *ngIf="!isPropertyFEModel && propType != derivedPropertyTypes.SIMPLE && !property.isDeclared"> <!-- right cell for complex elements, or list complex -->
58         <div class="table-cell" *ngIf="propType == derivedPropertyTypes.COMPLEX">{{property.type | contentAfterLastDot }}</div>
59         <div class="table-cell" *ngIf="propType == derivedPropertyTypes.MAP && !property.schema.property.isSimpleType">{{property.schema.property.type | contentAfterLastDot }}</div>
60     </ng-container>
61     <ng-container *ngIf="isPropertyFEModel && (propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && !property.isDeclared"><!-- empty, full-width table cell - for PropertyFEModel of type list or map -->
62         <div class="table-cell empty"></div>
63     </ng-container>
64     <!-- ICONS: add, delete, and expand -->
65     <ng-container *ngIf="!property.isDeclared">
66             <a *ngIf="(propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && !property.isChildOfListOrMap" class="property-icon add-item" (click)="createNewChildProperty();" [ngClass]="{'disabled':readonly || preventInsertItem(property)}" [attr.data-tests-id]="'add-to-list-' + propertyTestsId">Add value to list</a>
67             <span *ngIf="property.isChildOfListOrMap" (click)="deleteItem.emit(property);" class="property-icon sprite-new delete-item-icon" [ngClass]="{'disabled':readonly}" [attr.data-tests-id]="'delete-from-list-' + propertyTestsId"></span>
68             <span *ngIf="!isPropertyFEModel && (propType == derivedPropertyTypes.COMPLEX || ((propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && hasChildren))" (click)="expandChildById(propPath)" class="property-icon sprite-new round-expand-icon" [class.open]="expandedChildId.indexOf(propPath) == 0" [attr.data-tests-id]="'expand-' + propertyTestsId"></span>
69     </ng-container>
70
71 </div>
72 <!-- FLAT CHILDREN -->
73 <div class="flat-children-container" *ngIf="isPropertyFEModel && !property.isDeclared">
74     <ng-container *ngFor="let prop of property.flattenedChildren | filterChildProperties: expandedChildId; trackBy:prop?.propertiesName">
75         <dynamic-property
76             [selectedPropertyId]="selectedPropertyId"
77             [hasDeclareOption]="hasDeclareOption"
78             [canBeDeclared]="hasDeclareOption && prop.canBeDeclared"
79             [property]="prop"
80             [rootProperty]="rootProperty || property"
81             [expandedChildId]="expandedChildId"
82             [propertyNameSearchText]="propertyNameSearchText"
83             [readonly]="readonly"
84             [hasChildren]="getHasChildren(prop)"
85             (propertyChanged)="childValueChanged(prop)"
86             (mapKeyChanged)="updateChildKeyInParent(prop, $event)"
87             (expandChild)="expandChildById($event)"
88             (deleteItem)="deleteListOrMapItem($event)"
89             (clickOnPropertyRow)="onClickPropertyRow($event)"
90             (checkProperty)="checkedChange($event)"
91             (addChildPropsToParent)="addChildProps($event, prop.propertiesName)"
92             >
93         </dynamic-property>
94     </ng-container>
95 </div>