Merge branch 'feature/virtual-rooms-1.2' into feature/hotkeys

# Conflicts:
#	products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js
#	products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js
This commit is contained in:
Nikita Gopienko 2022-03-10 10:16:01 +03:00
commit a00ed16990
8 changed files with 26 additions and 28 deletions

View File

@ -45,9 +45,8 @@ class ContextMenu extends Component {
};
show = (e) => {
if (this.props.contextMenuData) {
const { item, t, getModel } = this.props.contextMenuData;
const model = getModel(item, t);
if (this.props.getContextModel) {
const model = this.props.getContextModel();
this.setState({ model });
}
@ -328,7 +327,9 @@ class ContextMenu extends Component {
)}
<SubMenu
model={
this.props.contextMenuData ? this.state.model : this.props.model
this.props.getContextModel
? this.state.model
: this.props.model
}
root
resetMenu={this.state.resetMenu}
@ -385,7 +386,7 @@ ContextMenu.propTypes = {
containerRef: PropTypes.any,
/** Scale with by container component*/
scaled: PropTypes.bool,
contextMenuData: PropTypes.object,
getContextModel: PropTypes.func,
};
ContextMenu.defaultProps = {

View File

@ -34,7 +34,7 @@ class Row extends React.Component {
onSelect,
rowContextClick,
sectionWidth,
contextMenuData,
getContextModel,
} = this.props;
const renderCheckbox = Object.prototype.hasOwnProperty.call(
@ -128,7 +128,7 @@ class Row extends React.Component {
<div className="expandButton"> </div>
)}
<ContextMenu
contextMenuData={contextMenuData}
getContextModel={getContextModel}
model={contextData.contextOptions}
ref={this.cm}
header={contextMenuHeader}
@ -171,7 +171,7 @@ Row.propTypes = {
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
sectionWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
inProgress: PropTypes.bool,
contextMenuData: PropTypes.object,
getContextModel: PropTypes.func,
};
Row.defaultProps = {

View File

@ -15,7 +15,7 @@ const TableRow = (props) => {
style,
selectionProp,
title,
contextMenuData,
getContextModel,
...rest
} = props;
@ -31,10 +31,8 @@ const TableRow = (props) => {
};
const renderContext =
Object.prototype.hasOwnProperty.call(
contextMenuData ? contextMenuData.item : props,
"contextOptions"
) && contextOptions.length > 0;
Object.prototype.hasOwnProperty.call(props, "contextOptions") &&
contextOptions.length > 0;
const getOptions = () => {
fileContextClick && fileContextClick();
@ -59,7 +57,7 @@ const TableRow = (props) => {
onHide={onHideContextMenu}
ref={cm}
model={contextOptions}
contextMenuData={contextMenuData}
getContextModel={getContextModel}
withBackdrop={true}
></ContextMenu>
{renderContext ? (
@ -89,7 +87,7 @@ TableRow.propTypes = {
className: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
style: PropTypes.object,
title: PropTypes.string,
contextMenuData: PropTypes.object,
getContextModel: PropTypes.func,
};
export default TableRow;

View File

@ -124,6 +124,8 @@ export default function withFileActions(WrappedFileItem) {
openFileAction(item);
};
getContextModel = () => this.props.getModel(this.props.item, this.props.t);
render() {
const {
item,
@ -142,8 +144,6 @@ export default function withFileActions(WrappedFileItem) {
personal,
canWebEdit,
canViewedDocs,
getModel,
t,
} = this.props;
const { fileExst, access, id } = item;
@ -177,7 +177,6 @@ export default function withFileActions(WrappedFileItem) {
: true;
const checkedProps = isEdit || id <= 0 ? false : checked;
const contextMenuData = { getModel, t, item };
return (
<WrappedFileItem
@ -198,7 +197,7 @@ export default function withFileActions(WrappedFileItem) {
checkedProps={checkedProps}
dragging={dragging}
isEdit={isEdit}
contextMenuData={contextMenuData}
getContextModel={this.getContextModel}
{...this.props}
/>
);

View File

@ -195,7 +195,7 @@ const SimpleFilesRow = (props) => {
isActive,
inProgress,
isAdmin,
contextMenuData,
getContextModel,
} = props;
const withAccess = isAdmin || item.access === 0;
@ -244,7 +244,7 @@ const SimpleFilesRow = (props) => {
isThirdPartyFolder={item.isThirdPartyFolder}
className="files-row"
withAccess={withAccess}
contextMenuData={contextMenuData}
getContextModel={getContextModel}
showHotkeyBorder={showHotkeyBorder}
>
<FilesRowContent

View File

@ -264,7 +264,7 @@ const FilesTableRow = (props) => {
setFirsElemChecked,
theme,
quickButtonsComponent,
contextMenuData,
getContextModel,
showHotkeyBorder,
} = props;
const { acceptBackground, background } = theme.dragAndDrop;
@ -342,7 +342,7 @@ const FilesTableRow = (props) => {
onDoubleClick={onFilesClick}
checked={checkedProps}
contextOptions={item.contextOptions}
contextMenuData={contextMenuData}
getContextModel={getContextModel}
showHotkeyBorder={showHotkeyBorder}
title={
item.isFolder

View File

@ -37,7 +37,7 @@ const FileTile = (props) => {
showHotkeyBorder,
badgesComponent,
t,
getModel,
getContextModel,
} = props;
const temporaryExtension =
@ -87,7 +87,7 @@ const FileTile = (props) => {
isActive={isActive}
inProgress={inProgress}
isEdit={isEdit}
getModel={getModel}
getContextModel={getContextModel}
t={t}
title={
item.isFolder

View File

@ -353,7 +353,7 @@ class Tile extends React.PureComponent {
isEdit,
contentElement,
title,
contextMenuData,
getContextModel,
} = this.props;
const { isFolder, id, fileExst } = item;
@ -455,7 +455,7 @@ class Tile extends React.PureComponent {
<div className="expandButton" />
)}
<ContextMenu
contextMenuData={contextMenuData}
getContextModel={getContextModel}
ref={this.cm}
header={contextMenuHeader}
/>
@ -520,7 +520,7 @@ class Tile extends React.PureComponent {
<div className="expandButton" />
)}
<ContextMenu
contextMenuData={contextMenuData}
getContextModel={getContextModel}
ref={this.cm}
header={contextMenuHeader}
withBackdrop={true}