Merge branch 'master' into pre-release

This commit is contained in:
jiatianqi 2022-09-01 15:48:05 +08:00
commit 996fede566
18 changed files with 205 additions and 184 deletions

View File

@ -1,6 +1,6 @@
{
"name": "amis-editor",
"version": "5.2.0-beta.20",
"version": "5.2.0-beta.36",
"description": "amis 可视化编辑器",
"main": "lib/index.js",
"module": "esm/index.js",

View File

@ -39,12 +39,12 @@ export class AudioPlugin extends BasePlugin {
tpl: '<p>当前为字段内容节点配置,选择上层还有更多的配置。</p>'
}
: null,
{
getSchemaTpl('audioUrl',{
name: 'src',
type: 'input-text',
label: '音频地址',
description: '支持获取变量如:<code>\\${audioSrc}</code>'
},
}),
{
type: 'select',
name: 'rates',

View File

@ -285,9 +285,8 @@ export class ButtonPlugin extends BasePlugin {
title: '事件',
className: 'p-none',
body:
this.manager?.config.actionOptions?.showOldEntry !== false &&
(!!context.schema.actionType ||
['submit', 'reset'].includes(context.schema.type))
!!context.schema.actionType ||
['submit', 'reset'].includes(context.schema.type)
? [
getSchemaTpl('eventControl', {
name: 'onEvent',

View File

@ -85,34 +85,6 @@ export class CRUDPlugin extends BasePlugin {
}
];
sampleBuilder = (schema: any) => {
const data: any = {
items: [],
total: 0
};
if (Array.isArray(schema?.columns)) {
const item = {};
schema.columns.forEach((control: any) => {
if (control?.name) {
setVariable(item, control.name, 'sample');
}
});
data.items.push(item);
}
return JSON.stringify(
{
status: 0,
msg: '',
data: data
},
null,
2
);
};
btnSchemas = {
create: {
label: '新增',
@ -394,8 +366,8 @@ export class CRUDPlugin extends BasePlugin {
/** 统一api格式 */
valueSchema.api =
typeof valueSchema.api === 'string'
? valueSchema.api
: normalizeApi(valueSchema.api);
? normalizeApi(valueSchema.api)
: valueSchema.api;
hasFeatures &&
features.forEach((item: string) => {
if (itemBtns.includes(item)) {

View File

@ -1,21 +1,20 @@
import {Button} from 'amis';
import React from 'react';
import {registerEditorPlugin} from 'amis-editor-core';
import {
registerEditorPlugin,
BaseEventContext,
BasePlugin,
RegionConfig,
RendererInfo
RendererPluginAction,
diff,
defaultValue,
getSchemaTpl,
CodeEditor as AmisCodeEditor
} from 'amis-editor-core';
import {defaultValue, getSchemaTpl, } from 'amis-editor-core';
import {diff} from 'amis-editor-core';
import AMisCodeEditor from 'amis-editor-core';
import {RendererPluginAction} from 'amis-editor-core';
const ChartConfigEditor = ({value, onChange}: any) => {
return (
<div className="ae-JsonEditor">
<AMisCodeEditor value={value} onChange={onChange} />
<AmisCodeEditor value={value} onChange={onChange} />
</div>
);
};

View File

@ -10,10 +10,7 @@ import {
import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {jsonToJsonSchema} from 'amis-editor-core';
import {EditorNodeType} from 'amis-editor-core';
import {
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
import {setVariable} from 'amis-core';
import {getEventControlConfig} from '../../renderer/event-control/helper';
@ -552,7 +549,7 @@ export class FormPlugin extends BasePlugin {
getSchemaTpl('api', {
label: '保存接口',
description: '用来保存表单数据',
sampleBuilder: (schema: any) => `{
sampleBuilder: () => `{
"status": 0,
"msg": "",
@ -594,10 +591,11 @@ export class FormPlugin extends BasePlugin {
name: 'initApi',
label: '初始化接口',
description: '用来初始化表单数据',
sampleBuilder: (schema: any) => {
sampleBuilder: () => {
const data = {};
const schema = context?.schema;
if (Array.isArray(schema.body)) {
if (Array.isArray(schema?.body)) {
schema.body.forEach((control: any) => {
if (
control.name &&
@ -903,8 +901,8 @@ export class FormPlugin extends BasePlugin {
...jsonToJsonSchema(data)
};
scope.removeSchema(jsonschema.$id);
scope.addSchema(jsonschema);
scope?.removeSchema(jsonschema.$id);
scope?.addSchema(jsonschema);
}
}
}

View File

@ -279,7 +279,7 @@ export class TreeControlPlugin extends BasePlugin {
name: 'options'
},
getSchemaTpl('source', {
sampleBuilder: (schema: any) =>
sampleBuilder: () =>
JSON.stringify(
{
status: 0,

View File

@ -1,7 +1,4 @@
import {
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core';
import {BaseEventContext, BasePlugin} from 'amis-editor-core';
@ -280,7 +277,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
},
getSchemaTpl('source', {
sampleBuilder: (schema: any) =>
sampleBuilder: () =>
JSON.stringify(
{
status: 0,

View File

@ -3,11 +3,9 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {BaseEventContext, BasePlugin} from 'amis-editor-core';
import {getSchemaTpl} from 'amis-editor-core';
import {getEventControlConfig} from '../renderer/event-control/helper';
import {
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
import type {SchemaObject} from 'amis/lib/Schema';
import {jsonToJsonSchema, EditorNodeType} from 'amis-editor-core';
export class PagePlugin extends BasePlugin {
// 关联渲染器名字
@ -176,7 +174,7 @@ export class PagePlugin extends BasePlugin {
getSchemaTpl('api', {
label: '数据初始化接口',
name: 'initApi',
sampleBuilder: (schema: any) => `{
sampleBuilder: () => `{
"status": 0,
"msg": "",
@ -391,6 +389,19 @@ export class PagePlugin extends BasePlugin {
])
];
};
rendererBeforeDispatchEvent(node: EditorNodeType, e: any, data: any) {
if (e === 'inited') {
const scope = this.manager.dataSchema.getScope(`${node.id}-${node.type}`);
const jsonschema: any = {
$id: 'pageInitedData',
...jsonToJsonSchema(data)
};
scope?.removeSchema(jsonschema.$id);
scope?.addSchema(jsonschema);
}
}
}
registerEditorPlugin(PagePlugin);

View File

@ -1,6 +1,6 @@
import {Button} from 'amis';
import React from 'react';
import {registerEditorPlugin} from 'amis-editor-core';
import {EditorNodeType, jsonToJsonSchema, registerEditorPlugin} from 'amis-editor-core';
import {BaseEventContext, BasePlugin, RegionConfig} from 'amis-editor-core';
import {getSchemaTpl} from 'amis-editor-core';
import {getEventControlConfig} from '../renderer/event-control/helper';
@ -222,6 +222,19 @@ export class ServicePlugin extends BasePlugin {
}
]);
};
rendererBeforeDispatchEvent(node: EditorNodeType, e: any, data: any) {
if (e === 'fetchInited') {
const scope = this.manager.dataSchema.getScope(`${node.id}-${node.type}`);
const jsonschema: any = {
$id: 'serviceFetchInitedData',
...jsonToJsonSchema(data)
};
scope?.removeSchema(jsonschema.$id);
scope?.addSchema(jsonschema);
}
}
}
registerEditorPlugin(ServicePlugin);

View File

@ -512,7 +512,7 @@ export class TablePlugin extends BasePlugin {
title: '显隐',
body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
},
{
isCRUDBody ? null : {
title: '事件',
className: 'p-none',
body: [

View File

@ -1,4 +1,4 @@
import {registerEditorPlugin} from 'amis-editor-core';
import {EditorNodeType, jsonToJsonSchema, registerEditorPlugin} from 'amis-editor-core';
import {
BaseEventContext,
BasePlugin,
@ -939,6 +939,19 @@ export class WizardPlugin extends BasePlugin {
);
}
};
rendererBeforeDispatchEvent(node: EditorNodeType, e: any, data: any) {
if (e === 'inited') {
const scope = this.manager.dataSchema.getScope(`${node.id}-${node.type}`);
const jsonschema: any = {
$id: 'wizardInitedData',
...jsonToJsonSchema(data)
};
scope?.removeSchema(jsonschema.$id);
scope?.addSchema(jsonschema);
}
}
}
registerEditorPlugin(WizardPlugin);

View File

@ -13,7 +13,7 @@ import isString from 'lodash/isString';
import isEqual from 'lodash/isEqual';
import omit from 'lodash/omit';
import cx from 'classnames';
import {FormItem, Button, InputBox, Icon, render, ResultBox} from 'amis';
import {FormItem, Button, InputBox, Icon, ResultBox} from 'amis';
import {FormulaExec, isExpression} from 'amis';
import {PickerContainer} from 'amis';
import {FormulaEditor} from 'amis-ui/lib/components/formula/Editor';
@ -321,7 +321,8 @@ export default class FormulaControl extends React.Component<
'suffix',
'unitOptions',
'keyboard',
'kilobitSeparator'
'kilobitSeparator',
'value'
];
// 当前组件要剔除的字段
@ -353,7 +354,11 @@ export default class FormulaControl extends React.Component<
} else {
curRendererSchema.placeholder = '请输入静态默认值';
}
// 设置popOverContainer
curRendererSchema.popOverContainer = window.document.body;
}
return curRendererSchema;
}
@ -388,6 +393,7 @@ export default class FormulaControl extends React.Component<
rendererWrapper,
manager,
useExternalFormData = false,
render,
...rest
} = this.props;
@ -443,21 +449,17 @@ export default class FormulaControl extends React.Component<
rendererWrapper ? 'border-wrapper' : ''
)}
>
{render(
this.filterCustomRendererProps(rendererSchema),
{
data: useExternalFormData
? {
...this.props.data
}
: {},
onChange: this.handleSimpleInputChange,
manager: manager
},
{
...(manager?.env || {})
}
)}
{render('left', this.filterCustomRendererProps(rendererSchema), {
inputOnly: true,
value: value,
data: useExternalFormData
? {
...this.props.data
}
: {},
onChange: this.handleSimpleInputChange,
manager: manager
})}
</div>
)}
{!simple && isExpr && (

View File

@ -660,7 +660,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
</div>
);
},
supportComponents: [],
supportComponents: 'byComponent',
schema: renderCmptSelect('选择组件', true)
},
{
@ -685,7 +685,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
</div>
);
},
supportComponents: [],
supportComponents: 'byComponent',
schema: [
...renderCmptActionSelect('选择组件', true),
getArgsWrapper({
@ -745,14 +745,6 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
labelField: 'label',
valueField: 'value',
required: true,
visibleOn: `data.__rendererName && ${SHOW_SELECT_PROP}`,
},
{
name: 'key',
type: 'input-text',
placeholder: '变量名',
required: true,
visibleOn: `data.__rendererName && !${SHOW_SELECT_PROP} && __comboType === 'appoint'`
},
{
name: 'val',
@ -831,7 +823,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
label: '赋值',
size: 'lg',
mode: 'horizontal',
visibleOn: `data.__rendererName && !${IS_DATA_CONTAINER} && __rendererName !== 'combo'`,
visibleOn: `data.__rendererName && !${IS_DATA_CONTAINER} && !${SHOW_SELECT_PROP} && __rendererName !== 'combo'`,
required: true
}
]

View File

@ -13,11 +13,17 @@ import {
SubRendererPluginAction
} from 'amis-editor-core';
import {ActionConfig, ContextVariables} from './types';
import {DataSchema, filterTree, findTree, mapTree, normalizeApi} from 'amis-core';
import {
DataSchema,
filterTree,
findTree,
mapTree,
normalizeApi
} from 'amis-core';
import CmptActionSelect from './comp-action-select';
import {Button} from 'amis';
import ACTION_TYPE_TREE from './actions';
import { stores } from 'amis-core/lib/factory';
import {stores} from 'amis-core/lib/factory';
// 数据容器范围
export const DATA_CONTAINER = [
@ -32,9 +38,7 @@ export const DATA_CONTAINER = [
];
// 下拉展示可赋值属性范围
export const SELECT_PROPS_CONTAINER = [
'form',
];
export const SELECT_PROPS_CONTAINER = ['form'];
// 是否数据容器
export const IS_DATA_CONTAINER = `${JSON.stringify(
@ -46,7 +50,6 @@ export const SHOW_SELECT_PROP = `${JSON.stringify(
SELECT_PROPS_CONTAINER
)}.includes(__rendererName)`;
// 表单项组件
export const FORMITEM_CMPTS = [
'button-group-select',
@ -130,7 +133,7 @@ export const SUPPORT_DISABLED_CMPTS = [
'nav',
'wizard'
// 'card2'
]
];
export const getArgsWrapper = (items: any, multiple: boolean = false) => ({
type: 'combo',
@ -186,20 +189,12 @@ export const COMMON_ACTION_SCHEMA_MAP: {
items: [
{
name: 'key',
type: 'select',
type: 'input-text',
placeholder: '变量名',
source: '${__setValueDs}',
labelField: 'label',
valueField: 'value',
required: true,
visibleOn: `data.__rendererName && ${SHOW_SELECT_PROP}`,
},
{
name: 'key',
type: 'input-text',
placeholder: '变量名',
required: true,
visibleOn: `data.__rendererName && !${SHOW_SELECT_PROP}`
},
{
name: 'val',
@ -317,7 +312,9 @@ export const COMMON_ACTION_SCHEMA_MAP: {
return (
<div>
<span className="variable-left variable-right">{info?.rendererLabel}</span>
<span className="variable-left variable-right">
{info?.rendererLabel}
</span>
{info?.__rendererName === 'wizard' ? '全部数据' : '数据'}
</div>
);
@ -537,7 +534,7 @@ export const renderCmptActionSelect = (
true,
async (value: string, oldVal: any, data: any, form: any) => {
// 获取组件上下文.
const rendererType = form.data.__rendererName
const rendererType = form.data.__rendererName;
if (form.data.__nodeId) {
const dataSchema: any = await form.data.getContextSchemas?.(
form.data.__nodeId,
@ -564,7 +561,10 @@ export const renderCmptActionSelect = (
form.setValueByName('args.__comboType', undefined);
form.setValueByName('args.__valueInput', undefined);
if (SELECT_PROPS_CONTAINER.includes(rendererType)) {
form.setValueByName('__setValueDs', variables.filter(item => item.value !== '$$id'));
form.setValueByName(
'__setValueDs',
variables.filter(item => item.value !== '$$id')
);
} else {
form.setValueByName('__setValueDs', []);
}
@ -597,7 +597,7 @@ export const getOldActionSchema = (
content:
'温馨提示:添加下方事件动作后,下方事件动作将先于旧版动作执行,建议统一迁移至事件动作机制,帮助您实现更灵活的交互设计',
inline: true,
tooltipTheme: "dark",
tooltipTheme: 'dark',
body: [
{
type: 'button',
@ -984,12 +984,14 @@ export const getEventControlConfig = (
isSupport =
action.supportComponents === '*' ||
action.supportComponents === node.type;
// 内置逻辑
if (action.supportComponents === 'byComponent') {
isSupport = hasActionType(actionType, actions);
}
} else if (Array.isArray(action.supportComponents)) {
isSupport = action.supportComponents.includes(node.type);
}
if (['reload', 'setValue'].includes(actionType)) {
isSupport = hasActionType(actionType, actions);
}
if (actionType === 'component' && !actions?.length) {
node.disabled = true;
}
@ -1000,11 +1002,12 @@ export const getEventControlConfig = (
return true;
}
return false;
}
};
return {
showOldEntry: manager?.config.actionOptions?.showOldEntry !== false &&
(!!context.schema.actionType ||
['submit', 'reset'].includes(context.schema.type)),
showOldEntry:
!!context.schema.actionType ||
['submit', 'reset'].includes(context.schema.type),
actions: manager?.pluginActions,
events: manager?.pluginEvents,
actionTree,
@ -1028,7 +1031,7 @@ export const getEventControlConfig = (
let components = allComponents;
if (isSubEditor) {
let superTree = manager.store.getSuperEditorData;
while(superTree) {
while (superTree) {
if (superTree.__superCmptTreeSource) {
components = components.concat(superTree.__superCmptTreeSource);
}
@ -1037,19 +1040,22 @@ export const getEventControlConfig = (
}
const result = filterTree(
components,
(node) => checkComponent(node, action),
node => checkComponent(node, action),
1,
true
);
return result;
},
actionConfigInitFormatter: (action: ActionConfig) => {
actionConfigInitFormatter: async (
action: ActionConfig,
variables: {
eventVariables: ContextVariables[];
rawVariables: ContextVariables[];
}
) => {
let config = {...action};
if (
['setValue', 'url'].includes(action.actionType) &&
action.args
) {
if (['setValue', 'url'].includes(action.actionType) && action.args) {
const prop = action.actionType === 'setValue' ? 'value' : 'params';
!config.args && (config.args = {});
if (Array.isArray(action.args[prop])) {
@ -1085,7 +1091,10 @@ export const getEventControlConfig = (
delete config.args?.value;
}
}
if (action.actionType === 'ajax' && typeof action?.args?.api === 'string') {
if (
action.actionType === 'ajax' &&
typeof action?.args?.api === 'string'
) {
action.args.api = normalizeApi(action?.args?.api);
}
// 获取动作专有配置参数
@ -1124,10 +1133,37 @@ export const getEventControlConfig = (
// 获取左侧命中的动作节点
const hasSubActionNode = findSubActionNode(actionTree, action.actionType);
// 如果args配置中存在组件id则自动获取一次该组件的上下文
let datasource = [];
if (action.args?.componentId) {
const schema = manager?.store?.getSchema(
action.args?.componentId,
'id'
);
const dataSchema: any = await manager.getContextSchemas(
schema?.$$id,
true
);
const dataSchemaIns = new DataSchema(dataSchema || []);
datasource = dataSchemaIns?.getDataPropsAsOptions() || [];
}
return {
...config,
actionType: getActionType(action, hasSubActionNode)
actionType: getActionType(action, hasSubActionNode),
args: {
...config.args,
__dataContainerVariables: datasource?.length
? [
...variables.eventVariables,
{
label: `数据来源变量`,
children: datasource
},
...variables.rawVariables
]
: [...variables.eventVariables, ...variables.rawVariables]
}
};
},
actionConfigSubmitFormatter: (config: ActionConfig) => {
@ -1143,10 +1179,7 @@ export const getEventControlConfig = (
// 标记一下组件特性动作
action.groupType = config.actionType;
}
const hasSubActionNode = findSubActionNode(
actionTree,
config.groupType
);
const hasSubActionNode = findSubActionNode(actionTree, config.groupType);
if (hasSubActionNode) {
// 修正动作
action.actionType = config.groupType;
@ -1166,13 +1199,19 @@ export const getEventControlConfig = (
// 转换下格式
if (['setValue', 'url'].includes(action.actionType)) {
const propName = action.actionType === 'setValue' ? 'value' : 'params';
if (action.actionType === 'setValue' && config.args?.__valueInput !== undefined) {
if (
action.actionType === 'setValue' &&
config.args?.__valueInput !== undefined
) {
action.args = {
value: config.args?.__valueInput
};
} else if (Array.isArray(config.args?.[propName])) {
action.args = action.args ?? {};
if (action.__rendererName === 'combo' && action.args?.index === undefined) {
if (
action.__rendererName === 'combo' &&
action.args?.index === undefined
) {
// combo特殊处理
let tempArr: any = [];
config.args?.[propName].forEach((valueItem: any, index: number) => {
@ -1210,4 +1249,4 @@ export const getEventControlConfig = (
return action;
}
};
};
};

View File

@ -49,7 +49,10 @@ interface EventControlProps extends FormControlProps {
removeBroadcast?: (eventName: string) => void;
getComponents: (action: RendererPluginAction) => ComponentInfo[]; // 当前页面组件树
getContextSchemas?: (id?: string, withoutSuper?: boolean) => DataSchema; // 获取上下文
actionConfigInitFormatter?: (actionConfig: ActionConfig) => ActionConfig; // 动作配置初始化时格式化
actionConfigInitFormatter?: (actionConfig: ActionConfig, variables: {
eventVariables: ContextVariables[], // 当前事件变量
rawVariables: ContextVariables[] // 绑定事件的组件上下文
}) => ActionConfig; // 动作配置初始化时格式化
actionConfigSubmitFormatter?: (actionConfig: ActionConfig) => ActionConfig; // 动作配置提交时格式化
owner?: string; // 组件标识
}
@ -80,7 +83,6 @@ interface EventControlState {
}
| undefined;
type: 'update' | 'add';
rawVariables: ContextVariables[]; // 外部获取的上下文变量
}
export class EventControl extends React.Component<
@ -92,7 +94,6 @@ export class EventControl extends React.Component<
[prop: string]: Sortable;
} = {};
drag?: HTMLElement | null;
isUnmount: boolean;
constructor(props: EventControlProps) {
super(props);
@ -107,23 +108,16 @@ export class EventControl extends React.Component<
eventPanelActive[event.eventName] = true;
});
this.isUnmount = false;
this.state = {
onEvent: value ?? this.generateEmptyDefault(pluginEvents),
events: pluginEvents,
eventPanelActive,
showAcionDialog: false,
actionData: undefined,
rawVariables: [],
type: 'add'
};
}
componentDidMount() {
this.loadContextVariables();
}
componentDidUpdate(
prevProps: EventControlProps,
prevState: EventControlState
@ -139,26 +133,6 @@ export class EventControl extends React.Component<
}
}
componentWillUnmount() {
this.isUnmount = true;
}
/**
*
*/
async loadContextVariables() {
const {getContextSchemas} = this.props;
// 获取上下文变量
if (getContextSchemas) {
const dataSchemaIns = await getContextSchemas();
const variables = dataSchemaIns?.getDataPropsAsOptions();
if (!this.isUnmount) {
this.setState({rawVariables: variables});
}
}
}
generateEmptyDefault(events: RendererPluginEvent[]) {
const onEvent: ActionEventConfig = {};
events.forEach((event: RendererPluginEvent) => {
@ -496,7 +470,7 @@ export class EventControl extends React.Component<
}
// 唤起动作配置弹窗
activeActionDialog(
async activeActionDialog(
data: Pick<EventControlState, 'showAcionDialog' | 'type' | 'actionData'>
) {
const {
@ -507,18 +481,25 @@ export class EventControl extends React.Component<
actionTree,
allComponents
} = this.props;
const {rawVariables} = this.state;
let rawVariables = [];
// 获取绑定事件的组件上下文变量
if (getContextSchemas) {
const dataSchemaIns = await getContextSchemas();
rawVariables = dataSchemaIns?.getDataPropsAsOptions();
}
// 收集事件变量
const eventVariables = this.getEventVariables(data);
const variables = [...eventVariables, ...rawVariables];
// 编辑操作,需要格式化动作配置
if (data.type === 'update') {
const action = data.actionData!.action!;
const actionConfig = actionConfigInitFormatter?.(action);
const actionConfig = await actionConfigInitFormatter?.(action, {eventVariables, rawVariables});
const actionNode = findActionNode(actionTree, actionConfig?.actionType!);
const hasSubActionNode = findSubActionNode(actionTree, action.actionType);
const cmpts = getComponents(actionNode!);
const node = findTree(cmpts, item => item.value === action.componentId);
const supportComponents = getComponents(actionNode!);
const node = findTree(supportComponents, item => item.value === action.componentId);
let setValueDs: any = null;
if (actionConfig?.actionType === 'setValue') {
@ -530,7 +511,7 @@ export class EventControl extends React.Component<
item => item.label === `${rendererName}变量`
);
setValueDs = curVariable?.children?.filter(
item => item.value !== '$$id'
(item: ContextVariables) => item.value !== '$$id'
);
}
};
@ -546,9 +527,7 @@ export class EventControl extends React.Component<
__actionDesc: actionNode!.description!, // 树节点描述
__actionSchema: actionNode!.schema, // 树节点schema
__subActions: hasSubActionNode?.actions, // 树节点子动作
__cmptTreeSource: actionConfig?.componentId
? getComponents?.(actionNode!) ?? []
: [],
__cmptTreeSource: supportComponents ?? [],
__superCmptTreeSource: allComponents,
// __supersCmptTreeSource: '',
__setValueDs: setValueDs
@ -597,8 +576,8 @@ export class EventControl extends React.Component<
const actionNode = actionType && findActionNode(actionTree, actionType);
if (action.componentId && actionNode) {
const cmpts = getComponents(actionNode);
const node = findTree(cmpts, item => item.value === action.componentId);
const supportComponents = getComponents(actionNode);
const node = findTree(supportComponents, item => item.value === action.componentId);
if (node) {
info = {
...info,

View File

@ -17,7 +17,7 @@ setSchemaTpl('api', (patch: any = {}) => {
label: '示例',
title: '接口返回示例',
tooltipClassName: 'ae-ApiSample-tooltip',
render: (data: any) => (
children: (data: any) => (
<Html
className="ae-ApiSample"
inline={false}
@ -314,7 +314,7 @@ setSchemaTpl('source', (patch: any = {}) => {
name: 'source',
label: '获取选项接口',
description: '可以通过接口获取动态选项,一次拉取全部。',
sampleBuilder: (schema: any) =>
sampleBuilder: () =>
JSON.stringify(
{
status: 0,
@ -423,7 +423,7 @@ setSchemaTpl('apiControl', (patch: any = {}) => {
label: '示例',
title: '接口返回示例',
tooltipClassName: 'ae-ApiSample-tooltip',
render: (data: any) => (
children: (data: any) => (
<Html
className="ae-ApiSample"
inline={false}
@ -460,7 +460,7 @@ setSchemaTpl('actionApiControl', (patch: any = {}) => {
label: '示例',
title: '接口返回示例',
tooltipClassName: 'ae-ApiSample-tooltip',
render: (data: any) => (
children: (data: any) => (
<Html
className="ae-ApiSample"
inline={false}

View File

@ -148,7 +148,7 @@ setSchemaTpl('labelHide', () =>
pipeIn: (value: any) => value === false,
pipeOut: (value: any) => (value === true ? false : ''),
visibleOn:
'__props__.formMode === "horizontal" || data.mode === "horizontal" || data.label === false'
'this.__props__ && this.__props__.formMode === "horizontal" || data.mode === "horizontal" || data.label === false'
})
);
@ -717,6 +717,13 @@ setSchemaTpl('backgroundImageUrl', {
label: '图片路径'
});
setSchemaTpl('audioUrl', {
type: 'input-text',
label: '音频地址',
name: 'src',
description: '支持获取变量如:<code>\\${audioSrc}</code>'
});
setSchemaTpl('fileUrl', {
type: 'input-text',
label: '文件'