Refactor #3879 - For BlockUI
parent
5f18c9b3b2
commit
ee6f59fcf3
|
@ -22,6 +22,12 @@ const BlockUIProps = [
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: 'true',
|
default: 'true',
|
||||||
description: 'Whether to automatically manage layering.'
|
description: 'Whether to automatically manage layering.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'pt',
|
||||||
|
type: 'any',
|
||||||
|
default: 'null',
|
||||||
|
description: 'Uses to pass attributes to DOM elements inside the component.'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,45 @@
|
||||||
import { VNode } from 'vue';
|
import { VNode } from 'vue';
|
||||||
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
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
|
* Defines valid properties in BlockUI component
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +73,11 @@ export interface BlockUIProps {
|
||||||
* @defaultValue true
|
* @defaultValue true
|
||||||
*/
|
*/
|
||||||
autoZIndex?: boolean | undefined;
|
autoZIndex?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to DOM elements inside the component.
|
||||||
|
* @type {BlockUIPassThroughOptions}
|
||||||
|
*/
|
||||||
|
pt?: BlockUIPassThroughOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
<template>
|
<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>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import BaseComponent from 'primevue/basecomponent';
|
||||||
import { DomHandler, ZIndexUtils } from 'primevue/utils';
|
import { DomHandler, ZIndexUtils } from 'primevue/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BlockUI',
|
name: 'BlockUI',
|
||||||
|
extends: BaseComponent,
|
||||||
emits: ['block', 'unblock'],
|
emits: ['block', 'unblock'],
|
||||||
props: {
|
props: {
|
||||||
blocked: {
|
blocked: {
|
||||||
|
|
Loading…
Reference in New Issue