From 35569020b4cba380c4b48e60fe189b1ebc688cde Mon Sep 17 00:00:00 2001 From: dzonidoo Date: Wed, 28 Jun 2023 11:22:10 +0200 Subject: [PATCH 1/3] remove zIndex --- scripts/apps/search/components/fields/authors.tsx | 1 - scripts/apps/search/components/fields/translations.tsx | 2 +- scripts/core/ArticlesListByQueryWithFilters.tsx | 4 ++-- scripts/validate-instance-configuration.tsx | 1 - 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/apps/search/components/fields/authors.tsx b/scripts/apps/search/components/fields/authors.tsx index d1916e212d..8d4e61468c 100644 --- a/scripts/apps/search/components/fields/authors.tsx +++ b/scripts/apps/search/components/fields/authors.tsx @@ -110,7 +110,6 @@ export class Authors extends SuperdeskReactComponent { title={gettext('Authors')} placement="bottom-end" triggerSelector="#more-authors-button" - zIndex={1031} > diff --git a/scripts/apps/search/components/fields/translations.tsx b/scripts/apps/search/components/fields/translations.tsx index 45ec2257d3..eed8767338 100644 --- a/scripts/apps/search/components/fields/translations.tsx +++ b/scripts/apps/search/components/fields/translations.tsx @@ -2,7 +2,7 @@ import React from 'react'; import {gettext, gettextPlural} from 'core/utils'; import {IArticle} from 'superdesk-api'; import {TranslationsListWrapper} from '../translations-list-wrapper'; -import {showPopup} from 'core/ui/components/popup'; +import {showPopup} from ''; interface IProps { item: IArticle; diff --git a/scripts/core/ArticlesListByQueryWithFilters.tsx b/scripts/core/ArticlesListByQueryWithFilters.tsx index 5c26d710ec..6f4eefdcbf 100644 --- a/scripts/core/ArticlesListByQueryWithFilters.tsx +++ b/scripts/core/ArticlesListByQueryWithFilters.tsx @@ -230,7 +230,7 @@ export class ArticlesListByQueryWithFilters extends React.PureComponent {(dimensions) => ( - + {getTypeFilteringComponent(dimensions.width < COMPACT_WIDTH)} { return (
- +

{issues[0]} From d95f9e3f84d6c8b0b221ae8b1a9199a12fa2f638 Mon Sep 17 00:00:00 2001 From: dzonidoo Date: Wed, 28 Jun 2023 13:09:06 +0200 Subject: [PATCH 2/3] delete file popup.tsx and fix imports --- .../search/components/fields/translations.tsx | 3 +- scripts/core/ui/components/popup.tsx | 122 ------------------ 2 files changed, 1 insertion(+), 124 deletions(-) delete mode 100644 scripts/core/ui/components/popup.tsx diff --git a/scripts/apps/search/components/fields/translations.tsx b/scripts/apps/search/components/fields/translations.tsx index eed8767338..b8463d0339 100644 --- a/scripts/apps/search/components/fields/translations.tsx +++ b/scripts/apps/search/components/fields/translations.tsx @@ -2,7 +2,7 @@ import React from 'react'; import {gettext, gettextPlural} from 'core/utils'; import {IArticle} from 'superdesk-api'; import {TranslationsListWrapper} from '../translations-list-wrapper'; -import {showPopup} from ''; +import {showPopup} from 'superdesk-ui-framework/react/components/ShowPopup'; interface IProps { item: IArticle; @@ -41,7 +41,6 @@ export class Translations extends React.PureComponent { close={closePopup} /> ), - 100, ); } diff --git a/scripts/core/ui/components/popup.tsx b/scripts/core/ui/components/popup.tsx deleted file mode 100644 index 8cdf5fdbaa..0000000000 --- a/scripts/core/ui/components/popup.tsx +++ /dev/null @@ -1,122 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import {throttle, once} from 'lodash'; -import {createPopper, Instance as PopperInstance, Placement} from '@popperjs/core/'; -import maxSize from 'popper-max-size-modifier'; -import {applyMaxSize} from './AutoCompleteSuggestions'; - -interface IPropsPositioner { - referenceElement: HTMLElement; - placement: Placement; - zIndex?: number; - onClose(): void; -} - -class PopupPositioner extends React.PureComponent { - private wrapperEl: HTMLDivElement; - private positionOnce: (el: HTMLElement) => void; - private popper: PopperInstance; - - constructor(props: IPropsPositioner) { - super(props); - - this.closeOnClick = this.closeOnClick.bind(this); - this.closeOnScroll = throttle(this.closeOnScroll.bind(this), 200); - } - - closeOnClick(event: MouseEvent) { - if (this.wrapperEl == null) { - return; - } - - if ( - this.props.referenceElement.contains(event.target as Node) !== true - && this.wrapperEl.contains(event.target as Node) !== true - ) { - this.props.onClose(); - } - } - - closeOnScroll(event: MouseEvent) { - if (this.wrapperEl == null) { - return; - } - - if (this.wrapperEl.contains(event.target as Node) !== true) { - this.props.onClose(); - } - } - - componentDidMount() { - window.addEventListener('click', this.closeOnClick); - window.addEventListener('scroll', this.closeOnScroll, true); - - if (this.wrapperEl != null) { - this.popper = createPopper( - this.props.referenceElement, - this.wrapperEl, - { - placement: 'bottom', - modifiers: [maxSize, applyMaxSize], - }, - ); - } - } - - componentWillUnmount() { - window.removeEventListener('click', this.closeOnClick); - window.removeEventListener('scroll', this.closeOnScroll, true); - - this.popper.destroy?.(); - } - - render() { - return ( -
{ - this.wrapperEl = el; - }} - style={{zIndex: this.props.zIndex ?? 1}} - > - {this.props.children} -
- ); - } -} - -/** - * The popup will remove itself if click/scroll events are detected outside the popup. - */ -export function showPopup( - referenceElement: HTMLElement, - placement: Placement, - Component: React.ComponentType<{closePopup(): void}>, - zIndex?: number, -) { - const el = document.createElement('div'); - - document.body.appendChild(el); - - const onClose = () => { - ReactDOM.unmountComponentAtNode(el); - el.remove(); - }; - - ReactDOM.render( - ( - - - - ), - el, - ); - - return Promise.resolve(); -} From 5f413d70ec8bb7287be1c7babbeed0cefeb9b072 Mon Sep 17 00:00:00 2001 From: dzonidoo Date: Wed, 28 Jun 2023 14:21:47 +0200 Subject: [PATCH 3/3] remove zIndex property from search --- .../src/ImageTaggingComponent/ImageTaggingComponent.tsx | 1 - .../extensions/sams/src/components/sets/manageSetsModal.tsx | 2 +- scripts/extensions/sams/src/components/workspaceSubnav.tsx | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx b/scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx index 8ac712b91e..a4ed85bd9d 100644 --- a/scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx +++ b/scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx @@ -292,7 +292,6 @@ export class ImageTagging extends React.PureComponent { title={gettext('Information')} placement="bottom-end" triggerSelector="#image-suggestions-info-btn" - zIndex={999} > {gettext( 'Image suggestions are based on generated tags' diff --git a/scripts/extensions/sams/src/components/sets/manageSetsModal.tsx b/scripts/extensions/sams/src/components/sets/manageSetsModal.tsx index 2ae3e6c3d2..6816b5c737 100644 --- a/scripts/extensions/sams/src/components/sets/manageSetsModal.tsx +++ b/scripts/extensions/sams/src/components/sets/manageSetsModal.tsx @@ -100,7 +100,7 @@ export class ManageSetsModalComponent extends React.PureComponent { > +

) : ( - +