fix dispatch events

This commit is contained in:
kangwei 2020-06-23 22:40:20 +08:00
parent f463fe8c6b
commit 3b6dd61f3c
4 changed files with 6 additions and 2 deletions

View File

@ -38,7 +38,6 @@ export class BuiltinSimulatorHostView extends Component<SimulatorHostProps> {
}
}
render() {
const { Provider } = SimulatorContext;
return (
<div className="lc-simulator">
{/*progressing.visible ? <PreLoaderView /> : null*/}

View File

@ -322,7 +322,9 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
'click',
(e) => {
// fix for popups close logic
document.dispatchEvent(new Event('click'));
const x = new Event('click');
x.initEvent('click', true);
this._iframe?.dispatchEvent(x);
const target = e.target as HTMLElement;
if (isFormEvent(e) || target?.closest('.next-input-group,.next-checkbox-group,.next-date-picker,.next-input,.next-month-picker,.next-number-picker,.next-radio-group,.next-range,.next-range-picker,.next-rating,.next-select,.next-switch,.next-time-picker,.next-upload,.next-year-picker,.next-breadcrumb-item,.next-calendar-header,.next-calendar-table')) {
e.preventDefault();

View File

@ -163,6 +163,7 @@ export class Field extends Component<FieldProps> {
*/
function createValueState(valueState?: number, onClear?: (e: React.MouseEvent) => void) {
return null;
/*
let tip: any = null;
let className = 'lc-valuestate';
let icon: any = null;
@ -194,6 +195,7 @@ function createValueState(valueState?: number, onClear?: (e: React.MouseEvent) =
{tip && <Tip>{tip}</Tip>}
</i>
);
*/
}
export interface PopupFieldProps extends FieldProps {

View File

@ -107,6 +107,7 @@ class Renderer extends Component<{ renderer: SimulatorRenderer }> {
viewProps.componentId = __id;
const leaf = host.document.getNode(__id);
viewProps._leaf = leaf;
viewProps._componentName = leaf?.componentName;
return createElement(
getDeviceView(Component, device, designMode),