import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
import { AbstractControl, FormBuilder, FormControl } from '@angular/forms';
import { TsOption } from '@terminus/ui/option';
import { TsSelectionListChange, TsSelectionListComponent } from '@terminus/ui/selection-list';
/**
* Represents the range for a {@link TsDateCohort}
*/
export interface TsDateCohortRange {
start: string | Date;
end: string | Date;
}
/**
* Represents the date cohort object that passed in
*/
export interface TsDateCohort extends TsOption {
active?: boolean;
display: string;
range: TsDateCohortRange;
}
/**
* Cohort date range change event interface
*/
export interface TsCohortDateChangeEvent {
start: string | Date;
end: string | Date;
}
/**
* Event object emitted by {@link TsCohortDateRangeComponent} when there is date range change
*/
export declare class TsCohortDateRangeChanged {
start: string | Date;
end: string | Date;
source: TsCohortDateRangeComponent;
constructor(start: string | Date, end: string | Date, source: TsCohortDateRangeComponent);
}
/**
* This is the cohort-date-range UI Component
*
*
* @example
*
*
* https://getterminus.github.io/ui-demos-release/components/cohort-date-range
*/
export declare class TsCohortDateRangeComponent implements OnInit, OnDestroy {
formBuilder: FormBuilder;
/**
* Define the custom date cohort
*
* @internal
*/
customDateCohort: TsDateCohort;
/**
* Initialize the date range with empty start and end date
*
* @internal
*/
formGroup: import("@angular/forms").FormGroup;
/**
* Define the default component ID
*/
readonly uid: string;
/**
* Get reference to the date range form group
*
* @internal
*/
get dateRangeFormGroup(): AbstractControl;
/**
* Get a reference to the cohort form control
*
* @internal
*/
get cohortControl(): FormControl;
/**
* Define a reference to the {@link TsSelectionListComponent}
*
* @internal
*/
selectionListComponent: TsSelectionListComponent;
/**
* Define whether custom dates are allowed
*
* @param value
*/
set allowCustomDates(value: boolean);
get allowCustomDates(): boolean;
private _allowCustomDates;
/**
* Define the array of date cohorts
*
* @param value
*/
set cohorts(value: ReadonlyArray);
get cohorts(): ReadonlyArray;
private _cohorts;
private originalCohorts;
/**
* Define the date locale
*/
dateLocale: string | undefined;
/**
* Define the max date for the end date
*/
endMaxDate: Date | undefined;
/**
* Define the min date for the end date
*/
endMinDate: Date | undefined;
/**
* Define an ID for the component
*
* @param value
*/
set id(value: string);
get id(): string;
protected _id: string;
/**
* Disable the component
*/
isDisabled: boolean;
/**
* Define the max date for the starting date
*/
startMaxDate: Date | undefined;
/**
* Define the min date for the starting date
*/
startMinDate: Date | undefined;
/**
* Cohort change event emitter
*/
readonly cohortDateRangeChanged: EventEmitter;
constructor(formBuilder: FormBuilder);
ngOnInit(): void;
/**
* Needed for untilComponentDestroyed
*/
ngOnDestroy(): void;
/**
* Emit the change event
*
* @internal
* @param event - triggered by date range change
*/
cohortDateRangeChange(event: TsCohortDateChangeEvent): void;
/**
* Called when selection changed
*
* @internal
* @param event - TsSelectChangeEvent
*/
selectionChange(event: TsSelectionListChange): void;
/**
* Function for tracking for-loops changes
*
* @internal
* @param index - The item index
* @returns The index
*/
trackByFn(index: any): number;
/**
* The display formatter for {@link TsSelectionListComponent}
*
* @param cohort - The cohort
* @returns The display value for the cohort
*/
formatter(cohort: TsDateCohort): string;
/**
* Update the date range form values
*
* @param range - The new range
*/
private setDateRangeValues;
/**
* Update the select when the date is manually changed to not match a cohort
*/
private updateSelectOnRangeChange;
}