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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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