@manycore/custom-sdk 1.12.0 → 1.13.0-krs.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.
Files changed (3) hide show
  1. package/index.d.ts +297 -90
  2. package/index.js +38 -19
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -4,7 +4,6 @@ import { IParamModelPhotoResponse } from '@manycore/custom-miniapp-sdk';
4
4
  import { IServClientService } from 'servkit';
5
5
  import { Number2 } from '@manycore/custom-miniapp-sdk';
6
6
  import { Number3 } from '@manycore/custom-miniapp-sdk';
7
- import { PlankArea } from '@qunhe/miniapp-model-viewer-core/src/model/base/plankArea';
8
7
  import { ServService } from 'servkit';
9
8
 
10
9
  declare interface AMap<K, V> {
@@ -182,6 +181,24 @@ export declare class CustomModelService extends BaseService {
182
181
  }): Promise<void>;
183
182
  }
184
183
 
184
+ /**
185
+ * 自定议字段枚举类型
186
+ */
187
+ declare enum EBzPropertyType {
188
+ /**
189
+ * 数字类型
190
+ */
191
+ number = "number",
192
+ /**
193
+ * 字符串类型
194
+ */
195
+ string = "string",
196
+ /**
197
+ * boolean类型
198
+ */
199
+ boolean = "boolean"
200
+ }
201
+
185
202
  /**
186
203
  * 相机展示模式
187
204
  */
@@ -240,6 +257,26 @@ declare enum EClockWise {
240
257
  FALSE = "false"
241
258
  }
242
259
 
260
+ /**
261
+ * 定制模型类型
262
+ */
263
+ declare enum ECustomModelType {
264
+ /** 实体模型 */
265
+ PARAM_ENTITY = 1,
266
+ /** 家具模型,3d模型文件 */
267
+ PARAM_FURNITURE = 2,
268
+ /** 基元模型,需要计算mesh */
269
+ PARAM_PRIMITIVE = 3,
270
+ /** 虚拟模型 */
271
+ PARAM_VIRTUAL = 4,
272
+ /** 参数化组合:即在设计方案当中,选中多个模型,组合之后的结果 */
273
+ PARAM_ASSEMBLY = 5,
274
+ /**
275
+ * 参数化组合:在参数化编辑器中,对多个模型进行组合操作
276
+ */
277
+ TEMPLATE_ASSEMBLY = 6
278
+ }
279
+
243
280
  /**
244
281
  * 交互模式
245
282
  */
@@ -364,6 +401,36 @@ export declare enum ELanguage {
364
401
  VI = 'vi',
365
402
  }
366
403
 
404
+ /**
405
+ * 设计对象 ID
406
+ */
407
+ declare interface ElementId {
408
+ /** 实例 ID */
409
+ id: string;
410
+ /** 类型 */
411
+ type: ElementType;
412
+ }
413
+
414
+ /**
415
+ * 定制设计对象类型
416
+ */
417
+ declare enum ElementType {
418
+ /** 全屋定制家具 */
419
+ Wardrobe = "Wardrobe",
420
+ /** 全屋定制家具副本 */
421
+ WardrobeCopy = "WardrobeCopy",
422
+ /** 厨卫 */
423
+ Cabinet = "Cabinet",
424
+ /** 厨卫副本 */
425
+ CabinetCopy = "CabinetCopy",
426
+ /** 门窗 */
427
+ DoorWindow = "DoorWindow",
428
+ /** 门窗副本 */
429
+ DoorWindowCopy = "DoorWindowCopy",
430
+ /** 定制组合 */
431
+ CustomGroup = "CustomGroup"
432
+ }
433
+
367
434
  /**
368
435
  * 线的类型
369
436
  */
@@ -985,6 +1052,52 @@ export declare class FittingDesignService extends BaseService {
985
1052
  modelId?: string;
986
1053
  }
987
1054
 
