Refactor #3879 - For BlockUI

pull/3892/head
Tuğçe Küçükoğlu 2023-04-24 12:32:20 +03:00
parent 5f18c9b3b2
commit ee6f59fcf3
3 changed files with 53 additions and 1 deletions

View File

@ -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.'
}
];

View File

@ -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;
}
/**

View File

@ -1,14 +1,16 @@
<template>
<div ref="container" class="p-blockui-container" :aria-busy="isBlocked">
<div ref="container" class="p-blockui-container" :aria-busy="isBlocked" v-bind="ptm('root')">
<slot></slot>
</div>
</template>
<script>
import BaseComponent from 'primevue/basecomponent';
import { DomHandler, ZIndexUtils } from 'primevue/utils';
export default {
name: 'BlockUI',
extends: BaseComponent,
emits: ['block', 'unblock'],
props: {
blocked: {