Skip to content

Delta

reference
1 min readUpdated

Kind: Class

Source: Pams/Web/Pams.WebApp/Client/app/core/models/dashboard-data-fields.ts (line 316)

Part of: Pams

Delta represents a dashboard data field and stores its field name, persisted name, display caption, and DeltaTypeEnum type. It also tracks whether the field should be hidden when dashboard data is displayed or processed.

Methods

MethodSignatureReturns
isHiddenisHidden()boolean
setHiddensetHidden(flag: boolean)void
GetStoredNameGetStoredName()string
SetStoredNameSetStoredName(name: string)void
GetFieldNameGetFieldName()string
SetFieldNameSetFieldName(name: string)void
GetTypeGetType()DeltaTypeEnum
SetTypeSetType(type: DeltaTypeEnum)void
GetCaptionGetCaption()string
SetCaptionSetCaption(input: string)void
SetDataTypeSetDataType(ty: DataTypeEnum)void
GetDataTypeGetDataType()DataTypeEnum
GetFieldNameTargetGetFieldNameTarget()string
SetFieldNameTargetSetFieldNameTarget(name: string)void
GetStoredNameTargetGetStoredNameTarget()string
SetStoredNameTargetSetStoredNameTarget(name: string)void

Where it refuses work

  • Delta stops the work with an early return when this.FieldName.

Diagram

mermaid
graph LR
  Delta[Delta]
  StoredName[Stored Name]
  FieldName[Field Name]
  Caption[Caption]
  Type[DeltaTypeEnum]
  Hidden[Hidden State]

  Delta --> StoredName
  Delta --> FieldName
  Delta --> Caption
  Delta --> Type
  Delta --> Hidden

Usage

ts
import { Delta, DeltaTypeEnum } from "./dashboard-data-fields";

function createDashboardField(type: DeltaTypeEnum): Delta {
  const delta = new Delta();

  delta.SetStoredName("totalAmount");
  delta.SetFieldName("TotalAmount");
  delta.SetCaption("Total Amount");
  delta.SetType(type);
  delta.setHidden(false);

  return delta;
}

const field = createDashboardField(existingField.GetType());

if (!field.isHidden()) {
  console.log(field.GetCaption(), field.GetFieldName());
}

AI Coding Instructions

  • Keep dashboard field metadata in Delta through its getter and setter methods rather than duplicating field-name mappings elsewhere.
  • Use GetStoredName() for persisted or backend-facing field identifiers and GetFieldName() for the dashboard field identifier.
  • Check isHidden() before rendering or exposing a field in dashboard UI code.
  • Pass a valid DeltaTypeEnum value to SetType() so consumers can handle the field according to its configured type.

Was this page helpful?

Download as PDF