@jlceda/pro-api-types 0.2.33 → 0.2.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +129 -26
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -43,6 +43,8 @@ declare global {
43
43
  HOME = -1,
44
44
  /** 空白页 */
45
45
  BLANK = 0,
46
+ /** 工程 */
47
+ PROJECT = 5,
46
48
  /** 原理图图页 */
47
49
  SCHEMATIC_PAGE = 1,
48
50
  /** PCB */
@@ -72,7 +74,15 @@ declare global {
72
74
  /** 封装 */
73
75
  FOOTPRINT = 4,
74
76
  /** 面板库 */
75
- PANEL_LIBRARY = 29
77
+ PANEL_LIBRARY = 29,
78
+ /** 仿真原理图图页:NGspice */
79
+ SIMULATION_SCHEMATIC_PAGE_NGSPICE = 8,
80
+ /** 仿真原理图图页:SimulIDE */
81
+ SIMULATION_SCHEMATIC_PAGE_SIMULIDE = 9,
82
+ /** 仿真元件符号:NGspice */
83
+ SIMULATION_SYMBOL_COMPONENT_NGSPICE = 7,
84
+ /** 仿真元件符号:SimulIDE */
85
+ SIMULATION_SYMBOL_COMPONENT_SIMULIDE = 32
76
86
  }
77
87
  /**
78
88
  * 编辑器文档对象
@@ -927,6 +937,8 @@ declare global {
927
937
  title: string;
928
938
  /** 标签页 ID */
929
939
  tabId: string;
940
+ /** 文档类型 */
941
+ documentType: EDMT_EditorDocumentType;
930
942
  /** 标签页是否可拖动 */
931
943
  draggable: boolean;
932
944
  /** 标签页是否可关闭 */
@@ -960,7 +972,7 @@ declare global {
960
972
  * @beta
961
973
  * @param libraryUuid - 库 UUID,可以使用 {@link LIB_LibrariesList} 内的接口获取
962
974
  * @param libraryType - 库类型,支持符号和封装
963
- * @param uuid - 符号、封��� UUID
975
+ * @param uuid - 符号、封装 UUID
964
976
  * @param splitScreenId - 分屏 ID,即 {@link DMT_EditorControl.getSplitScreenTree} 方法获取到的 {@link IDMT_EditorSplitScreenItem.id}
965
977
  * @returns 标签页 ID,如若为 `undefined`,则打开文档失败
966
978
  */
@@ -1150,6 +1162,88 @@ declare global {
1150
1162
  removeIndicatorMarkers(tabId?: string): Promise<boolean>;
1151
1163
  }
1152
1164
 
1165
+ /**
1166
+ * 编辑器标签页事件类型
1167
+ *
1168
+ * @public
1169
+ * @remarks 在类型为 {@link EDMT_EditorTabEventType.CLOSE | 关闭} 或 {@link EDMT_EditorTabEventType.OPEN | 打开} 时,均会同时触发 {@link EDMT_EditorTabEventType.TOGGLE | 切换} 事件
1170
+ */
1171
+ enum EDMT_EditorTabEventType {
1172
+ /** 切换 */
1173
+ TOGGLE = "toggle",
1174
+ /** 关闭 */
1175
+ CLOSE = "close",
1176
+ /** 打开 */
1177
+ OPEN = "open"
1178
+ }
1179
+ /**
1180
+ * 编辑器标签页事件触发原因
1181
+ *
1182
+ * @public
1183
+ */
1184
+ enum EDMT_EditorTabEventTriggerCause {
1185
+ /** 切换标签页 */
1186
+ TOGGLE_TAB = "Toggle Tab",
1187
+ /** 关闭标签页 */
1188
+ CLOSE_TAB = "Close Tab",
1189
+ /** 打开文档 */
1190
+ OPEN_DOCUMENT = "Open Document",
1191
+ /** 打开工程 */
1192
+ OPEN_PROJECT = "Open Project",
1193
+ /** 关闭工程 */
1194
+ CLOSE_PROJECT = "Close Project"
1195
+ }
1196
+ /**
1197
+ * 文档树 / 事件类
1198
+ *
1199
+ * @public
1200
+ * @remarks 注册事件回调
1201
+ */
1202
+ class DMT_Event {
1203
+ /** 扩展 UUID */
1204
+ private extensionUuid?;
1205
+ /**
1206
+ * @internal
1207
+ * @param extensionUuid - 扩展 UUID
1208
+ */
1209
+ constructor(extensionUuid?: string);
1210
+ /**
1211
+ * 新增编辑器标签页事件监听
1212
+ *
1213
+ * @alpha
1214
+ * @remarks
1215
+ * 注意:本接口仅扩展有效,在独立脚本环境内调用将始终 `throw Error`
1216
+ *
1217
+ * 在 {@link EDMT_EditorTabEventType | 标签页事件类型} 为 {@link EDMT_EditorTabEventType.CLOSE | 关闭} 或 {@link EDMT_EditorTabEventType.OPEN | 打开} 时,均会同时触发 {@link EDMT_EditorTabEventType.TOGGLE | 切换} 事件
1218
+ * @param id - 事件 ID,用以防止重复注册事件
1219
+ * @param eventType - 事件类型
1220
+ * @param callFn - 事件触发时的回调函数
1221
+ * @param onlyOnce - 是否仅监听一次
1222
+ */
1223
+ addEditorTabEventListener(id: string, eventType: 'all' | EDMT_EditorTabEventType, callFn: (eventType: EDMT_EditorTabEventType, props: {
1224
+ triggerCause: EDMT_EditorTabEventTriggerCause;
1225
+ documentType: EDMT_EditorDocumentType;
1226
+ title: string;
1227
+ tabId: string;
1228
+ }) => void | Promise<void>, onlyOnce?: boolean): void;
1229
+ /**
1230
+ * 移除事件监听
1231
+ *
1232
+ * @public
1233
+ * @param id - 事件 ID
1234
+ * @returns 是否移除指定事件监听
1235
+ */
1236
+ removeEventListener(id: string): boolean;
1237
+ /**
1238
+ * 查询事件监听是否存在
1239
+ *
1240
+ * @public
1241
+ * @param id - 事件 ID
1242
+ * @returns 事件监听是否存在
1243
+ */
1244
+ isEventListenerAlreadyExist(id: string): boolean;
1245
+ }
1246
+
1153
1247
  /**
1154
1248
  * 文件夹属性
1155
1249
  *
@@ -1392,7 +1486,7 @@ declare global {
1392
1486
  * @beta
1393
1487
  * @param projectFriendlyName - 工程友好名称
1394
1488
  * @param projectName - 工程名称,不可重复,仅支持字母 `a-zA-Z`、数字 `0-9`、中划线 `-`,如若不指定,则根据工程友好名称自动生成
1395
- * @param teamUuid - 团队 UUID,如若不指定,则默认为个人;在不存在个人工程的环境下必须指定团�� UUID
1489
+ * @param teamUuid - 团队 UUID,如若不指定,则默认为个人;在不存在个人工程的环境下必须指定团队 UUID
1396
1490
  * @param folderUuid - 文件夹 UUID,如若不指定,则为根文件夹
1397
1491
  * @param description - 工程描述
1398
1492
  * @param collaborationMode - 工程协作模式,如若团队权限无需工程设置协作模式,则该参数将被忽略
@@ -3277,7 +3371,7 @@ declare global {
3277
3371
  * 保存文档
3278
3372
  *
3279
3373
  * @public
3280
- * @returns 保存操作是否成功,保存失败、上传失败等错误均返回 `false`
3374
+ * @returns 保存操作是否成功,保存失败、上传失败���错误均返回 `false`
3281
3375
  */
3282
3376
  save(uuid: string): Promise<boolean>;
3283
3377
  /**
@@ -3361,7 +3455,7 @@ declare global {
3361
3455
  * 即 `setCanvasOrigin(0, 0)`;
3362
3456
  *
3363
3457
  * 此处的单位为数据层面单位,在跨度上等同于画布层面的 mil
3364
- * @param offsetX - 画布原点相对���数据原点的 X 坐标偏移
3458
+ * @param offsetX - 画布原点相对于数据原点的 X 坐标偏移
3365
3459
  * @param offsetY - 画布原点相对于数据原点的 Y 坐标偏移
3366
3460
  * @returns 操作是否成功
3367
3461
  */
@@ -4690,7 +4784,7 @@ declare global {
4690
4784
  *
4691
4785
  * 注意:本接口需要启用 **工程设计图 \> 文件导出** 权限,没有权限调用将始终 `throw Error`
4692
4786
  * @param fileName - 文件名
4693
- * @param password - 加密密码
4787
+ * @param password - 加密���码
4694
4788
  * @param fileType - 文件格式
4695
4789
  * @returns 文档文件数据,`undefined` 表示当前未打开文档或数据获取失败
4696
4790
  */
@@ -4839,7 +4933,11 @@ declare global {
4839
4933
  existingProjectUuid: IDMT_BriefProjectItem['uuid'];
4840
4934
  }, librariesImportSetting?: {
4841
4935
  ownerTeamUuid: IDMT_TeamItem['uuid'];
4936
+ deviceClassification?: Array<string>;
4937
+ symbolClassification?: Array<string>;
4938
+ footprintClassification?: Array<string>;
4842
4939
  createDeviceForSingleSymbol?: boolean;
4940
+ updateExistingLibrariesWithTheSameName?: boolean;
4843
4941
  }): Promise<IDMT_BriefProjectItem | undefined>;
4844
4942
  /**
4845
4943
  * 使用工程文件导入工程
@@ -4873,7 +4971,11 @@ declare global {
4873
4971
  existingProjectUuid: IDMT_BriefProjectItem['uuid'];
4874
4972
  }, librariesImportSetting?: {
4875
4973
  ownerTeamUuid: IDMT_TeamItem['uuid'];
4974
+ deviceClassification?: Array<string>;
4975
+ symbolClassification?: Array<string>;
4976
+ footprintClassification?: Array<string>;
4876
4977
  createDeviceForSingleSymbol?: boolean;
4978
+ updateExistingLibrariesWithTheSameName?: boolean;
4877
4979
  }): Promise<IDMT_BriefProjectItem | undefined>;
4878
4980
  /**
4879
4981
  * 提取文件内的工程配置信息
@@ -5444,7 +5546,7 @@ declare global {
5444
5546
  * 获取 JRouter 专用自动布线文件(JSON)
5445
5547
  *
5446
5548
  * @beta
5447
- * @remarks 可以使用 {@link SYS_FileSystem.saveFile} 接口将文件导出到本地文件系统
5549
+ * @remarks 可以使用 {@link SYS_FileSystem.saveFile} 接口将文件���出到本地文件系统
5448
5550
  * @param fileName - 文件名
5449
5551
  * @returns 自动布线 JSON 文件数据
5450
5552
  */
@@ -5989,7 +6091,7 @@ declare global {
5989
6091
  */
5990
6092
  unhighlightNet(net: string): Promise<boolean>;
5991
6093
  /**
5992
- * 取消高亮所��网络
6094
+ * 取消高亮所有网络
5993
6095
  *
5994
6096
  * @beta
5995
6097
  * @returns 操作是否成功
@@ -7125,7 +7227,7 @@ declare global {
7125
7227
  * 获取文本
7126
7228
  *
7127
7229
  * @alpha
7128
- * @remarks 如若传入多个图元 ID,任意图元 ID 未匹配到不影响其它图元的返回,即可能返回少于传入的图元 ID 数量的图��对象
7230
+ * @remarks 如若传入多个图元 ID,任意图元 ID 未匹配到不影响其它图元的返回,即可能返回少于传入的图元 ID 数量的图元对象
7129
7231
  * @param primitiveIds - 文本的图元 ID,可以为字符串或字符串数组,如若为数组,则返回的也是数组
7130
7232
  * @returns 文本图元对象,空数组表示获取失败
7131
7233
  */
@@ -8767,7 +8869,7 @@ declare global {
8767
8869
  *
8768
8870
  * @beta
8769
8871
  * @param primitiveId - 图元 ID
8770
- * @param property - 修改参数
8872
+ * @param property - 修��参数
8771
8873
  * @returns 折线图元对象
8772
8874
  */
8773
8875
  modify(primitiveId: string | IPCB_PrimitivePolyline, property: {
@@ -8882,7 +8984,7 @@ declare global {
8882
8984
  */
8883
8985
  getState_Polygon(): IPCB_Polygon;
8884
8986
  /**
8885
- * 获��属性状态:线宽
8987
+ * 获取属性状态:线宽
8886
8988
  *
8887
8989
  * @public
8888
8990
  * @returns 线宽
@@ -10403,7 +10505,7 @@ declare global {
10403
10505
  *
10404
10506
  * @beta
10405
10507
  * @param layer - 层
10406
- * @returns 器件图元对象
10508
+ * @returns 器���图元对象
10407
10509
  */
10408
10510
  setState_Layer(layer: TPCB_LayersOfComponent): IPCB_PrimitiveComponent;
10409
10511
  /**
@@ -11534,7 +11636,7 @@ declare global {
11534
11636
  * 将图元转换为异步图元
11535
11637
  *
11536
11638
  * @public
11537
- * @returns 二进制内嵌对象图元对象
11639
+ * @returns 二进制内嵌对象图��对象
11538
11640
  */
11539
11641
  toAsync(): IPCB_PrimitiveObject;
11540
11642
  /**
@@ -14779,7 +14881,7 @@ declare global {
14779
14881
  * @param addIntoPcb - 是否转到 PCB
14780
14882
  * @param designator - 位号
14781
14883
  * @param name - 名称,`null` 表示留空
14782
- * @param uniqueId - 唯一 ID,`null` 表示留空
14884
+ * @param uniqueId - 唯一 ID,`null` 表示��空
14783
14885
  * @param manufacturer - 制造商,`null` 表示留空
14784
14886
  * @param manufacturerId - 制造商编号,`null` 表示留空
14785
14887
  * @param supplier - 供应商,`null` 表示留空
@@ -14856,7 +14958,7 @@ declare global {
14856
14958
  *
14857
14959
  * 本接口的返回时机并不会等待用户的放置操作,一旦器件被绑定到鼠标,本接口将立即返回 `true` 的结果
14858
14960
  * @param component - 关联库器件
14859
- * @returns 是否找��器件
14961
+ * @returns 是否找到器件
14860
14962
  */
14861
14963
  placeComponentWithMouse(component: {
14862
14964
  libraryUuid: string;
@@ -15783,7 +15885,7 @@ declare global {
15783
15885
  * 获取属性状态:图元 ID
15784
15886
  *
15785
15887
  * @public
15786
- * @returns 图元 ID
15888
+ * @returns 图�� ID
15787
15889
  */
15788
15890
  getState_PrimitiveId(): string;
15789
15891
  /**
@@ -16969,7 +17071,7 @@ declare global {
16969
17071
  *
16970
17072
  * @beta
16971
17073
  * @param height - 高
16972
- * @returns 矩形图元对象
17074
+ * @returns 矩形图元���象
16973
17075
  */
16974
17076
  setState_Height(height: number): ISCH_PrimitiveRectangle;
16975
17077
  /**
@@ -17325,13 +17427,6 @@ declare global {
17325
17427
  * @returns 所有已选中图元的图元对象
17326
17428
  */
17327
17429
  getAllSelectedPrimitives(): Promise<Array<ISCH_Primitive>>;
17328
- /**
17329
- * 3.0版:查询所有已选中图元的图元对象
17330
- *
17331
- * @beta
17332
- * @returns 所有已选中图元的图元对象
17333
- */
17334
- refactorGetAllSelectedPrimitives(): Promise<Array<ISCH_Primitive>>;
17335
17430
  /**
17336
17431
  * 查询选中图元的图元 ID
17337
17432
  *
@@ -17385,6 +17480,13 @@ declare global {
17385
17480
  x: number;
17386
17481
  y: number;
17387
17482
  } | undefined>;
17483
+ /**
17484
+ * 查询所有已选中图元的图元对象
17485
+ *
17486
+ * @internal
17487
+ * @returns 所有已选中图元的图元对象
17488
+ */
17489
+ private getAllSelectedPrimitives3;
17388
17490
  }
17389
17491
 
17390
17492
  /**
@@ -18588,7 +18690,7 @@ declare global {
18588
18690
  title: string;
18589
18691
  /** 菜单项图标 */
18590
18692
  icon?: string;
18591
- /** 注册方法名称(需要在扩展入���文件导出该方法) */
18693
+ /** 注册方法名称(需要在扩展入口文件导出该方法) */
18592
18694
  registerFn?: string;
18593
18695
  }
18594
18696
  /**
@@ -20071,7 +20173,7 @@ declare global {
20071
20173
  * 获取当前主题
20072
20174
  *
20073
20175
  * @public
20074
- * @remarks 获取当��� EDA 主题,**浅色** 或 **深色**
20176
+ * @remarks 获取当前 EDA 主题,**浅色** 或 **深色**
20075
20177
  * @returns 当前主题
20076
20178
  */
20077
20179
  getCurrentTheme(): Promise<ESYS_Theme>;
@@ -20114,6 +20216,7 @@ declare global {
20114
20216
  class EDA {
20115
20217
  dmt_Board: DMT_Board;
20116
20218
  dmt_EditorControl: DMT_EditorControl;
20219
+ dmt_Event: DMT_Event;
20117
20220
  dmt_Folder: DMT_Folder;
20118
20221
  dmt_Panel: DMT_Panel;
20119
20222
  dmt_Pcb: DMT_Pcb;
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@jlceda/pro-api-types", "type": "module", "version": "0.2.33", "description": "嘉立创EDA & EasyEDA 专业版扩展 API 接口类型定义", "typings": "index.d.ts", "author": "JLCEDA <support@lceda.cn>", "license": "Apache-2.0", "homepage": "https://pro.lceda.cn/", "keywords": ["jlceda", "pro-api"], "scripts": { "lint": "eslint", "fix": "eslint --fix", "build": "ts-node ./build/build.ts" }, "devDependencies": { "@antfu/eslint-config": "^5.4.1", "@types/fast-text-encoding": "^1.0.3", "@types/fs-extra": "^11.0.4", "dotenv": "^16.4.7", "eslint": "^9.37.0", "fast-text-encoding": "^1.0.6", "fs-extra": "^11.3.0", "lint-staged": "^16.2.3", "simple-git-hooks": "^2.13.1", "ts-node": "^10.9.2", "typescript": "^5.7.3" }, "simple-git-hooks": { "pre-commit": "npx lint-staged" }, "lint-staged": { "*": "eslint --fix" } }
1
+ { "name": "@jlceda/pro-api-types", "type": "module", "version": "0.2.35", "description": "嘉立创EDA & EasyEDA 专业版扩展 API 接口类型定义", "typings": "index.d.ts", "author": "JLCEDA <support@lceda.cn>", "license": "Apache-2.0", "homepage": "https://pro.lceda.cn/", "keywords": ["jlceda", "pro-api"], "scripts": { "lint": "eslint", "fix": "eslint --fix", "build": "ts-node ./build/build.ts" }, "devDependencies": { "@antfu/eslint-config": "^5.4.1", "@types/fast-text-encoding": "^1.0.3", "@types/fs-extra": "^11.0.4", "dotenv": "^16.4.7", "eslint": "^9.37.0", "fast-text-encoding": "^1.0.6", "fs-extra": "^11.3.0", "lint-staged": "^16.2.3", "simple-git-hooks": "^2.13.1", "ts-node": "^10.9.2", "typescript": "^5.7.3" }, "simple-git-hooks": { "pre-commit": "npx lint-staged" }, "lint-staged": { "*": "eslint --fix" } }