mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:48:55 +08:00
Merge pull request #7187 from lurunze1226/editor-sharedcontext
chore(amis-editor): EditorNode中info支持设置sharedContext; fix: InputTable…
This commit is contained in:
commit
7dc984b463
@ -102,7 +102,12 @@ export interface DSSourceSettingFormConfig {
|
||||
grain?: DSGrain;
|
||||
/** 数据源所被使用的功能场景 */
|
||||
feat: DSFeatureType;
|
||||
/** 是否是在CRUD场景下,有的数据源在CRUD中可以统一设置 */
|
||||
/** 渲染器类型 */
|
||||
renderer?: string;
|
||||
/**
|
||||
* @deprecated 待废弃,使用renderer字段代替
|
||||
* 是否是在CRUD场景下,有的数据源在CRUD中可以统一设置
|
||||
* */
|
||||
inCrud?: boolean;
|
||||
/** 是否在脚手架中 */
|
||||
inScaffold?: boolean;
|
||||
|
@ -33,7 +33,7 @@ import SearchPanel from './component/base/SearchPanel';
|
||||
import {VRenderer} from './component/VRenderer';
|
||||
import {RegionWrapper} from './component/RegionWrapper';
|
||||
import {mapReactElement} from './component/factory';
|
||||
import type {EditorNodeType} from './store/node';
|
||||
import type {EditorNodeType, EditorNodeSnapshot} from './store/node';
|
||||
import {ContainerWrapper} from './component/ContainerWrapper';
|
||||
import type {EditorStoreType} from './store/editor';
|
||||
import {AvailableRenderersPlugin} from './plugin/AvailableRenderers';
|
||||
@ -56,6 +56,7 @@ export {
|
||||
IFramePreview as IFrameEditor,
|
||||
SearchPanel,
|
||||
EditorNodeType,
|
||||
EditorNodeSnapshot,
|
||||
EditorStoreType,
|
||||
ContainerWrapper,
|
||||
AvailableRenderersPlugin,
|
||||
|
@ -291,6 +291,8 @@ export interface RendererInfo extends RendererScaffoldInfo {
|
||||
memberIndex?: number;
|
||||
|
||||
tipName?: string;
|
||||
/** 共享上下文 */
|
||||
sharedContext?: Record<string, any>;
|
||||
}
|
||||
|
||||
export type BasicRendererInfo = Omit<
|
||||
|
@ -77,6 +77,14 @@ export const EditorNode = types
|
||||
info = value;
|
||||
},
|
||||
|
||||
updateSharedContext(value: Record<string, any>) {
|
||||
if (!value || !info?.hasOwnProperty('sharedContext')) {
|
||||
return;
|
||||
}
|
||||
|
||||
info.sharedContext = value;
|
||||
},
|
||||
|
||||
get rendererConfig() {
|
||||
return rendererConfig;
|
||||
},
|
||||
|
@ -649,24 +649,31 @@ export class ComboControlPlugin extends BasePlugin {
|
||||
target: EditorNodeType,
|
||||
region?: EditorNodeType
|
||||
) {
|
||||
if (target.parent.isRegion && target.parent.region === 'items') {
|
||||
const scope = scopeNode.parent.parent;
|
||||
const builder = this.dsBuilderManager.resolveBuilderBySchema(
|
||||
let scope;
|
||||
let builder;
|
||||
|
||||
if (
|
||||
target.type === scopeNode.type ||
|
||||
(target.parent.isRegion && target.parent.region === 'items')
|
||||
) {
|
||||
scope = scopeNode.parent.parent;
|
||||
builder = this.dsBuilderManager.resolveBuilderBySchema(
|
||||
scope.schema,
|
||||
'api'
|
||||
);
|
||||
}
|
||||
|
||||
if (builder && scope.schema.api) {
|
||||
return builder.getAvailableContextFileds(
|
||||
{
|
||||
schema: scope.schema,
|
||||
sourceKey: 'api',
|
||||
feat: scope.schema?.feat ?? 'List',
|
||||
scopeNode
|
||||
},
|
||||
target
|
||||
);
|
||||
}
|
||||
if (builder && scope.schema.api) {
|
||||
return builder.getAvailableContextFileds(
|
||||
{
|
||||
schema: scope.schema,
|
||||
sourceKey: 'api',
|
||||
feat: scope.schema?.feat ?? 'List',
|
||||
scopeNode
|
||||
},
|
||||
/** ID相同为本体,否则为子项 */
|
||||
target?.id === scopeNode?.id ? scopeNode : target
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1082,24 +1082,31 @@ export class TableControlPlugin extends BasePlugin {
|
||||
target: EditorNodeType,
|
||||
region?: EditorNodeType
|
||||
) {
|
||||
if (target.parent.isRegion && target.parent.region === 'columns') {
|
||||
const scope = scopeNode.parent.parent;
|
||||
const builder = this.dsBuilderManager.resolveBuilderBySchema(
|
||||
let scope;
|
||||
let builder;
|
||||
|
||||
if (
|
||||
target.type === scopeNode.type ||
|
||||
(target.parent.isRegion && target.parent.region === 'columns')
|
||||
) {
|
||||
scope = scopeNode.parent.parent;
|
||||
builder = this.dsBuilderManager.resolveBuilderBySchema(
|
||||
scope.schema,
|
||||
'api'
|
||||
);
|
||||
}
|
||||
|
||||
if (builder && scope.schema.api) {
|
||||
return builder.getAvailableContextFileds(
|
||||
{
|
||||
schema: scope.schema,
|
||||
sourceKey: 'api',
|
||||
feat: scope.schema?.feat ?? 'List',
|
||||
scopeNode
|
||||
},
|
||||
target
|
||||
);
|
||||
}
|
||||
if (builder && scope.schema.api) {
|
||||
return builder.getAvailableContextFileds(
|
||||
{
|
||||
schema: scope.schema,
|
||||
sourceKey: 'api',
|
||||
feat: scope.schema?.feat ?? 'List',
|
||||
scopeNode
|
||||
},
|
||||
/** ID相同为本体,否则为子项 */
|
||||
target?.id === scopeNode?.id ? scopeNode : target
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user