1055
+ /**
1056
+ * 自定议参数
1057
+ */
1058
+ declare interface IBzParamModelLiteProperty<T extends number | string | boolean = string> {
1059
+ /**
1060
+ * 参数命名空间
1061
+ */
1062
+ namespace: string;
1063
+ /**
1064
+ * 参数名称,为key
1065
+ */
1066
+ name: string;
1067
+ /**
1068
+ * 参数中存取的值
1069
+ */
1070
+ value: string | undefined;
1071
+ /**
1072
+ * 当前字段数据类型
1073
+ */
1074
+ type: EBzPropertyType | string;
1075
+ /**
1076
+ * 当前参数是否只读
1077
+ */
1078
+ readonly: boolean;
1079
+ /**
1080
+ * 获取参数名称
1081
+ */
1082
+ getName(): string;
1083
+ /**
1084
+ * 获取参数命名空间
1085
+ */
1086
+ getNamespace(): string;
1087
+ /**
1088
+ * 获取当前参数类型
1089
+ */
1090
+ getType(): string;
1091
+ /**
1092
+ * 读取值
1093
+ */
1094
+ getValue(): T | undefined;
1095
+ /**
1096
+ * 设置值
1097
+ */
1098
+ setValue(value: T): void;
1099
+ }
1100
+
988
1101
  declare interface IChangeMap {
989
1102
  update?: IUpdateInfo[];
990
1103
  }
@@ -1003,6 +1116,24 @@ export declare class FittingDesignService extends BaseService {
1003
1116
  type: EElementType;
1004
1117
  }
1005
1118
 
1119
+ /**
1120
+ * 事件管理器
1121
+ */
1122
+ export declare interface IEvent<T = any> {
1123
+ /**
1124
+ * 添加事件监听
1125
+ */
1126
+ on: (fn: (evt: T) => void) => void;
1127
+ /**
1128
+ * 添加一次性事件监听
1129
+ */
1130
+ once: (fn: (evt: T) => void) => void;
1131
+ /**
1132
+ * 移除事件监听
1133
+ */
1134
+ off: (fn: (evt: T) => void) => void;
1135
+ }
1136
+
1006
1137
  /**
1007
1138
  * 自定义模式,hover触发模型高亮回调
1008
1139
  */
