Refactor #4124 - InputText pt context improvements

pull/4148/head
Tuğçe Küçükoğlu 2023-07-13 15:42:41 +03:00
parent 02f67d1b0f
commit e1c7806c2d
2 changed files with 28 additions and 2 deletions

View File

@ -11,7 +11,16 @@ import { InputHTMLAttributes } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { ClassComponent, GlobalComponentConstructor, Nullable } from '../ts-helpers';
export declare type InputTextPassThroughOptionType = InputTextPassThroughAttributes | null | undefined;
export declare type InputTextPassThroughOptionType = InputTextPassThroughAttributes | ((options: InputTextPassThroughMethodOptions) => InputTextPassThroughAttributes | string) | string | null | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface InputTextPassThroughMethodOptions {
instance: any;
props: InputTextProps;
context: InputTextContext;
}
/**
* Custom passthrough(pt) options.
@ -36,6 +45,22 @@ export interface InputTextPassThroughAttributes {
[key: string]: any;
}
/**
* Defines current options in InputText component.
*/
export interface InputTextContext {
/**
* Current filled state of the component as a boolean.
* @defaultValue false
*/
filled: boolean;
/**
* Current disabled state of the component as a boolean.
* @defaultValue false
*/
disabled: boolean;
}
/**
* Defines valid properties in InputText component.
*/

View File

@ -21,7 +21,8 @@ export default {
ptmParams() {
return {
context: {
filled: this.filled
filled: this.filled,
disabled: this.$attrs.disabled || this.$attrs.disabled === ''
}
};
}