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