joint trunk-pane

This commit is contained in:
kangwei 2020-04-22 14:42:27 +08:00
parent f15c0ad0ff
commit a21490a379
5 changed files with 26 additions and 6 deletions

View File

@ -488,6 +488,9 @@ export class Node {
insertBefore(node: Node, ref?: Node) { insertBefore(node: Node, ref?: Node) {
this.children?.insert(node, ref ? ref.index : null); this.children?.insert(node, ref ? ref.index : null);
} }
insertAfter(node: Node, ref?: Node) {
this.children?.insert(node, ref ? (ref.index + 1) : null);
}
getParent() { getParent() {
return this.parent; return this.parent;
} }

View File

@ -1,5 +1,5 @@
import { I18nData } from './i18n'; import { I18nData } from './i18n';
import { ReactNode, ReactElement } from 'react'; import { ReactNode } from 'react';
export interface TipConfig { export interface TipConfig {
className?: string; className?: string;
@ -8,4 +8,4 @@ export interface TipConfig {
direction?: 'top' | 'bottom' | 'left' | 'right'; direction?: 'top' | 'bottom' | 'left' | 'right';
} }
export type TipContent = string | I18nData | ReactElement | TipConfig; export type TipContent = string | I18nData | ReactNode | TipConfig;

View File

@ -58,7 +58,7 @@ const builtinSetters = {
DateRangeSetter, DateRangeSetter,
EventsSetter, EventsSetter,
// StyleSetter, // StyleSetter,
ColorSetter, // ColorSetter,
JsonSetter, JsonSetter,
}; };

View File

@ -10,10 +10,27 @@ export default class LeftFloatPane extends Component<{ area: Area<any, Panel> }>
shouldComponentUpdate() { shouldComponentUpdate() {
return false; return false;
} }
private dispose?: () => void;
componentDidMount() {
const { area } = this.props;
const triggerClose = () => area.setVisible(false);
area.skeleton.editor.on('designer.dragstart', triggerClose);
this.dispose = () => {
area.skeleton.editor.removeListener('designer.dragstart', triggerClose);
}
}
componentWillUnmount() {
this.dispose?.();
}
render() { render() {
const { area } = this.props; const { area } = this.props;
// TODO: add focusingManager // TODO: add focusingManager
// TODO: dragstart close // focusin set focus (push|replace)
// focusout remove focus
// onEsc
return ( return (
<div <div
className={classNames('lc-left-float-pane', { className={classNames('lc-left-float-pane', {

View File

@ -1,5 +1,5 @@
import { ReactElement, ComponentType } from 'react'; import { ReactElement, ComponentType } from 'react';
import { TitleContent, IconType, I18nData } from '@ali/lowcode-globals'; import { TitleContent, IconType, I18nData, TipContent } from '@ali/lowcode-globals';
export interface IWidgetBaseConfig { export interface IWidgetBaseConfig {
type: string; type: string;
@ -30,7 +30,7 @@ export interface DockProps {
icon?: IconType; icon?: IconType;
size?: 'small' | 'medium' | 'large'; size?: 'small' | 'medium' | 'large';
className?: string; className?: string;
description?: string | I18nData; description?: TipContent;
onClick?: () => void; onClick?: () => void;
} }