Merge remote-tracking branch 'baidu/master'
Some checks are pending
CodeQL / Analyze (javascript) (push) Waiting to run
gh-pages / build (20.x) (push) Waiting to run

This commit is contained in:
2betop 2024-11-27 19:42:19 +08:00
commit 0ab0fce398
13 changed files with 235 additions and 19 deletions

View File

@ -298,6 +298,8 @@ export class DialogPlugin extends BasePlugin {
name: 'title'
},
getSchemaTpl('button-manager'),
getSchemaTpl('switch', {
label: '展示关闭按钮',
name: 'showCloseButton',

View File

@ -171,6 +171,7 @@ export class DrawerPlugin extends BasePlugin {
label: '显示蒙层',
pipeIn: defaultValue(true)
}),
getSchemaTpl('button-manager'),
getSchemaTpl('switch', {
name: 'showCloseButton',
label: '展示关闭按钮',

View File

@ -19,9 +19,11 @@ import {ValidatorTag} from '../../validator';
import {
getArgsWrapper,
getEventControlConfig,
getActionCommonProps
getActionCommonProps,
buildLinkActionDesc
} from '../../renderer/event-control/helper';
import {resolveInputTableEventDataSchame} from '../../util';
import React from 'react';
export class ComboControlPlugin extends BasePlugin {
static id = 'ComboControlPlugin';
@ -264,6 +266,14 @@ export class ComboControlPlugin extends BasePlugin {
actionLabel: '添加项',
description: '添加新的项',
innerArgs: ['item'],
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
},
schema: getArgsWrapper({
type: 'combo',
label: '添加项',

View File

@ -25,13 +25,15 @@ import {ValidatorTag} from '../../validator';
import {
getEventControlConfig,
getArgsWrapper,
getActionCommonProps
getActionCommonProps,
buildLinkActionDesc
} from '../../renderer/event-control/helper';
import cloneDeep from 'lodash/cloneDeep';
import {
resolveArrayDatasource,
resolveInputTableEventDataSchame
} from '../../util';
import React from 'react';
export class TableControlPlugin extends BasePlugin {
static id = 'TableControlPlugin';
@ -960,6 +962,14 @@ export class TableControlPlugin extends BasePlugin {
actionLabel: '添加行',
description: '添加行数据',
innerArgs: ['item', 'index'],
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
},
schema: getArgsWrapper({
type: 'container',
body: [
@ -1028,6 +1038,14 @@ export class TableControlPlugin extends BasePlugin {
actionLabel: '删除行',
description: '删除某一行数据',
innerArgs: ['condition', 'index'],
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
},
schema: getArgsWrapper({
type: 'container',
body: [
@ -1109,12 +1127,30 @@ export class TableControlPlugin extends BasePlugin {
{
actionType: 'initDrag',
actionLabel: '开启排序',
description: '开启表格拖拽排序功能'
description: '开启表格拖拽排序功能',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
}
},
{
actionType: 'cancelDrag',
actionLabel: '取消排序',
description: '取消表格拖拽排序功能'
description: '取消表格拖拽排序功能',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
}
}
];

View File

@ -34,6 +34,15 @@ export const TreeCommonAction: RendererPluginAction[] = [
actionLabel: '新增',
description: '新增数据项',
innerArgs: ['item', 'parentValue'],
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
},
schema: getArgsWrapper({
type: 'container',
body: [
@ -71,6 +80,15 @@ export const TreeCommonAction: RendererPluginAction[] = [
actionLabel: '编辑',
description: '编辑数据项',
innerArgs: ['item', 'originValue'],
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
},
schema: getArgsWrapper({
type: 'container',
body: [
@ -109,6 +127,15 @@ export const TreeCommonAction: RendererPluginAction[] = [
actionLabel: '删除',
description: '删除数据项',
innerArgs: ['value'],
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
},
schema: getArgsWrapper([
getSchemaTpl('formulaControl', {
label: '数据删除项的值',

View File

@ -14,9 +14,11 @@ import {
import {defaultValue, getSchemaTpl, tipedLabel} from 'amis-editor-core';
import {mockValue} from 'amis-editor-core';
import {
buildLinkActionDesc,
getArgsWrapper,
getEventControlConfig
} from '../renderer/event-control/helper';
import React from 'react';
export class ImagePlugin extends BasePlugin {
static id = 'ImagePlugin';
@ -119,12 +121,29 @@ export class ImagePlugin extends BasePlugin {
{
actionType: 'preview',
actionLabel: '预览',
description: '预览图片'
description: '预览图片',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
}
},
{
actionType: 'zoom',
actionLabel: '调整图片比例',
description: '将图片等比例放大或缩小',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
},
schema: {
type: 'container',
body: [

View File

@ -12,7 +12,8 @@ import {
} from 'amis-editor-core';
import {
getEventControlConfig,
getActionCommonProps
getActionCommonProps,
buildLinkActionDesc
} from '../renderer/event-control/helper';
export class NavPlugin extends BasePlugin {
@ -253,7 +254,16 @@ export class NavPlugin extends BasePlugin {
{
actionType: 'updateItems',
actionLabel: '更新菜单项',
description: '触发组件更新菜单项'
description: '触发组件更新菜单项',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
}
},
{
actionType: 'collapse',

View File

@ -1,6 +1,8 @@
import {RendererPluginAction, registerEditorPlugin} from 'amis-editor-core';
import {BaseEventContext, BasePlugin} from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import React from 'react';
import {buildLinkActionDesc} from '../renderer/event-control';
export class OfficeViewerPlugin extends BasePlugin {
static id = 'OfficeViewerPlugin';
@ -32,12 +34,28 @@ export class OfficeViewerPlugin extends BasePlugin {
{
actionType: 'print',
actionLabel: '打印',
description: '打印文档'
description: '打印文档',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
}
},
{
actionType: 'saveAs',
actionLabel: '下载',
description: '下载文档'
description: '下载文档',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
}
}
];

View File

@ -1,6 +1,8 @@
import {RendererPluginAction, registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin} from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import React from 'react';
import {buildLinkActionDesc} from '../renderer/event-control';
export class QRCodePlugin extends BasePlugin {
static id = 'QRCodePlugin';
@ -29,7 +31,15 @@ export class QRCodePlugin extends BasePlugin {
{
actionType: 'saveAs',
actionLabel: '下载',
description: '触发二维码下载'
description: '触发二维码下载',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
}
}
];

View File

@ -18,7 +18,8 @@ import {DSBuilderManager} from '../builder/DSBuilderManager';
import {DSFeatureEnum, ModelDSBuilderKey, ApiDSBuilderKey} from '../builder';
import {
getEventControlConfig,
getActionCommonProps
getActionCommonProps,
buildLinkActionDesc
} from '../renderer/event-control/helper';
import type {Schema} from 'amis-core';
@ -177,7 +178,16 @@ export class ServicePlugin extends BasePlugin {
{
actionType: 'rebuild',
actionLabel: '重新构建',
description: '触发schemaApi刷新重新构建Schema'
description: '触发schemaApi刷新重新构建Schema',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
Schema
</div>
);
}
},
{
actionType: 'setValue',

View File

@ -29,7 +29,8 @@ import {reaction} from 'mobx';
import {DSBuilderManager} from '../builder/DSBuilderManager';
import {
getEventControlConfig,
getArgsWrapper
getArgsWrapper,
buildLinkActionDesc
} from '../renderer/event-control/helper';
import {
schemaArrayFormat,
@ -453,6 +454,15 @@ export class TablePlugin extends BasePlugin {
actionLabel: '设置选中项',
description: '设置表格的选中项',
innerArgs: ['selected'],
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
},
schema: getArgsWrapper([
getSchemaTpl('formulaControl', {
name: 'selected',
@ -472,17 +482,44 @@ export class TablePlugin extends BasePlugin {
{
actionType: 'clearAll',
actionLabel: '清空选中项',
description: '清空表格所有选中项'
description: '清空表格所有选中项',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
}
},
{
actionType: 'initDrag',
actionLabel: '开启排序',
description: '开启表格拖拽排序功能'
description: '开启表格拖拽排序功能',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
}
},
{
actionType: 'cancelDrag',
actionLabel: '取消排序',
description: '取消表格拖拽排序功能'
description: '取消表格拖拽排序功能',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">
{buildLinkActionDesc(props.manager, info)}
</div>
);
}
}
];

View File

@ -6,7 +6,7 @@ import {
tipedLabel,
EditorManager
} from 'amis-editor-core';
import type {SchemaObject} from 'amis';
import {render, type SchemaObject} from 'amis';
import flatten from 'lodash/flatten';
import {InputComponentName} from '../component/InputComponentName';
import {FormulaDateType} from '../renderer/FormulaControl';
@ -1851,3 +1851,39 @@ setSchemaTpl('inputForbid', {
name: 'inputForbid',
inputClassName: 'is-inline'
});
setSchemaTpl('button-manager', () => {
return getSchemaTpl('combo-container', {
type: 'combo',
label: '按钮管理',
name: 'actions',
mode: 'normal',
multiple: true,
addable: true,
draggable: true,
editable: false,
items: [
{
component: (props: any) => {
return render({
...props.data,
onEvent: {},
actionType: '',
onClick: (e: any, props: any) => {
const editorStore = (window as any).editorStore;
const subEditorStore = editorStore.getSubEditorRef()?.store;
(subEditorStore || editorStore).setActiveIdByComponentId(
props.id
);
}
});
}
}
],
addButtonText: '新增按钮',
scaffold: {
type: 'button',
label: '按钮'
}
});
});

View File

@ -707,9 +707,7 @@ export class Action extends React.Component<ActionProps, ActionState> {
render() {
const {
type,
icon,
iconClassName,
rightIcon,
rightIconClassName,
loadingClassName,
primary,
@ -791,6 +789,8 @@ export class Action extends React.Component<ActionProps, ActionState> {
}) as string;
disabled = true;
}
const icon = filter(this.props.icon, data);
const rightIcon = filter(this.props.rightIcon, data);
const iconElement = (
<Icon