Alexey Safronov
3aeac42444
# Conflicts: # common/ASC.Core.Common/Data/DbSubscriptionService.cs # common/ASC.Core.Common/Notify/Signalr/SignalrServiceClient.cs # common/services/ASC.ElasticSearch/Engine/FactoryIndexer.cs # common/services/ASC.ElasticSearch/Service/Settings.cs # common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj # common/services/ASC.Socket.IO.Svc/SocketServiceLauncher.cs # packages/asc-web-components/combobox/index.js # packages/asc-web-components/table-container/StyledTableContainer.js # packages/asc-web-components/table-container/TableGroupMenu.js # packages/asc-web-components/table-container/TableHeader.js # packages/asc-web-components/table-container/TableHeaderCell.js # packages/asc-web-components/table-container/TableRow.js # products/ASC.Files/Client/public/locales/az/Home.json # products/ASC.Files/Client/public/locales/bg/Home.json # products/ASC.Files/Client/public/locales/bg/Translations.json # products/ASC.Files/Client/public/locales/cs/Home.json # products/ASC.Files/Client/public/locales/de/ConvertDialog.json # products/ASC.Files/Client/public/locales/de/Home.json # products/ASC.Files/Client/public/locales/de/Translations.json # products/ASC.Files/Client/public/locales/de/UploadPanel.json # products/ASC.Files/Client/public/locales/el/ConvertDialog.json # products/ASC.Files/Client/public/locales/el/Home.json # products/ASC.Files/Client/public/locales/en/ConvertDialog.json # products/ASC.Files/Client/public/locales/en/Home.json # products/ASC.Files/Client/public/locales/en/Translations.json # products/ASC.Files/Client/public/locales/en/UploadPanel.json # products/ASC.Files/Client/public/locales/es/ConvertDialog.json # products/ASC.Files/Client/public/locales/es/Home.json # products/ASC.Files/Client/public/locales/es/UploadPanel.json # products/ASC.Files/Client/public/locales/fi/Home.json # products/ASC.Files/Client/public/locales/fr/ConvertDialog.json # products/ASC.Files/Client/public/locales/fr/Home.json # products/ASC.Files/Client/public/locales/fr/Translations.json # products/ASC.Files/Client/public/locales/it/ConvertDialog.json # products/ASC.Files/Client/public/locales/it/Home.json # products/ASC.Files/Client/public/locales/it/Translations.json # products/ASC.Files/Client/public/locales/it/UploadPanel.json # products/ASC.Files/Client/public/locales/ja/Home.json # products/ASC.Files/Client/public/locales/ja/UploadPanel.json # products/ASC.Files/Client/public/locales/lv/Home.json # products/ASC.Files/Client/public/locales/nl/Home.json # products/ASC.Files/Client/public/locales/nl/Translations.json # products/ASC.Files/Client/public/locales/pl/Home.json # products/ASC.Files/Client/public/locales/pt-BR/ConvertDialog.json # products/ASC.Files/Client/public/locales/pt-BR/Home.json # products/ASC.Files/Client/public/locales/pt-BR/Translations.json # products/ASC.Files/Client/public/locales/ro/Home.json # products/ASC.Files/Client/public/locales/ro/UploadPanel.json # products/ASC.Files/Client/public/locales/ru/ConvertDialog.json # products/ASC.Files/Client/public/locales/ru/Home.json # products/ASC.Files/Client/public/locales/ru/Translations.json # products/ASC.Files/Client/public/locales/ru/UploadPanel.json # products/ASC.Files/Client/public/locales/sk/Home.json # products/ASC.Files/Client/public/locales/tr/Home.json # products/ASC.Files/Client/public/locales/uk/Home.json # products/ASC.Files/Client/public/locales/vi/ConvertDialog.json # products/ASC.Files/Client/public/locales/vi/Home.json # products/ASC.Files/Client/public/locales/zh-CN/Home.json # products/ASC.Files/Client/public/locales/zh-CN/UploadPanel.json # products/ASC.Files/Client/src/HOCs/withBadges.js # products/ASC.Files/Client/src/HOCs/withContent.js # products/ASC.Files/Client/src/components/Badges.js # products/ASC.Files/Client/src/components/EditingWrapperComponent.js # products/ASC.Files/Client/src/components/panels/OperationsPanel/index.js # products/ASC.Files/Client/src/components/panels/SharingPanel/index.js # products/ASC.Files/Client/src/components/panels/UploadPanel/FileRow.js # products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js # products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableHeader.js # products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js # products/ASC.Files/Client/src/pages/Home/Section/Body/TilesView/FileTile.js # products/ASC.Files/Client/src/pages/Home/Section/Body/TilesView/sub-components/Tile.js # products/ASC.Files/Client/src/pages/Home/Section/Body/index.js # products/ASC.Files/Client/src/store/DialogsStore.js # products/ASC.Files/Client/src/store/FilesActionsStore.js # products/ASC.Files/Core/HttpHandlers/FileHandler.ashx.cs # products/ASC.Files/Core/Utils/FileConverter.cs # products/ASC.Files/Server/Helpers/FilesControllerHelper.cs # products/ASC.Files/Service/Thumbnail/Builder.cs # products/ASC.Files/Service/Thumbnail/ThumbnailSettings.cs # products/ASC.Files/Service/Thumbnail/Worker.cs # products/ASC.People/Client/src/pages/Home/Section/Body/TableView/TableRow.js # public/locales/de/Common.json
167 lines
5.0 KiB
JavaScript
167 lines
5.0 KiB
JavaScript
import PropTypes from "prop-types";
|
|
import React from "react";
|
|
|
|
import Checkbox from "../checkbox";
|
|
import ContextMenuButton from "../context-menu-button";
|
|
import ContextMenu from "../context-menu";
|
|
import {
|
|
StyledOptionButton,
|
|
StyledContentElement,
|
|
StyledElement,
|
|
StyledCheckbox,
|
|
StyledContent,
|
|
StyledRow,
|
|
} from "./styled-row";
|
|
import Loader from "../loader";
|
|
|
|
class Row extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
|
|
this.cm = React.createRef();
|
|
this.row = React.createRef();
|
|
}
|
|
|
|
render() {
|
|
const {
|
|
checked,
|
|
children,
|
|
contentElement,
|
|
contextButtonSpacerWidth,
|
|
contextOptions,
|
|
data,
|
|
element,
|
|
indeterminate,
|
|
onSelect,
|
|
rowContextClick,
|
|
sectionWidth,
|
|
} = this.props;
|
|
|
|
const renderCheckbox = Object.prototype.hasOwnProperty.call(
|
|
this.props,
|
|
"checked"
|
|
);
|
|
|
|
const renderElement = Object.prototype.hasOwnProperty.call(
|
|
this.props,
|
|
"element"
|
|
);
|
|
|
|
const renderContentElement = Object.prototype.hasOwnProperty.call(
|
|
this.props,
|
|
"contentElement"
|
|
);
|
|
|
|
const renderContext =
|
|
Object.prototype.hasOwnProperty.call(this.props, "contextOptions") &&
|
|
contextOptions.length > 0;
|
|
|
|
const changeCheckbox = (e) => {
|
|
onSelect && onSelect(e.target.checked, data);
|
|
};
|
|
|
|
const getOptions = () => {
|
|
rowContextClick && rowContextClick();
|
|
return contextOptions;
|
|
};
|
|
|
|
const onContextMenu = (e) => {
|
|
rowContextClick && rowContextClick();
|
|
if (!this.cm.current.menuRef.current) {
|
|
this.row.current.click(e); //TODO: need fix context menu to global
|
|
}
|
|
this.cm.current.show(e);
|
|
};
|
|
|
|
const { onRowClick, inProgress, ...rest } = this.props;
|
|
|
|
return (
|
|
<StyledRow ref={this.row} {...rest} onContextMenu={onContextMenu}>
|
|
{inProgress ? (
|
|
<Loader className="row-loader" type="oval" size="16px" />
|
|
) : (
|
|
renderCheckbox && (
|
|
<StyledCheckbox className="not-selectable">
|
|
<Checkbox
|
|
className="checkbox"
|
|
isChecked={checked}
|
|
isIndeterminate={indeterminate}
|
|
onChange={changeCheckbox}
|
|
/>
|
|
</StyledCheckbox>
|
|
)
|
|
)}
|
|
{renderElement && (
|
|
<StyledElement onClick={onRowClick} className="styled-element">
|
|
{element}
|
|
</StyledElement>
|
|
)}
|
|
<StyledContent onClick={onRowClick} className="row_content">
|
|
{children}
|
|
</StyledContent>
|
|
<StyledOptionButton
|
|
className="row_context-menu-wrapper"
|
|
spacerWidth={contextButtonSpacerWidth}
|
|
>
|
|
{renderContentElement && (
|
|
<StyledContentElement>{contentElement}</StyledContentElement>
|
|
)}
|
|
{renderContext ? (
|
|
<ContextMenuButton
|
|
color="#A3A9AE"
|
|
hoverColor="#657077"
|
|
className="expandButton"
|
|
getData={getOptions}
|
|
directionX="right"
|
|
isNew={true}
|
|
onClick={onContextMenu}
|
|
/>
|
|
) : (
|
|
<div className="expandButton"> </div>
|
|
)}
|
|
<ContextMenu model={contextOptions} ref={this.cm}></ContextMenu>
|
|
</StyledOptionButton>
|
|
</StyledRow>
|
|
);
|
|
}
|
|
}
|
|
|
|
Row.propTypes = {
|
|
/** Required to host the Checkbox component. Its location is fixed and it is always the first.
|
|
* If there is no value, the occupied space is distributed among the other child elements. */
|
|
checked: PropTypes.bool,
|
|
children: PropTypes.element,
|
|
/** Accepts class */
|
|
className: PropTypes.string,
|
|
contentElement: PropTypes.any,
|
|
/** Required for the width task of the ContextMenuButton component. */
|
|
contextButtonSpacerWidth: PropTypes.string,
|
|
/** Required to host the ContextMenuButton component. It is always located near the right border of the container,
|
|
* regardless of the contents of the child elements. If there is no value, the occupied space is distributed among the other child elements. */
|
|
contextOptions: PropTypes.array,
|
|
/** Current row item information. */
|
|
data: PropTypes.object,
|
|
/** Required to host some component. It has a fixed order of location, if the Checkbox component is specified,
|
|
* then it follows, otherwise it occupies the first position. If there is no value, the occupied space is distributed among the other child elements. */
|
|
element: PropTypes.element,
|
|
/** Accepts id */
|
|
id: PropTypes.string,
|
|
/** If true, this state is shown as a rectangle in the checkbox */
|
|
indeterminate: PropTypes.bool,
|
|
/** when selecting row element. Returns data value. */
|
|
onSelect: PropTypes.func,
|
|
/** On click anywhere in the row, except the checkbox and context menu */
|
|
onRowClick: PropTypes.func,
|
|
rowContextClick: PropTypes.func,
|
|
/** Accepts css style */
|
|
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
sectionWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
inProgress: PropTypes.bool,
|
|
};
|
|
|
|
Row.defaultProps = {
|
|
contextButtonSpacerWidth: "26px",
|
|
};
|
|
|
|
export default Row;
|