@manycore/custom-sdk 1.0.1-rc.8 → 1.0.3-rc.0

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.
package/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { ELineType as ELineType_2 } from '@manycore/custom-miniapp-sdk';
2
2
  import { IExportModelData } from '@manycore/custom-miniapp-sdk';
3
+ import { IParamModelLite as IParamModelLite_2 } from '@qunhe/custom-apass-api';
4
+ import { IParamModelPhotoResponse } from '@manycore/custom-miniapp-sdk';
3
5
  import { Number3 } from '@manycore/custom-miniapp-sdk';
4
6
 
5
7
  /**
@@ -12,6 +14,7 @@ import { Number3 } from '@manycore/custom-miniapp-sdk';
12
14
  */
13
15
  export declare class Application {
14
16
  constructor();
17
+ private serviceMap;
15
18
  /**
16
19
  * 启动对接2.0应用
17
20
  *
@@ -64,7 +67,87 @@ export declare class Application {
64
67
  /**
65
68
  * @private
66
69
  */
67
- declare class BaseService {
70
+ declare abstract class BaseService {
71
+ __onDestroy?(): void;
72
+ }
73
+
74
+ /**
75
+ * 模型相关控制的逻辑
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * const CustomModelService = application.getService(CustomModelService);
80
+ * ```
81
+ */
82
+ export declare class CustomModelService extends BaseService {
83
+ /**
84
+ * 获取所有模型
85
+ * @returns Promise<IParamModelLite[]>
86
+ */
87
+ getAllCustomModels(): Promise<IParamModelLite[]>;
88
+ /**
89
+ * 根据id获取所有模型
90
+ * @param id 模型id
91
+ * @returns Promise<IParamModelLite | undefined>
92
+ */
93
+ getCustomModelById(id: string): Promise<IParamModelLite | undefined>;
94
+ /**
95
+ * 保存模型改动
96
+ * @param models IParamModelLite[]
97
+ * @returns Promise<void>
98
+ * @example
99
+ * // 模型改动:隐藏
100
+ * model.setHidden(true);
101
+ * // 保存模型改动
102
+ * ModelService.save({ models: [model] }});
103
+ */
104
+ save(option: {
105
+ models: IParamModelLite[];
106
+ }): Promise<void>;
107
+ }
108
+
109
+ /**
110
+ * 相机展示模式
111
+ */
112
+ export declare enum ECameraMode {
113
+ /**
114
+ * 鸟瞰模式
115
+ */
116
+ View3D = "view3d",
117
+ /**
118
+ * 漫游模式
119
+ */
120
+ Roamer = "roamer"
121
+ }
122
+
123
+ /**
124
+ * 场景相机方向移动
125
+ */
126
+ export declare enum ECameraMoveDirection {
127
+ /**
128
+ * 上移
129
+ */
130
+ UP = "UP",
131
+ /**
132
+ * 下移
133
+ */
134
+ DOWN = "DOWN",
135
+ /**
136
+ * 左移
137
+ */
138
+ LEFT = "LEFT",
139
+ /**
140
+ * 右移
141
+ */
142
+ RIGHT = "RIGHT",
143
+ /**
144
+ * 前进
145
+ */
146
+ FRONT = "FRONT",
147
+ /**
148
+ * 后退
149
+ */
150
+ BACK = "BACK"
68
151
  }
69
152
 
70
153
  /**
@@ -198,6 +281,20 @@ export declare enum ESelectedType {
198
281
  CASBIN = 2
199
282
  }
200
283
 
284
+ /**
285
+ * 设置选中内容类型
286
+ */
287
+ export declare enum ESetSelectType {
288
+ /**
289
+ * 模型或商品
290
+ */
291
+ MODEL = 1,
292
+ /**
293
+ * 五金
294
+ */
295
+ CASBIN = 2
296
+ }
297
+
201
298
  /**
202
299
  * 定制行业工具线
203
300
  */
@@ -356,6 +453,31 @@ export declare class FittingDesignService extends BaseService {
356
453
  clearDesign(options?: IBaseOptions): Promise<void>;
357
454
  }
358
455
 
456
+ /**
457
+ * 提供孔槽模型操作能力
458
+ *
459
+ * @example
460
+ * ```typescript
461
+ * const fittingModelService = application.getService(FittingModelService);
462
+ * ```
463
+ */
464
+ export declare class FittingModelService extends BaseService {
465
+ /**
466
+ * 获取所有五金孔槽模型
467
+ * @param modelId paramModel id,查找相关联孔槽五金
468
+ * @returns Promise<IFittingModelLite[]>
469
+ */
470
+ getAllFittingModels(modelId?: string): Promise<IFittingModelLite[]>;
471
+ /**
472
+ * 保存所有孔槽模型
473
+ * @param option
474
+ * @returns Promise<void>
475
+ */
476
+ save(option: {
477
+ models: IFittingModelLite[];
478
+ }): Promise<void>;
479
+ }
480
+
359
481
  /**
360
482
  * 孔槽数据基础示意
361
483
  */
@@ -467,6 +589,10 @@ export declare class FittingDesignService extends BaseService {
467
589
  modelId?: string;
468
590
  }
469
591
 
592
+ declare interface IChangeMap {
593
+ update?: IUpdateInfo[];
594
+ }
595
+
470
596
  /**
471
597
  * 孔/槽方案的数据结构
472
598
  */
@@ -520,6 +646,46 @@ export declare class FittingDesignService extends BaseService {
520
646
  */
521
647
  export declare type IFittingHoleCollect = Record<string, IHoleData[]>;
522
648
 
649
+ /**
650
+ * 五金孔槽通用模型
651
+ */
652
+ export declare interface IFittingModelLite {
653
+ /**
654
+ * 孔槽模型id
655
+ */
656
+ id: string;
657
+ /**
658
+ * 隐藏状态
659
+ */
660
+ isHidden: boolean;
661
+ /**
662
+ * 模型类型
663
+ */
664
+ modelType: EFittingType;
665
+ /**
666
+ * 关联 paramModel id
667
+ */
668
+ linkParamModelId: string;
669
+ /**
670
+ * 方案原始数据
671
+ */
672
+ originalData: IHoleData | IGrooveData | IHardwareData | IHardwareGrooveData;
673
+ /**
674
+ * 模型变更记录
675
+ */
676
+ __changeMap: IChangeMap;
677
+ /**
678
+ * 获取显示隐藏状态
679
+ * @returns
680
+ */
681
+ getHidden(): boolean;
682
+ /**
683
+ * 更新显示隐藏状态
684
+ * @param isHidden
685
+ */
686
+ setHidden(isHidden: boolean): void;
687
+ }
688
+
523
689
  export declare interface IGrooveData extends IBaseHoleGrooveData {
524
690
  width: number;
525
691
  }
@@ -572,6 +738,67 @@ export declare class FittingDesignService extends BaseService {
572
738
  lines: ILineData[];
573
739
  }
574
740
 
741
+ /**
742
+ * 颜色配置信息
743
+ *
744
+ * @example
745
+ * ```json
746
+ * {
747
+ * "color": "#234432",
748
+ * "opacity": 0.8
749
+ * }
750
+ * ```
751
+ */
752
+ export declare interface IHintBase {
753
+ /**
754
+ * 颜色,以#开头,16进制
755
+ *
756
+ * @example
757
+ * ```
758
+ * #FFB6C1
759
+ * ```
760
+ */
761
+ color: string;
762
+ /**
763
+ * 透明度,范围为 0~1 ;当为1时,表示不透明;为0时,表示为全透明
764
+ */
765
+ opacity: number;
766
+ }
767
+
768
+ /**
769
+ * 配置默认的高亮配置信息
770
+ */
771
+ export declare interface IHintPlank {
772
+ /**
773
+ * 边框高亮颜色
774
+ */
775
+ hintOutline?: boolean | IHintBase;
776
+ /**
777
+ * 高亮的板面信息
778
+ */
779
+ hintPlankFace?: Array<IHintPlankFace | Omit<IHintPlankFace, keyof IHintBase>>;
780
+ }
781
+
782
+ /**
783
+ * 板面配置信息
784
+ *
785
+ * @example
786
+ * ```json
787
+ * {
788
+ * "color": "#234432",
789
+ * "opacity": 0.8,
790
+ * "plankFaceId": 1
791
+ * }
792
+ * ```
793
+ */
794
+ export declare interface IHintPlankFace extends IHintBase {
795
+ /**
796
+ * 需要展示的该信息的板面
797
+ * 支持多个板面ID或单个
798
+ */
799
+ plankFaceId: number | number[];
800
+ }
801
+
575
802
  export declare interface IHoleData extends IBaseHoleGrooveData {
576
803
  /**
577
804
  * 孔直径
@@ -635,6 +862,73 @@ export declare class FittingDesignService extends BaseService {
635
862
  radius: number;
636
863
  }
637
864
 
865
+ /**
866
+ * 模型高亮默认配置信息
867
+ * @example
868
+ * ```json
869
+ * {
870
+ * "outline": {
871
+ * "color": "#234432",
872
+ * "opacity": 0.8,
873
+ * },
874
+ * "plankFace":{
875
+ * "color": "#234432",
876
+ * "opacity": 0.8,
877
+ * }
878
+ * }
879
+ * ```
880
+ */
881
+ export declare interface IModelDefaultHintOption {
882
+ /**
883
+ * 模型轮廓高亮信息
884
+ */
885
+ outline?: IHintBase;
886
+ /**
887
+ * 板面高亮配置信息
888
+ */
889
+ plankFace?: IHintBase;
890
+ }
891
+
892
+ /**
893
+ * 设置模型高亮时的配置信息
894
+ * @example
895
+ * ```typescript
896
+ * {
897
+ * "89D2793C-2B23-41A9-BA6E-4E3908490057": {
898
+ * // 使用默认的高亮配置信息
899
+ * "hintBorder": true,
900
+ * // 板件高亮
901
+ * "hintPlankFace": [
902
+ * {
903
+ * "color": "#234432",
904
+ * "opacity": 0.8,
905
+ * // 仅单个板面
906
+ * "plankFaceId": 1
907
+ * },
908
+ * {
909
+ * "color": "#233242",
910
+ * "opacity": 0.8,
911
+ * // 多个板面
912
+ * "plankFaceId": [2, 4]
913
+ * },
914
+ * // 使用默认颜色
915
+ * {
916
+ * "plankFaceId": 3
917
+ * }
918
+ * ]
919
+ * },
920
+ * "89D2793C-2B23-41A9-BA6E-4E3FS8490057": {
921
+ * // 自定议高亮配置信息
922
+ * "hintBorder": {
923
+ * "color": "#234432",
924
+ * "opacity": 0.8
925
+ * }
926
+ * }
927
+ * }
928
+ * ```
929
+ */
930
+ export declare type IModelHintOption = Record<string, IHintPlank>;
931
+
638
932
  /**
639
933
  * 获取交接信息
640
934
  *
@@ -671,6 +965,21 @@ export declare class FittingDesignService extends BaseService {
671
965
  toggleModelViewedIntersected(option?: IToggleIntersectedViewOption): void;
672
966
  }
673
967
 
968
+ export declare interface IParamModelLite extends IParamModelLite_2 {
969
+ /**
970
+ * 获取显示隐藏状态
971
+ * @returns
972
+ */
973
+ getHidden(): boolean | undefined;
974
+ /**
975
+ * 更新显示隐藏状态
976
+ * @param isHidden
977
+ */
978
+ setHidden(isHidden: boolean): void;
979
+ }
980
+
981
+ export { IParamModelPhotoResponse }
982
+
674
983
  /**
675
984
  * 点的基本类型
676
985
  */
@@ -778,6 +1087,20 @@ export declare class FittingDesignService extends BaseService {
778
1087
  type: ESelectedType;
779
1088
  }
780
1089
 
1090
+ /**
1091
+ * 通过ID选中模型参数
1092
+ */
1093
+ export declare interface ISetSelectedByIdOption {
1094
+ /**
1095
+ * 模型ID/五金ID
1096
+ */
1097
+ id: string;
1098
+ /**
1099
+ * 选中的类型
1100
+ */
1101
+ type: ESetSelectType;
1102
+ }
1103
+
781
1104
  /**
782
1105
  * 场景中,模型的颜色配置能力
783
1106
  *
@@ -921,6 +1244,127 @@ export declare class FittingDesignService extends BaseService {
921
1244
  pageNum?: number;
922
1245
  }
923
1246
 
1247
+ declare interface IUpdateInfo {
1248
+ field: string;
1249
+ }
1250
+
1251
+ /**
1252
+ * 主要提供了场景相机的模式、移动等
1253
+ *
1254
+ * @example
1255
+ * ```typescript
1256
+ * const modelCameraService = application.getService(ModelCameraService);
1257
+ * ```
1258
+ */
1259
+ export declare class ModelCameraService extends BaseService {
1260
+ /**
1261
+ * 切换相机模式
1262
+ * @param mode 相机模式
1263
+ * @example
1264
+ * ```ts
1265
+ * const modelCameraService = application.getService(ModelCameraService);
1266
+ *
1267
+ * // 切换至漫游模式
1268
+ * modelCameraService.toggleCameraMode(ECameraMode.Roamer);
1269
+ * ```
1270
+ */
1271
+ toggleCameraMode(mode: ECameraMode): void;
1272
+ /**
1273
+ * 根据方向移动相机
1274
+ * @param direction 移动方向
1275
+ * @example
1276
+ * ```ts
1277
+ * const modelCameraService = application.getService(ModelCameraService);
1278
+ *
1279
+ * // 相机向上移动
1280
+ * modelCameraService.moveCamera(ECameraMoveDirection.UP);
1281
+ *
1282
+ * // 相机向前移动
1283
+ * modelCameraService.moveCamera(ECameraMoveDirection.FRONT);
1284
+ * ```
1285
+ */
1286
+ moveCamera(direction: ECameraMoveDirection): void;
1287
+ }
1288
+
1289
+ /**
1290
+ * 配置板件特殊标识
1291
+ *
1292
+ * @example
1293
+ * ```typescript
1294
+ * const modelHintService = application.getService(ModelHintService);
1295
+ * ```
1296
+ */
1297
+ export declare class ModelHintService extends BaseService {
1298
+ /**
1299
+ * 设置板件标识的特殊颜色
1300
+ * @example
1301
+ * modelHintService.setDefaultHint({
1302
+ * "outline": {
1303
+ * "color": "#234432",
1304
+ * "opacity": 0.8,
1305
+ * },
1306
+ * "plankFace":{
1307
+ * "color": "#234432",
1308
+ * "opacity": 0.8,
1309
+ * }
1310
+ * });
1311
+ */
1312
+ setDefaultHint(option: IModelDefaultHintOption): void;
1313
+ /**
1314
+ * 设置模型高亮
1315
+ *
1316
+ * @example
1317
+ * ```typescript
1318
+ * modelHintService.setModelHint({
1319
+ * "89D2793C-2B23-41A9-BA6E-4E3908490057": {
1320
+ * // 使用默认的标识信息
1321
+ * "hintBorder": true,
1322
+ * // 板件高亮
1323
+ * "hintPlankFace": [
1324
+ * {
1325
+ * "color": "#234432",
1326
+ * "opacity": 0.8,
1327
+ * // 仅单个板面
1328
+ * "plankFaceId": 1
1329
+ * },
1330
+ * {
1331
+ * "color": "#233242",
1332
+ * "opacity": 0.8,
1333
+ * // 多个板面
1334
+ * "plankFaceId": [2, 4]
1335
+ * },
1336
+ * // 使用默认颜色配置
1337
+ * {
1338
+ * "plankFaceId": 1
1339
+ * },
1340
+ * ]
1341
+ * },
1342
+ * "89D2793C-2B23-41A9-BA6E-4E3FS8490057": {
1343
+ * // 自定议标识颜色
1344
+ * "hintBorder": {
1345
+ * "color": "#234432",
1346
+ * "opacity": 0.8
1347
+ * }
1348
+ * }
1349
+ * })
1350
+ * ```
1351
+ */
1352
+ setModelHint(config: IModelHintOption): void;
1353
+ /**
1354
+ * 清空当前已经配置的标识信息
1355
+ *
1356
+ * 当id不传时,清空所有,当id传入部分时,则清除对应的内容
1357
+ *
1358
+ * @example
1359
+ * ```typescript
1360
+ * modelHintService.clearModelHint()
1361
+ * ```
1362
+ *
1363
+ * @param id 待删除标识信息的ID
1364
+ */
1365
+ clearModelHint(id?: string[]): void;
1366
+ }
1367
+
924
1368
  /**
925
1369
  * 主要提供了获取当前模型的 JSON 输出数据,以及当前模型的交接信息的功能。
926
1370
  *
@@ -975,6 +1419,7 @@ export declare class FittingDesignService extends BaseService {
975
1419
  * @param options
976
1420
  */
977
1421
  getTopParamModels(options?: ITopParamModelListOption): Promise<ITopParamModelDataResponse>;
1422
+ getParamModelPhotoById(modelId: string | string[]): Promise<IParamModelPhotoResponse[]>;
978
1423
  }
979
1424
 
980
1425
  /**
@@ -992,14 +1437,48 @@ export declare class FittingDesignService extends BaseService {
992
1437
  */
993
1438
  getSelected(): ISelected;
994
1439
  /**
995
- * @ignore
996
- * 设置当前选中内容
1440
+ * 设置选中的模型
1441
+ * 同时选中多个模型暂未支持,请勿使用
1442
+ * @param option ISetSelectedByIdOption
1443
+ * @example
1444
+ * ```
1445
+ * const viewerSelectionService = application.getService(ModelViewerSelectionService);
1446
+ * const selectOption = {
1447
+ * id: 'modelId...',
1448
+ * type: ESetSelectType.MODEL,
1449
+ * };
1450
+ *
1451
+ * viewerSelectionService.select(selectOption);
1452
+ * ```
997
1453
  */
998
- select(selected: any[]): void;
1454
+ select(option: ISetSelectedByIdOption | ISetSelectedByIdOption[]): void;
999
1455
  /**
1000
1456
  * 取消场景当中选中内容
1457
+ * 同时取消多个模型暂未支持,请勿使用
1458
+ * @param option
1459
+ * @example
1460
+ * ```
1461
+ * const viewerSelectionService = application.getService(ModelViewerSelectionService);
1462
+ * const selectOption = {
1463
+ * id: 'modelId...',
1464
+ * type: ESetSelectType.MODEL,
1465
+ * };
1466
+ *
1467
+ * // 取消指定选中模型
1468
+ * viewerSelectionService.unSelect(selectOption);
1469
+ * // 默认取消全部选中模型
1470
+ * viewerSelectionService.unSelect();
1471
+ * ```
1472
+ */
1473
+ unSelect(option?: ISetSelectedByIdOption | ISetSelectedByIdOption[]): void;
1474
+ /**
1475
+ * 根据参数生成entity
1476
+ * @param option
1477
+ * @returns entity
1478
+ * @private
1479
+ * @ignore
1001
1480
  */
1002
- unSelect(): void;
1481
+ private __generateEntity;
1003
1482
  /**
1004
1483
  * @ignore
1005
1484
  */