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