From e1c7806c2d65c5c27b81a64a53fa7a06e286cb69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Thu, 13 Jul 2023 15:42:41 +0300 Subject: [PATCH] Refactor #4124 - InputText pt context improvements --- components/lib/inputtext/InputText.d.ts | 27 ++++++++++++++++++++++++- components/lib/inputtext/InputText.vue | 3 ++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/components/lib/inputtext/InputText.d.ts b/components/lib/inputtext/InputText.d.ts index f57e418c8..616db110e 100755 --- a/components/lib/inputtext/InputText.d.ts +++ b/components/lib/inputtext/InputText.d.ts @@ -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. */ diff --git a/components/lib/inputtext/InputText.vue b/components/lib/inputtext/InputText.vue index 33eea8556..1f2077a9d 100755 --- a/components/lib/inputtext/InputText.vue +++ b/components/lib/inputtext/InputText.vue @@ -21,7 +21,8 @@ export default { ptmParams() { return { context: { - filled: this.filled + filled: this.filled, + disabled: this.$attrs.disabled || this.$attrs.disabled === '' } }; }