mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 05:48:17 +00:00
Merge branch 'feat/tip-render' into 'release/1.0.50'
feat(editor-skeleton&editor-core): 添加了点击setter-pane后抛出editor事件 点击setter的title See merge request !1264429
This commit is contained in:
commit
3820949eb6
@ -1,9 +1,9 @@
|
|||||||
import { Component } from 'react';
|
import { Component, MouseEvent } from 'react';
|
||||||
import { isObject } from 'lodash';
|
import { isObject } from 'lodash';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { Icon } from '@alifd/next';
|
import { Icon } from '@alifd/next';
|
||||||
import { Title } from '@ali/lowcode-editor-core';
|
import { Title } from '@ali/lowcode-editor-core';
|
||||||
import { TitleContent } from '@ali/lowcode-types';
|
import { IEditor, TitleContent } from '@ali/lowcode-types';
|
||||||
import { PopupPipe, PopupContext } from '../popup';
|
import { PopupPipe, PopupContext } from '../popup';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
import InlineTip from './inlinetip';
|
import InlineTip from './inlinetip';
|
||||||
@ -12,6 +12,7 @@ export interface FieldProps {
|
|||||||
className?: string;
|
className?: string;
|
||||||
meta?: { package: string; componentName: string } | string;
|
meta?: { package: string; componentName: string } | string;
|
||||||
title?: TitleContent | null;
|
title?: TitleContent | null;
|
||||||
|
editor?: IEditor;
|
||||||
defaultDisplay?: 'accordion' | 'inline' | 'block' | 'plain' | 'popup' | 'entry';
|
defaultDisplay?: 'accordion' | 'inline' | 'block' | 'plain' | 'popup' | 'entry';
|
||||||
collapsed?: boolean;
|
collapsed?: boolean;
|
||||||
valueState?: number;
|
valueState?: number;
|
||||||
@ -31,6 +32,7 @@ export class Field extends Component<FieldProps> {
|
|||||||
constructor(props: any) {
|
constructor(props: any) {
|
||||||
super(props);
|
super(props);
|
||||||
this.handleClear = this.handleClear.bind(this);
|
this.handleClear = this.handleClear.bind(this);
|
||||||
|
this.clickHandler = this.clickHandler.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private toggleExpand = () => {
|
private toggleExpand = () => {
|
||||||
@ -125,6 +127,11 @@ export class Field extends Component<FieldProps> {
|
|||||||
return tipContent;
|
return tipContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clickHandler(event?: MouseEvent) {
|
||||||
|
const { editor, name, title, meta } = this.props;
|
||||||
|
editor?.emit('setting.setter.field.click', { name, title, meta, event });
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { hasError } = this.state;
|
const { hasError } = this.state;
|
||||||
if (hasError) {
|
if (hasError) {
|
||||||
@ -154,7 +161,10 @@ export class Field extends Component<FieldProps> {
|
|||||||
<div className="lc-field-head" onClick={isAccordion ? this.toggleExpand : undefined}>
|
<div className="lc-field-head" onClick={isAccordion ? this.toggleExpand : undefined}>
|
||||||
<div className="lc-field-title">
|
<div className="lc-field-title">
|
||||||
{createValueState(valueState, this.handleClear)}
|
{createValueState(valueState, this.handleClear)}
|
||||||
<Title title={title || ''} />
|
<Title
|
||||||
|
title={title || ''}
|
||||||
|
onClick={this.clickHandler}
|
||||||
|
/>
|
||||||
<InlineTip position="top">{tipContent}</InlineTip>
|
<InlineTip position="top">{tipContent}</InlineTip>
|
||||||
</div>
|
</div>
|
||||||
{isAccordion && <Icon className="lc-field-icon" type="arrow-up" size="xs" />}
|
{isAccordion && <Icon className="lc-field-icon" type="arrow-up" size="xs" />}
|
||||||
|
|||||||
@ -108,6 +108,7 @@ class SettingFieldView extends Component<{ field: SettingField }> {
|
|||||||
{
|
{
|
||||||
meta: field?.componentMeta?.npm || field?.componentMeta?.componentName || '',
|
meta: field?.componentMeta?.npm || field?.componentMeta?.componentName || '',
|
||||||
title: field.title,
|
title: field.title,
|
||||||
|
editor: field.editor,
|
||||||
collapsed: !field.expanded,
|
collapsed: !field.expanded,
|
||||||
valueState: field.isRequired ? 10 : field.valueState,
|
valueState: field.isRequired ? 10 : field.valueState,
|
||||||
onExpandChange: (expandState) => field.setExpanded(expandState),
|
onExpandChange: (expandState) => field.setExpanded(expandState),
|
||||||
@ -196,6 +197,7 @@ class SettingGroupView extends Component<{ field: SettingField }> {
|
|||||||
{
|
{
|
||||||
meta: field.componentMeta?.npm || field.componentMeta?.componentName || '',
|
meta: field.componentMeta?.npm || field.componentMeta?.componentName || '',
|
||||||
title: field.title,
|
title: field.title,
|
||||||
|
editor: field.editor,
|
||||||
collapsed: !field.expanded,
|
collapsed: !field.expanded,
|
||||||
onExpandChange: (expandState) => field.setExpanded(expandState),
|
onExpandChange: (expandState) => field.setExpanded(expandState),
|
||||||
// field: field,
|
// field: field,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user