File

src/lib/model/range-value.model.ts

Description

Value class to be used with form elements that support ranges

Index

Properties
Methods

Constructor

constructor(operator: string, firstValue: string, secondValue?: string, useNot?: boolean, actualOperator?: string)

Creates new instance

Parameters :
Name Type Optional Description
operator string no

The operator (see

firstValue string no

The rages first/start value

secondValue string yes

The ranges last/end value

useNot boolean yes
actualOperator string yes

Properties

Public Optional actualOperator
actualOperator: string
Type : string
Public firstValue
firstValue: string
Type : string
The rages first/start value
Public operator
operator: string
Type : string
The operator (see
Public Optional secondValue
secondValue: string
Type : string
The ranges last/end value
Public Optional useNot
useNot: boolean
Type : boolean

Methods

Static getOperatorLabel
getOperatorLabel(operator: string)

Get the label for a given operator

Parameters :
Name Type Optional Description
operator string no

The operator to retrieve the label for

Returns : string

The corresponding label

import {SearchFilter} from '../service/search/search-query.model';

/**
 * Value class to be used with form elements that support ranges
 */
export class RangeValue {

  /**
   * Creates new instance
   * @param operator The operator (see @link SearchFilter.OPERATOR)
   * @param firstValue The rages first/start value
   * @param secondValue The ranges last/end value
   */
  constructor(public operator: string,
    public firstValue: string,
    public secondValue?: string,
    public useNot?: boolean,
    public actualOperator?: string
  ) {
  }

  /**
   * Get the label for a given operator
   * @param operator The operator to retrieve the label for
   * @returns The corresponding label
   */
  public static getOperatorLabel(operator: string) {
    let label = '?';
    switch (operator) {
      case SearchFilter.OPERATOR.EQUAL: {
        label = '=';
        break;
      }
      case SearchFilter.OPERATOR.GREATER_OR_EQUAL: {
        label = '>=';
        break;
      }
      case SearchFilter.OPERATOR.LESS_OR_EQUAL: {
        label = '<=';
        break;
      }
      case SearchFilter.OPERATOR.INTERVAL_INCLUDE_BOTH: {
        label = '-';
        break;
      }
      case SearchFilter.OPERATOR.MORE: {
        label = '...';
        break;
      }
      case SearchFilter.OPERATOR.USE_NOT: {
        label = '≠';
        break;
      }
    }
    return label;
  }
}

results matching ""

    No results matching ""