Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_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;
}
}
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;
}
});
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();
}
export function isGapStart(idx: number, data: DataPoint[]): boolean {
return (
isDataMissing(idx, data) && (!data[idx - 1] || isDefined(data[idx - 1].y))
);
}
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,
);
}
private _hasIndicator(indicatorType: IndicatorType): boolean {
return (
this._indicators &&
isDefined(
this._indicators.find(
indicator => indicator.active && indicator.color === indicatorType,
),
)
);
}
}
.filter(sc => isDefined(sc.sortAccessor))
.forEach(sc => sortAccessorMap.set(sc.name, sc.sortAccessor));
function isValidColor(color: any): color is DtEventChartColors {
return isDefined(color) && DT_EVENT_CHART_COLORS.indexOf(color) !== -1;
}
get _hasDescriptionOrCount(): boolean {
return isDefined(this._description) || isDefined(this._count);
}
}