From 090c60abc2c5f264ecb2425476c68391ff7f43d3 Mon Sep 17 00:00:00 2001
From: melloware
Date: Mon, 21 Nov 2022 16:32:11 -0500
Subject: [PATCH] Fix #3683: BlockUI add containerStyle, containerClassName
---
api-generator/components/blockui.js | 12 +++++++
components/doc/blockui/index.js | 18 ++++++++--
components/lib/blockui/BlockUI.js | 19 +++++-----
components/lib/blockui/BlockUI.spec.js | 6 ++++
.../__snapshots__/BlockUI.spec.js.snap | 35 +++++++++++++++++++
components/lib/blockui/blockui.d.ts | 8 +++--
6 files changed, 84 insertions(+), 14 deletions(-)
diff --git a/api-generator/components/blockui.js b/api-generator/components/blockui.js
index e674937f4e..1517d52ff0 100644
--- a/api-generator/components/blockui.js
+++ b/api-generator/components/blockui.js
@@ -41,6 +41,18 @@ const BlockUIProps = [
default: 'null',
description: 'Inline style of the element.'
},
+ {
+ name: 'containerClassName',
+ type: 'string',
+ default: 'null',
+ description: 'Style class of the container element.'
+ },
+ {
+ name: 'containerStyle',
+ type: 'React.CSSProperties',
+ default: 'null',
+ description: 'Inline style of the container element.'
+ },
{
name: 'template',
type: 'any',
diff --git a/components/doc/blockui/index.js b/components/doc/blockui/index.js
index c0bf7193a7..c42da3b88f 100644
--- a/components/doc/blockui/index.js
+++ b/components/doc/blockui/index.js
@@ -1,9 +1,9 @@
-import React, { memo } from 'react';
import Link from 'next/link';
-import { TabView, TabPanel } from '../../lib/tabview/TabView';
-import { useLiveEditorTabs } from '../common/liveeditor';
+import React, { memo } from 'react';
+import { TabPanel, TabView } from '../../lib/tabview/TabView';
import { CodeHighlight } from '../common/codehighlight';
import { DevelopmentSection } from '../common/developmentsection';
+import { useLiveEditorTabs } from '../common/liveeditor';
const BlockUIDoc = memo(() => {
const sources = {
@@ -437,6 +437,18 @@ export const BlockUIDemo = () => {
null |
Inline style of the element. |
+
+ containerClassName |
+ string |
+ null |
+ Style class of the container element. |
+
+
+ containerStyle |
+ React.CSSProperties |
+ null |
+ Inline style of the container element. |
+
template |
any |
diff --git a/components/lib/blockui/BlockUI.js b/components/lib/blockui/BlockUI.js
index 730b58ef0d..71a8d4ea1c 100644
--- a/components/lib/blockui/BlockUI.js
+++ b/components/lib/blockui/BlockUI.js
@@ -95,9 +95,10 @@ export const BlockUI = React.forwardRef((props, ref) => {
const otherProps = ObjectUtils.findDiffKeys(props, BlockUI.defaultProps);
const mask = createMask();
+ const className = classNames('p-blockui-container', props.containerClassName);
return (
-
+
{props.children}
{mask}
@@ -107,14 +108,16 @@ export const BlockUI = React.forwardRef((props, ref) => {
BlockUI.displayName = 'BlockUI';
BlockUI.defaultProps = {
__TYPE: 'BlockUI',
- id: null,
- blocked: false,
- fullScreen: false,
- baseZIndex: 0,
autoZIndex: true,
- style: null,
+ baseZIndex: 0,
+ blocked: false,
className: null,
- template: null,
+ containerClassName: null,
+ containerStyle: null,
+ fullScreen: false,
+ id: null,
onBlocked: null,
- onUnblocked: null
+ onUnblocked: null,
+ style: null,
+ template: null
};
diff --git a/components/lib/blockui/BlockUI.spec.js b/components/lib/blockui/BlockUI.spec.js
index 5df296fe68..3ba2ab8b9d 100644
--- a/components/lib/blockui/BlockUI.spec.js
+++ b/components/lib/blockui/BlockUI.spec.js
@@ -66,4 +66,10 @@ describe('BlockUI', () => {
// Assert
expect(container.parentElement).toMatchSnapshot('unblocked-event-fullscreen');
});
+ snapshotParent(
+
+ style + class
+ ,
+ 'container style and className'
+ );
});
diff --git a/components/lib/blockui/__snapshots__/BlockUI.spec.js.snap b/components/lib/blockui/__snapshots__/BlockUI.spec.js.snap
index a311c73818..6bc9fac61f 100644
--- a/components/lib/blockui/__snapshots__/BlockUI.spec.js.snap
+++ b/components/lib/blockui/__snapshots__/BlockUI.spec.js.snap
@@ -142,6 +142,41 @@ exports[`BlockUI block panel 1`] = `
+
+ React.ReactNode);
export interface BlockUIProps extends Omit, HTMLDivElement>, 'ref'> {
+ autoZIndex?: boolean;
+ baseZIndex?: number;
blocked?: boolean;
+ children?: React.ReactNode;
+ containerClassName?: string;
+ containerStyle?: React.CSSProperties;
fullScreen?: boolean;
- baseZIndex?: number;
- autoZIndex?: boolean;
template?: BlockUITemplateType;
onBlocked?(): void;
onUnblocked?(): void;
- children?: React.ReactNode;
}
export declare class BlockUI extends React.Component {