ng-toggle-button
Version:
Angular toggle button switch
115 lines (114 loc) • 4.64 kB
TypeScript
import { OnInit, EventEmitter, OnChanges, SimpleChanges, ElementRef } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { NgToggleConfig } from './ng-toggle.config';
import * as i0 from "@angular/core";
export declare class NgToggleComponent implements OnInit, ControlValueAccessor, OnChanges {
private config;
private _elementRef;
value: any;
name: string;
disabled: boolean;
height: number;
width: number;
margin: number;
fontSize: number;
speed: number;
color: string | toggleConfig;
switchColor: string | toggleConfig;
labels: boolean | toggleConfig;
fontColor: string | toggleConfig;
values: valueConfig;
textAlign: string | toggleConfig;
id: string;
ariaLabel: string | null;
ariaLabelledby: string | null;
ariaDescribedby: string;
cssColors: boolean;
change: EventEmitter<any>;
valueChange: EventEmitter<any>;
toggled: boolean;
focused: boolean;
private _uniqueId;
constructor(config: NgToggleConfig, _elementRef: ElementRef<HTMLElement>);
ngOnInit(): void;
onChange: (_: any) => void;
onTouch: () => void;
onInput(value: boolean): void;
writeValue(value: any): void;
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
setDisabledState(isDisabled: boolean): void;
setToogle(): void;
ngOnChanges(changes: SimpleChanges): void;
get coreStyle(): {
width: string;
height: string;
transition: string;
backgroundColor: any;
borderRadius: string;
};
get buttonRadius(): number;
get distance(): string;
get buttonStyle(): {
width: string;
height: string;
transition: string;
transform: string;
background: any;
};
get labelStyle(): {
lineHeight: string;
fontSize: string;
color: any;
width: string;
};
get labelLeftStyle(): {
textAlign: string | toggleConfig;
lineHeight: string;
fontSize: string;
color: any;
width: string;
};
get labelRightStyle(): {
textAlign: string | toggleConfig;
lineHeight: string;
fontSize: string;
color: any;
width: string;
};
get colorChecked(): any;
get colorUnchecked(): any;
get colorDisabled(): any;
get colorCurrent(): any;
get labelChecked(): any;
get labelUnchecked(): any;
get switchColorChecked(): any;
get switchColorUnchecked(): any;
get switchColorDisabled(): any;
get switchColorCurrent(): any;
get fontColorChecked(): any;
get fontColorUnchecked(): any;
get fontColorDisabled(): any;
get fontColorCurrent(): any;
get label(): string;
toggle(event: any): void;
getValue(key: boolean): any;
onFocus(event: FocusEvent): void;
onFocusout(event: FocusEvent): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NgToggleComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NgToggleComponent, "ng-toggle", never, { "value": { "alias": "value"; "required": false; }; "name": { "alias": "name"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "height": { "alias": "height"; "required": false; }; "width": { "alias": "width"; "required": false; }; "margin": { "alias": "margin"; "required": false; }; "fontSize": { "alias": "fontSize"; "required": false; }; "speed": { "alias": "speed"; "required": false; }; "color": { "alias": "color"; "required": false; }; "switchColor": { "alias": "switchColor"; "required": false; }; "labels": { "alias": "labels"; "required": false; }; "fontColor": { "alias": "fontColor"; "required": false; }; "values": { "alias": "values"; "required": false; }; "textAlign": { "alias": "textAlign"; "required": false; }; "id": { "alias": "id"; "required": false; }; "ariaLabel": { "alias": "aria-label"; "required": false; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; }; }, { "change": "change"; "valueChange": "valueChange"; }, never, never, true, never>;
}
export declare const isObject: (value: any) => boolean;
export declare const has: (object: any, key: any) => any;
export declare const get: (object: any, key: any, defaultValue: any) => any;
export declare const px: (value: any) => string;
export declare const translate: (x: any, y: any) => string;
export type toggleConfig = {
checked: string;
unchecked: string;
disabled?: string;
};
export type valueConfig = {
checked: any;
unchecked: any;
};