@@ -1144,7 +1275,8 @@ export declare class FittingDesignService extends BaseService {
1144
1275
  export declare interface IGetModelIntersectedOption extends IBaseOptions {
1145
1276
  /**
1146
1277
  * 含义为交接面/体进行运算过程中的阈值容差;即两个平行面之间,生成交接信息时,最大距离
1147
- * 默认值为 0.001m
1278
+ * 默认值为 0.1mm
1279
+ * 单位:毫米
1148
1280
  */
1149
1281
  tolerance?: number;
1150
1282
  }
@@ -1383,25 +1515,6 @@ export declare class FittingDesignService extends BaseService {
1383
1515
  ellipseCenter?: Number2;
1384
1516
  }
1385
1517
 
1386
- declare interface ILineData$1 {
1387
- /**
1388
- * 线条类型
1389
- */
1390
- type: ELineType_3;
1391
- /**
1392
- * 是否顺时针
1393
- */
1394
- clockwise?: boolean;
1395
- /**
1396
- * 优弧劣弧 (只有弧线有)
1397
- */
1398
- minorArc?: boolean;
1399
- /**
1400
- * 半径 (只有弧线有)
1401
- */
1402
- radius?: number;
1403
- }
1404
-
1405
1518
  export declare type ILineData = ILineDataBase | ILineDataCircle;
1406
1519
 
1407
1520
  /**
@@ -1590,6 +1703,12 @@ export declare class FittingDesignService extends BaseService {
1590
1703
  * @type string
1591
1704
  */
1592
1705
  readonly id: string;
1706
+ /**
1707
+ * 定制模型类型,在 @modelType 基础上进行了细分
1708
+ * @public
1709
+ * @type ECustomModelType
1710
+ */
1711
+ type: ECustomModelType;
1593
1712
  /**
1594
1713
  * 模型在方案中的名称
1595
1714
  * @readonly
@@ -1640,6 +1759,10 @@ export declare class FittingDesignService extends BaseService {
1640
1759
  * @typedef AMap<string, IParamModelLiteParam>
1641
1760
  */
1642
1761
  readonly params: AMap<string, IParamModelLiteParam>;
1762
+ /**
1763
+ * 模型当前用户自定义属性
1764
+ */
1765
+ readonly bzProperties: AMap<string, IBzParamModelLiteProperty>;
1643
1766
  /**
1644
1767
  * 商品ID,即商品后台的商品ID
1645
1768
  * @readonly
@@ -1676,6 +1799,13 @@ export declare class FittingDesignService extends BaseService {
1676
1799
  * @readonly
1677
1800
  */
1678
1801
  isRoot?: boolean;
1802
+ /**
1803
+ * 当前模型是否是合法(隐藏)模型
1804
+ * @readonly
1805
+ * @public
1806
+ * @type boolean
1807
+ */
1808
+ readonly legal?: boolean;
1679
1809
  /**
1680
1810
  * 获取当前模型名称
1681
1811
  */
@@ -1728,10 +1858,20 @@ export declare class FittingDesignService extends BaseService {
1728
1858
  * 获取当前模型相对父级的旋转信息
1729
1859
  */
1730
1860
  getRotation(): Number3_2;
1861
+ /**
1862
+ * 获取当前模型所处的工具线
1863
+ */
1864
+ getToolType(): EToolType_2 | undefined;
1865
+ /**
1866
+ * 设置当前模型工具线
1867
+ * @param toolType
1868
+ * @throws 如果工具线不被允许,将会报错
1869
+ */
1870
+ setToolType(toolType: EToolType_2): void;
1731
1871
  /**
1732
1872
  * 模型的复制,返回一个新的`ParamModel`对象
1733
1873
  */
1734
- clone(): IParamModelLite_2;
1874
+ clone(): this;
1735
1875
  /**
1736
1876
  * 将当前模型与父级模型断开联系
1737
1877
  * 可以更直接的理解为:删除当前模型
@@ -1741,31 +1881,32 @@ export declare class FittingDesignService extends BaseService {
1741
1881
  /**
1742
1882
  * 查找当前模型的父节点
1743
1883
  */
1744
- getParent(): IParamModelLite_2 | undefined;
1884
+ getParent(): this | undefined;
1745
1885
  /**
1746
- * 获取当前模型的顶层模型,如果当前模型就是顶层模型,则会返回undefined
1886
+ * 获取root节点,如果当前模型为root节点,则返回自身
1887
+ * @param recursion 存在多root时,是否获取最顶层root
1747
1888
  */
1748
- getRoot(): IParamModelLite_2 | undefined;
1889
+ getRoot(recursion?: boolean): this;
1749
1890
  /**
1750
1891
  * 获取当前模型的所有子模型
1751
1892
  */
1752
- getChild(): IParamModelLite_2[];
1893
+ getChild(): this[];
1753
1894
  /**
1754
1895
  * 获取当前模型下的所有非原生模型
1755
1896
  * @description 说明一下:非原生模型可以大致理解为:在方案当中,手动生成一个模型,添加到其他模型上;与之对应子模型可以理解为原生模型,即参数
1756
1897
  * 化编辑中自带的模型
1757
1898
  */
1758
- getAccessory(): IParamModelLite_2[];
1899
+ getAccessory(): this[];
1759
1900
  /**
1760
1901
  * 向当前模型中,添加一个子模型;一般会向包裹层当中,添加子模型;另外,五金配件,也必须使用此方法添加
1761
1902
  * @param child {IParamModelLite} 待添加的模型
1762
1903
  */
1763
- appendChild(child: IParamModelLite_2): void;
1904
+ appendChild(child: this): void;
1764
1905
  /**
1765
1906
  * 向当前模型中,添加一个非原生模型;一般会使用在添加五金
1766
1907
  * @param accessory {IParamModelLite} 待添加的模型
1767
1908
  */
1768
- appendAccessory(accessory: IParamModelLite_2): void;
1909
+ appendAccessory(accessory: this): void;
1769
1910
  /**
1770
1911
  * 获取当前模型中的参数信息(参数即在参数化编辑中的信息)
1771
1912
  * @example
@@ -1773,6 +1914,25 @@ export declare class FittingDesignService extends BaseService {
1773
1914
  * @param name {string} 参数名称
1774
1915
  */
1775
1916
  getParam(name: string): IParamModelLiteParam | undefined;
1917
+ /**
1918
+ * 获取用户自定义属性
1919
+ * @param name {string} 属性名称
1920
+ * @param namespace {string} 命名空间(当不传时,即表示当前小程序下的命名空间,格式如下:miniapp-${appId})
1921
+ */
1922
+ getBzProperty(name: string, namespace?: string): IBzParamModelLiteProperty | undefined;
1923
+ /**
1924
+ * 判断当前模型是否包含某个属性
1925
+ * @param name {string} 属性名称
1926
+ * @param namespace {string} 命名空间
1927
+ */
1928
+ hasBzProperty(name: string, namespace?: string): boolean;
1929
+ /**
1930
+ * 删除自定义属性、当删除成功时,将返回true,否则返回false
1931
+ *
1932
+ * @param name
1933
+ * @param namespace
1934
+ */
1935
+ removeBzProperty(name: string, namespace?: string): boolean;
1776
1936
  /**
1777
1937
  * 判断当前模型是否包含某个参数
1778
1938
  * @param name {string} 参数名称
@@ -1790,7 +1950,7 @@ export declare class FittingDesignService extends BaseService {
1790
1950
  /**
1791
1951
  * 将一个序列化之后的模型,进行反序列化操作
1792
1952
  */
1793
- deserialize(model: string): IParamModelLite_2;
1953
+ deserialize(model: string): this;
1794
1954
  /**
1795
1955
  * 刷新某个模型,此API仅适用于反向对接的模型:
1796
1956
  * 当前某个模型在后台更新了,但用户方案中,存储的仍然是之前的版本,调用此方法后,会自动将当前模型更新成后台最新的版本。
@@ -1798,6 +1958,10 @@ export declare class FittingDesignService extends BaseService {
1798
1958
  * > 模型中,添加的appendChild或addAccessory等参数,可能会失效不起作用
1799
1959
  */
1800
1960
  forceUpdate(update?: boolean): void;
1961
+ /**
1962
+ * 获取设计对象id
1963
+ */
1964
+ getElementId(): ElementId | undefined;
1801
1965
  }
1802
1966
 
1803
1967
  /**
@@ -1868,21 +2032,6 @@ export declare class FittingDesignService extends BaseService {
1868
2032
  setPrimitiveOverride(value: boolean): void;
1869
2033
  }
1870
2034
 
1871
- declare interface IPathData {
1872
- /**
1873
- * 偏移, 正数扩大路径范围,负数缩小路径范围
1874
- */
1875
- offset?: number;
1876
- /**
1877
- * 轮廓上的点
1878
- */
1879
- paramPoints: IPointData$1[];
1880
- /**
1881
- * 轮廓上的线
1882
- */
1883
- paramPathLines: ILineData$1[];
1884
- }
1885
-
1886
2035
  /**
1887
2036
  * 板件轮廓描述
1888
2037
  */
