Adoptions from ivis-core

This commit is contained in:
Tomas Bures 2019-01-12 21:33:00 +01:00
parent 18eb54037c
commit d14942da93
6 changed files with 41 additions and 15 deletions

View file

@ -146,7 +146,8 @@ export class ButtonDropdown extends Component {
export class ActionLink extends Component {
static propTypes = {
onClickAsync: PropTypes.func,
className: PropTypes.string
className: PropTypes.string,
href: PropTypes.string
}
@withAsyncErrorHandler
@ -163,7 +164,7 @@ export class ActionLink extends Component {
const props = this.props;
return (
<a href="" className={props.className} onClick={::this.onClick}>{props.children}</a>
<a href={props.href || ''} className={props.className} onClick={::this.onClick}>{props.children}</a>
);
}
}

View file

@ -28,16 +28,21 @@ export function withComponentMixins(mixins, delegateFuns) {
return TargetClass => {
const ctors = [];
const mixinDelegateFuns = [];
function TargetClassWithCtors(props, context) {
if (delegateFuns) {
mixinDelegateFuns.push(...delegateFuns);
}
function TargetClassWithCtors(props) {
if (!new.target) {
throw new TypeError();
}
const self = Reflect.construct(TargetClass, [props, context], new.target);
const self = Reflect.construct(TargetClass, [props], new.target);
for (const ctor of ctors) {
ctor(self);
ctor(self, props);
}
return self;
@ -76,6 +81,10 @@ export function withComponentMixins(mixins, delegateFuns) {
if (res.ctor) {
ctors.push(res.ctor);
}
if (res.delegateFuns) {
mixinDelegateFuns.push(...res.delegateFuns);
}
}
class ComponentMixinsOuter extends React.Component {
@ -107,11 +116,9 @@ export function withComponentMixins(mixins, delegateFuns) {
}
}
if (delegateFuns) {
for (const fun of delegateFuns) {
ComponentMixinsOuter.prototype[fun] = function (...args) {
return this._decoratorInnerInstance[fun](...args);
}
for (const fun of mixinDelegateFuns) {
ComponentMixinsOuter.prototype[fun] = function (...args) {
return this._decoratorInnerInstance[fun](...args);
}
}

View file

@ -82,7 +82,6 @@
background-color: white;
}
:global h3.legend {
font-size: 21px;
margin-bottom: 20px;
@ -101,6 +100,21 @@
}
}
.colorPickerSwatchWrapper {
padding: 7px;
background: #fff;
border: 1px solid #AAB2BD;
border-radius: 4px;
display: inline-block;
cursor: pointer;
.colorPickerSwatchColor {
width: 60px;
height: 18px;
borderRadius: 2px;
}
}
.colorPickerWrapper {
text-align: right;
}

View file

@ -87,7 +87,8 @@ export class UntrustedContentHost extends Component {
}
sendMessage(type, data) {
if (this.contentNodeIsLoaded) { // This is to avoid errors: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://localhost:8081') does not match the recipient window's origin ('http://localhost:3000')"
if (this.contentNodeIsLoaded && this.contentNode) { // This is to avoid errors: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://localhost:8081') does not match the recipient window's origin ('http://localhost:3000')"
// When the child window is closed during processing of the message, the this.contentNode becomes null and we can't deliver the response
this.contentNode.contentWindow.postMessage({type, data}, getSandboxUrl());
}
}