mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:48:13 +08:00
fix: 选中关联编辑相关弹窗数据映射不统一 (#5296)
* fix: 选中关联编辑相关弹窗数据映射不统一 * 有可能需要有个初始化接口,因为选项的数据可能不全
This commit is contained in:
parent
1f853d78cd
commit
9854ed381e
@ -248,6 +248,7 @@ export interface OptionsProps
|
|||||||
creatable?: boolean;
|
creatable?: boolean;
|
||||||
addApi?: Api;
|
addApi?: Api;
|
||||||
addControls?: Array<any>;
|
addControls?: Array<any>;
|
||||||
|
editInitApi?: Api;
|
||||||
editApi?: Api;
|
editApi?: Api;
|
||||||
editControls?: Array<any>;
|
editControls?: Array<any>;
|
||||||
deleteApi?: Api;
|
deleteApi?: Api;
|
||||||
@ -1110,6 +1111,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|||||||
labelField,
|
labelField,
|
||||||
onOpenDialog,
|
onOpenDialog,
|
||||||
editApi,
|
editApi,
|
||||||
|
editInitApi,
|
||||||
env,
|
env,
|
||||||
source,
|
source,
|
||||||
data,
|
data,
|
||||||
@ -1144,6 +1146,7 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|||||||
...editDialog,
|
...editDialog,
|
||||||
body: {
|
body: {
|
||||||
type: 'form',
|
type: 'form',
|
||||||
|
initApi: editInitApi,
|
||||||
api: editApi,
|
api: editApi,
|
||||||
controls: editControls
|
controls: editControls
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import {StoreNode} from './node';
|
|||||||
import {getStoreById} from './manager';
|
import {getStoreById} from './manager';
|
||||||
import {normalizeOptions} from '../utils/normalizeOptions';
|
import {normalizeOptions} from '../utils/normalizeOptions';
|
||||||
import {optionValueCompare} from '../utils/optionValueCompare';
|
import {optionValueCompare} from '../utils/optionValueCompare';
|
||||||
|
import {dataMapping} from '../utils/dataMapping';
|
||||||
|
|
||||||
interface IOption {
|
interface IOption {
|
||||||
value?: string | number | null;
|
value?: string | number | null;
|
||||||
@ -1179,13 +1180,14 @@ export const FormItemStore = StoreNode.named('FormItemStore')
|
|||||||
clearError();
|
clearError();
|
||||||
}
|
}
|
||||||
|
|
||||||
function openDialog(
|
function openDialog(schema: any, ctx: any, callback?: (ret?: any) => void) {
|
||||||
schema: any,
|
if (schema.data) {
|
||||||
data: any,
|
self.dialogData = dataMapping(schema.data, ctx);
|
||||||
callback?: (ret?: any) => void
|
} else {
|
||||||
) {
|
self.dialogData = ctx;
|
||||||
|
}
|
||||||
|
|
||||||
self.dialogSchema = schema;
|
self.dialogSchema = schema;
|
||||||
self.dialogData = data;
|
|
||||||
self.dialogOpen = true;
|
self.dialogOpen = true;
|
||||||
callback && dialogCallbacks.set(self.dialogData, callback);
|
callback && dialogCallbacks.set(self.dialogData, callback);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user