superdesk-ui-framework 3.0.30 → 3.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import { Dialog as PrimeDialog } from '@superdesk/primereact/dialog';
3
3
  import classNames from 'classnames';
4
+ import {noop} from 'lodash';
4
5
 
5
6
  interface IProps {
6
7
  id?: string;
7
8
  className?: string;
8
9
  theme?: string;
9
10
  visible?: boolean;
11
+ zIndex?: number;
12
+ closeOnEscape?: boolean;
10
13
  contentBg?: 'default' | 'medium' | 'dark';
11
14
  contentPadding?: 'none' | 'small' | 'medium' | 'large';
12
15
  size?: 'small' | 'medium' | 'large' | 'x-large';
@@ -15,10 +18,8 @@ interface IProps {
15
18
  maximizable?: boolean;
16
19
  headerTemplate?: JSX.Element | string;
17
20
  footerTemplate?: JSX.Element | string;
18
- closeOnEscape?: boolean;
19
- zIndex?: number;
20
21
  onShow?(): void;
21
- onHide(): void;
22
+ onHide?(): void;
22
23
  }
23
24
 
24
25
  export class Modal extends React.Component<IProps, {}> {
@@ -43,9 +44,10 @@ export class Modal extends React.Component<IProps, {}> {
43
44
  maximizable={this.props.maximizable}
44
45
  contentClassName={classes}
45
46
  onShow={this.props.onShow}
46
- onHide={this.props.onHide}
47
+ onHide={this.props.onHide ?? noop}
47
48
  zIndex={this.props.zIndex ? this.props.zIndex : 1000}
48
49
  position={this.props.position}
50
+ closable={this.props.onHide != null ? true : false}
49
51
  >
50
52
  {this.props.children}
51
53
  </PrimeDialog>
@@ -132,11 +132,10 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
132
132
  componentDidMount = () => {
133
133
  this.recursion(this.state.options);
134
134
  document.addEventListener("mousedown", (event) => {
135
- if (!(event.target instanceof HTMLInputElement)) {
136
- return;
137
- }
138
- if ((this.dropdownRef.current && !this.dropdownRef.current.contains(event.target))
139
- && (this.openDropdownRef.current && !this.openDropdownRef.current.contains(event.target))) {
135
+ if (
136
+ (this.dropdownRef.current?.contains(event.target as HTMLElement) !== true)
137
+ && (this.openDropdownRef.current?.contains(event.target as HTMLElement) !== true)
138
+ ) {
140
139
  this.setState({openDropdown: false});
141
140
  }
142
141
  });
@@ -150,6 +149,7 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
150
149
  );
151
150
  if (e.key === 'Backspace') {
152
151
  this.backButton();
152
+ this.backButtonValue();
153
153
 
154
154
  const {buttonTarget} = this.state;
155
155
  const className = buttonTarget.pop();