From ee6f59fcf37db2e66f5f0ea8d8930f88d39b1fac 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: Mon, 24 Apr 2023 12:32:20 +0300 Subject: [PATCH] Refactor #3879 - For BlockUI --- api-generator/components/blockui.js | 6 ++++ components/lib/blockui/BlockUI.d.ts | 44 +++++++++++++++++++++++++++++ components/lib/blockui/BlockUI.vue | 4 ++- 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/api-generator/components/blockui.js b/api-generator/components/blockui.js index 73deaf34c..d355deac8 100644 --- a/api-generator/components/blockui.js +++ b/api-generator/components/blockui.js @@ -22,6 +22,12 @@ const BlockUIProps = [ type: 'boolean', default: 'true', description: 'Whether to automatically manage layering.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/blockui/BlockUI.d.ts b/components/lib/blockui/BlockUI.d.ts index 5ca626cf1..a9d5f8c5d 100755 --- a/components/lib/blockui/BlockUI.d.ts +++ b/components/lib/blockui/BlockUI.d.ts @@ -10,6 +10,45 @@ import { VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type BlockUIPassThroughOptionType = BlockUIPassThroughAttributes | ((options: BlockUIPassThroughMethodOptions) => BlockUIPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface BlockUIPassThroughMethodOptions { + props: BlockUIProps; + state: BlockUIState; +} + +/** + * Custom passthrough(pt) options. + * @see {@link BlockUIProps.pt} + */ +export interface BlockUIPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: BlockUIPassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface BlockUIPassThroughAttributes { + [key: string]: any; +} + +/** + * Defines current inline state in BlockUI component. + */ +export interface BlockUIState { + /** + * Current blocked state as a boolean. + * @defaultValue false + */ + isBlocked: boolean; +} + /** * Defines valid properties in BlockUI component */ @@ -34,6 +73,11 @@ export interface BlockUIProps { * @defaultValue true */ autoZIndex?: boolean | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {BlockUIPassThroughOptions} + */ + pt?: BlockUIPassThroughOptions; } /** diff --git a/components/lib/blockui/BlockUI.vue b/components/lib/blockui/BlockUI.vue index 7c3eb981b..1d34bd7f1 100755 --- a/components/lib/blockui/BlockUI.vue +++ b/components/lib/blockui/BlockUI.vue @@ -1,14 +1,16 @@