Sync Integ to Master
[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             ></dynamic-element>
23         </div>
24     </ng-container>
25     <!-- RIGHT CELL OR FULL WIDTH CELL-->
26     <ng-container *ngIf="propType == derivedPropertyTypes.SIMPLE || property.isDeclared || (property.isChildOfListOrMap && propType == derivedPropertyTypes.MAP && property.schema.property.isSimpleType)">
27         <div class="table-cell">
28             <dynamic-element class="value-input"
29                 pattern="validationUtils.getValidationPattern(property.type)"
30                 [value]="property.valueObj"
31                 [type]="property.isDeclared ? 'string' : property.type"
32                 [name]="property.name"
33                 [path]="property.propertiesName"
34                 (elementChanged)="onElementChanged($event)"
35                 [readonly]="readonly || property.isDeclared || property.isDisabled"
36             ></dynamic-element>
37         </div>
38     </ng-container>
39     <ng-container *ngIf="!isPropertyFEModel && propType != derivedPropertyTypes.SIMPLE && !property.isDeclared"> <!-- right cell for complex elements, or list complex -->
40         <div class="table-cell" *ngIf="propType == derivedPropertyTypes.COMPLEX">{{property.type | contentAfterLastDot }}</div>
41         <div class="table-cell" *ngIf="propType == derivedPropertyTypes.MAP && !property.schema.property.isSimpleType">{{property.schema.property.type | contentAfterLastDot }}</div>
42     </ng-container>
43     <ng-container *ngIf="isPropertyFEModel && (propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && !property.isDeclared"><!-- empty, full-width table cell - for PropertyFEModel of type list or map -->
44         <div class="table-cell empty"></div>
45     </ng-container>
46     <!-- ICONS: add, delete, and expand -->
47     <ng-container *ngIf="!property.isDeclared">
48             <a *ngIf="(propType == derivedPropertyTypes.LIST || propType == derivedPropertyTypes.MAP) && !property.isChildOfListOrMap" class="property-icon add-item" (click)="createNewChildProperty();" [ngClass]="{'disabled':readonly || preventInsertItem(property)}">Add value to list</a>
49             <span *ngIf="property.isChildOfListOrMap" (click)="deleteItem.emit(property);" class="property-icon sprite-new delete-item-icon" [ngClass]="{'disabled':readonly}"></span>
50             <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"></span>
51     </ng-container>
52
53 </div>
54 <!-- FLAT CHILDREN -->
55 <div class="flat-children-container" *ngIf="isPropertyFEModel && !property.isDeclared">
56     <ng-container *ngFor="let prop of property.flattenedChildren | filterChildProperties: expandedChildId; trackBy:prop?.propertiesName">
57         <dynamic-property
58             [selectedPropertyId]="selectedPropertyId"
59             [hasDeclareOption]="hasDeclareOption"
60             [canBeDeclared]="hasDeclareOption && prop.canBeDeclared"
61             [property]="prop"
62             [expandedChildId]="expandedChildId"
63             [propertyNameSearchText]="propertyNameSearchText"
64             [readonly]="readonly"
65             [hasChildren]="getHasChildren(prop)"
66             (propertyChanged)="childValueChanged(prop)"
67             (mapKeyChanged)="updateChildKeyInParent(prop, $event)"
68             (expandChild)="expandChildById($event)"
69             (deleteItem)="deleteListOrMapItem($event)"
70             (clickOnPropertyRow)="onClickPropertyRow($event)"
71             (checkProperty)="checkedChange($event)"
72             (addChildPropsToParent)="addChildProps($event, prop.propertiesName)"
73             >
74         </dynamic-property>
75     </ng-container>
76 </div>