mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-05 05:18:34 +08:00
merge maseter
Change-Id: Ia6dc7b3044bc75a0924eb3a1ee124059f96d4b11
This commit is contained in:
commit
3b92b3091e
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "amis-editor-core",
|
||||
"version": "5.2.0-beta.35",
|
||||
"version": "5.2.0-beta.37",
|
||||
"description": "amis 可视化编辑器",
|
||||
"main": "lib/index.min.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -64,12 +64,14 @@
|
||||
margin-right: 3px;
|
||||
max-width: calc(100% - 39px); // 避免表达式内容太长撑开面板
|
||||
white-space: nowrap;
|
||||
padding: 0;
|
||||
|
||||
&.is-clearable {
|
||||
> div:first-child {
|
||||
max-width: calc(100% - 20px); // 避免表达式内容太长撑开面板
|
||||
|
||||
> div,span {
|
||||
> div,
|
||||
span {
|
||||
padding-right: 0; // 覆盖 amis 默认样式
|
||||
}
|
||||
}
|
||||
@ -83,7 +85,7 @@
|
||||
font-size: 12px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
|
||||
span.c-func {
|
||||
color: #ae4597;
|
||||
font-weight: bold;
|
||||
|
@ -30,7 +30,7 @@ export interface EditorProps extends PluginEventListener {
|
||||
theme?: string;
|
||||
showCustomRenderersPanel?: boolean;
|
||||
amisDocHost?: string;
|
||||
|
||||
superEditorData?: any;
|
||||
withSuperDataSchema?: boolean;
|
||||
dataBindingChange?: (
|
||||
value: string,
|
||||
@ -116,6 +116,7 @@ export default class Editor extends Component<EditorProps> {
|
||||
isSubEditor = false,
|
||||
onChange,
|
||||
showCustomRenderersPanel,
|
||||
superEditorData,
|
||||
...rest
|
||||
} = props;
|
||||
|
||||
@ -128,7 +129,8 @@ export default class Editor extends Component<EditorProps> {
|
||||
theme: props.theme,
|
||||
isSubEditor,
|
||||
amisDocHost: props.amisDocHost,
|
||||
ctx: props.ctx
|
||||
ctx: props.ctx,
|
||||
superEditorData
|
||||
},
|
||||
config
|
||||
);
|
||||
@ -481,9 +483,9 @@ export default class Editor extends Component<EditorProps> {
|
||||
data,
|
||||
iframeUrl,
|
||||
previewProps,
|
||||
autoFocus
|
||||
autoFocus,
|
||||
isSubEditor
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={this.mainRef}
|
||||
|
@ -67,7 +67,6 @@ export class RightPanels extends React.Component<
|
||||
const id = store.activeId;
|
||||
const node = store.getNodeById(id);
|
||||
const panelKey = store.getPanelKey();
|
||||
|
||||
const renderPanel = (panel: PanelItem) => {
|
||||
return panel.render ? (
|
||||
panel.render({
|
||||
|
@ -2,6 +2,8 @@ import React from 'react';
|
||||
import {EditorManager} from '../manager';
|
||||
import {EditorStoreType} from '../store/editor';
|
||||
import {render} from 'amis';
|
||||
import {createObject} from 'amis-core';
|
||||
|
||||
import {observer} from 'mobx-react';
|
||||
import Editor from './Editor';
|
||||
import {
|
||||
@ -96,7 +98,10 @@ export class SubEditor extends React.Component<SubEditorProps> {
|
||||
const {store, manager} = this.props;
|
||||
const subEditorContext = store.subEditorContext;
|
||||
const config = manager.config;
|
||||
|
||||
let superEditorData: any = store.superEditorData;
|
||||
if (!!subEditorContext) {
|
||||
superEditorData = createObject(store.superEditorData, subEditorContext?.data?.__super);
|
||||
}
|
||||
return {
|
||||
size: 'full',
|
||||
title: store.subEditorContext?.title,
|
||||
@ -134,6 +139,7 @@ export class SubEditor extends React.Component<SubEditorProps> {
|
||||
ref={store.subEditorRef}
|
||||
onChange={onChange}
|
||||
data={store.subEditorContext?.data}
|
||||
superEditorData={superEditorData}
|
||||
schemaFilter={manager.config.schemaFilter}
|
||||
theme={manager.env.theme}
|
||||
afterResolveEditorInfo={this.afterResolveEditorInfo}
|
||||
@ -200,7 +206,6 @@ export class SubEditor extends React.Component<SubEditorProps> {
|
||||
|
||||
render() {
|
||||
const {store, theme, manager} = this.props;
|
||||
|
||||
return render(
|
||||
{
|
||||
type: 'dialog',
|
||||
|
@ -288,6 +288,13 @@ export class EditorManager {
|
||||
this.plugins.push(newPlugin);
|
||||
// 重新排序
|
||||
this.plugins.sort((a, b) => a.order! - b.order!); // 按order排序【升序】
|
||||
|
||||
// 记录动作定义
|
||||
if (newPlugin.rendererName) {
|
||||
this.pluginEvents[newPlugin.rendererName] = newPlugin.events || [];
|
||||
this.pluginActions[newPlugin.rendererName] = newPlugin.actions || [];
|
||||
}
|
||||
|
||||
this.buildRenderers();
|
||||
}
|
||||
}
|
||||
|
@ -912,6 +912,7 @@ export interface RendererPluginAction {
|
||||
supportComponents?: string[] | string; // 如果schema中包含选择组件,可以指定该动作支持的组件类型,用于组件数树过滤
|
||||
innerArgs?: string[]; // 动作专属配置参数,主要是为了区分特性字段和附加参数
|
||||
descDetail?: (info: any) => string | JSX.Element; // 动作详细描述
|
||||
outputVarDataSchema?: any | any[]; // 动作出参的结构定义
|
||||
actions?: SubRendererPluginAction[]; // 分支动作(配置面板包含多种动作的情况)
|
||||
children?: RendererPluginAction[]; // 子类型,for动作树
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {findTree, getVariable, mapObject} from 'amis-core';
|
||||
import {findTree, getVariable, mapObject, createObject} from 'amis-core';
|
||||
import {cast, getEnv, Instance, types} from 'mobx-state-tree';
|
||||
import {
|
||||
diff,
|
||||
@ -188,6 +188,8 @@ export const EditorStore = types
|
||||
|
||||
// 弹出子编辑器相关的信息
|
||||
subEditorContext: types.maybe(types.frozen<SubEditorContext>()),
|
||||
// 子编辑器中可能需要拿到父编辑器的数据
|
||||
superEditorData: types.maybe(types.frozen()),
|
||||
|
||||
calculateStarted: false,
|
||||
|
||||
@ -496,7 +498,7 @@ export const EditorStore = types
|
||||
},
|
||||
|
||||
getValueOf(id: string) {
|
||||
return JSONPipeOut(JSONGetById(self.schema, id));
|
||||
return JSONPipeOut(JSONGetById(self.schema, id), false);
|
||||
},
|
||||
|
||||
get valueWithoutHiddenProps() {
|
||||
@ -507,10 +509,11 @@ export const EditorStore = types
|
||||
return JSONPipeOut(
|
||||
JSONGetById(self.schema, self.activeId),
|
||||
getEnv(self).isHiddenProps ||
|
||||
(key =>
|
||||
((key, props) =>
|
||||
(key.substring(0, 2) === '$$' &&
|
||||
key !== '$$comments' &&
|
||||
key !== '$$commonSchema') ||
|
||||
typeof props === 'function' || // pipeIn 和 pipeOut
|
||||
key.substring(0, 2) === '__')
|
||||
);
|
||||
},
|
||||
@ -846,6 +849,10 @@ export const EditorStore = types
|
||||
item => item.versionId === self.versionId
|
||||
);
|
||||
return idx < self.schemaHistory.length - 1;
|
||||
},
|
||||
|
||||
get getSuperEditorData() {
|
||||
return self.superEditorData || {};
|
||||
}
|
||||
};
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user