re base code
[sdc.git] / catalog-ui / src / app / ng2 / components / logic / properties-table / dynamic-property / dynamic-property.component.html
1 <div *ngIf="!property.hidden" class="dynamic-property-row nested-level-{{nestedLevel}}" [@fadeIn]
2     [ngClass]="{'selected': selectedPropertyId && selectedPropertyId === property.propertiesName, 'readonly':  property.isDisabled ||property.isDeclared}"
3     [class.with-top-border]="property.isChildOfListOrMap"
4     (click)="onClickPropertyRow(property, $event)">
5     <!-- LEFT CELL -->
6     <ng-container *ngIf="!isPropertyFEModel">
7         <div class="table-cell" *ngIf="canBeDeclared" [ngClass]="{'filtered':property.name === propertyNameSearchText}" [class.round-checkbox]="property.isDeclared"> <!-- simple children of complex type [@checkEffect]="property.isDeclared"-->
8             <checkbox *ngIf="hasDeclareOption" [(checked)]="property.isSelected" [disabled]="property.isDisabled ||property.isDeclared || readonly" (checkedChange)="checkProperty.emit(property.propertiesName)" ></checkbox>
9             <div class="inner-cell-div" tooltip="{{property.name}}"><span>{{property.name}}</span></div>
10         </div>
11         <div class="table-cell" *ngIf="!canBeDeclared && !property.isChildOfListOrMap">{{property.name}}</div> <!-- simple children of complex type within map or list -->
12         <div class="table-cell map-entry" *ngIf="property.isChildOfListOrMap && propType == derivedPropertyTypes.MAP"><!-- map left cell -->
13             <!--<input [value]="property.mapKey" [placeholder]="property.name" (input)="mapKeyChanged.emit($event.target.value)" [readonly]="readonly" type="text" [ngClass]="{'disabled':readonly, 'error':property.mapKeyError}" required/>-->
14             <dynamic-element #mapKeyInput
15                 class="value-input"
16                 pattern="validationUtils.getValidationPattern(string)"
17                 [value]="property.mapKey"
18                 type="string"
19                 [name]="property.name"
20                 (elementChanged)="mapKeyChanged.emit($event.value)"
21                 [readonly]="readonly"
22                 [testId]="'prop-key-' + propertyTestsId"
23             ></dynamic-element>
24         </div>
25     </ng-container>
26     <!-- RIGHT CELL OR FULL WIDTH CELL-->
27     <ng-container *ngIf="propType == derivedPropertyTypes.SIMPLE || property.isDeclared || (property.isChildOfListOrMap && propType == derivedPropertyTypes.MAP && property.schema.property.isSimpleType)">
28         <div class="table-cell">
29             <dynamic-element class="value-input"
30                 pattern="validationUtils.getValidationPattern(property.type)"
31                 [value]="property.isDeclared ? property.value : property.valueObj"
32                 [type]="property.isDeclared ? 'string' : property.type"
33                 [name]="property.name"
34                 [path]="property.propertiesName"
35                 (elementChanged)="onElementChanged($event)"
36                 [readonly]="readonly || property.isDeclared || property.isDisabled"
37                 [testId]="'prop-' + propertyTestsId"
38             ></dynamic-element>
39         </div>
40     </ng-container>
41     <ng-container *ngIf="!isPropertyFEModel && propType != derivedPropertyTypes.SIMPLE && !property.isDeclared"> <!-- right cell for complex elements, or list complex -->
42         <div class="table-cell" *ngIf="propType == derivedPropertyTypes.COMPLEX">{{property.type | contentAfterLastDot }}</div>
43         <div class="table-cell" *ngIf="propType == derivedPropertyTypes.MAP && !property.schema.property.isSimpleType">{{property.schema.property.type | contentAfterLastDot }}</div>
44     </ng-container>
45     <ng-container *ngIf="isPropertyFEModel && (propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && !property.isDeclared"><!-- empty, full-width table cell - for PropertyFEModel of type list or map -->
46         <div class="table-cell empty"></div>
47     </ng-container>
48     <!-- ICONS: add, delete, and expand -->
49     <ng-container *ngIf="!property.isDeclared">
50             <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>
51             <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>
52             <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>
53     </ng-container>
54
55 </div>
56 <!-- FLAT CHILDREN -->
57 <div class="flat-children-container" *ngIf="isPropertyFEModel && !property.isDeclared">
58     <ng-container *ngFor="let prop of property.flattenedChildren | filterChildProperties: expandedChildId; trackBy:prop?.propertiesName">
59         <dynamic-property
60             [selectedPropertyId]="selectedPropertyId"
61             [hasDeclareOption]="hasDeclareOption"
62             [canBeDeclared]="hasDeclareOption && prop.canBeDeclared"
63             [property]="prop"
64             [rootProperty]="rootProperty || property"
65             [expandedChildId]="expandedChildId"
66             [propertyNameSearchText]="propertyNameSearchText"
67             [readonly]="readonly"
68             [hasChildren]="getHasChildren(prop)"
69             (propertyChanged)="childValueChanged(prop)"
70             (mapKeyChanged)="updateChildKeyInParent(prop, $event)"
71             (expandChild)="expandChildById($event)"
72             (deleteItem)="deleteListOrMapItem($event)"
73             (clickOnPropertyRow)="onClickPropertyRow($event)"
74             (checkProperty)="checkedChange($event)"
75             (addChildPropsToParent)="addChildProps($event, prop.propertiesName)"
76             >
77         </dynamic-property>
78     </ng-container>
79 </div>