Skip to content

Commit

Permalink
fix:补充特性动作的描述
Browse files Browse the repository at this point in the history
  • Loading branch information
hsm-lv committed Nov 27, 2024
1 parent a745cf5 commit b2464f9
Show file tree
Hide file tree
Showing 12 changed files with 195 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class AvailableRenderersPanel extends React.Component<
const customRenderersByOrder = store.customRenderersByOrder || [];
const groupedSubRenderers = store.groupedSubRenderers || {};
const groupedCustomRenderers = store.groupedCustomRenderers || {}; // 自定义组件

debugger;
return (
<div className="ae-RendererPanel">
<div className="panel-header">组件</div>
Expand Down
1 change: 1 addition & 0 deletions packages/amis-editor-core/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ export class EditorManager {
readonly store: EditorStoreType,
readonly parent?: EditorManager
) {
debugger;
// 传给 amis 渲染器的默认 env
this.env = {
...(env as any), // 默认的 env 中带 jumpTo
Expand Down
2 changes: 1 addition & 1 deletion packages/amis-editor-core/src/store/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ export const MainStore = types
const panels: Array<PanelItem> = [].concat(
(this.leftPanels as any) || []
);

debugger;
if (self.insertId && self.insertRegion) {
panels.push({
key: 'insert',
Expand Down
12 changes: 11 additions & 1 deletion packages/amis-editor/src/plugin/Form/Combo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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: '添加项',
Expand Down
41 changes: 38 additions & 3 deletions packages/amis-editor/src/plugin/Form/InputTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import {ValidatorTag} from '../../validator';
import {
getEventControlConfig,
getArgsWrapper,
getActionCommonProps
getActionCommonProps,
buildLinkActionDesc
} from '../../renderer/event-control/helper';
import cloneDeep from 'lodash/cloneDeep';
import {
Expand Down Expand Up @@ -958,6 +959,14 @@ export class TableControlPlugin extends BasePlugin {
actionLabel: '添加行',
description: '添加行数据',
innerArgs: ['item', 'index'],
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">

Check failure on line 964 in packages/amis-editor/src/plugin/Form/InputTable.tsx

View workflow job for this annotation

GitHub Actions / build (20.x)

'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.
{buildLinkActionDesc(props.manager, info)}
添加行
</div>
);
},
schema: getArgsWrapper({
type: 'container',
body: [
Expand Down Expand Up @@ -1026,6 +1035,14 @@ export class TableControlPlugin extends BasePlugin {
actionLabel: '删除行',
description: '删除某一行数据',
innerArgs: ['condition', 'index'],
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">

Check failure on line 1040 in packages/amis-editor/src/plugin/Form/InputTable.tsx

View workflow job for this annotation

GitHub Actions / build (20.x)

'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.
{buildLinkActionDesc(props.manager, info)}
删除行
</div>
);
},
schema: getArgsWrapper({
type: 'container',
body: [
Expand Down Expand Up @@ -1107,12 +1124,30 @@ export class TableControlPlugin extends BasePlugin {
{
actionType: 'initDrag',
actionLabel: '开启排序',
description: '开启表格拖拽排序功能'
description: '开启表格拖拽排序功能',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">

Check failure on line 1130 in packages/amis-editor/src/plugin/Form/InputTable.tsx

View workflow job for this annotation

GitHub Actions / build (20.x)

'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.
开启
{buildLinkActionDesc(props.manager, info)}
排序
</div>
);
}
},
{
actionType: 'cancelDrag',
actionLabel: '取消排序',
description: '取消表格拖拽排序功能'
description: '取消表格拖拽排序功能',
descDetail: (info: any, context: any, props: any) => {
return (
<div className="action-desc">

Check failure on line 1144 in packages/amis-editor/src/plugin/Form/InputTable.tsx

View workflow job for this annotation

GitHub Actions / build (20.x)

'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.
取消
{buildLinkActionDesc(props.manager, info)}
排序
</div>
);
}
}
];

Expand Down
27 changes: 27 additions & 0 deletions packages/amis-editor/src/plugin/Form/InputTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -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: [
Expand Down Expand Up @@ -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: '数据删除项的值',
Expand Down
21 changes: 20 additions & 1 deletion packages/amis-editor/src/plugin/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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: [
Expand Down
14 changes: 12 additions & 2 deletions packages/amis-editor/src/plugin/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
} from 'amis-editor-core';
import {
getEventControlConfig,
getActionCommonProps
getActionCommonProps,
buildLinkActionDesc
} from '../renderer/event-control/helper';

export class NavPlugin extends BasePlugin {
Expand Down Expand Up @@ -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',
Expand Down
22 changes: 20 additions & 2 deletions packages/amis-editor/src/plugin/OfficeViewer.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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>
);
}
}
];

Expand Down
12 changes: 11 additions & 1 deletion packages/amis-editor/src/plugin/QRCode.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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>
);
}
}
];

Expand Down
14 changes: 12 additions & 2 deletions packages/amis-editor/src/plugin/Service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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',
Expand Down
Loading

0 comments on commit b2464f9

Please sign in to comment.