primeng
Version:
PrimeNG is an open source UI library for Angular featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeB
130 lines (129 loc) • 5.07 kB
TypeScript
import { AfterContentInit, ElementRef, EventEmitter, QueryList, TemplateRef } from '@angular/core';
import { PrimeTemplate } from 'primeng/api';
import { BaseComponent } from 'primeng/basecomponent';
import { ToggleSwitchStyle } from './style/toggleswitchstyle';
import { ToggleSwitchChangeEvent } from './toggleswitch.interface';
import * as i0 from "@angular/core";
import * as i1 from "primeng/api";
/**
* Context interface for the handle template.
* @property {boolean} checked - A flag indicating whether the input is checked.
* @group Interface
*/
export interface ToggleSwitchHandleTemplateContext {
checked: boolean;
}
export declare const TOGGLESWITCH_VALUE_ACCESSOR: any;
/**
* ToggleSwitch is used to select a boolean value.
* @group Components
*/
export declare class ToggleSwitch extends BaseComponent implements AfterContentInit {
/**
* Inline style of the component.
* @group Props
*/
style: {
[klass: string]: any;
} | null | undefined;
/**
* Style class of the component.
* @group Props
*/
styleClass: string | undefined;
/**
* Index of the element in tabbing order.
* @group Props
*/
tabindex: number | undefined;
/**
* Identifier of the input element.
* @group Props
*/
inputId: string | undefined;
/**
* Name of the input element.
* @group Props
*/
name: string | undefined;
/**
* When present, it specifies that the element should be disabled.
* @group Props
*/
disabled: boolean | undefined;
/**
* When present, it specifies that the component cannot be edited.
* @group Props
*/
readonly: boolean | undefined;
/**
* Value in checked state.
* @group Props
*/
trueValue: any;
/**
* Value in unchecked state.
* @group Props
*/
falseValue: any;
/**
* Used to define a string that autocomplete attribute the current element.
* @group Props
*/
ariaLabel: string | undefined;
/**
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
* @group Props
*/
ariaLabelledBy: string | undefined;
/**
* When present, it specifies that the component should automatically get focus on load.
* @group Props
*/
autofocus: boolean | undefined;
/**
* Callback to invoke when the on value change.
* @param {ToggleSwitchChangeEvent} event - Custom change event.
* @group Emits
*/
onChange: EventEmitter<ToggleSwitchChangeEvent>;
input: ElementRef;
/**
* Callback to invoke when the on value change.
* @type {TemplateRef<ToggleSwitchHandleTemplateContext>} context - Context of the template
* @example
* ```html
* <ng-template #handle let-checked="checked"> </ng-template>
* ```
* @see {@link ToggleSwitchHandleTemplateContext}
* @group Templates
*/
handleTemplate: TemplateRef<any> | undefined;
_handleTemplate: TemplateRef<any> | undefined;
modelValue: any;
focused: boolean;
onModelChange: Function;
onModelTouched: Function;
_componentStyle: ToggleSwitchStyle;
templates: QueryList<PrimeTemplate>;
ngAfterContentInit(): void;
onClick(event: Event): void;
onFocus(): void;
onBlur(): void;
writeValue(value: any): void;
registerOnChange(fn: Function): void;
registerOnTouched(fn: Function): void;
setDisabledState(val: boolean): void;
checked(): boolean;
static ɵfac: i0.ɵɵFactoryDeclaration<ToggleSwitch, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ToggleSwitch, "p-toggleswitch, p-toggleSwitch, p-toggle-switch", never, { "style": { "alias": "style"; "required": false; }; "styleClass": { "alias": "styleClass"; "required": false; }; "tabindex": { "alias": "tabindex"; "required": false; }; "inputId": { "alias": "inputId"; "required": false; }; "name": { "alias": "name"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "trueValue": { "alias": "trueValue"; "required": false; }; "falseValue": { "alias": "falseValue"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; }; "autofocus": { "alias": "autofocus"; "required": false; }; }, { "onChange": "onChange"; }, ["handleTemplate", "templates"], never, true, never>;
static ngAcceptInputType_tabindex: unknown;
static ngAcceptInputType_disabled: unknown;
static ngAcceptInputType_readonly: unknown;
static ngAcceptInputType_autofocus: unknown;
}
export declare class ToggleSwitchModule {
static ɵfac: i0.ɵɵFactoryDeclaration<ToggleSwitchModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<ToggleSwitchModule, never, [typeof ToggleSwitch, typeof i1.SharedModule], [typeof ToggleSwitch, typeof i1.SharedModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<ToggleSwitchModule>;
}