@tangential/input-widgets
Version:
Input Widgets with persistable, dynamic configuration.
76 lines (75 loc) • 2.95 kB
TypeScript
import { ChangeDetectorRef, EventEmitter, OnChanges, OnInit, SimpleChange } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { DurationPickerState } from './duration-picker-state';
import * as i0 from "@angular/core";
/**
* Provider Expression that allows this widget to register as a ControlValueAccessor.
* This allows it to support [(ngModel)].
* @docs-private
*/
export declare const TANJ_DURATION_PICKER_WIDGET_VIEW_CONTROL_VALUE_ACCESSOR: any;
export declare class DurationPickerWidgetChange {
source: DurationPickerWidgetComponent;
value: number;
constructor(source: DurationPickerWidgetComponent, value: number);
}
export interface DurationFieldConfig {
unitKey: string;
showing: boolean;
showingNext: boolean;
separator?: string;
label: string;
max: number;
value: number;
}
export declare class DurationPickerWidgetComponent implements OnInit, OnChanges, ControlValueAccessor {
private changeDetectorRef;
private dialog;
flex: string;
flexLayout: string;
flexLayoutAlign: string;
value: number;
valueChange: EventEmitter<number>;
labelPosition: 'before' | 'after' | 'below';
disabled: boolean;
hideLabel: boolean;
onlyLabel: boolean;
/**
* Configuration Fields
*/
label: string;
defaultValue: number;
max: number;
showDays: boolean;
showHours: boolean;
showMinutes: boolean;
showSeconds: boolean;
showMilliseconds: boolean;
change: EventEmitter<any>;
state: DurationPickerState;
onTouched: () => any;
private controlValueAccessorChangeFn;
constructor(changeDetectorRef: ChangeDetectorRef, dialog: MatDialog);
ngOnInit(): void;
ngOnChanges(changes: {
value: SimpleChange;
}): void;
private updateFields;
showEditDialog(): void;
private emitChangeEvent;
/**
* Boilerplate / required for Angular
*
*/
writeValue(value: number): void;
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
/**
* Sets the input's disabled state. Implemented as a part of ControlValueAccessor.
* @param isDisabled Whether the input should be disabled.
*/
setDisabledState(isDisabled: boolean): void;
static ɵfac: i0.ɵɵFactoryDeclaration<DurationPickerWidgetComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<DurationPickerWidgetComponent, "tanj-duration-picker-widget", never, { "value": "value"; "labelPosition": "labelPosition"; "disabled": "disabled"; "hideLabel": "hideLabel"; "onlyLabel": "onlyLabel"; "label": "label"; "defaultValue": "defaultValue"; "max": "max"; "showDays": "showDays"; "showHours": "showHours"; "showMinutes": "showMinutes"; "showSeconds": "showSeconds"; "showMilliseconds": "showMilliseconds"; }, { "valueChange": "valueChange"; "change": "change"; }, never, never, false>;
}