2023-02-28 08:29:30 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Knob is a form component to define number inputs with a dial.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/knob/)
|
|
|
|
*
|
|
|
|
* @module knob
|
|
|
|
*
|
|
|
|
*/
|
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, PassThrough } from '../ts-helpers';
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-07-11 22:42:43 +00:00
|
|
|
export declare type KnobPassThroughOptionType = KnobPassThroughAttributes | ((options: KnobPassThroughMethodOptions) => KnobPassThroughAttributes | string) | string | null | undefined;
|
2023-05-05 14:13:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface KnobPassThroughMethodOptions {
|
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-05 14:13:58 +00:00
|
|
|
props: KnobProps;
|
2023-09-05 06:50:04 +00:00
|
|
|
/**
|
|
|
|
* Defines current inline state.
|
|
|
|
*/
|
2023-05-05 14:13:58 +00:00
|
|
|
state: KnobState;
|
2023-12-10 21:41:17 +00:00
|
|
|
/**
|
|
|
|
* Defines valid attributes.
|
|
|
|
*/
|
|
|
|
attrs: any;
|
2023-12-05 11:06:32 +00:00
|
|
|
/**
|
|
|
|
* Defines parent options.
|
|
|
|
*/
|
|
|
|
parent: any;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Defines passthrough(pt) options in global config.
|
|
|
|
*/
|
|
|
|
global: object | undefined;
|
2023-05-05 14:13:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link KnobProps.pt}
|
|
|
|
*/
|
|
|
|
export interface KnobPassThroughOptions {
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the root's DOM element.
|
2023-05-05 14:13:58 +00:00
|
|
|
*/
|
|
|
|
root?: KnobPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the svg's DOM element.
|
2023-05-05 14:13:58 +00:00
|
|
|
*/
|
|
|
|
svg?: KnobPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the range's DOM element.
|
2023-05-05 14:13:58 +00:00
|
|
|
*/
|
|
|
|
range?: KnobPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the value' DOM element.
|
2023-05-05 14:13:58 +00:00
|
|
|
*/
|
|
|
|
value?: KnobPassThroughOptionType;
|
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to the label's DOM element.
|
2023-05-05 14:13:58 +00:00
|
|
|
*/
|
|
|
|
label?: KnobPassThroughOptionType;
|
2023-07-06 11:09:01 +00:00
|
|
|
/**
|
2023-11-07 06:16:39 +00:00
|
|
|
* Used to manage all lifecycle hooks.
|
2023-07-06 11:09:01 +00:00
|
|
|
* @see {@link BaseComponent.ComponentHooks}
|
|
|
|
*/
|
|
|
|
hooks?: ComponentHooks;
|
2023-05-05 14:13:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface KnobPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in Knob component.
|
|
|
|
*/
|
|
|
|
export interface KnobState {
|
|
|
|
/**
|
|
|
|
* Current radius state as a number.
|
|
|
|
* @defaultValue 40
|
|
|
|
*/
|
|
|
|
radius: number;
|
|
|
|
/**
|
|
|
|
* Current middle x axis state as a number.
|
|
|
|
* @defaultValue 50
|
|
|
|
*/
|
|
|
|
midX: number;
|
|
|
|
/**
|
|
|
|
* Current middle y axis state as a number.
|
|
|
|
* @defaultValue 50
|
|
|
|
*/
|
|
|
|
midY: number;
|
|
|
|
/**
|
|
|
|
* Current minimum radian state as a number.
|
|
|
|
*/
|
|
|
|
minRadians: number;
|
|
|
|
/**
|
|
|
|
* Current maximum radian state as a number.
|
|
|
|
*/
|
|
|
|
maxRadians: number;
|
|
|
|
}
|
|
|
|
|
2023-02-28 08:29:30 +00:00
|
|
|
/**
|
2023-03-01 08:45:08 +00:00
|
|
|
* Defines valid properties in Knob component.
|
2023-02-28 08:29:30 +00:00
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface KnobProps {
|
|
|
|
/**
|
|
|
|
* Value of the component.
|
|
|
|
*/
|
|
|
|
modelValue?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Size of the component in pixels.
|
2023-02-28 08:29:30 +00:00
|
|
|
* @defaultValue 100
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
size?: number | undefined;
|
|
|
|
/**
|
|
|
|
* When present, it specifies that the component should be disabled.
|
2023-03-01 08:45:08 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
disabled?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* When present, it specifies that the component value cannot be edited.
|
2023-03-01 08:45:08 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
readonly?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Step factor to increment/decrement the value.
|
2023-03-01 08:45:08 +00:00
|
|
|
* @defaultValue 1
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
step?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Mininum boundary value.
|
2023-02-28 08:29:30 +00:00
|
|
|
* @defaultValue 0
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
min?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Maximum boundary value.
|
2023-02-28 08:29:30 +00:00
|
|
|
* @defaultValue 100
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
max?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Background of the value.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue var(--primary-color, Black)
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
valueColor?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Background color of the range.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue var(--surface-border, LightGray)
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
rangeColor?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Color of the value text.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue var(--text-color-secondary, Black)
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
textColor?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Width of the knob stroke.
|
2023-03-01 08:45:08 +00:00
|
|
|
* @defaultValue 14
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
strokeWidth?: number | undefined;
|
|
|
|
/**
|
|
|
|
* Whether the show the value inside the knob.
|
2023-03-01 08:45:08 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
showValue?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Template string of the value.
|
2024-04-19 09:16:26 +00:00
|
|
|
* @defaultValue '{value}'
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2024-04-11 21:52:30 +00:00
|
|
|
valueTemplate?: (val: number) => string | string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Index of the element in tabbing order.
|
2023-03-01 08:45:08 +00:00
|
|
|
* @defaultValue 0
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
tabindex?: number | undefined;
|
|
|
|
/**
|
2022-09-14 11:26:01 +00:00
|
|
|
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
|
|
|
|
*/
|
2023-11-24 12:21:54 +00:00
|
|
|
ariaLabelledby?: string | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
2022-09-14 11:26:01 +00:00
|
|
|
* Used to define a string that labels the element.
|
|
|
|
*/
|
2023-11-24 12:21:54 +00:00
|
|
|
ariaLabel?: string | undefined;
|
2023-05-05 14:13:58 +00:00
|
|
|
/**
|
2023-08-01 14:01:12 +00:00
|
|
|
* Used to pass attributes to DOM elements inside the component.
|
2023-05-05 14:13:58 +00:00
|
|
|
* @type {KnobPassThroughOptions}
|
|
|
|
*/
|
2023-09-05 11:28:04 +00:00
|
|
|
pt?: PassThrough<KnobPassThroughOptions>;
|
2023-09-05 08:50:46 +00:00
|
|
|
/**
|
|
|
|
* Used to configure passthrough(pt) options of the component.
|
|
|
|
* @type {PassThroughOptions}
|
|
|
|
*/
|
|
|
|
ptOptions?: PassThroughOptions;
|
2023-05-24 12:19:17 +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-02-28 08:29:30 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in Knob component.
|
|
|
|
*/
|
2022-09-14 11:26:01 +00:00
|
|
|
export interface KnobSlots {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-02-28 08:29:30 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in Knob component.
|
|
|
|
*/
|
|
|
|
export interface KnobEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the value changes.
|
2023-02-28 08:29:30 +00:00
|
|
|
* @param {number} event - New value.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-02-28 08:29:30 +00:00
|
|
|
'update:modelValue'(value: number): void;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Callback to invoke when the value changes.
|
2023-02-28 08:29:30 +00:00
|
|
|
* @param {number} event - New value
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-02-28 08:29:30 +00:00
|
|
|
change(value: number): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-02-28 08:29:30 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - Knob**
|
|
|
|
*
|
|
|
|
* _Knob groups a collection of contents in tabs._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/knob/)
|
|
|
|
* --- ---
|
2023-03-03 10:55:20 +00:00
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
2023-02-28 08:29:30 +00:00
|
|
|
*
|
|
|
|
*/
|
2023-03-01 14:48:23 +00:00
|
|
|
declare class Knob extends ClassComponent<KnobProps, KnobSlots, KnobEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2024-03-14 22:58:11 +00:00
|
|
|
declare module 'vue' {
|
|
|
|
export interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
Knob: GlobalComponentConstructor<Knob>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Knob;
|