Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
section.component.html 1.58 KiB
<ng-container *ngTemplateOutlet="section.dynamicPositioning ? dynamicElements : staticElements"></ng-container>

<ng-template #staticElements>
  <ng-container *ngFor="let element of section.elements; let i = index">
    <app-element
        [style.overflow]="'auto'"
        [style.width.px]="element.width"
        [style.height.px]="element.height"
        [style.position]="'absolute'"
        [style.left.px]="element.xPosition"
        [style.top.px]="element.yPosition"
        [elementModel]="element"
        [parentForm]="sectionForm"
        [parentArrayIndex]="i">
    </app-element>
  </ng-container>
</ng-template>

<ng-template #dynamicElements>
  <div [style.display]="'grid'"
       [style.grid-template-columns]="section.gridColumnSizes"
       [style.grid-template-rows]="section.gridRowSizes">
    <ng-container *ngFor="let element of section.elements; let i = index">
      <app-element
          [style.min-width.px]="element.width"
          [style.min-height.px]="element.height"
          [style.margin-left.px]="element.marginLeft"
          [style.margin-right.px]="element.marginRight"
          [style.margin-top.px]="element.marginTop"
          [style.margin-bottom.px]="element.marginBottom"
          [style.grid-column-start]="element.gridColumnStart"
          [style.grid-column-end]="element.gridColumnEnd"
          [style.grid-row-start]="element.gridRowStart"
          [style.grid-row-end]="element.gridRowEnd"
          [elementModel]="element"
          [parentForm]="sectionForm"
          [parentArrayIndex]="i">
      </app-element>
    </ng-container>
  </div>
</ng-template>