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
249 lines (244 loc) • 8.27 kB
TypeScript
import * as i0 from '@angular/core';
import { TemplateRef, AfterContentInit, EventEmitter, ElementRef, QueryList, SimpleChanges } from '@angular/core';
import { FormControl } from '@angular/forms';
import * as i1 from 'primeng/api';
import { PrimeTemplate } from 'primeng/api';
import { BaseEditableHolder } from 'primeng/baseeditableholder';
import { Nullable } from 'primeng/ts-helpers';
import { BaseStyle } from 'primeng/base';
/**
* Custom change event.
* @see {@link Checkbox.onChange}
* @group Events
*/
interface CheckboxChangeEvent {
/**
* Checked value.
*/
checked?: any;
/**
* Browser event.
*/
originalEvent?: Event;
}
/**
* Defines valid templates in Checkbox.
* @group Templates
*/
interface CheckboxTemplates {
/**
* Custom checkbox icon template
*/
icon(): TemplateRef<any>;
}
/**
*
* Checkbox is an extension to standard checkbox element with theming.
*
* [Live Demo](https://www.primeng.org/checkbox/)
*
* @module checkboxstyle
*
*/
declare enum CheckboxClasses {
/**
* Class name of the root element
*/
root = "p-checkbox",
/**
* Class name of the box element
*/
box = "p-checkbox-box",
/**
* Class name of the input element
*/
input = "p-checkbox-input",
/**
* Class name of the icon element
*/
icon = "p-checkbox-icon"
}
declare class CheckboxStyle extends BaseStyle {
name: string;
theme: string;
classes: {
root: ({ instance }: {
instance: any;
}) => (string | {
'p-checkbox-checked p-highlight': any;
'p-disabled': any;
'p-invalid': any;
'p-variant-filled': boolean;
'p-checkbox-sm p-inputfield-sm': boolean;
'p-checkbox-lg p-inputfield-lg': boolean;
})[];
box: string;
input: string;
icon: string;
};
static ɵfac: i0.ɵɵFactoryDeclaration<CheckboxStyle, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<CheckboxStyle>;
}
interface CheckboxStyle extends BaseStyle {
}
declare const CHECKBOX_VALUE_ACCESSOR: any;
/**
* Checkbox is an extension to standard checkbox element with theming.
* @group Components
*/
declare class Checkbox extends BaseEditableHolder implements AfterContentInit {
/**
* Value of the checkbox.
* @group Props
*/
value: any;
/**
* Allows to select a boolean value instead of multiple values.
* @group Props
*/
binary: boolean | undefined;
/**
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
* @group Props
*/
ariaLabelledBy: string | undefined;
/**
* Used to define a string that labels the input element.
* @group Props
*/
ariaLabel: string | undefined;
/**
* Index of the element in tabbing order.
* @group Props
*/
tabindex: number | undefined;
/**
* Identifier of the focus input to match a label defined for the component.
* @group Props
*/
inputId: string | undefined;
/**
* Inline style of the input element.
* @group Props
*/
inputStyle: {
[klass: string]: any;
} | null | undefined;
/**
* Style class of the component.
* @deprecated since v20.0.0, use `class` instead.
* @group Props
*/
styleClass: string | undefined;
/**
* Style class of the input element.
* @group Props
*/
inputClass: string | undefined;
/**
* When present, it specifies input state as indeterminate.
* @group Props
*/
indeterminate: boolean;
/**
* Form control value.
* @group Props
*/
formControl: FormControl | undefined;
/**
* Icon class of the checkbox icon.
* @group Props
*/
checkboxIcon: string | undefined;
/**
* When present, it specifies that the component cannot be edited.
* @group Props
*/
readonly: boolean | undefined;
/**
* When present, it specifies that the component should automatically get focus on load.
* @group Props
*/
autofocus: boolean | undefined;
/**
* Value in checked state.
* @group Props
*/
trueValue: any;
/**
* Value in unchecked state.
* @group Props
*/
falseValue: any;
/**
* Specifies the input variant of the component.
* @defaultValue undefined
* @group Props
*/
variant: i0.InputSignal<"filled" | "outlined">;
/**
* Specifies the size of the component.
* @defaultValue undefined
* @group Props
*/
size: i0.InputSignal<"small" | "large">;
/**
* Callback to invoke on value change.
* @param {CheckboxChangeEvent} event - Custom value change event.
* @group Emits
*/
onChange: EventEmitter<CheckboxChangeEvent>;
/**
* Callback to invoke when the receives focus.
* @param {Event} event - Browser event.
* @group Emits
*/
onFocus: EventEmitter<Event>;
/**
* Callback to invoke when the loses focus.
* @param {Event} event - Browser event.
* @group Emits
*/
onBlur: EventEmitter<Event>;
inputViewChild: Nullable<ElementRef>;
get checked(): boolean;
_indeterminate: i0.WritableSignal<any>;
/**
* The template of the checkbox icon.
* @group Templates
*/
checkboxIconTemplate: TemplateRef<any>;
templates: Nullable<QueryList<PrimeTemplate>>;
_checkboxIconTemplate: TemplateRef<any> | undefined;
focused: boolean;
_componentStyle: CheckboxStyle;
$variant: i0.Signal<"filled" | "outlined">;
ngAfterContentInit(): void;
ngOnChanges(changes: SimpleChanges): void;
updateModel(event: any): void;
handleChange(event: any): void;
onInputFocus(event: any): void;
onInputBlur(event: any): void;
focus(): void;
/**
* @override
*
* @see {@link BaseEditableHolder.writeControlValue}
* Writes the value to the control.
*/
writeControlValue(value: any, setModelValue: (value: any) => void): void;
static ɵfac: i0.ɵɵFactoryDeclaration<Checkbox, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<Checkbox, "p-checkbox, p-checkBox, p-check-box", never, { "value": { "alias": "value"; "required": false; }; "binary": { "alias": "binary"; "required": false; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "tabindex": { "alias": "tabindex"; "required": false; }; "inputId": { "alias": "inputId"; "required": false; }; "inputStyle": { "alias": "inputStyle"; "required": false; }; "styleClass": { "alias": "styleClass"; "required": false; }; "inputClass": { "alias": "inputClass"; "required": false; }; "indeterminate": { "alias": "indeterminate"; "required": false; }; "formControl": { "alias": "formControl"; "required": false; }; "checkboxIcon": { "alias": "checkboxIcon"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "autofocus": { "alias": "autofocus"; "required": false; }; "trueValue": { "alias": "trueValue"; "required": false; }; "falseValue": { "alias": "falseValue"; "required": false; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "onChange": "onChange"; "onFocus": "onFocus"; "onBlur": "onBlur"; }, ["checkboxIconTemplate", "templates"], never, true, never>;
static ngAcceptInputType_binary: unknown;
static ngAcceptInputType_tabindex: unknown;
static ngAcceptInputType_indeterminate: unknown;
static ngAcceptInputType_readonly: unknown;
static ngAcceptInputType_autofocus: unknown;
}
declare class CheckboxModule {
static ɵfac: i0.ɵɵFactoryDeclaration<CheckboxModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<CheckboxModule, never, [typeof Checkbox, typeof i1.SharedModule], [typeof Checkbox, typeof i1.SharedModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<CheckboxModule>;
}
export { CHECKBOX_VALUE_ACCESSOR, Checkbox, CheckboxClasses, CheckboxModule, CheckboxStyle };
export type { CheckboxChangeEvent, CheckboxTemplates };