mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-13 20:36:34 +00:00
Merge branch 'v/0.8.0' of gitlab.alibaba-inc.com:ali-lowcode/ali-lowcode-engine into v/0.8.0
This commit is contained in:
commit
ddec8145bd
@ -1,12 +1,10 @@
|
|||||||
import { Component, isValidElement, ReactElement, ReactNode } from 'react';
|
import { Component, isValidElement, ReactElement, ReactNode } from 'react';
|
||||||
import { Dialog, Search, Input } from '@alifd/next';
|
import { Dialog, Search, Input } from '@alifd/next';
|
||||||
|
import Editor from '@ali/lowcode-editor-core';
|
||||||
import './style.less';
|
import './style.less';
|
||||||
|
|
||||||
export default class EventDialog extends Component<{
|
export default class EventDialog extends Component<{
|
||||||
dialigVisiable?: boolean;
|
editor:Editor,
|
||||||
closeDialog?: () => void;
|
|
||||||
submitDialog?: (value?: string) => void;
|
|
||||||
bindEventName?: string;
|
|
||||||
}> {
|
}> {
|
||||||
private eventList: any[] = [
|
private eventList: any[] = [
|
||||||
{
|
{
|
||||||
@ -27,18 +25,33 @@ export default class EventDialog extends Component<{
|
|||||||
];
|
];
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
visiable:false,
|
||||||
selectedEventName: '',
|
selectedEventName: '',
|
||||||
eventName: '',
|
eventName: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps: any) {
|
openDialog = (bindEventName:String) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
eventName: nextProps.bindEventName,
|
visiable:true,
|
||||||
|
eventName:bindEventName
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
closeDialog = () => {
|
||||||
|
this.setState({
|
||||||
|
visiable:false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount (){
|
||||||
|
const {editor} = this.props;
|
||||||
|
editor.on('eventBindDialog.open',(bindEventName:String)=>{
|
||||||
|
this.openDialog(bindEventName)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
initEventName = () => {
|
initEventName = () => {
|
||||||
const { bindEventName } = this.props;
|
const { bindEventName } = this.state;
|
||||||
let eventName = bindEventName;
|
let eventName = bindEventName;
|
||||||
this.eventList.map((item) => {
|
this.eventList.map((item) => {
|
||||||
if (item.name === eventName) {
|
if (item.name === eventName) {
|
||||||
@ -76,14 +89,15 @@ export default class EventDialog extends Component<{
|
|||||||
onSearchEvent = (searchEventName: String) => {};
|
onSearchEvent = (searchEventName: String) => {};
|
||||||
|
|
||||||
onOk = () => {
|
onOk = () => {
|
||||||
this.props.submitDialog?.(this.state.eventName);
|
const {editor} = this.props;
|
||||||
|
editor.emit('event-setter.bindEvent',this.state.eventName);
|
||||||
|
this.closeDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { dialigVisiable, closeDialog } = this.props;
|
const { selectedEventName, eventName,visiable} = this.state;
|
||||||
const { selectedEventName, eventName } = this.state;
|
|
||||||
return (
|
return (
|
||||||
<Dialog visible={dialigVisiable} title="事件绑定" onClose={closeDialog} onCancel={closeDialog} onOk={this.onOk}>
|
<Dialog visible={visiable} title="事件绑定" onClose={this.closeDialog} onCancel={this.closeDialog} onOk={this.onOk}>
|
||||||
<div className="event-dialog-body">
|
<div className="event-dialog-body">
|
||||||
<div className="dialog-left-container">
|
<div className="dialog-left-container">
|
||||||
<div className="dialog-small-title">事件选择</div>
|
<div className="dialog-small-title">事件选择</div>
|
||||||
|
|||||||
@ -31,13 +31,14 @@ export default class EventsSetter extends Component<{
|
|||||||
nativeEventList: [],
|
nativeEventList: [],
|
||||||
lifeCycleEventList: [],
|
lifeCycleEventList: [],
|
||||||
eventDataList: this.props.value || [],
|
eventDataList: this.props.value || [],
|
||||||
isShowEventDialog: false,
|
|
||||||
bindEventName: '',
|
|
||||||
relatedEventName: '',
|
relatedEventName: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static getDerivedStateFromProps(nextProps, prevState) {
|
static getDerivedStateFromProps(nextProps, prevState) {
|
||||||
const { value } = nextProps;
|
const { value } = nextProps;
|
||||||
|
debugger;
|
||||||
if (value !== prevState.eventDataList) {
|
if (value !== prevState.eventDataList) {
|
||||||
return {
|
return {
|
||||||
value,
|
value,
|
||||||
@ -46,9 +47,16 @@ export default class EventsSetter extends Component<{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bindEventName:String;
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const {editor} = this.props.field;
|
||||||
this.initEventBtns();
|
this.initEventBtns();
|
||||||
this.initEventList();
|
this.initEventList();
|
||||||
|
editor.on('event-setter.bindEvent',(relatedEventName)=>{
|
||||||
|
this.bindEvent(relatedEventName);
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,7 +209,7 @@ export default class EventsSetter extends Component<{
|
|||||||
<Icon
|
<Icon
|
||||||
type="set"
|
type="set"
|
||||||
className="event-operate-icon"
|
className="event-operate-icon"
|
||||||
style={{ marginLeft: '5px', marginRight: '4px' }}
|
style={{ marginLeft: '3px', marginRight: '4px' }}
|
||||||
onClick={() => this.openDialog(eventName)}
|
onClick={() => this.openDialog(eventName)}
|
||||||
/>
|
/>
|
||||||
<Icon
|
<Icon
|
||||||
@ -291,29 +299,27 @@ export default class EventsSetter extends Component<{
|
|||||||
};
|
};
|
||||||
|
|
||||||
openDialog = (bindEventName: String) => {
|
openDialog = (bindEventName: String) => {
|
||||||
this.setState({
|
const {editor} = this.props.field;
|
||||||
isShowEventDialog: true,
|
this.bindEventName = bindEventName;
|
||||||
bindEventName,
|
editor.emit('eventBindDialog.open',bindEventName);
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
closeDialog = () => {
|
|
||||||
this.setState({
|
|
||||||
isShowEventDialog: false,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
submitDialog = (relatedEventName: String) => {
|
bindEvent = (relatedEventName: String) => {
|
||||||
const { bindEventName, eventDataList } = this.state;
|
const {eventDataList} = this.state;
|
||||||
eventDataList.map(item => {
|
eventDataList.map(item => {
|
||||||
if (item.name === bindEventName) {
|
if (item.name === this.bindEventName) {
|
||||||
item.relatedEventName = relatedEventName;
|
item.relatedEventName = relatedEventName;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
eventDataList
|
||||||
|
})
|
||||||
|
|
||||||
this.props.onChange(eventDataList);
|
this.props.onChange(eventDataList);
|
||||||
|
|
||||||
this.closeDialog();
|
//this.closeDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -324,10 +330,8 @@ export default class EventsSetter extends Component<{
|
|||||||
lifeCycleEventList,
|
lifeCycleEventList,
|
||||||
selectType,
|
selectType,
|
||||||
eventDataList,
|
eventDataList,
|
||||||
isShowEventDialog,
|
|
||||||
bindEventName,
|
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
const {editor} = this.props.field;
|
||||||
let showEventList =
|
let showEventList =
|
||||||
lifeCycleEventList.length > 0 ? lifeCycleEventList : eventList;
|
lifeCycleEventList.length > 0 ? lifeCycleEventList : eventList;
|
||||||
return (
|
return (
|
||||||
@ -396,10 +400,7 @@ export default class EventsSetter extends Component<{
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<EventDialog
|
<EventDialog
|
||||||
dialigVisiable={isShowEventDialog}
|
editor={editor}
|
||||||
closeDialog={this.closeDialog}
|
|
||||||
submitDialog={this.submitDialog}
|
|
||||||
bindEventName={bindEventName}
|
|
||||||
></EventDialog>
|
></EventDialog>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -17,6 +17,13 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.next-table td .next-table-cell-wrapper{
|
||||||
|
padding: 12px 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
.next-radio-group label {
|
.next-radio-group label {
|
||||||
-webkit-box-flex: 1;
|
-webkit-box-flex: 1;
|
||||||
-webkit-flex: auto;
|
-webkit-flex: auto;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user