From 68f65229b438e546d5a233d1cacedd6ece4a0ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ula=C5=9F=20Turan?= Date: Tue, 22 Aug 2023 09:33:09 +0300 Subject: [PATCH] Related #4352, #4602 - For Misc --- components/lib/avatar/Avatar.js | 12 +++++++-- components/lib/avatar/avatar.d.ts | 17 ++++++++++++ components/lib/blockui/BlockUI.js | 11 ++++++-- components/lib/blockui/BlockUIBase.js | 5 ---- components/lib/editor/Editor.js | 28 ++++++++++---------- components/lib/editor/EditorBase.js | 14 ---------- components/lib/passthrough/tailwind/index.js | 8 +++--- 7 files changed, 54 insertions(+), 41 deletions(-) diff --git a/components/lib/avatar/Avatar.js b/components/lib/avatar/Avatar.js index f76162a866..d1d4a53314 100644 --- a/components/lib/avatar/Avatar.js +++ b/components/lib/avatar/Avatar.js @@ -1,7 +1,7 @@ import * as React from 'react'; import { PrimeReactContext } from '../api/Api'; import { useHandleStyle } from '../componentbase/ComponentBase'; -import { IconUtils, ObjectUtils, classNames, mergeProps } from '../utils/Utils'; +import { DomHandler, IconUtils, ObjectUtils, classNames, mergeProps } from '../utils/Utils'; import { AvatarBase } from './AvatarBase'; export const Avatar = React.forwardRef((inProps, ref) => { @@ -10,11 +10,13 @@ export const Avatar = React.forwardRef((inProps, ref) => { const elementRef = React.useRef(null); const [imageFailed, setImageFailed] = React.useState(false); + const [isNestedInAvatarGroup, setisNestedInAvatarGroup] = React.useState(false); const { ptm, cx, isUnstyled } = AvatarBase.setMetaData({ props, state: { - imageFailed: imageFailed + imageFailed: imageFailed, + isNestedInAvatarGroup } }); @@ -69,6 +71,12 @@ export const Avatar = React.forwardRef((inProps, ref) => { props.onImageError && props.onImageError(event); }; + React.useEffect(() => { + const isInAG = DomHandler.isAttributeEquals(elementRef.current.parentElement, 'data-pc-name', 'avatargroup'); + + setisNestedInAvatarGroup(isInAG); + },[]) + React.useImperativeHandle(ref, () => ({ props, getElement: () => elementRef.current diff --git a/components/lib/avatar/avatar.d.ts b/components/lib/avatar/avatar.d.ts index c73deec4a9..10ade60a30 100644 --- a/components/lib/avatar/avatar.d.ts +++ b/components/lib/avatar/avatar.d.ts @@ -16,6 +16,23 @@ export declare type AvatarPassThroughType = PassThroughType { if (visibleState) { const appendTo = props.fullScreen ? document.body : 'self'; const maskProps = - ({ + mergeProps({ className: cx('mask'), - style: props.style + style: { + ...props.style, + position: props.fullScreen ? 'fixed' : 'absolute', + top: '0', + left: '0', + width: '100%', + height: '100%' + } }, ptm('mask')); const content = props.template ? ObjectUtils.getJSXElement(props.template, props) : null; diff --git a/components/lib/blockui/BlockUIBase.js b/components/lib/blockui/BlockUIBase.js index 1d6296e499..f8fe26c6b0 100644 --- a/components/lib/blockui/BlockUIBase.js +++ b/components/lib/blockui/BlockUIBase.js @@ -19,11 +19,6 @@ const styles = ` } .p-blockui { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; opacity: 1; display: flex; align-items: center; diff --git a/components/lib/editor/Editor.js b/components/lib/editor/Editor.js index 485cb74faa..bbb70db7f2 100644 --- a/components/lib/editor/Editor.js +++ b/components/lib/editor/Editor.js @@ -162,35 +162,35 @@ export const Editor = React.memo( } else { const getMergeProps = (params, key) => mergeProps(params && { ...params }, ptm(key)); - const formatsProps = mergeProps({ className: cx('formats') }, ptm('formats')); + const formatsProps = mergeProps({ className: 'ql-formats' }, ptm('formats')); return (
- - - - - + + + - - + + - + - @@ -198,12 +198,12 @@ export const Editor = React.memo( - - - + + + - +
); diff --git a/components/lib/editor/EditorBase.js b/components/lib/editor/EditorBase.js index b6c6bc5c9b..d2eaa9a79a 100644 --- a/components/lib/editor/EditorBase.js +++ b/components/lib/editor/EditorBase.js @@ -4,20 +4,6 @@ import { classNames } from '../utils/Utils'; const classes = { root: ({ props }) => classNames('p-component p-editor-container', props.className), toolbar: 'p-editor-toolbar', - formats: 'ql-formats', - header: 'ql-header', - font: 'ql-font', - bold: 'ql-bold', - italic: 'ql-italic', - underline: 'ql-underline', - color: 'ql-color', - background: 'ql-background', - list: 'ql-list', - select: 'ql-align', - link: 'ql-link', - image: 'ql-image', - codeBlock: 'ql-code-block', - clean: 'ql-clean', content: 'p-editor-content' }; diff --git a/components/lib/passthrough/tailwind/index.js b/components/lib/passthrough/tailwind/index.js index 192c14671b..de5f7ea61d 100644 --- a/components/lib/passthrough/tailwind/index.js +++ b/components/lib/passthrough/tailwind/index.js @@ -1512,7 +1512,7 @@ const Tailwind = { }) }, avatar: { - root: ({ props, parent }) => ({ + root: ({ props, state }) => ({ className: classNames( 'flex items-center justify-center', 'bg-gray-300 dark:bg-gray-800', @@ -1524,10 +1524,10 @@ const Tailwind = { 'text-base h-8 w-8': props.size == null || props.size == 'normal', 'w-12 h-12 text-xl': props.size == 'large', 'w-16 h-16 text-2xl': props.size == 'xlarge' + }, + { + '-ml-4 border-2 border-white dark:border-gray-900': state.isNestedInAvatarGroup } - // { - // '-ml-4 border-2 border-white dark:border-gray-900': parent.instance !== undefined - // } ) }), image: 'h-full w-full'