Skip to content

Commit

Permalink
Refactor #3879 - For BlockUI
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Apr 24, 2023
1 parent 5f18c9b commit ee6f59f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
6 changes: 6 additions & 0 deletions api-generator/components/blockui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
}
];

Expand Down
44 changes: 44 additions & 0 deletions components/lib/blockui/BlockUI.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion components/lib/blockui/BlockUI.vue
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down

0 comments on commit ee6f59f

Please sign in to comment.