Home > LIB_PanelLibrary > copy
LIB_PanelLibrary.copy() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Copy Panel library
Signature
typescript
function copy(
panelLibraryUuid: string,
libraryUuid: string,
targetLibraryUuid: string,
targetClassification?: ILIB_ClassificationIndex | Array<string>,
newPanelLibraryName?: string,
): Promise<string | undefined>;1
2
3
4
5
6
7
2
3
4
5
6
7
Parameters
Parameter | Type | Description |
|---|---|---|
panelLibraryUuid | string | Panel library UUID |
libraryUuid | string | Library UUID, you can use LIB_LibrariesList APIs in |
targetLibraryUuid | string | Target library UUID |
targetClassification | ILIB_ClassificationIndex | Array<string> | (Optional) Classification in the target library |
newPanelLibraryName | string | (Optional) New panel library name. If a panel library with the same name exists in the target library, the copy will fail |
Returns
Promise<string | undefined>
UUID of the new panel library in the target library
Example
javascript
// 1. 搜索系统库,取一个面板库作为复制来源
const [source] = await eda.lib_PanelLibrary.search('', undefined, undefined, 1, 1);
// 2. 获取个人库 UUID
const targetLibraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 3. 从系统库复制到个人库,指定新名称避免同名冲突(分类传 [] = 不分类)
const newName = `嘉立创示例_面板库副本_${Date.now()}`;
const copiedUuid = await eda.lib_PanelLibrary.copy(
source.uuid,
source.libraryUuid,
targetLibraryUuid,
[],
newName
);
// 创建类保留现场(副本留在个人库中供观察)
console.log('sourceUuid:', source.uuid);
console.log('copiedUuid:', copiedUuid);
console.log('newName:', newName);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21