Merge branch 'master' of github.com:ONLYOFFICE/AppServer

This commit is contained in:
Ilya Oleshko 2020-01-24 15:53:21 +03:00
commit bbade48b46
11 changed files with 71 additions and 47 deletions

View File

@ -154,7 +154,7 @@ const Home = (props) => {
}
Home.propTypes = {
users: PropTypes.array.isRequired,
users: PropTypes.array,
history: PropTypes.object.isRequired,
isLoaded: PropTypes.bool
};

View File

@ -8,7 +8,7 @@ import { TabContainer } from "asc-web-components";
import OwnerSettings from "./sub-components/owner";
import AdminsSettings from "./sub-components/admins";
import ModulesSettings from "./sub-components/modules";
// import ModulesSettings from "./sub-components/modules";
const MainContainer = styled.div`
padding-bottom: 16px;
@ -33,9 +33,10 @@ class PureAccessRights extends Component {
let selectedTab = 0;
if (activeStatus === "admins") {
selectedTab = 1;
} else if (activeStatus === "modules") {
selectedTab = 2;
}
// else if (activeStatus === "modules") {
// selectedTab = 2;
// }
this.state = {
selectedTab
@ -54,9 +55,9 @@ class PureAccessRights extends Component {
case "1":
history.push("/settings/security/accessrights/admins");
break;
case "2":
history.push("/settings/security/accessrights/modules");
break;
// case "2":
// history.push("/settings/security/accessrights/modules");
// break;
default:
break;
}
@ -96,11 +97,11 @@ class PureAccessRights extends Component {
title: "Admins settings",
content: <AdminsSettings />
},
{
key: "2",
title: "Portals settings",
content: <ModulesSettings />
}
// {
// key: "2",
// title: "Portals settings",
// content: <ModulesSettings />
// }
]}
</TabContainer>
</MainContainer>

View File

@ -23,12 +23,12 @@ const Security = () => {
component={AccessRightsSettings}
selectedTab={1}
/>
<Route
{/* <Route
exact
path={[`${basePath}/accessrights/modules`, basePath]}
component={AccessRightsSettings}
selectedTab={2}
/>
/> */}
</Switch>
</Suspense>
);

View File

@ -22,11 +22,14 @@ import { PageLayout } from "asc-web-common";
### Properties
| Props | Type | Required | Values | Default | Description |
| ------------------- | :----: | :------: | :----: | :-----: | ----------------------------------------- |
| `isBackdropVisible` | `bool` | - | - | `false` | If you need display Backdrop |
| `isNavHoverEnabled` | `bool` | - | - | `true` | If you need hover navigation on Backdrop |
| `isNavOpened` | `bool` | - | - | `false` | If you need display navigation |
| `isAsideVisible` | `bool` | - | - | `false` | If you need display aside |
| `withBodyScroll` | `bool` | - | - | `true` | If you need display scroll inside content |
| `withBodyAutoFocus` | `bool` | - | - | `true` | If you need set focus on content element |
| Props | Type | Required | Values | Default | Description |
| -------------------------- | :----: | :------: | :----: | :-----: | ----------------------------------------- |
| `articleHeaderContent` | `bool` | - | - | - | Article header content |
| `articleMainButtonContent` | `bool` | - | - | - | Article main button content |
| `articleBodyContent` | `bool` | - | - | - | Article body content |
| `sectionHeaderContent` | `bool` | - | - | - | Section header content |
| `sectionFilterContent` | `bool` | - | - | - | Section filter content |
| `sectionBodyContent` | `bool` | - | - | - | Section body content |
| `sectionPagingContent` | `bool` | - | - | - | Section paging content |
| `withBodyScroll` | `bool` | - | - | `true` | If you need display scroll inside content |
| `withBodyAutoFocus` | `bool` | - | - | `false` | If you need set focus on content element |

View File

@ -4,6 +4,7 @@ import { Backdrop } from "asc-web-components";
import { withTranslation } from 'react-i18next';
import i18n from './i18n';
import { connect } from "react-redux";
import { ARTICLE_PINNED_KEY } from "../../constants";
import Article from "./sub-components/article";
import ArticleHeader from "./sub-components/article-header";
@ -51,7 +52,8 @@ class PageLayoutComponent extends React.PureComponent {
isSectionPagingAvailable = !!props.sectionPagingContent,
isSectionBodyAvailable = !!props.sectionBodyContent || isSectionFilterAvailable || isSectionPagingAvailable,
isSectionAvailable = isSectionHeaderAvailable || isSectionFilterAvailable || isSectionBodyAvailable || isSectionPagingAvailable || isArticleAvailable,
isBackdropAvailable = isArticleAvailable;
isBackdropAvailable = isArticleAvailable,
isArticleVisibleAndPinned = !!localStorage.getItem(ARTICLE_PINNED_KEY);
let newState = {
isBackdropAvailable: isBackdropAvailable,
@ -65,9 +67,9 @@ class PageLayoutComponent extends React.PureComponent {
isSectionBodyAvailable: isSectionBodyAvailable,
isSectionPagingAvailable: isSectionPagingAvailable,
isBackdropVisible: props.isBackdropVisible,
isArticleVisible: props.isArticleVisible,
isArticlePinned: props.isArticlePinned,
isBackdropVisible: false,
isArticleVisible: isArticleVisibleAndPinned,
isArticlePinned: isArticleVisibleAndPinned,
articleHeaderContent: props.articleHeaderContent,
articleMainButtonContent: props.articleMainButtonContent,
@ -95,6 +97,8 @@ class PageLayoutComponent extends React.PureComponent {
isArticlePinned: true,
isArticleVisible: true
});
localStorage.setItem(ARTICLE_PINNED_KEY, true);
};
unpinArticle = () => {
@ -103,6 +107,8 @@ class PageLayoutComponent extends React.PureComponent {
isArticlePinned: false,
isArticleVisible: true
});
localStorage.removeItem(ARTICLE_PINNED_KEY);
};
showArticle = () => {
@ -172,7 +178,7 @@ class PageLayoutComponent extends React.PureComponent {
{this.state.isArticleAvailable && (
<SectionToggler
visible={!this.state.isArticlePinned}
visible={!this.state.isArticleVisible}
onClick={this.showArticle}
/>
)}
@ -196,10 +202,6 @@ PageLayout.propTypes = {
}
PageLayoutComponent.propTypes = {
isBackdropVisible: PropTypes.bool,
isArticleVisible: PropTypes.bool,
isArticlePinned: PropTypes.bool,
articleHeaderContent: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
@ -235,9 +237,6 @@ PageLayoutComponent.propTypes = {
};
PageLayoutComponent.defaultProps = {
isBackdropVisible: false,
isArticleVisible: false,
isArticlePinned: false,
withBodyScroll: true,
withBodyAutoFocus: false
};

View File

@ -3,10 +3,8 @@ import { mount } from 'enzyme';
import PageLayout from '.';
const baseProps = {
isBackdropVisible: false,
isArticleVisible: false,
isArticlePinned: false,
withBodyScroll: true
withBodyScroll: true,
withBodyAutoFocus: false
}
describe('<PageLayout />', () => {

View File

@ -1,4 +1,5 @@
export const AUTH_KEY = 'asc_auth_key';
export const ARTICLE_PINNED_KEY = 'asc_article_pinned_key';
/**
* Enum for employee activation status.

View File

@ -1,6 +1,6 @@
{
"name": "asc-web-components",
"version": "1.0.324",
"version": "1.0.326",
"description": "Ascensio System SIA component library",
"license": "AGPL-3.0",
"main": "dist/asc-web-components.js",
@ -120,7 +120,8 @@
"react-tooltip": "^3.11.2",
"react-virtualized-auto-sizer": "^1.0.2",
"react-window": "^1.8.5",
"react-window-infinite-loader": "^1.0.5"
"react-window-infinite-loader": "^1.0.5",
"resize-image": "^0.1.0"
},
"resolutions": {
"js-yaml": "3.13.1"

View File

@ -149,7 +149,7 @@ AvatarEditor.propTypes = {
AvatarEditor.defaultProps = {
visible: false,
maxSize: 1, //1MB
maxSize: 10, //10MB
headerLabel: 'Edit Photo',
saveButtonLabel: 'Save',
accept: ['image/png', 'image/jpeg'],

View File

@ -7,7 +7,7 @@ import { default as ASCAvatar } from '../../avatar/index'
import accepts from 'attr-accept'
import Text from '../../text'
import { tablet } from '../../../utils/device';
import resizeImage from 'resize-image'
const StyledErrorContainer = styled.div`
p{
text-align: center
@ -160,11 +160,27 @@ class AvatarEditorBody extends React.Component {
this.props.onLoadFileError(2);
}
onDropAccepted(acceptedFiles) {
this.setState({
image: acceptedFiles[0],
errorText: null
});
this.props.onLoadFile(acceptedFiles[0]);
const _this = this;
var fr = new FileReader();
fr.readAsDataURL(acceptedFiles[0]);
fr.onload = function () {
var img = new Image();
img.onload= function () {
var canvas = resizeImage.resize2Canvas(img, 1024, 1024);
var data = resizeImage.resize(canvas, 1024, 1024, resizeImage.JPEG);
_this.setState({
image: data,
errorText: null
});
fetch(data)
.then(res => res.blob())
.then(blob => {
const file = new File([blob], "File name",{ type: "image/jpg" })
_this.props.onLoadFile(file);
})
};
img.src = fr.result;
};
}
deleteImage() {
this.setState({

View File

@ -12348,6 +12348,11 @@ reserved-words@^0.1.2:
resolved "https://registry.yarnpkg.com/reserved-words/-/reserved-words-0.1.2.tgz#00a0940f98cd501aeaaac316411d9adc52b31ab1"
integrity sha1-AKCUD5jNUBrqqsMWQR2a3FKzGrE=
resize-image@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/resize-image/-/resize-image-0.1.0.tgz#033d5f499cb7095def7827d48b8046f7e1c5776c"
integrity sha512-78cWCEX/IupMCwKi5Gg5gxjOZKoN6UXinL2eVOB4xzyG2QNjq64z6pJBnyBKg5/BsjEosLz1co5e3DHr99TgFg==
resize-observer-polyfill@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464"