diff --git a/packages/designer/src/setters/event-setter.tsx b/packages/designer/src/setters/event-setter.tsx index ac576259..a340d9dc 100644 --- a/packages/designer/src/setters/event-setter.tsx +++ b/packages/designer/src/setters/event-setter.tsx @@ -8,6 +8,7 @@ import { ExpressionModal, getWrappedExpressionCode } from './expression-setter'; enum EventAction { NoAction = 'noAction', + ConsoleLog = 'consoleLog', BindExpression = 'bindExpression', OpenModal = 'openModal', CloseModal = 'closeModal', @@ -24,6 +25,7 @@ const wrapperStyle = css` const options = [ { label: '无动作', value: EventAction.NoAction }, + { label: '打印事件', value: EventAction.ConsoleLog }, { label: '绑定 JS 表达式', value: EventAction.BindExpression }, { label: '打开页面', value: EventAction.NavigateTo }, { label: '打开弹窗', value: EventAction.OpenModal }, @@ -63,6 +65,9 @@ export function EventSetter(props: EventSetterProps) { case EventAction.BindExpression: setExpModalVisible(true); break; + case EventAction.ConsoleLog: + handleChange('(...args) => console.log(...args)'); + break; case EventAction.NoAction: handleChange(undefined); break; diff --git a/packages/designer/src/setters/expression-setter.tsx b/packages/designer/src/setters/expression-setter.tsx index 3548278f..a957aa10 100644 --- a/packages/designer/src/setters/expression-setter.tsx +++ b/packages/designer/src/setters/expression-setter.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect, useCallback } from 'react'; import { Box, Text, css } from 'coral-system'; -import { Modal } from 'antd'; +import { Dropdown, Modal } from 'antd'; import { isValidExpressionCode, isWrappedByExpressionContainer, @@ -13,8 +13,14 @@ import { getValue, IVariableTreeNode, } from '@music163/tango-helpers'; -import { CloseCircleFilled, ExpandAltOutlined } from '@ant-design/icons'; -import { Panel, InputCode, Action } from '@music163/tango-ui'; +import { + CloseCircleFilled, + ExpandAltOutlined, + InfoOutlined, + KeyOutlined, + MenuOutlined, +} from '@ant-design/icons'; +import { Panel, InputCode, Action, CodeOutlined } from '@music163/tango-ui'; import { FormItemComponentProps } from '@music163/tango-setting-form'; import { useWorkspace, useWorkspaceData } from '@music163/tango-context'; import { VariableTree } from '../components'; @@ -60,6 +66,8 @@ export function getWrappedExpressionCode(code: string) { } const suffixStyle = css` + display: flex; + align-items: center; .anticon-close-circle { color: rgba(0, 0, 0, 0.25); &:hover { @@ -73,6 +81,7 @@ export interface ExpressionSetterProps extends FormItemComponentProps { modalTip?: string; autoCompleteOptions?: string[]; allowClear?: boolean; + showOptionsDropDown?: boolean; } export function ExpressionSetter(props: ExpressionSetterProps) { @@ -86,6 +95,7 @@ export function ExpressionSetter(props: ExpressionSetterProps) { status, allowClear = true, newStoreTemplate, + showOptionsDropDown = true, } = props; const [visible, { on, off }] = useBoolean(); const [inputValue, setInputValue] = useState(() => { @@ -118,6 +128,7 @@ export function ExpressionSetter(props: ExpressionSetterProps) { return ( + {/* 同时支持下拉框展示 */} )} + {showOptionsDropDown && autoCompleteOptions?.length && ( + ({ + key: option, + label: ( + { + change(option); + }} + > + {option} + + ), + })), + }} + > + } size="small" /> + + )} } diff --git a/packages/designer/src/setting-panel.tsx b/packages/designer/src/setting-panel.tsx index 8777c892..95df475c 100644 --- a/packages/designer/src/setting-panel.tsx +++ b/packages/designer/src/setting-panel.tsx @@ -91,6 +91,9 @@ export const SettingPanel = observer((props: SettingPanelProps) => { borderLeftColor="line2" bg="white" headerProps={headerProps} + bodyProps={{ + overflowY: 'hidden', + }} className="SettingPanel" > {prototype ? ( diff --git a/packages/setting-form/src/form-ui.tsx b/packages/setting-form/src/form-ui.tsx index 869cd1f7..0643f76c 100644 --- a/packages/setting-form/src/form-ui.tsx +++ b/packages/setting-form/src/form-ui.tsx @@ -86,6 +86,7 @@ export function FormControlGroup({ collapsed={collapsed} onCollapse={setCollapsed} className="FormControlGroup" + stickyHeader title={ .SettingFormMain > :first-child:is(.FormControl) { margin-top: var(--tango-space-m); } @@ -199,7 +201,7 @@ export function SettingForm({ - + {showIdentifier && ( )} - + {renderProps(filterProps)} {filterProps.length === 0 && (