Web: Components: ContextMenuButton: Fixed property usage. Added new display type - "toggle". Fixed usage on clients.

This commit is contained in:
Ilya Oleshko 2023-04-25 13:57:49 +03:00
parent 9362331ecc
commit d798773f62
7 changed files with 15 additions and 23 deletions

View File

@ -159,7 +159,7 @@ const Tile = (props) => {
className="expandButton"
directionX="right"
getData={getOptions}
isNew={true}
displayType="toggle"
onClick={onContextMenu}
title={title}
/>

View File

@ -81,7 +81,7 @@ const ItemContextOptions = ({
onClick={onContextMenu}
getData={getData}
directionX="right"
isNew={true}
displayType="toggle"
/>
)}
</StyledItemContextOptions>
@ -90,13 +90,10 @@ const ItemContextOptions = ({
export default inject(({ filesStore, peopleStore, contextOptionsStore }) => {
const { getUserContextOptions } = peopleStore.contextOptionsStore;
const {
setBufferSelection,
getFilesContextOptions: getContextOptions,
} = filesStore;
const {
getFilesContextOptions: getContextOptionActions,
} = contextOptionsStore;
const { setBufferSelection, getFilesContextOptions: getContextOptions } =
filesStore;
const { getFilesContextOptions: getContextOptionActions } =
contextOptionsStore;
return {
setBufferSelection,

View File

@ -679,7 +679,7 @@ class Tile extends React.PureComponent {
className="expandButton"
directionX="right"
getData={getOptions}
isNew={true}
displayType="toggle"
onClick={onContextMenu}
title={title}
/>
@ -772,7 +772,7 @@ class Tile extends React.PureComponent {
className="expandButton"
directionX="right"
getData={getOptions}
isNew={true}
displayType="toggle"
onClick={onContextMenu}
title={title}
/>
@ -851,7 +851,7 @@ class Tile extends React.PureComponent {
className="expandButton"
directionX="right"
getData={getOptions}
isNew={true}
displayType="toggle"
onClick={onContextMenu}
title={title}
/>

View File

@ -62,6 +62,7 @@ const Template = (args) => {
export const Default = Template.bind({});
Default.args = {
title: "Actions",
displayType: "dropdown",
iconName: VerticalDotsReactSvgUrl,
size: 16,
directionX: "left",

View File

@ -86,7 +86,7 @@ class ContextMenuButton extends React.Component {
}
onIconButtonClick = (e) => {
if (this.props.isDisabled || this.props.isNew) {
if (this.props.isDisabled || this.state.displayType === "toggle") {
this.stopAction;
return;
}
@ -131,7 +131,7 @@ class ContextMenuButton extends React.Component {
}
callNewMenu = (e) => {
if (this.props.isDisabled || !this.props.isNew) {
if (this.props.isDisabled || this.state.displayType !== "toggle") {
this.stopAction;
return;
}
@ -168,7 +168,6 @@ class ContextMenuButton extends React.Component {
style,
isFill, // eslint-disable-line react/prop-types
asideHeader, // eslint-disable-line react/prop-types
isNew,
title,
zIndex,
usePortal,
@ -329,11 +328,7 @@ ContextMenuButton.propTypes = {
/** Sets the number of columns */
columnCount: PropTypes.number,
/** Sets the display type */
displayType: PropTypes.string,
// TODO: rename prop
/** Switches to the new view mode */
// isNew: PropTypes.bool,
displayType: PropTypes.oneOf(["dropdown", "toggle", "aside", "auto"]),
/** Closing event */
onClose: PropTypes.func,
/** Sets the drop down open with the portal */
@ -356,7 +351,6 @@ ContextMenuButton.defaultProps = {
directionX: "left",
isFill: false,
displayType: "dropdown",
isNew: false,
usePortal: true,
displayIconBorder: false,
};

View File

@ -166,7 +166,7 @@ class Row extends React.Component {
className="expandButton"
getData={getOptions}
directionX="right"
isNew={true}
displayType="toggle"
onClick={onContextMenu}
/>
) : (

View File

@ -65,7 +65,7 @@ const TableRow = (props) => {
className="expandButton"
getData={getOptions}
directionX="right"
isNew={true}
displayType="toggle"
onClick={onContextMenu}
onClose={onHideContextMenu}
title={title}