This commit is contained in:
Nikita Gopienko 2019-11-25 14:16:26 +03:00
commit 69a2818741
6 changed files with 26 additions and 19 deletions

View File

@ -1,9 +1,8 @@
import React, { lazy } from "react";
import React from "react";
import { Route, Switch } from "react-router-dom";
import { withRouter } from "react-router";
const CustomizationSettings = lazy(() => import("./customization"));
const WhiteLabel = lazy(() => import("./whitelabel"));
import CustomizationSettings from "./customization";
import WhiteLabel from "./whitelabel";
const Common = ({ match }) => {
const basePath = '/settings/common';
@ -15,13 +14,11 @@ const Common = ({ match }) => {
path={[`${basePath}/customization`, '/common', match.path]}
component={CustomizationSettings}
/>
<Route
exact
path={`${basePath}/whitelabel`}
component={WhiteLabel}
/>
</Switch>
);
};

View File

@ -1,35 +1,29 @@
import React, { lazy } from "react";
import React from "react";
import { Route, Switch, Redirect } from "react-router-dom";
import { withRouter } from "react-router";
import Layout from './Layout';
const CommonSettings = lazy(() => import("./categories/common"));
const SecuritySettings = lazy(() => import("./categories/security"));
import CommonSettings from "./categories/common";
import SecuritySettings from "./categories/security";
const Settings = () => {
const basePath = '/settings';
return (
<Layout key='1'>
<Switch>
<Route
path={`${basePath}/security`}
component={SecuritySettings}
/>
<Route
path={[`${basePath}/common`, basePath]}
component={CommonSettings}
/>
<Redirect
to={{
pathname: "/error/404",
}}
/>
</Switch>
</Layout>
);

View File

@ -1,6 +1,6 @@
{
"name": "asc-web-components",
"version": "1.0.188",
"version": "1.0.189",
"description": "Ascensio System SIA component library",
"license": "AGPL-3.0",
"main": "dist/asc-web-components.js",

View File

@ -25,6 +25,8 @@ class AvatarEditor extends React.Component {
this.onLoadFileError = this.onLoadFileError.bind(this);
this.onLoadFile = this.onLoadFile.bind(this);
this.onPositionChange = this.onPositionChange.bind(this);
this.onSizeChange = this.onSizeChange.bind(this);
this.onDeleteImage = this.onDeleteImage.bind(this);
}
@ -40,6 +42,9 @@ class AvatarEditor extends React.Component {
})
if (typeof this.props.onDeleteImage === 'function') this.props.onDeleteImage();
}
onSizeChange(data){
this.setState(data);
}
onPositionChange(data) {
this.setState(data);
}
@ -83,6 +88,7 @@ class AvatarEditor extends React.Component {
<AvatarEditorBody
onImageChange={this.onImageChange}
onPositionChange={this.onPositionChange}
onSizeChange={this.onSizeChange}
onLoadFileError={this.onLoadFileError}
onLoadFile={this.onLoadFile}
deleteImage={this.onDeleteImage}

View File

@ -190,6 +190,10 @@ class AvatarEditorBody extends React.Component {
this.setState({
scale: scale < 1 ? 1 : scale > 5 ? 5 : scale
});
this.props.onSizeChange({
width: this.setEditorRef.current.getImage().width,
height: this.setEditorRef.current.getImage().height
});
}
}
onTouchEnd(evt) {
@ -217,6 +221,10 @@ class AvatarEditorBody extends React.Component {
this.setState({
scale: scale < 1 ? 1 : scale > 5 ? 5 : scale
});
this.props.onSizeChange({
width: this.setEditorRef.current.getImage().width,
height: this.setEditorRef.current.getImage().height
});
}
handleScale = e => {
@ -319,6 +327,7 @@ class AvatarEditorBody extends React.Component {
AvatarEditorBody.propTypes = {
onImageChange: PropTypes.func,
onPositionChange: PropTypes.func,
onSizeChange: PropTypes.func,
onLoadFileError: PropTypes.func,
onLoadFile: PropTypes.func,
deleteImage: PropTypes.func,

View File

@ -50,8 +50,9 @@ export default function createStyledIcon(Component, displayName, fillPath="*", s
)
}
render() {
const { isfill, isStroke, color, stroke, fillPath, strokePath, ...props } = this.props;
var svg = ReactDOMServer.renderToString(<Component {...this.props}></Component>);
var svg = ReactDOMServer.renderToString(<Component {...props}></Component>);
const matchResult = svg.match(/\s*mask id="(\w*)"\s/);
if(matchResult != null){
@ -62,7 +63,7 @@ export default function createStyledIcon(Component, displayName, fillPath="*", s
return reactComponent;
}
}
return (<Component {...this.props}></Component>);
return (<Component {...props}></Component>);
}
}