mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:09:08 +08:00
Merge branch 'master' into pre-release
This commit is contained in:
commit
d5ac890449
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "amis-editor-core",
|
||||
"version": "5.2.0-beta.20",
|
||||
"version": "5.2.0-beta.36",
|
||||
"description": "amis 可视化编辑器",
|
||||
"main": "lib/index.min.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -65,6 +65,7 @@
|
||||
margin-right: 3px;
|
||||
max-width: calc(100% - 39px); // 避免表达式内容太长撑开面板
|
||||
white-space: nowrap;
|
||||
padding: 0;
|
||||
|
||||
&.is-clearable {
|
||||
> div:first-child {
|
||||
|
@ -44,7 +44,8 @@ import {
|
||||
reactionWithOldValue,
|
||||
reGenerateID,
|
||||
isString,
|
||||
isObject
|
||||
isObject,
|
||||
JSONPipeOut
|
||||
} from './util';
|
||||
import {reaction} from 'mobx';
|
||||
import {hackIn, makeSchemaFormRender, makeWrapper} from './component/factory';
|
||||
@ -285,6 +286,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();
|
||||
}
|
||||
}
|
||||
@ -1717,7 +1725,7 @@ export class EditorManager {
|
||||
component.props.$$id,
|
||||
component.props.type
|
||||
);
|
||||
node?.info?.plugin?.rendererBeforeDispatchEvent?.(node, e, data);
|
||||
node?.info?.plugin?.rendererBeforeDispatchEvent?.(node, e, JSONPipeOut(data));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,8 +361,8 @@ export const EditorStore = types
|
||||
return this.getNodeById(self.activeId)?.info;
|
||||
},
|
||||
|
||||
getSchema(id?: string) {
|
||||
return id ? JSONGetById(self.schema, id) : self.schema;
|
||||
getSchema(id?: string, idKey?: string) {
|
||||
return id ? JSONGetById(self.schema, id, idKey) : self.schema;
|
||||
},
|
||||
|
||||
getSchemaParentById(id: string) {
|
||||
@ -498,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() {
|
||||
@ -509,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) === '__')
|
||||
);
|
||||
},
|
||||
@ -851,7 +852,7 @@ export const EditorStore = types
|
||||
},
|
||||
|
||||
get getSuperEditorData() {
|
||||
return self.superEditorData || {}
|
||||
return self.superEditorData || {};
|
||||
}
|
||||
};
|
||||
})
|
||||
|
@ -210,7 +210,7 @@ export function JSONGetByPath(
|
||||
return target;
|
||||
}
|
||||
|
||||
export function JSONGetPathById(json: any, id: string): Array<string> | null {
|
||||
export function JSONGetPathById(json: any, id: string, idKey: string = '$$id'): Array<string> | null {
|
||||
let paths: Array<string> = [];
|
||||
let resolved: boolean = false;
|
||||
let stack: Array<any> = [
|
||||
@ -225,7 +225,7 @@ export function JSONGetPathById(json: any, id: string): Array<string> | null {
|
||||
let data = cur.data;
|
||||
let path = cur.path;
|
||||
|
||||
if (data.$$id === id) {
|
||||
if (data[idKey] === id) {
|
||||
resolved = true;
|
||||
paths = path.split('.').filter((item: any) => item);
|
||||
break;
|
||||
@ -255,8 +255,8 @@ export function JSONGetPathById(json: any, id: string): Array<string> | null {
|
||||
return resolved ? paths : null;
|
||||
}
|
||||
|
||||
export function JSONGetById(json: any, id: string): any {
|
||||
let paths = JSONGetPathById(json, id);
|
||||
export function JSONGetById(json: any, id: string, idKey?: string): any {
|
||||
let paths = JSONGetPathById(json, id, idKey);
|
||||
if (paths === null) {
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user