2023-03-01 11:23:31 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* TriStateCheckbox is used to select either 'true', 'false' or 'null' as the value.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/tristatecheckbox/)
|
|
|
|
*
|
|
|
|
* @module tristatecheckbox
|
|
|
|
*
|
|
|
|
*/
|
2023-04-04 12:42:13 +00:00
|
|
|
import { InputHTMLAttributes, VNode } from 'vue';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2023-09-05 08:50:46 +00:00
|
|
|
import { PassThroughOptions } from '../passthrough';
|
2023-09-05 11:28:04 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor, Nullable, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
export declare type TriStateCheckboxPassThroughOptionType = TriStateCheckboxPassThroughAttributes | ((options: TriStateCheckboxPassThroughMethodOptions) => TriStateCheckboxPassThroughAttributes | string) | string | null | undefined;
|
2023-05-07 11:19:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface TriStateCheckboxPassThroughMethodOptions {
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines instance.
|
|
|
|
*/
|
2023-07-06 12:01:33 +00:00
|
|
|
instance: any;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties.
|
|
|
|
*/
|
2023-05-07 11:19:35 +00:00
|
|
|
props: TriStateCheckboxProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
2023-05-07 11:19:35 +00:00
|
|
|
state: TriStateCheckboxState;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current options.
|
|
|
|
*/
|
2023-05-09 09:17:12 +00:00
|
|
|
context: TriStateCheckboxContext;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Defines passthrough(pt) options in global config.
|
|
|
|
*/
|
|
|
|
global: object | undefined;
|
2023-05-07 11:19:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link TriStateCheckboxProps.pt}
|
|
|
|
*/
|
|
|
|
export interface TriStateCheckboxPassThroughOptions {
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-05-07 11:19:35 +00:00
|
|
|
*/
|
|
|
|
root?: TriStateCheckboxPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the checkbox box's DOM element.
|
2023-05-07 11:19:35 +00:00
|
|
|
*/
|
2023-05-23 07:56:17 +00:00
|
|
|
checkbox?: TriStateCheckboxPassThroughOptionType;
|
2023-05-07 11:19:35 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the check icon's DOM element.
|
2023-05-07 11:19:35 +00:00
|
|
|
*/
|
|
|
|
checkIcon?: TriStateCheckboxPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the uncheck icon's DOM element.
|
2023-05-07 11:19:35 +00:00
|
|
|
*/
|
|
|
|
uncheckIcon?: TriStateCheckboxPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the nullable icon's DOM element.
|
2023-05-07 11:19:35 +00:00
|
|
|
*/
|
|
|
|
nullableIcon?: TriStateCheckboxPassThroughOptionType;
|
2023-05-09 09:17:12 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the hidden input wrapper's DOM element.
|
2023-05-09 09:17:12 +00:00
|
|
|
*/
|
|
|
|
hiddenInputWrapper?: TriStateCheckboxPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the hidden input's DOM element.
|
2023-05-09 09:17:12 +00:00
|
|
|
*/
|
|
|
|
hiddenInput?: TriStateCheckboxPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the hidden value label's DOM element.
|
2023-05-09 09:17:12 +00:00
|
|
|
*/
|
2023-05-25 13:44:22 +00:00
|
|
|
hiddenValueLabel?: TriStateCheckboxPassThroughOptionType;
|
2023-07-06 11:09:01 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to manage all lifecycle hooks
|
2023-07-06 11:09:01 +00:00
|
|
|
* @see {@link BaseComponent.ComponentHooks}
|
|
|
|
*/
|
|
|
|
hooks?: ComponentHooks;
|
2023-05-07 11:19:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface TriStateCheckboxPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in TriStateCheckbox component.
|
|
|
|
*/
|
|
|
|
export interface TriStateCheckboxState {
|
|
|
|
/**
|
|
|
|
* Focused state as a boolean.
|
|
|
|
*/
|
|
|
|
focused: boolean;
|
|
|
|
}
|
|
|
|
|
2023-05-09 09:17:12 +00:00
|
|
|
/**
|
|
|
|
* Defines current options in TriStateCheckbox component.
|
|
|
|
*/
|
|
|
|
export interface TriStateCheckboxContext {
|
|
|
|
/**
|
|
|
|
* Current active state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
active: boolean;
|
|
|
|
/**
|
|
|
|
* Current focused state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
focused: boolean;
|
|
|
|
/**
|
|
|
|
* Current disabled state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
disabled: boolean;
|
|
|
|
}
|
|
|
|
|
2023-03-01 11:23:31 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in TriStateCheckbox component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface TriStateCheckboxProps {
|
|
|
|
/**
|
|
|
|
* Value of the component.
|
2023-03-01 11:23:31 +00:00
|
|
|
* @defaultValue null
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
modelValue?: Nullable<boolean>;
|
|
|
|
/**
|
|
|
|
* When present, it specifies that the component should be disabled.
|
2023-03-01 11:23:31 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
disabled?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Index of the element in tabbing order.
|
|
|
|
*/
|
|
|
|
tabindex?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Identifier of the underlying input element.
|
|
|
|
*/
|
|
|
|
inputId?: string | undefined;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass all properties of the HTMLInputElement to the focusable input element inside the component.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.26.0. Use 'pt' property.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
inputProps?: InputHTMLAttributes | undefined;
|
|
|
|
/**
|
|
|
|
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
|
|
|
|
*/
|
|
|
|
'aria-labelledby'?: string | undefined;
|
|
|
|
/**
|
2022-09-14 11:26:01 +00:00
|
|
|
* Establishes a string value that labels the component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
'aria-label'?: string | undefined;
|
2023-05-07 11:19:35 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-05-07 11:19:35 +00:00
|
|
|
* @type {TriStateCheckboxPassThroughOptions}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<TriStateCheckboxPassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
2023-05-24 14:39:47 +00:00
|
|
|
/**
|
|
|
|
* When enabled, it removes component related styles in the core.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
unstyled?: boolean;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 11:23:31 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in TriStateCheckbox component.
|
|
|
|
*/
|
2023-04-04 12:42:13 +00:00
|
|
|
export interface TriStateCheckboxSlots {
|
|
|
|
/**
|
|
|
|
* Custom check icon template.
|
2023-08-17 07:16:25 +00:00
|
|
|
* @param {Object} scope - checkicon slot's params.
|
2023-04-04 12:42:13 +00:00
|
|
|
*/
|
2023-05-24 14:39:47 +00:00
|
|
|
checkicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
|
|
|
}): VNode[];
|
2023-04-04 12:42:13 +00:00
|
|
|
/**
|
|
|
|
* Custom uncheck icon template.
|
2023-08-17 07:16:25 +00:00
|
|
|
* @param {Object} scope - uncheckicon slot's params.
|
2023-04-04 12:42:13 +00:00
|
|
|
*/
|
2023-05-24 14:39:47 +00:00
|
|
|
uncheckicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
|
|
|
}): VNode[];
|
2023-04-04 12:42:13 +00:00
|
|
|
/**
|
|
|
|
* Custom nullable icon template.
|
2023-08-17 07:16:25 +00:00
|
|
|
* @param {Object} scope - nullableicon slot's params.
|
2023-04-04 12:42:13 +00:00
|
|
|
*/
|
2023-05-24 14:39:47 +00:00
|
|
|
nullableicon(scope: {
|
|
|
|
/**
|
|
|
|
* Style class of the icon.
|
|
|
|
*/
|
|
|
|
class: string;
|
|
|
|
}): VNode[];
|
2023-04-04 12:42:13 +00:00
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 11:23:31 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in TriStateCheckbox component.
|
|
|
|
*/
|
|
|
|
export interface TriStateCheckboxEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the value changes.
|
|
|
|
* @param {boolean|null|undefined} value - New value.
|
|
|
|
*/
|
2023-03-01 11:23:31 +00:00
|
|
|
'update:modelValue'(value: Nullable<boolean>): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 11:23:31 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - TriStateCheckbox**
|
|
|
|
*
|
|
|
|
* _TriStateCheckbox is used to select either 'true', 'false' or 'null' as the value._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/tristatecheckbox/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-03-01 11:23:31 +00:00
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
declare class TriStateCheckbox extends ClassComponent<TriStateCheckboxProps, TriStateCheckboxSlots, TriStateCheckboxEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
TriStateCheckbox: GlobalComponentConstructor<TriStateCheckbox>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TriStateCheckbox;
|