How to use the @dynatrace/barista-components/core.isDefined function in @dynatrace/barista-components

To help you get started, we’ve selected a few @dynatrace/barista-components examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dynatrace-oss / barista / components / filter-field / src / filter-field-range / filter-field-range.ts View on Github external
_handleSubmit(event: Event): void {
    event.preventDefault();
    event.stopImmediatePropagation();
    const range = this._validateRange();
    if (isDefined(range)) {
      this.rangeSubmitted.emit(
        new DtFilterFieldRangeSubmittedEvent(
          this,
          this._selectedOperator as DtFilterFieldRangeOperator,
          range as number | [number, number],
          this.unit,
        ),
      );
      // After emission we need to reset the range state, to have a fresh one
      // if another range opens.
      this._valueFrom = '';
      this._valueTo = '';
      this._selectedOperator = null;
    }
  }
github dynatrace-oss / barista / components / select / src / select.ts View on Github external
const correspondingOption = this.options.find((option: DtOption) => {
      try {
        // Treat null as a special reset value.
        return (
          isDefined(option.value) && this._compareWith(option.value, value)
        );
      } catch (error) {
        // Notify developers of errors in their comparator.
        LOG.warn(error);
        return false;
      }
    });
github dynatrace-oss / barista / components / chart / src / heatfield / chart-heatfield.ts View on Github external
private _updatePosition(): void {
    if (this._isValidStartEndRange && this._chartObject && this._boundingBox) {
      const xAxis = this._chartObject.xAxis;
      if (xAxis && xAxis.length > 0) {
        // NOTE that there can be multiple xAxis in highcharts but our charts don't have multiple xAxis
        // so we use the first one for the extremes
        const extremes = xAxis[0].getExtremes();
        const pxPerUnit =
          this._boundingBox.width / (extremes.max - extremes.min);
        const left =
          (clamp(this._start, extremes.min, extremes.max) - extremes.min) *
          pxPerUnit;
        // calculate the width based on start/end values or from start to the edge of the chart
        const width = isDefined(this._end)
          ? (clamp(this._end, extremes.min, extremes.max) - extremes.min) *
              pxPerUnit -
            left
          : (extremes.max - extremes.min) * pxPerUnit - left;
        // tslint:disable:no-magic-numbers
        this._relativeBoundingBox = {
          left: round(left + this._boundingBox.left, 2),
          width: round(width, 2),
          top: round(this._boundingBox.top - DT_HEATFIELD_TOP_OFFSET, 2),
        };
        // tslint:enable:no-magic-numbers
        // It is not possible to set this on the ref nativelement and not in the marker and the backdrop,
        // because we need to have the backdrop behind the chart and the marker in front.
        this._updateMarkerPosition();
        this._updateBackdropPosition();
      }
github dynatrace-oss / barista / components / micro-chart / src / micro-chart-util.ts View on Github external
export function isGapStart(idx: number, data: DataPoint[]): boolean {
  return (
    isDataMissing(idx, data) && (!data[idx - 1] || isDefined(data[idx - 1].y))
  );
}
github dynatrace-oss / barista / components / filter-field / src / filter-field-default-data-source.ts View on Github external
transformRange(data: DtFilterFieldDefaultDataSourceRange): DtNodeDef {
    return dtRangeDef(
      !!data.range.operators.range,
      !!data.range.operators.equal,
      !!data.range.operators.greaterThanEqual,
      !!data.range.operators.lessThanEqual,
      data.range.unit,
      data,
      null,
      isDefined(data.unique) ? data.unique! : false,
    );
  }
github dynatrace-oss / barista / components / table / src / cell.ts View on Github external
private _hasIndicator(indicatorType: IndicatorType): boolean {
    return (
      this._indicators &&
      isDefined(
        this._indicators.find(
          indicator => indicator.active && indicator.color === indicatorType,
        ),
      )
    );
  }
}
github dynatrace-oss / barista / components / table / src / table.ts View on Github external
              .filter(sc => isDefined(sc.sortAccessor))
              .forEach(sc => sortAccessorMap.set(sc.name, sc.sortAccessor));
github dynatrace-oss / barista / components / event-chart / src / event-chart.ts View on Github external
function isValidColor(color: any): color is DtEventChartColors {
  return isDefined(color) && DT_EVENT_CHART_COLORS.indexOf(color) !== -1;
}
github dynatrace-oss / barista / components / progress-bar / src / progress-bar.ts View on Github external
get _hasDescriptionOrCount(): boolean {
    return isDefined(this._description) || isDefined(this._count);
  }
}