@@ -1898,6 +2047,22 @@ export declare class FittingDesignService extends BaseService {
1898
2047
  getRealPaths(): IPlankArea;
1899
2048
  }
1900
2049
 
2050
+ /**
2051
+ * 板面信息
2052
+ */
2053
+ export declare interface IPlankFace {
2054
+ /**
2055
+ * 板面ID
2056
+ *
2057
+ * @value 0-5为正确板面值,-1表示不处于任意板面上
2058
+ */
2059
+ id: number;
2060
+ /**
2061
+ * 板面所属模型
2062
+ */
2063
+ modelId: string;
2064
+ }
2065
+
1901
2066
  /**
1902
2067
  * 板件轮廓上的某条闭合路径,例如外轮廓、内部挖洞
1903
2068
  */
@@ -1921,74 +2086,49 @@ export declare class FittingDesignService extends BaseService {
1921
2086
  }
1922
2087
 
1923
2088
  declare interface IPlankPathData {
1924
- path?: IPathData;
1925
- holes: IPathData[];
2089
+ path?: IPlankPathPathData;
2090
+ holes: IPlankPathPathData[];
1926
2091
  /**
1927
2092
  * other fields
1928
2093
  */
1929
2094
  [key: string]: any;
1930
2095
  }
1931
2096
 
