Skip to content

Function: normalizeVirtualRoot()

Call Signature

ts
function normalizeVirtualRoot<T>(
   values, 
   virtualRootId?, 
   parentIdField?): T[];

将表单数据中的虚拟根节点 ID 转换回 null(提交到后端前调用)。

Type Parameters

Type Parameter
T extends Record<string, any>

Parameters

ParameterType
valuesT[]
virtualRootId?string
parentIdField?string

Returns

T[]

Example

ts
normalizeVirtualRoot({ name: 'X', parentId: VIRTUAL_ROOT_ID }, VIRTUAL_ROOT_ID, 'parentId')
// => { name: 'X', parentId: null } *

Since

1.0.0

Call Signature

ts
function normalizeVirtualRoot<T>(
   values, 
   virtualRootId, 
   parentIdField): T;

将表单数据中的虚拟根节点 ID 转换回 null(提交到后端前调用)。

Type Parameters

Type Parameter
T extends Record<string, any>

Parameters

ParameterType
valuesT
virtualRootIdstring
parentIdFieldstring

Returns

T

Example

ts
normalizeVirtualRoot({ name: 'X', parentId: VIRTUAL_ROOT_ID }, VIRTUAL_ROOT_ID, 'parentId')
// => { name: 'X', parentId: null } *

Since

1.0.0

Released under the MIT License.