File

components/parameter-summary/parameter-summary.component.ts

Description

Summary of parameters entered, form field values to call service.

Metadata

Index

Properties

Constructor

constructor(service: AppService)
Parameters :
Name Type Optional
service AppService No

Properties

disaggData
Default value : this.service.disaggData

Disaggregation response data stat

DisaggTarget
Default value : DisaggTarget

Disaggregation target enum

form
Default value : this.service.formGroup

Form field state

imts
Default value : computed(() => this.service.usage()?.response.model.imts)

Usage IMTs

isNaN
Default value : Number.isNaN
Number
Default value : Number
returnPeriodName
Default value : returnPeriodAltName

Return period value to name map

selectPlaceHolder
Default value : nshmpUtils.selectPlaceHolder()

Place holder for select menus

Public service
Type : AppService
siteClasses
Default value : computed(() => { const usage = this.service.usage(); if (usage) { return hazardUtils.siteClassesToParameters( usage.response.model.siteClasses, ); } })

The site classes as Parameters

toDisplay
Default value : nshmpUtils.parameterToDisplay

Function to get display from a Parameter

import {Component, computed} from '@angular/core';
import {MatDivider} from '@angular/material/divider';
import {MatList, MatListItem} from '@angular/material/list';
import {DisaggTarget, hazardUtils} from '@ghsc/nshmp-lib-ng/hazard';
import {nshmpUtils, returnPeriodAltName} from '@ghsc/nshmp-lib-ng/nshmp';

import {AppService} from '../../services/app.service';

/**
 * Summary of parameters entered, form field values to call service.
 */
@Component({
  imports: [MatDivider, MatList, MatListItem],
  selector: 'app-parameter-summary',
  styleUrl: './parameter-summary.component.scss',
  templateUrl: './parameter-summary.component.html',
})
export class ParameterSummaryComponent {
  /** Disaggregation target enum */
  DisaggTarget = DisaggTarget;

  Number = Number;

  isNaN = Number.isNaN;

  /** Return period value to name map */
  returnPeriodName = returnPeriodAltName;

  /** Place holder for select menus */
  selectPlaceHolder = nshmpUtils.selectPlaceHolder();

  /** Function to get display from a `Parameter` */
  toDisplay = nshmpUtils.parameterToDisplay;

  /** Disaggregation response data stat */
  disaggData = this.service.disaggData;

  /** Form field state */
  form = this.service.formGroup;

  /** Usage IMTs */
  imts = computed(() => this.service.usage()?.response.model.imts);

  /** The site classes as `Parameter`s */
  siteClasses = computed(() => {
    const usage = this.service.usage();

    if (usage) {
      return hazardUtils.siteClassesToParameters(
        usage.response.model.siteClasses,
      );
    }
  });

  constructor(public service: AppService) {}
}
<mat-divider />

<div class="grid-row parameter-summary">
  <div class="grid-col-12 tablet:grid-col-6 print-flex-basis-half">
    <mat-list class="parameter-list">
      <mat-list-item>
        <span class="parameter">Model</span>:
        {{ toDisplay(form.value.model, service.availableModels()) }}
      </mat-list-item>

      <mat-list-item>
        <span class="parameter">Latitude</span>:
        @if (!isNaN(form.value.latitude)) {
          {{ form.value.latitude }}
        }
        °
      </mat-list-item>

      <mat-list-item>
        <span class="parameter">Longitude</span>:
        @if (!isNaN(form.value.longitude)) {
          {{ form.value.longitude }}
        }
        °
      </mat-list-item>

      <mat-list-item>
        @if (form.value.siteClass !== selectPlaceHolder.value) {
          <span class="parameter">Site Class</span>:
          {{ toDisplay(form.value.siteClass, siteClasses()) }}
        } @else {
          <span class="parameter">Vs30</span>: {{ form.value.vs30 }} m/s
        }
      </mat-list-item>
    </mat-list>
  </div>

  <div class="grid-col-12 tablet:grid-col-6 print-flex-basis-half">
    <mat-list class="parameter-list">
      <mat-list-item>
        <span class="parameter">Intensity Measure Type</span>:
        {{ toDisplay(form.value.imt, imts()) }}
      </mat-list-item>

      @if (form.value.disaggTarget === DisaggTarget.RETURN_PERIOD) {
        <mat-list-item>
          <span class="parameter">Return Period</span>:
          @if (
            form.value.commonReturnPeriods !==
            Number.parseInt(selectPlaceHolder.value)
          ) {
            {{ returnPeriodName[form.value.returnPeriod] }}
          } @else {
            {{ form.value.returnPeriod }} yr
          }
        </mat-list-item>
      } @else {
        <mat-list-item>
          <span class="parameter">Intensity Measure Level</span>:
          {{ form.value.iml }} g
        </mat-list-item>

        <mat-list-item>
          <span class="parameter">Max Direction</span>:
          {{ form.value.maxDirection === true ? 'On' : 'Off' }}
        </mat-list-item>
      }

      <mat-list-item>
        <span class="parameter">Component</span>:
        {{ form.value.disaggComponent }}
      </mat-list-item>
    </mat-list>
  </div>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""