1932
- /**
1933
- * 轮廓路径端点表示
1934
- */
1935
- export declare interface IPoint extends IPointBase {
2097
+ declare interface IPlankPathLineData {
1936
2098
  /**
1937
- * 获取实际渲染端点
1938
- * >非直角端点为渲染线段的两端,直角端点两个端点相同
2099
+ * 线条类型
1939
2100
  */
1940
- getRenderPoints(): [Number2, Number2];
2101
+ type: ELineType_3;
1941
2102
  /**
1942
- * 设置非直角端点渲染线段的高亮,高亮深度为板件厚度
1943
- * @param hint 高亮配置
2103
+ * 是否顺时针
1944
2104
  */
1945
- setHint(hint: IHintBase): void;
2105
+ clockwise?: boolean;
1946
2106
  /**
1947
- * 清除高亮
2107
+ * 优弧劣弧 (只有弧线有)
1948
2108
  */
1949
- clearHint(): void;
2109
+ minorArc?: boolean;
1950
2110
  /**
1951
- * 获取高亮
2111
+ * 半径 (只有弧线有)
1952
2112
  */
1953
- getHint(): IHintBase | undefined;
2113
+ radius?: number;
1954
2114
  }
1955
2115
 
1956
- /**
1957
- * 点的基本类型
1958
- */
1959
- export declare interface IPointBase {
1960
- type: EPointType;
1961
- /**
1962
- * 点的位置
1963
- */
1964
- position: Number3 | Number2;
1965
- /**
1966
- * 切角长度
1967
- */
1968
- cornerCutDistance?: [number, number];
1969
- /**
1970
- * 椭圆端点长轴
1971
- */
1972
- majorRadius?: number;
1973
- /**
1974
- * 椭圆端点短轴
1975
- */
1976
- minorRadius?: number;
2116
+ declare interface IPlankPathPathData {
1977
2117
  /**
1978
- * 圆弧、切圆半径
2118
+ * 偏移, 正数扩大路径范围,负数缩小路径范围
1979
2119
  */
1980
- radius?: number;
2120
+ offset?: number;
1981
2121
  /**
1982
- * 圆弧是否为顺时针
2122
+ * 轮廓上的点
1983
2123
  */
1984
- clockwise?: boolean;
2124
+ paramPoints: IPlankPathPointData[];
1985
2125
  /**
1986
- * 圆弧、椭圆弧圆心偏移
2126
+ * 轮廓上的线
1987
2127
  */
1988
- offset?: Number2;
2128
+ paramPathLines: IPlankPathLineData[];
1989
2129
  }
1990
2130
 
1991
- declare interface IPointData$1 {
2131
+ declare interface IPlankPathPointData {
1992
2132
  /**
1993
2133
  * 点的位置
1994
2134
  *
@@ -2034,6 +2174,65 @@ export declare class FittingDesignService extends BaseService {
2034
2174
  minorRadius?: string;
2035
2175
  }
2036
2176
 
2177
+ /**
2178
+ * 轮廓路径端点表示
2179
+ */
2180
+ export declare interface IPoint extends IPointBase {
2181
+ /**
2182
+ * 获取实际渲染端点
2183
+ * >非直角端点为渲染线段的两端,直角端点两个端点相同
2184
+ */
2185
+ getRenderPoints(): [Number2, Number2];
2186
+ /**
2187
+ * 设置非直角端点渲染线段的高亮,高亮深度为板件厚度
2188
+ * @param hint 高亮配置
2189
+ */
2190
+ setHint(hint: IHintBase): void;
2191
+ /**
2192
+ * 清除高亮
2193
+ */
2194
+ clearHint(): void;
2195
+ /**
2196
+ * 获取高亮
2197
+ */
2198
+ getHint(): IHintBase | undefined;
2199
+ }
2200
+
2201
+ /**
2202
+ * 点的基本类型
2203
+ */
2204
+ export declare interface IPointBase {
2205
+ type: EPointType;
2206
+ /**
2207
+ * 点的位置
2208
+ */
2209
+ position: Number3 | Number2;
2210
+ /**
2211
+ * 切角长度
2212
+ */
2213
+ cornerCutDistance?: [number, number];
2214
+ /**
2215
+ * 椭圆端点长轴
2216
+ */
2217
+ majorRadius?: number;
2218
+ /**
2219
+ * 椭圆端点短轴
2220
+ */
2221
+ minorRadius?: number;
2222
+ /**
2223
+ * 圆弧、切圆半径
2224
+ */
2225
+ radius?: number;
2226
+ /**
2227
+ * 圆弧是否为顺时针
2228
+ */
2229
+ clockwise?: boolean;
2230
+ /**
2231
+ * 圆弧、椭圆弧圆心偏移
2232
+ */
2233
+ offset?: Number2;
2234
+ }
2235
+
2037
2236
  /**
2038
2237
  * 点的类型参数
2039
2238
  */
@@ -2845,6 +3044,14 @@ export declare class FittingDesignService extends BaseService {
2845
3044
  * @ignore
2846
3045
  */
2847
3046
  private hasWatchSelectionChange;
3047
+ /**
3048
+ * 板面点击事件管理器
3049
+ */
3050
+ plankFaceClickEvent: IEvent<IPlankFace>;
3051
+ /**
3052
+ * 板面hover事件管理器
3053
+ */
3054
+ plankFaceHoverEvent: IEvent<IPlankFace>;
2848
3055
  /**
2849
3056
  * 获取当前选中的数据
2850
3057
  */
@@ -3013,7 +3220,7 @@ export declare class FittingDesignService extends BaseService {
3013
3220
  parseModelPlankPath(option: {
3014
3221
  modelID: string;
3015
3222
  data: IPlankPathData;
3016
- }): PlankArea;
3223
+ }): IPlankArea;
3017
3224
  /**
3018
3225
  * 同步板件轮廓修改到渲染场景中
3019
3226
  *