3dviewer-sdk 1.1.6 → 1.1.8
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/dist/index.d.mts +99 -1
- package/dist/index.d.ts +99 -1
- package/dist/index.js +242 -18
- package/dist/index.mjs +242 -18
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,10 @@ declare enum ViewerMessageType {
|
|
|
32
32
|
SHEETS_GET_LIST = "viewer-sheets-get-list",
|
|
33
33
|
SHEETS_LIST = "viewer-sheets-list",
|
|
34
34
|
SHEETS_APPLY = "viewer-sheets-apply",
|
|
35
|
+
VIEWS_GET_LIST = "viewer-views-get-list",
|
|
36
|
+
VIEWS_LIST = "viewer-views-list",
|
|
37
|
+
VIEWS_APPLY = "viewer-views-apply",
|
|
38
|
+
VIEWS_APPLY_RESULT = "viewer-views-apply-result",
|
|
35
39
|
OBJECT_PROPERTIES_GET_LIST = "viewer-object-properties-get-list",
|
|
36
40
|
OBJECT_PROPERTIES_LIST = "viewer-object-properties-list",
|
|
37
41
|
LINKED_OBJECTS_GET_LIST = "viewer-linked-objects-get-list",
|
|
@@ -40,6 +44,8 @@ declare enum ViewerMessageType {
|
|
|
40
44
|
STATES_OBJECTS_LIST = "viewer-states-objects-list",
|
|
41
45
|
TREE_SELECT_NODE = "viewer-tree-select-node",
|
|
42
46
|
TREE_SET_NODE_VISIBILITY = "viewer-tree-set-node-visibility",
|
|
47
|
+
NODE_SYNC_LOCKED_STATE = "viewer-node-sync-locked-state",
|
|
48
|
+
NODE_GET_LOCKED_STATE = "viewer-node-get-locked-state",
|
|
43
49
|
TREE_GET_NODE_IDS = "viewer-tree-get-node-ids",
|
|
44
50
|
TREE_NODE_IDS = "viewer-tree-node-ids",
|
|
45
51
|
TREE_GET_NODES = "viewer-tree-get-nodes",
|
|
@@ -53,6 +59,8 @@ declare enum ViewerMessageType {
|
|
|
53
59
|
PDF_CURRENT_PAGE = "viewer-pdf-current-page",
|
|
54
60
|
HOME_CLICK = "viewer-home-click",
|
|
55
61
|
NODE_SELECTION_CHANGE = "viewer-node-selection-change",
|
|
62
|
+
NODE_LOCKED_STATE = "viewer-node-locked-state",
|
|
63
|
+
NODE_LOCKED_STATE_CHANGE = "viewer-node-locked-state-change",
|
|
56
64
|
PAN_CHANGE = "viewer-pan-change"
|
|
57
65
|
}
|
|
58
66
|
type LanguageCode = "en" | "vn";
|
|
@@ -120,6 +128,37 @@ type SheetListItem = {
|
|
|
120
128
|
is3D?: boolean;
|
|
121
129
|
viewId?: string;
|
|
122
130
|
};
|
|
131
|
+
type SdkViewType = "cad" | "saved";
|
|
132
|
+
type SdkViewItem = {
|
|
133
|
+
id: string;
|
|
134
|
+
name: string;
|
|
135
|
+
type: SdkViewType;
|
|
136
|
+
modelFileId?: string;
|
|
137
|
+
sheetId?: string | number | null;
|
|
138
|
+
createdBy?: string;
|
|
139
|
+
createdDate?: number;
|
|
140
|
+
modifiedDate?: number;
|
|
141
|
+
isPerspective?: boolean;
|
|
142
|
+
drawMode?: number;
|
|
143
|
+
};
|
|
144
|
+
type ViewsListPayload = {
|
|
145
|
+
requestId: string;
|
|
146
|
+
success: boolean;
|
|
147
|
+
cadViews: SdkViewItem[];
|
|
148
|
+
savedViews: SdkViewItem[];
|
|
149
|
+
selectedViewId?: string | null;
|
|
150
|
+
selectedViewType?: SdkViewType | null;
|
|
151
|
+
timestamp: number;
|
|
152
|
+
error?: string;
|
|
153
|
+
};
|
|
154
|
+
type ViewsApplyResultPayload = {
|
|
155
|
+
requestId: string;
|
|
156
|
+
success: boolean;
|
|
157
|
+
id: string;
|
|
158
|
+
type: SdkViewType;
|
|
159
|
+
timestamp: number;
|
|
160
|
+
error?: string;
|
|
161
|
+
};
|
|
123
162
|
type ObjectPropertyItem = Record<string, unknown>;
|
|
124
163
|
type ObjectPropertiesListPayload = {
|
|
125
164
|
requestId: string;
|
|
@@ -144,6 +183,21 @@ type StateObjectItem = {
|
|
|
144
183
|
type: string;
|
|
145
184
|
};
|
|
146
185
|
};
|
|
186
|
+
type SyncLockedStatePayload = {
|
|
187
|
+
persistentIds?: string[];
|
|
188
|
+
treeNodeIds?: string[];
|
|
189
|
+
requestId?: string;
|
|
190
|
+
};
|
|
191
|
+
type GetLockedStatePayload = {
|
|
192
|
+
requestId?: string;
|
|
193
|
+
};
|
|
194
|
+
type LockedStatePayload = {
|
|
195
|
+
requestId?: string;
|
|
196
|
+
persistentIds: string[];
|
|
197
|
+
treeNodeIds: string[];
|
|
198
|
+
renderedNodeIds: string[];
|
|
199
|
+
timestamp: number;
|
|
200
|
+
};
|
|
147
201
|
type TreeNodeItem = {
|
|
148
202
|
id: string;
|
|
149
203
|
name: string;
|
|
@@ -178,6 +232,8 @@ type ViewerEventMap = {
|
|
|
178
232
|
};
|
|
179
233
|
"camera:zoom": CameraZoomPayload;
|
|
180
234
|
"node:selection-change": NodeSelectionChangePayload;
|
|
235
|
+
"node:locked-state": LockedStatePayload;
|
|
236
|
+
"node:locked-state-change": LockedStatePayload;
|
|
181
237
|
"interaction:pan-change": {
|
|
182
238
|
enabled: boolean;
|
|
183
239
|
};
|
|
@@ -210,6 +266,8 @@ type ViewerEventMap = {
|
|
|
210
266
|
activeSheetId?: string | number | null;
|
|
211
267
|
timestamp: number;
|
|
212
268
|
};
|
|
269
|
+
"views:list": ViewsListPayload;
|
|
270
|
+
"views:apply-result": ViewsApplyResultPayload;
|
|
213
271
|
"object-properties:list": ObjectPropertiesListPayload;
|
|
214
272
|
"linked-objects:list": {
|
|
215
273
|
requestId: string;
|
|
@@ -346,6 +404,11 @@ declare class InteractionModule {
|
|
|
346
404
|
private setDrawMode;
|
|
347
405
|
}
|
|
348
406
|
|
|
407
|
+
type LockedState = LockedStatePayload;
|
|
408
|
+
type SyncLockedStateInput = Omit<SyncLockedStatePayload, "requestId">;
|
|
409
|
+
type LockedStateRequestOptions = {
|
|
410
|
+
timeoutMs?: number;
|
|
411
|
+
};
|
|
349
412
|
declare class NodeModule {
|
|
350
413
|
private viewer;
|
|
351
414
|
on: {
|
|
@@ -353,8 +416,11 @@ declare class NodeModule {
|
|
|
353
416
|
nodeIds: string[];
|
|
354
417
|
timestamp: number;
|
|
355
418
|
}) => void) => () => void;
|
|
419
|
+
lockedStateChange: (cb: (payload: LockedState) => void) => () => void;
|
|
356
420
|
};
|
|
357
421
|
constructor(viewer: Viewer3D);
|
|
422
|
+
syncLockedState(input: SyncLockedStateInput, options?: LockedStateRequestOptions): Promise<LockedState>;
|
|
423
|
+
getLockedState(options?: LockedStateRequestOptions): Promise<LockedState>;
|
|
358
424
|
}
|
|
359
425
|
|
|
360
426
|
type FilesConfig = {
|
|
@@ -667,6 +733,37 @@ declare class ObjectPropertiesModule {
|
|
|
667
733
|
getByNodeIds(nodeIds: Array<string | number>, options?: ObjectPropertiesGetOptions): Promise<ObjectPropertiesResult>;
|
|
668
734
|
}
|
|
669
735
|
|
|
736
|
+
type GetViewsOptions = {
|
|
737
|
+
timeoutMs?: number;
|
|
738
|
+
};
|
|
739
|
+
type ApplyViewInput = {
|
|
740
|
+
id: string;
|
|
741
|
+
type: SdkViewType;
|
|
742
|
+
};
|
|
743
|
+
type ApplyViewOptions = {
|
|
744
|
+
timeoutMs?: number;
|
|
745
|
+
};
|
|
746
|
+
type ApplyViewResult = {
|
|
747
|
+
id: string;
|
|
748
|
+
type: SdkViewType;
|
|
749
|
+
timestamp: number;
|
|
750
|
+
};
|
|
751
|
+
type SdkViewsList = {
|
|
752
|
+
cadViews: SdkViewItem[];
|
|
753
|
+
savedViews: SdkViewItem[];
|
|
754
|
+
selectedViewId?: string | null;
|
|
755
|
+
selectedViewType?: SdkViewType | null;
|
|
756
|
+
timestamp: number;
|
|
757
|
+
};
|
|
758
|
+
declare class ViewsModule {
|
|
759
|
+
private viewer;
|
|
760
|
+
constructor(viewer: Viewer3D);
|
|
761
|
+
getViews(options?: GetViewsOptions): Promise<SdkViewsList>;
|
|
762
|
+
getCadViews(options?: GetViewsOptions): Promise<SdkViewItem[]>;
|
|
763
|
+
getSavedViews(options?: GetViewsOptions): Promise<SdkViewItem[]>;
|
|
764
|
+
applyView(input: ApplyViewInput, options?: ApplyViewOptions): Promise<ApplyViewResult>;
|
|
765
|
+
}
|
|
766
|
+
|
|
670
767
|
type InitialToolbarUse = ToolbarUseTarget | ToolbarUseTarget[] | Partial<Record<ToolbarUseTarget, boolean>>;
|
|
671
768
|
type Viewer3DOptions = {
|
|
672
769
|
container: HTMLElement | string;
|
|
@@ -706,6 +803,7 @@ declare class Viewer3D {
|
|
|
706
803
|
markup: MarkupModule;
|
|
707
804
|
language: LanguageModule;
|
|
708
805
|
objectProperties: ObjectPropertiesModule;
|
|
806
|
+
views: ViewsModule;
|
|
709
807
|
constructor(options: Viewer3DOptions);
|
|
710
808
|
getOptions(): Viewer3DOptions;
|
|
711
809
|
patchOptions(next: Partial<Viewer3DOptions>): void;
|
|
@@ -735,4 +833,4 @@ declare class Viewer3D {
|
|
|
735
833
|
private handleMessage;
|
|
736
834
|
}
|
|
737
835
|
|
|
738
|
-
export { type CameraZoomPayload, type ConvertOptions, type ConvertV2Options, type CreatePipelineOptions, type FileInfoCheckInput, type FileInfoCheckPayloadItem, type FilesConfig, type InitialBackground, type InitialToolbarUse, type LanguageCode, type LoadStage, type LoadStatePayload, type MarkupAction, type MarkupListItem, type MarkupOperationResultPayload, type ObjectPropertiesGetOptions, type ObjectPropertiesResult, type PreparedViewerData, type SetBackgroundOptions, Viewer3D, type Viewer3DOptions, type ViewerBackgroundColorInput, type ViewerBackgroundPayload, type ViewerLoadingChangePayload, type ViewerLoadingPhase, type ViewerReadyPayload, type ViewerRgbColor, type ViewerRgbaColor };
|
|
836
|
+
export { type ApplyViewInput, type ApplyViewOptions, type ApplyViewResult, type CameraZoomPayload, type ConvertOptions, type ConvertV2Options, type CreatePipelineOptions, type FileInfoCheckInput, type FileInfoCheckPayloadItem, type FilesConfig, type GetLockedStatePayload, type GetViewsOptions, type InitialBackground, type InitialToolbarUse, type LanguageCode, type LoadStage, type LoadStatePayload, type LockedState, type LockedStatePayload, type LockedStateRequestOptions, type MarkupAction, type MarkupListItem, type MarkupOperationResultPayload, type ObjectPropertiesGetOptions, type ObjectPropertiesResult, type PreparedViewerData, type SdkViewItem, type SdkViewType, type SdkViewsList, type SetBackgroundOptions, type SyncLockedStateInput, type SyncLockedStatePayload, Viewer3D, type Viewer3DOptions, type ViewerBackgroundColorInput, type ViewerBackgroundPayload, type ViewerLoadingChangePayload, type ViewerLoadingPhase, type ViewerReadyPayload, type ViewerRgbColor, type ViewerRgbaColor, type ViewsApplyResultPayload, type ViewsListPayload };
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,10 @@ declare enum ViewerMessageType {
|
|
|
32
32
|
SHEETS_GET_LIST = "viewer-sheets-get-list",
|
|
33
33
|
SHEETS_LIST = "viewer-sheets-list",
|
|
34
34
|
SHEETS_APPLY = "viewer-sheets-apply",
|
|
35
|
+
VIEWS_GET_LIST = "viewer-views-get-list",
|
|
36
|
+
VIEWS_LIST = "viewer-views-list",
|
|
37
|
+
VIEWS_APPLY = "viewer-views-apply",
|
|
38
|
+
VIEWS_APPLY_RESULT = "viewer-views-apply-result",
|
|
35
39
|
OBJECT_PROPERTIES_GET_LIST = "viewer-object-properties-get-list",
|
|
36
40
|
OBJECT_PROPERTIES_LIST = "viewer-object-properties-list",
|
|
37
41
|
LINKED_OBJECTS_GET_LIST = "viewer-linked-objects-get-list",
|
|
@@ -40,6 +44,8 @@ declare enum ViewerMessageType {
|
|
|
40
44
|
STATES_OBJECTS_LIST = "viewer-states-objects-list",
|
|
41
45
|
TREE_SELECT_NODE = "viewer-tree-select-node",
|
|
42
46
|
TREE_SET_NODE_VISIBILITY = "viewer-tree-set-node-visibility",
|
|
47
|
+
NODE_SYNC_LOCKED_STATE = "viewer-node-sync-locked-state",
|
|
48
|
+
NODE_GET_LOCKED_STATE = "viewer-node-get-locked-state",
|
|
43
49
|
TREE_GET_NODE_IDS = "viewer-tree-get-node-ids",
|
|
44
50
|
TREE_NODE_IDS = "viewer-tree-node-ids",
|
|
45
51
|
TREE_GET_NODES = "viewer-tree-get-nodes",
|
|
@@ -53,6 +59,8 @@ declare enum ViewerMessageType {
|
|
|
53
59
|
PDF_CURRENT_PAGE = "viewer-pdf-current-page",
|
|
54
60
|
HOME_CLICK = "viewer-home-click",
|
|
55
61
|
NODE_SELECTION_CHANGE = "viewer-node-selection-change",
|
|
62
|
+
NODE_LOCKED_STATE = "viewer-node-locked-state",
|
|
63
|
+
NODE_LOCKED_STATE_CHANGE = "viewer-node-locked-state-change",
|
|
56
64
|
PAN_CHANGE = "viewer-pan-change"
|
|
57
65
|
}
|
|
58
66
|
type LanguageCode = "en" | "vn";
|
|
@@ -120,6 +128,37 @@ type SheetListItem = {
|
|
|
120
128
|
is3D?: boolean;
|
|
121
129
|
viewId?: string;
|
|
122
130
|
};
|
|
131
|
+
type SdkViewType = "cad" | "saved";
|
|
132
|
+
type SdkViewItem = {
|
|
133
|
+
id: string;
|
|
134
|
+
name: string;
|
|
135
|
+
type: SdkViewType;
|
|
136
|
+
modelFileId?: string;
|
|
137
|
+
sheetId?: string | number | null;
|
|
138
|
+
createdBy?: string;
|
|
139
|
+
createdDate?: number;
|
|
140
|
+
modifiedDate?: number;
|
|
141
|
+
isPerspective?: boolean;
|
|
142
|
+
drawMode?: number;
|
|
143
|
+
};
|
|
144
|
+
type ViewsListPayload = {
|
|
145
|
+
requestId: string;
|
|
146
|
+
success: boolean;
|
|
147
|
+
cadViews: SdkViewItem[];
|
|
148
|
+
savedViews: SdkViewItem[];
|
|
149
|
+
selectedViewId?: string | null;
|
|
150
|
+
selectedViewType?: SdkViewType | null;
|
|
151
|
+
timestamp: number;
|
|
152
|
+
error?: string;
|
|
153
|
+
};
|
|
154
|
+
type ViewsApplyResultPayload = {
|
|
155
|
+
requestId: string;
|
|
156
|
+
success: boolean;
|
|
157
|
+
id: string;
|
|
158
|
+
type: SdkViewType;
|
|
159
|
+
timestamp: number;
|
|
160
|
+
error?: string;
|
|
161
|
+
};
|
|
123
162
|
type ObjectPropertyItem = Record<string, unknown>;
|
|
124
163
|
type ObjectPropertiesListPayload = {
|
|
125
164
|
requestId: string;
|
|
@@ -144,6 +183,21 @@ type StateObjectItem = {
|
|
|
144
183
|
type: string;
|
|
145
184
|
};
|
|
146
185
|
};
|
|
186
|
+
type SyncLockedStatePayload = {
|
|
187
|
+
persistentIds?: string[];
|
|
188
|
+
treeNodeIds?: string[];
|
|
189
|
+
requestId?: string;
|
|
190
|
+
};
|
|
191
|
+
type GetLockedStatePayload = {
|
|
192
|
+
requestId?: string;
|
|
193
|
+
};
|
|
194
|
+
type LockedStatePayload = {
|
|
195
|
+
requestId?: string;
|
|
196
|
+
persistentIds: string[];
|
|
197
|
+
treeNodeIds: string[];
|
|
198
|
+
renderedNodeIds: string[];
|
|
199
|
+
timestamp: number;
|
|
200
|
+
};
|
|
147
201
|
type TreeNodeItem = {
|
|
148
202
|
id: string;
|
|
149
203
|
name: string;
|
|
@@ -178,6 +232,8 @@ type ViewerEventMap = {
|
|
|
178
232
|
};
|
|
179
233
|
"camera:zoom": CameraZoomPayload;
|
|
180
234
|
"node:selection-change": NodeSelectionChangePayload;
|
|
235
|
+
"node:locked-state": LockedStatePayload;
|
|
236
|
+
"node:locked-state-change": LockedStatePayload;
|
|
181
237
|
"interaction:pan-change": {
|
|
182
238
|
enabled: boolean;
|
|
183
239
|
};
|
|
@@ -210,6 +266,8 @@ type ViewerEventMap = {
|
|
|
210
266
|
activeSheetId?: string | number | null;
|
|
211
267
|
timestamp: number;
|
|
212
268
|
};
|
|
269
|
+
"views:list": ViewsListPayload;
|
|
270
|
+
"views:apply-result": ViewsApplyResultPayload;
|
|
213
271
|
"object-properties:list": ObjectPropertiesListPayload;
|
|
214
272
|
"linked-objects:list": {
|
|
215
273
|
requestId: string;
|
|
@@ -346,6 +404,11 @@ declare class InteractionModule {
|
|
|
346
404
|
private setDrawMode;
|
|
347
405
|
}
|
|
348
406
|
|
|
407
|
+
type LockedState = LockedStatePayload;
|
|
408
|
+
type SyncLockedStateInput = Omit<SyncLockedStatePayload, "requestId">;
|
|
409
|
+
type LockedStateRequestOptions = {
|
|
410
|
+
timeoutMs?: number;
|
|
411
|
+
};
|
|
349
412
|
declare class NodeModule {
|
|
350
413
|
private viewer;
|
|
351
414
|
on: {
|
|
@@ -353,8 +416,11 @@ declare class NodeModule {
|
|
|
353
416
|
nodeIds: string[];
|
|
354
417
|
timestamp: number;
|
|
355
418
|
}) => void) => () => void;
|
|
419
|
+
lockedStateChange: (cb: (payload: LockedState) => void) => () => void;
|
|
356
420
|
};
|
|
357
421
|
constructor(viewer: Viewer3D);
|
|
422
|
+
syncLockedState(input: SyncLockedStateInput, options?: LockedStateRequestOptions): Promise<LockedState>;
|
|
423
|
+
getLockedState(options?: LockedStateRequestOptions): Promise<LockedState>;
|
|
358
424
|
}
|
|
359
425
|
|
|
360
426
|
type FilesConfig = {
|
|
@@ -667,6 +733,37 @@ declare class ObjectPropertiesModule {
|
|
|
667
733
|
getByNodeIds(nodeIds: Array<string | number>, options?: ObjectPropertiesGetOptions): Promise<ObjectPropertiesResult>;
|
|
668
734
|
}
|
|
669
735
|
|
|
736
|
+
type GetViewsOptions = {
|
|
737
|
+
timeoutMs?: number;
|
|
738
|
+
};
|
|
739
|
+
type ApplyViewInput = {
|
|
740
|
+
id: string;
|
|
741
|
+
type: SdkViewType;
|
|
742
|
+
};
|
|
743
|
+
type ApplyViewOptions = {
|
|
744
|
+
timeoutMs?: number;
|
|
745
|
+
};
|
|
746
|
+
type ApplyViewResult = {
|
|
747
|
+
id: string;
|
|
748
|
+
type: SdkViewType;
|
|
749
|
+
timestamp: number;
|
|
750
|
+
};
|
|
751
|
+
type SdkViewsList = {
|
|
752
|
+
cadViews: SdkViewItem[];
|
|
753
|
+
savedViews: SdkViewItem[];
|
|
754
|
+
selectedViewId?: string | null;
|
|
755
|
+
selectedViewType?: SdkViewType | null;
|
|
756
|
+
timestamp: number;
|
|
757
|
+
};
|
|
758
|
+
declare class ViewsModule {
|
|
759
|
+
private viewer;
|
|
760
|
+
constructor(viewer: Viewer3D);
|
|
761
|
+
getViews(options?: GetViewsOptions): Promise<SdkViewsList>;
|
|
762
|
+
getCadViews(options?: GetViewsOptions): Promise<SdkViewItem[]>;
|
|
763
|
+
getSavedViews(options?: GetViewsOptions): Promise<SdkViewItem[]>;
|
|
764
|
+
applyView(input: ApplyViewInput, options?: ApplyViewOptions): Promise<ApplyViewResult>;
|
|
765
|
+
}
|
|
766
|
+
|
|
670
767
|
type InitialToolbarUse = ToolbarUseTarget | ToolbarUseTarget[] | Partial<Record<ToolbarUseTarget, boolean>>;
|
|
671
768
|
type Viewer3DOptions = {
|
|
672
769
|
container: HTMLElement | string;
|
|
@@ -706,6 +803,7 @@ declare class Viewer3D {
|
|
|
706
803
|
markup: MarkupModule;
|
|
707
804
|
language: LanguageModule;
|
|
708
805
|
objectProperties: ObjectPropertiesModule;
|
|
806
|
+
views: ViewsModule;
|
|
709
807
|
constructor(options: Viewer3DOptions);
|
|
710
808
|
getOptions(): Viewer3DOptions;
|
|
711
809
|
patchOptions(next: Partial<Viewer3DOptions>): void;
|
|
@@ -735,4 +833,4 @@ declare class Viewer3D {
|
|
|
735
833
|
private handleMessage;
|
|
736
834
|
}
|
|
737
835
|
|
|
738
|
-
export { type CameraZoomPayload, type ConvertOptions, type ConvertV2Options, type CreatePipelineOptions, type FileInfoCheckInput, type FileInfoCheckPayloadItem, type FilesConfig, type InitialBackground, type InitialToolbarUse, type LanguageCode, type LoadStage, type LoadStatePayload, type MarkupAction, type MarkupListItem, type MarkupOperationResultPayload, type ObjectPropertiesGetOptions, type ObjectPropertiesResult, type PreparedViewerData, type SetBackgroundOptions, Viewer3D, type Viewer3DOptions, type ViewerBackgroundColorInput, type ViewerBackgroundPayload, type ViewerLoadingChangePayload, type ViewerLoadingPhase, type ViewerReadyPayload, type ViewerRgbColor, type ViewerRgbaColor };
|
|
836
|
+
export { type ApplyViewInput, type ApplyViewOptions, type ApplyViewResult, type CameraZoomPayload, type ConvertOptions, type ConvertV2Options, type CreatePipelineOptions, type FileInfoCheckInput, type FileInfoCheckPayloadItem, type FilesConfig, type GetLockedStatePayload, type GetViewsOptions, type InitialBackground, type InitialToolbarUse, type LanguageCode, type LoadStage, type LoadStatePayload, type LockedState, type LockedStatePayload, type LockedStateRequestOptions, type MarkupAction, type MarkupListItem, type MarkupOperationResultPayload, type ObjectPropertiesGetOptions, type ObjectPropertiesResult, type PreparedViewerData, type SdkViewItem, type SdkViewType, type SdkViewsList, type SetBackgroundOptions, type SyncLockedStateInput, type SyncLockedStatePayload, Viewer3D, type Viewer3DOptions, type ViewerBackgroundColorInput, type ViewerBackgroundPayload, type ViewerLoadingChangePayload, type ViewerLoadingPhase, type ViewerReadyPayload, type ViewerRgbColor, type ViewerRgbaColor, type ViewsApplyResultPayload, type ViewsListPayload };
|
package/dist/index.js
CHANGED
|
@@ -260,14 +260,74 @@ var InteractionModule = class {
|
|
|
260
260
|
};
|
|
261
261
|
|
|
262
262
|
// src/modules/node.module.ts
|
|
263
|
+
function createRequestId2(prefix) {
|
|
264
|
+
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
265
|
+
}
|
|
266
|
+
function normalizeIds(values) {
|
|
267
|
+
if (!values) return void 0;
|
|
268
|
+
const normalized = Array.from(
|
|
269
|
+
new Set(
|
|
270
|
+
values.map((value) => String(value).trim()).filter((value) => value !== "")
|
|
271
|
+
)
|
|
272
|
+
);
|
|
273
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
274
|
+
}
|
|
263
275
|
var NodeModule = class {
|
|
264
276
|
constructor(viewer) {
|
|
265
277
|
this.viewer = viewer;
|
|
266
278
|
this.on = {
|
|
267
279
|
// SDK no longer supports first-node-only select events; listen to selectionChange for the full node list.
|
|
268
|
-
selectionChange: (cb) => this.viewer._on("node:selection-change", cb)
|
|
280
|
+
selectionChange: (cb) => this.viewer._on("node:selection-change", cb),
|
|
281
|
+
lockedStateChange: (cb) => this.viewer._on("node:locked-state-change", cb)
|
|
269
282
|
};
|
|
270
283
|
}
|
|
284
|
+
syncLockedState(input, options) {
|
|
285
|
+
var _a;
|
|
286
|
+
const requestId = createRequestId2("locked_state_sync");
|
|
287
|
+
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
288
|
+
return new Promise((resolve, reject) => {
|
|
289
|
+
const timer = setTimeout(() => {
|
|
290
|
+
off();
|
|
291
|
+
reject(new Error("Timeout while syncing locked state with viewer"));
|
|
292
|
+
}, timeoutMs);
|
|
293
|
+
const off = this.viewer._on("node:locked-state", (payload2) => {
|
|
294
|
+
if (payload2.requestId !== requestId) return;
|
|
295
|
+
clearTimeout(timer);
|
|
296
|
+
off();
|
|
297
|
+
resolve(payload2);
|
|
298
|
+
});
|
|
299
|
+
const payload = {
|
|
300
|
+
requestId,
|
|
301
|
+
persistentIds: normalizeIds(input.persistentIds),
|
|
302
|
+
treeNodeIds: normalizeIds(input.treeNodeIds)
|
|
303
|
+
};
|
|
304
|
+
this.viewer.postToViewer(
|
|
305
|
+
"viewer-node-sync-locked-state" /* NODE_SYNC_LOCKED_STATE */,
|
|
306
|
+
payload
|
|
307
|
+
);
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
getLockedState(options) {
|
|
311
|
+
var _a;
|
|
312
|
+
const requestId = createRequestId2("locked_state_get");
|
|
313
|
+
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
314
|
+
return new Promise((resolve, reject) => {
|
|
315
|
+
const timer = setTimeout(() => {
|
|
316
|
+
off();
|
|
317
|
+
reject(new Error("Timeout while getting locked state from viewer"));
|
|
318
|
+
}, timeoutMs);
|
|
319
|
+
const off = this.viewer._on("node:locked-state", (payload) => {
|
|
320
|
+
if (payload.requestId !== requestId) return;
|
|
321
|
+
clearTimeout(timer);
|
|
322
|
+
off();
|
|
323
|
+
resolve(payload);
|
|
324
|
+
});
|
|
325
|
+
this.viewer.postToViewer(
|
|
326
|
+
"viewer-node-get-locked-state" /* NODE_GET_LOCKED_STATE */,
|
|
327
|
+
{ requestId }
|
|
328
|
+
);
|
|
329
|
+
});
|
|
330
|
+
}
|
|
271
331
|
};
|
|
272
332
|
|
|
273
333
|
// src/modules/files.module.ts
|
|
@@ -833,7 +893,7 @@ var FilesModule = class {
|
|
|
833
893
|
};
|
|
834
894
|
|
|
835
895
|
// src/modules/toolbar.module.ts
|
|
836
|
-
function
|
|
896
|
+
function createRequestId3(prefix) {
|
|
837
897
|
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
838
898
|
}
|
|
839
899
|
var ALL_3D_TOOLBAR_OPERATORS = [
|
|
@@ -991,7 +1051,7 @@ var ToolbarModule = class {
|
|
|
991
1051
|
}
|
|
992
1052
|
getSheets(options) {
|
|
993
1053
|
var _a;
|
|
994
|
-
const requestId =
|
|
1054
|
+
const requestId = createRequestId3("sheets");
|
|
995
1055
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
996
1056
|
return new Promise((resolve, reject) => {
|
|
997
1057
|
const timer = setTimeout(() => {
|
|
@@ -1009,7 +1069,7 @@ var ToolbarModule = class {
|
|
|
1009
1069
|
}
|
|
1010
1070
|
getObjectProperties(options) {
|
|
1011
1071
|
var _a;
|
|
1012
|
-
const requestId =
|
|
1072
|
+
const requestId = createRequestId3("object_properties");
|
|
1013
1073
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1014
1074
|
return new Promise((resolve, reject) => {
|
|
1015
1075
|
var _a2;
|
|
@@ -1031,7 +1091,7 @@ var ToolbarModule = class {
|
|
|
1031
1091
|
}
|
|
1032
1092
|
getLinkedObjects(options) {
|
|
1033
1093
|
var _a;
|
|
1034
|
-
const requestId =
|
|
1094
|
+
const requestId = createRequestId3("linked_objects");
|
|
1035
1095
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1036
1096
|
return new Promise((resolve, reject) => {
|
|
1037
1097
|
const timer = setTimeout(() => {
|
|
@@ -1049,7 +1109,7 @@ var ToolbarModule = class {
|
|
|
1049
1109
|
}
|
|
1050
1110
|
getStatesObjects(options) {
|
|
1051
1111
|
var _a;
|
|
1052
|
-
const requestId =
|
|
1112
|
+
const requestId = createRequestId3("states_objects");
|
|
1053
1113
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1054
1114
|
return new Promise((resolve, reject) => {
|
|
1055
1115
|
const timer = setTimeout(() => {
|
|
@@ -1137,7 +1197,7 @@ var ToolbarModule = class {
|
|
|
1137
1197
|
};
|
|
1138
1198
|
|
|
1139
1199
|
// src/modules/model-tree.module.ts
|
|
1140
|
-
function
|
|
1200
|
+
function createRequestId4(prefix) {
|
|
1141
1201
|
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1142
1202
|
}
|
|
1143
1203
|
function buildTree(nodes, rootNodeIds) {
|
|
@@ -1211,7 +1271,7 @@ var ModelTreeModule = class {
|
|
|
1211
1271
|
this.setNodeVisibility(nodeIds, true);
|
|
1212
1272
|
}
|
|
1213
1273
|
getNodeIds(options) {
|
|
1214
|
-
const requestId =
|
|
1274
|
+
const requestId = createRequestId4("tree");
|
|
1215
1275
|
const timeoutMs = this.resolveTimeoutMs(options);
|
|
1216
1276
|
return new Promise((resolve, reject) => {
|
|
1217
1277
|
const timer = setTimeout(() => {
|
|
@@ -1237,7 +1297,7 @@ var ModelTreeModule = class {
|
|
|
1237
1297
|
return this.requestNodes(options).then((response) => buildTree(response.nodes, response.rootNodeIds));
|
|
1238
1298
|
}
|
|
1239
1299
|
requestNodes(options) {
|
|
1240
|
-
const requestId =
|
|
1300
|
+
const requestId = createRequestId4("tree_nodes");
|
|
1241
1301
|
const timeoutMs = this.resolveTimeoutMs(options);
|
|
1242
1302
|
return new Promise((resolve, reject) => {
|
|
1243
1303
|
const timer = setTimeout(() => {
|
|
@@ -1289,7 +1349,7 @@ var ModelTreeModule = class {
|
|
|
1289
1349
|
};
|
|
1290
1350
|
|
|
1291
1351
|
// src/modules/markup.module.ts
|
|
1292
|
-
function
|
|
1352
|
+
function createRequestId5(prefix) {
|
|
1293
1353
|
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1294
1354
|
}
|
|
1295
1355
|
var MarkupModule = class {
|
|
@@ -1343,7 +1403,7 @@ var MarkupModule = class {
|
|
|
1343
1403
|
}
|
|
1344
1404
|
getList(options) {
|
|
1345
1405
|
var _a;
|
|
1346
|
-
const requestId =
|
|
1406
|
+
const requestId = createRequestId5("markup-list");
|
|
1347
1407
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1348
1408
|
return new Promise((resolve, reject) => {
|
|
1349
1409
|
const timer = setTimeout(() => {
|
|
@@ -1361,7 +1421,7 @@ var MarkupModule = class {
|
|
|
1361
1421
|
}
|
|
1362
1422
|
runRequest(prefix, messageType, eventName, options) {
|
|
1363
1423
|
var _a;
|
|
1364
|
-
const requestId =
|
|
1424
|
+
const requestId = createRequestId5(prefix);
|
|
1365
1425
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1366
1426
|
return new Promise((resolve, reject) => {
|
|
1367
1427
|
const timer = setTimeout(() => {
|
|
@@ -1407,7 +1467,7 @@ function createObjectPropertiesError(message, errorStatus) {
|
|
|
1407
1467
|
error.errorStatus = errorStatus;
|
|
1408
1468
|
return error;
|
|
1409
1469
|
}
|
|
1410
|
-
function
|
|
1470
|
+
function createRequestId6(prefix) {
|
|
1411
1471
|
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1412
1472
|
}
|
|
1413
1473
|
function normalizeNodeIds(nodeIds) {
|
|
@@ -1425,7 +1485,7 @@ var ObjectPropertiesModule = class {
|
|
|
1425
1485
|
getByNodeIds(nodeIds, options) {
|
|
1426
1486
|
var _a;
|
|
1427
1487
|
const normalizedNodeIds = normalizeNodeIds(nodeIds);
|
|
1428
|
-
const requestId =
|
|
1488
|
+
const requestId = createRequestId6("object_properties");
|
|
1429
1489
|
if (normalizedNodeIds.length === 0) {
|
|
1430
1490
|
return Promise.resolve({
|
|
1431
1491
|
requestId,
|
|
@@ -1463,6 +1523,89 @@ var ObjectPropertiesModule = class {
|
|
|
1463
1523
|
}
|
|
1464
1524
|
};
|
|
1465
1525
|
|
|
1526
|
+
// src/modules/views.module.ts
|
|
1527
|
+
function createRequestId7(prefix) {
|
|
1528
|
+
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1529
|
+
}
|
|
1530
|
+
var ViewsModule = class {
|
|
1531
|
+
constructor(viewer) {
|
|
1532
|
+
this.viewer = viewer;
|
|
1533
|
+
}
|
|
1534
|
+
getViews(options) {
|
|
1535
|
+
var _a;
|
|
1536
|
+
const requestId = createRequestId7("views");
|
|
1537
|
+
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1538
|
+
return new Promise((resolve, reject) => {
|
|
1539
|
+
const timer = setTimeout(() => {
|
|
1540
|
+
off();
|
|
1541
|
+
reject(new Error("Timeout while getting views list from viewer"));
|
|
1542
|
+
}, timeoutMs);
|
|
1543
|
+
const off = this.viewer._on("views:list", (payload) => {
|
|
1544
|
+
var _a2, _b;
|
|
1545
|
+
if (payload.requestId !== requestId) return;
|
|
1546
|
+
clearTimeout(timer);
|
|
1547
|
+
off();
|
|
1548
|
+
if (!payload.success) {
|
|
1549
|
+
reject(new Error(payload.error || "Viewer failed to load views"));
|
|
1550
|
+
return;
|
|
1551
|
+
}
|
|
1552
|
+
resolve({
|
|
1553
|
+
cadViews: payload.cadViews,
|
|
1554
|
+
savedViews: payload.savedViews,
|
|
1555
|
+
selectedViewId: (_a2 = payload.selectedViewId) != null ? _a2 : null,
|
|
1556
|
+
selectedViewType: (_b = payload.selectedViewType) != null ? _b : null,
|
|
1557
|
+
timestamp: payload.timestamp
|
|
1558
|
+
});
|
|
1559
|
+
});
|
|
1560
|
+
this.viewer.postToViewer(
|
|
1561
|
+
"viewer-views-get-list" /* VIEWS_GET_LIST */,
|
|
1562
|
+
{ requestId }
|
|
1563
|
+
);
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
async getCadViews(options) {
|
|
1567
|
+
const views = await this.getViews(options);
|
|
1568
|
+
return views.cadViews;
|
|
1569
|
+
}
|
|
1570
|
+
async getSavedViews(options) {
|
|
1571
|
+
const views = await this.getViews(options);
|
|
1572
|
+
return views.savedViews;
|
|
1573
|
+
}
|
|
1574
|
+
applyView(input, options) {
|
|
1575
|
+
var _a;
|
|
1576
|
+
const requestId = createRequestId7("views-apply");
|
|
1577
|
+
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1578
|
+
return new Promise((resolve, reject) => {
|
|
1579
|
+
const timer = setTimeout(() => {
|
|
1580
|
+
off();
|
|
1581
|
+
reject(new Error("Timeout while waiting for view apply result from viewer"));
|
|
1582
|
+
}, timeoutMs);
|
|
1583
|
+
const off = this.viewer._on(
|
|
1584
|
+
"views:apply-result",
|
|
1585
|
+
(payload) => {
|
|
1586
|
+
if (payload.requestId !== requestId) return;
|
|
1587
|
+
clearTimeout(timer);
|
|
1588
|
+
off();
|
|
1589
|
+
if (!payload.success) {
|
|
1590
|
+
reject(new Error(payload.error || "Viewer failed to apply view"));
|
|
1591
|
+
return;
|
|
1592
|
+
}
|
|
1593
|
+
resolve({
|
|
1594
|
+
id: payload.id,
|
|
1595
|
+
type: payload.type,
|
|
1596
|
+
timestamp: payload.timestamp
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
);
|
|
1600
|
+
this.viewer.postToViewer("viewer-views-apply" /* VIEWS_APPLY */, {
|
|
1601
|
+
requestId,
|
|
1602
|
+
id: input.id,
|
|
1603
|
+
type: input.type
|
|
1604
|
+
});
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
};
|
|
1608
|
+
|
|
1466
1609
|
// src/viewer.ts
|
|
1467
1610
|
var Viewer3D = class {
|
|
1468
1611
|
constructor(options) {
|
|
@@ -1479,7 +1622,7 @@ var Viewer3D = class {
|
|
|
1479
1622
|
};
|
|
1480
1623
|
this.emitter = new Emitter();
|
|
1481
1624
|
this.handleMessage = (event) => {
|
|
1482
|
-
var _a, _b, _c;
|
|
1625
|
+
var _a, _b, _c, _d;
|
|
1483
1626
|
const data = event.data;
|
|
1484
1627
|
if (!data || typeof data !== "object") return;
|
|
1485
1628
|
switch (data.type) {
|
|
@@ -1538,6 +1681,30 @@ var Viewer3D = class {
|
|
|
1538
1681
|
});
|
|
1539
1682
|
break;
|
|
1540
1683
|
}
|
|
1684
|
+
case "viewer-node-locked-state" /* NODE_LOCKED_STATE */: {
|
|
1685
|
+
const payload = data.payload;
|
|
1686
|
+
if (!payload) break;
|
|
1687
|
+
this._emit("node:locked-state", {
|
|
1688
|
+
requestId: payload.requestId ? String(payload.requestId) : void 0,
|
|
1689
|
+
persistentIds: Array.isArray(payload.persistentIds) ? payload.persistentIds.map(String) : [],
|
|
1690
|
+
treeNodeIds: Array.isArray(payload.treeNodeIds) ? payload.treeNodeIds.map(String) : [],
|
|
1691
|
+
renderedNodeIds: Array.isArray(payload.renderedNodeIds) ? payload.renderedNodeIds.map(String) : [],
|
|
1692
|
+
timestamp: Number(payload.timestamp) || Date.now()
|
|
1693
|
+
});
|
|
1694
|
+
break;
|
|
1695
|
+
}
|
|
1696
|
+
case "viewer-node-locked-state-change" /* NODE_LOCKED_STATE_CHANGE */: {
|
|
1697
|
+
const payload = data.payload;
|
|
1698
|
+
if (!payload) break;
|
|
1699
|
+
this._emit("node:locked-state-change", {
|
|
1700
|
+
requestId: payload.requestId ? String(payload.requestId) : void 0,
|
|
1701
|
+
persistentIds: Array.isArray(payload.persistentIds) ? payload.persistentIds.map(String) : [],
|
|
1702
|
+
treeNodeIds: Array.isArray(payload.treeNodeIds) ? payload.treeNodeIds.map(String) : [],
|
|
1703
|
+
renderedNodeIds: Array.isArray(payload.renderedNodeIds) ? payload.renderedNodeIds.map(String) : [],
|
|
1704
|
+
timestamp: Number(payload.timestamp) || Date.now()
|
|
1705
|
+
});
|
|
1706
|
+
break;
|
|
1707
|
+
}
|
|
1541
1708
|
case "viewer-pan-change" /* PAN_CHANGE */:
|
|
1542
1709
|
this._emit("interaction:pan-change", {
|
|
1543
1710
|
enabled: Boolean((_a = data.payload) == null ? void 0 : _a.enabled)
|
|
@@ -1655,13 +1822,69 @@ var Viewer3D = class {
|
|
|
1655
1822
|
});
|
|
1656
1823
|
break;
|
|
1657
1824
|
}
|
|
1825
|
+
case "viewer-views-list" /* VIEWS_LIST */: {
|
|
1826
|
+
const payload = data.payload;
|
|
1827
|
+
if (!payload || !payload.requestId) break;
|
|
1828
|
+
this._emit("views:list", {
|
|
1829
|
+
requestId: String(payload.requestId),
|
|
1830
|
+
success: Boolean(payload.success),
|
|
1831
|
+
cadViews: Array.isArray(payload.cadViews) ? payload.cadViews.filter((item) => item && typeof item === "object").map((item) => {
|
|
1832
|
+
var _a2, _b2, _c2;
|
|
1833
|
+
return {
|
|
1834
|
+
id: String((_a2 = item.id) != null ? _a2 : ""),
|
|
1835
|
+
name: String((_b2 = item.name) != null ? _b2 : ""),
|
|
1836
|
+
type: item.type === "saved" ? "saved" : "cad",
|
|
1837
|
+
modelFileId: item.modelFileId ? String(item.modelFileId) : void 0,
|
|
1838
|
+
sheetId: (_c2 = item.sheetId) != null ? _c2 : null,
|
|
1839
|
+
createdBy: item.createdBy ? String(item.createdBy) : void 0,
|
|
1840
|
+
createdDate: typeof item.createdDate === "number" ? item.createdDate : void 0,
|
|
1841
|
+
modifiedDate: typeof item.modifiedDate === "number" ? item.modifiedDate : void 0,
|
|
1842
|
+
isPerspective: typeof item.isPerspective === "boolean" ? item.isPerspective : void 0,
|
|
1843
|
+
drawMode: typeof item.drawMode === "number" ? item.drawMode : void 0
|
|
1844
|
+
};
|
|
1845
|
+
}) : [],
|
|
1846
|
+
savedViews: Array.isArray(payload.savedViews) ? payload.savedViews.filter((item) => item && typeof item === "object").map((item) => {
|
|
1847
|
+
var _a2, _b2, _c2;
|
|
1848
|
+
return {
|
|
1849
|
+
id: String((_a2 = item.id) != null ? _a2 : ""),
|
|
1850
|
+
name: String((_b2 = item.name) != null ? _b2 : ""),
|
|
1851
|
+
type: item.type === "cad" ? "cad" : "saved",
|
|
1852
|
+
modelFileId: item.modelFileId ? String(item.modelFileId) : void 0,
|
|
1853
|
+
sheetId: (_c2 = item.sheetId) != null ? _c2 : null,
|
|
1854
|
+
createdBy: item.createdBy ? String(item.createdBy) : void 0,
|
|
1855
|
+
createdDate: typeof item.createdDate === "number" ? item.createdDate : void 0,
|
|
1856
|
+
modifiedDate: typeof item.modifiedDate === "number" ? item.modifiedDate : void 0,
|
|
1857
|
+
isPerspective: typeof item.isPerspective === "boolean" ? item.isPerspective : void 0,
|
|
1858
|
+
drawMode: typeof item.drawMode === "number" ? item.drawMode : void 0
|
|
1859
|
+
};
|
|
1860
|
+
}) : [],
|
|
1861
|
+
selectedViewId: payload.selectedViewId ? String(payload.selectedViewId) : null,
|
|
1862
|
+
selectedViewType: payload.selectedViewType === "saved" ? "saved" : payload.selectedViewType === "cad" ? "cad" : null,
|
|
1863
|
+
error: payload.error ? String(payload.error) : void 0,
|
|
1864
|
+
timestamp: Number(payload.timestamp) || Date.now()
|
|
1865
|
+
});
|
|
1866
|
+
break;
|
|
1867
|
+
}
|
|
1868
|
+
case "viewer-views-apply-result" /* VIEWS_APPLY_RESULT */: {
|
|
1869
|
+
const payload = data.payload;
|
|
1870
|
+
if (!payload || !payload.requestId) break;
|
|
1871
|
+
this._emit("views:apply-result", {
|
|
1872
|
+
requestId: String(payload.requestId),
|
|
1873
|
+
success: Boolean(payload.success),
|
|
1874
|
+
id: String((_c = payload.id) != null ? _c : ""),
|
|
1875
|
+
type: payload.type === "saved" ? "saved" : "cad",
|
|
1876
|
+
error: payload.error ? String(payload.error) : void 0,
|
|
1877
|
+
timestamp: Number(payload.timestamp) || Date.now()
|
|
1878
|
+
});
|
|
1879
|
+
break;
|
|
1880
|
+
}
|
|
1658
1881
|
case "viewer-object-properties-list" /* OBJECT_PROPERTIES_LIST */: {
|
|
1659
1882
|
const payload = data.payload;
|
|
1660
1883
|
if (!payload || !payload.requestId || !Array.isArray(payload.properties))
|
|
1661
1884
|
break;
|
|
1662
1885
|
this._emit("object-properties:list", {
|
|
1663
1886
|
requestId: String(payload.requestId),
|
|
1664
|
-
selectionKey: String((
|
|
1887
|
+
selectionKey: String((_d = payload.selectionKey) != null ? _d : ""),
|
|
1665
1888
|
nodeIds: Array.isArray(payload.nodeIds) ? payload.nodeIds.map(String) : [],
|
|
1666
1889
|
persistentIds: Array.isArray(payload.persistentIds) ? payload.persistentIds.map(String) : [],
|
|
1667
1890
|
properties: payload.properties.filter((item) => item && typeof item === "object").map((item) => ({ ...item })),
|
|
@@ -1687,7 +1910,7 @@ var Viewer3D = class {
|
|
|
1687
1910
|
this._emit("states-objects:list", {
|
|
1688
1911
|
requestId: String(payload.requestId),
|
|
1689
1912
|
statesObjects: payload.statesObjects.map((item) => {
|
|
1690
|
-
var _a2, _b2, _c2,
|
|
1913
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g;
|
|
1691
1914
|
return {
|
|
1692
1915
|
id: String((_a2 = item.id) != null ? _a2 : ""),
|
|
1693
1916
|
name: String((_b2 = item.name) != null ? _b2 : ""),
|
|
@@ -1700,7 +1923,7 @@ var Viewer3D = class {
|
|
|
1700
1923
|
};
|
|
1701
1924
|
}) : [],
|
|
1702
1925
|
states: {
|
|
1703
|
-
color: String((_e = (
|
|
1926
|
+
color: String((_e = (_d2 = item.states) == null ? void 0 : _d2.color) != null ? _e : ""),
|
|
1704
1927
|
type: String((_g = (_f = item.states) == null ? void 0 : _f.type) != null ? _g : "")
|
|
1705
1928
|
}
|
|
1706
1929
|
};
|
|
@@ -1770,6 +1993,7 @@ var Viewer3D = class {
|
|
|
1770
1993
|
this.markup = new MarkupModule(this);
|
|
1771
1994
|
this.language = new LanguageModule(this);
|
|
1772
1995
|
this.objectProperties = new ObjectPropertiesModule(this);
|
|
1996
|
+
this.views = new ViewsModule(this);
|
|
1773
1997
|
}
|
|
1774
1998
|
// ===== options helpers =====
|
|
1775
1999
|
getOptions() {
|
package/dist/index.mjs
CHANGED
|
@@ -234,14 +234,74 @@ var InteractionModule = class {
|
|
|
234
234
|
};
|
|
235
235
|
|
|
236
236
|
// src/modules/node.module.ts
|
|
237
|
+
function createRequestId2(prefix) {
|
|
238
|
+
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
239
|
+
}
|
|
240
|
+
function normalizeIds(values) {
|
|
241
|
+
if (!values) return void 0;
|
|
242
|
+
const normalized = Array.from(
|
|
243
|
+
new Set(
|
|
244
|
+
values.map((value) => String(value).trim()).filter((value) => value !== "")
|
|
245
|
+
)
|
|
246
|
+
);
|
|
247
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
248
|
+
}
|
|
237
249
|
var NodeModule = class {
|
|
238
250
|
constructor(viewer) {
|
|
239
251
|
this.viewer = viewer;
|
|
240
252
|
this.on = {
|
|
241
253
|
// SDK no longer supports first-node-only select events; listen to selectionChange for the full node list.
|
|
242
|
-
selectionChange: (cb) => this.viewer._on("node:selection-change", cb)
|
|
254
|
+
selectionChange: (cb) => this.viewer._on("node:selection-change", cb),
|
|
255
|
+
lockedStateChange: (cb) => this.viewer._on("node:locked-state-change", cb)
|
|
243
256
|
};
|
|
244
257
|
}
|
|
258
|
+
syncLockedState(input, options) {
|
|
259
|
+
var _a;
|
|
260
|
+
const requestId = createRequestId2("locked_state_sync");
|
|
261
|
+
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
262
|
+
return new Promise((resolve, reject) => {
|
|
263
|
+
const timer = setTimeout(() => {
|
|
264
|
+
off();
|
|
265
|
+
reject(new Error("Timeout while syncing locked state with viewer"));
|
|
266
|
+
}, timeoutMs);
|
|
267
|
+
const off = this.viewer._on("node:locked-state", (payload2) => {
|
|
268
|
+
if (payload2.requestId !== requestId) return;
|
|
269
|
+
clearTimeout(timer);
|
|
270
|
+
off();
|
|
271
|
+
resolve(payload2);
|
|
272
|
+
});
|
|
273
|
+
const payload = {
|
|
274
|
+
requestId,
|
|
275
|
+
persistentIds: normalizeIds(input.persistentIds),
|
|
276
|
+
treeNodeIds: normalizeIds(input.treeNodeIds)
|
|
277
|
+
};
|
|
278
|
+
this.viewer.postToViewer(
|
|
279
|
+
"viewer-node-sync-locked-state" /* NODE_SYNC_LOCKED_STATE */,
|
|
280
|
+
payload
|
|
281
|
+
);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
getLockedState(options) {
|
|
285
|
+
var _a;
|
|
286
|
+
const requestId = createRequestId2("locked_state_get");
|
|
287
|
+
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
288
|
+
return new Promise((resolve, reject) => {
|
|
289
|
+
const timer = setTimeout(() => {
|
|
290
|
+
off();
|
|
291
|
+
reject(new Error("Timeout while getting locked state from viewer"));
|
|
292
|
+
}, timeoutMs);
|
|
293
|
+
const off = this.viewer._on("node:locked-state", (payload) => {
|
|
294
|
+
if (payload.requestId !== requestId) return;
|
|
295
|
+
clearTimeout(timer);
|
|
296
|
+
off();
|
|
297
|
+
resolve(payload);
|
|
298
|
+
});
|
|
299
|
+
this.viewer.postToViewer(
|
|
300
|
+
"viewer-node-get-locked-state" /* NODE_GET_LOCKED_STATE */,
|
|
301
|
+
{ requestId }
|
|
302
|
+
);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
245
305
|
};
|
|
246
306
|
|
|
247
307
|
// src/modules/files.module.ts
|
|
@@ -807,7 +867,7 @@ var FilesModule = class {
|
|
|
807
867
|
};
|
|
808
868
|
|
|
809
869
|
// src/modules/toolbar.module.ts
|
|
810
|
-
function
|
|
870
|
+
function createRequestId3(prefix) {
|
|
811
871
|
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
812
872
|
}
|
|
813
873
|
var ALL_3D_TOOLBAR_OPERATORS = [
|
|
@@ -965,7 +1025,7 @@ var ToolbarModule = class {
|
|
|
965
1025
|
}
|
|
966
1026
|
getSheets(options) {
|
|
967
1027
|
var _a;
|
|
968
|
-
const requestId =
|
|
1028
|
+
const requestId = createRequestId3("sheets");
|
|
969
1029
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
970
1030
|
return new Promise((resolve, reject) => {
|
|
971
1031
|
const timer = setTimeout(() => {
|
|
@@ -983,7 +1043,7 @@ var ToolbarModule = class {
|
|
|
983
1043
|
}
|
|
984
1044
|
getObjectProperties(options) {
|
|
985
1045
|
var _a;
|
|
986
|
-
const requestId =
|
|
1046
|
+
const requestId = createRequestId3("object_properties");
|
|
987
1047
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
988
1048
|
return new Promise((resolve, reject) => {
|
|
989
1049
|
var _a2;
|
|
@@ -1005,7 +1065,7 @@ var ToolbarModule = class {
|
|
|
1005
1065
|
}
|
|
1006
1066
|
getLinkedObjects(options) {
|
|
1007
1067
|
var _a;
|
|
1008
|
-
const requestId =
|
|
1068
|
+
const requestId = createRequestId3("linked_objects");
|
|
1009
1069
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1010
1070
|
return new Promise((resolve, reject) => {
|
|
1011
1071
|
const timer = setTimeout(() => {
|
|
@@ -1023,7 +1083,7 @@ var ToolbarModule = class {
|
|
|
1023
1083
|
}
|
|
1024
1084
|
getStatesObjects(options) {
|
|
1025
1085
|
var _a;
|
|
1026
|
-
const requestId =
|
|
1086
|
+
const requestId = createRequestId3("states_objects");
|
|
1027
1087
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1028
1088
|
return new Promise((resolve, reject) => {
|
|
1029
1089
|
const timer = setTimeout(() => {
|
|
@@ -1111,7 +1171,7 @@ var ToolbarModule = class {
|
|
|
1111
1171
|
};
|
|
1112
1172
|
|
|
1113
1173
|
// src/modules/model-tree.module.ts
|
|
1114
|
-
function
|
|
1174
|
+
function createRequestId4(prefix) {
|
|
1115
1175
|
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1116
1176
|
}
|
|
1117
1177
|
function buildTree(nodes, rootNodeIds) {
|
|
@@ -1185,7 +1245,7 @@ var ModelTreeModule = class {
|
|
|
1185
1245
|
this.setNodeVisibility(nodeIds, true);
|
|
1186
1246
|
}
|
|
1187
1247
|
getNodeIds(options) {
|
|
1188
|
-
const requestId =
|
|
1248
|
+
const requestId = createRequestId4("tree");
|
|
1189
1249
|
const timeoutMs = this.resolveTimeoutMs(options);
|
|
1190
1250
|
return new Promise((resolve, reject) => {
|
|
1191
1251
|
const timer = setTimeout(() => {
|
|
@@ -1211,7 +1271,7 @@ var ModelTreeModule = class {
|
|
|
1211
1271
|
return this.requestNodes(options).then((response) => buildTree(response.nodes, response.rootNodeIds));
|
|
1212
1272
|
}
|
|
1213
1273
|
requestNodes(options) {
|
|
1214
|
-
const requestId =
|
|
1274
|
+
const requestId = createRequestId4("tree_nodes");
|
|
1215
1275
|
const timeoutMs = this.resolveTimeoutMs(options);
|
|
1216
1276
|
return new Promise((resolve, reject) => {
|
|
1217
1277
|
const timer = setTimeout(() => {
|
|
@@ -1263,7 +1323,7 @@ var ModelTreeModule = class {
|
|
|
1263
1323
|
};
|
|
1264
1324
|
|
|
1265
1325
|
// src/modules/markup.module.ts
|
|
1266
|
-
function
|
|
1326
|
+
function createRequestId5(prefix) {
|
|
1267
1327
|
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1268
1328
|
}
|
|
1269
1329
|
var MarkupModule = class {
|
|
@@ -1317,7 +1377,7 @@ var MarkupModule = class {
|
|
|
1317
1377
|
}
|
|
1318
1378
|
getList(options) {
|
|
1319
1379
|
var _a;
|
|
1320
|
-
const requestId =
|
|
1380
|
+
const requestId = createRequestId5("markup-list");
|
|
1321
1381
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1322
1382
|
return new Promise((resolve, reject) => {
|
|
1323
1383
|
const timer = setTimeout(() => {
|
|
@@ -1335,7 +1395,7 @@ var MarkupModule = class {
|
|
|
1335
1395
|
}
|
|
1336
1396
|
runRequest(prefix, messageType, eventName, options) {
|
|
1337
1397
|
var _a;
|
|
1338
|
-
const requestId =
|
|
1398
|
+
const requestId = createRequestId5(prefix);
|
|
1339
1399
|
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1340
1400
|
return new Promise((resolve, reject) => {
|
|
1341
1401
|
const timer = setTimeout(() => {
|
|
@@ -1381,7 +1441,7 @@ function createObjectPropertiesError(message, errorStatus) {
|
|
|
1381
1441
|
error.errorStatus = errorStatus;
|
|
1382
1442
|
return error;
|
|
1383
1443
|
}
|
|
1384
|
-
function
|
|
1444
|
+
function createRequestId6(prefix) {
|
|
1385
1445
|
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1386
1446
|
}
|
|
1387
1447
|
function normalizeNodeIds(nodeIds) {
|
|
@@ -1399,7 +1459,7 @@ var ObjectPropertiesModule = class {
|
|
|
1399
1459
|
getByNodeIds(nodeIds, options) {
|
|
1400
1460
|
var _a;
|
|
1401
1461
|
const normalizedNodeIds = normalizeNodeIds(nodeIds);
|
|
1402
|
-
const requestId =
|
|
1462
|
+
const requestId = createRequestId6("object_properties");
|
|
1403
1463
|
if (normalizedNodeIds.length === 0) {
|
|
1404
1464
|
return Promise.resolve({
|
|
1405
1465
|
requestId,
|
|
@@ -1437,6 +1497,89 @@ var ObjectPropertiesModule = class {
|
|
|
1437
1497
|
}
|
|
1438
1498
|
};
|
|
1439
1499
|
|
|
1500
|
+
// src/modules/views.module.ts
|
|
1501
|
+
function createRequestId7(prefix) {
|
|
1502
|
+
return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
1503
|
+
}
|
|
1504
|
+
var ViewsModule = class {
|
|
1505
|
+
constructor(viewer) {
|
|
1506
|
+
this.viewer = viewer;
|
|
1507
|
+
}
|
|
1508
|
+
getViews(options) {
|
|
1509
|
+
var _a;
|
|
1510
|
+
const requestId = createRequestId7("views");
|
|
1511
|
+
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1512
|
+
return new Promise((resolve, reject) => {
|
|
1513
|
+
const timer = setTimeout(() => {
|
|
1514
|
+
off();
|
|
1515
|
+
reject(new Error("Timeout while getting views list from viewer"));
|
|
1516
|
+
}, timeoutMs);
|
|
1517
|
+
const off = this.viewer._on("views:list", (payload) => {
|
|
1518
|
+
var _a2, _b;
|
|
1519
|
+
if (payload.requestId !== requestId) return;
|
|
1520
|
+
clearTimeout(timer);
|
|
1521
|
+
off();
|
|
1522
|
+
if (!payload.success) {
|
|
1523
|
+
reject(new Error(payload.error || "Viewer failed to load views"));
|
|
1524
|
+
return;
|
|
1525
|
+
}
|
|
1526
|
+
resolve({
|
|
1527
|
+
cadViews: payload.cadViews,
|
|
1528
|
+
savedViews: payload.savedViews,
|
|
1529
|
+
selectedViewId: (_a2 = payload.selectedViewId) != null ? _a2 : null,
|
|
1530
|
+
selectedViewType: (_b = payload.selectedViewType) != null ? _b : null,
|
|
1531
|
+
timestamp: payload.timestamp
|
|
1532
|
+
});
|
|
1533
|
+
});
|
|
1534
|
+
this.viewer.postToViewer(
|
|
1535
|
+
"viewer-views-get-list" /* VIEWS_GET_LIST */,
|
|
1536
|
+
{ requestId }
|
|
1537
|
+
);
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
async getCadViews(options) {
|
|
1541
|
+
const views = await this.getViews(options);
|
|
1542
|
+
return views.cadViews;
|
|
1543
|
+
}
|
|
1544
|
+
async getSavedViews(options) {
|
|
1545
|
+
const views = await this.getViews(options);
|
|
1546
|
+
return views.savedViews;
|
|
1547
|
+
}
|
|
1548
|
+
applyView(input, options) {
|
|
1549
|
+
var _a;
|
|
1550
|
+
const requestId = createRequestId7("views-apply");
|
|
1551
|
+
const timeoutMs = Math.max(1e3, (_a = options == null ? void 0 : options.timeoutMs) != null ? _a : 1e4);
|
|
1552
|
+
return new Promise((resolve, reject) => {
|
|
1553
|
+
const timer = setTimeout(() => {
|
|
1554
|
+
off();
|
|
1555
|
+
reject(new Error("Timeout while waiting for view apply result from viewer"));
|
|
1556
|
+
}, timeoutMs);
|
|
1557
|
+
const off = this.viewer._on(
|
|
1558
|
+
"views:apply-result",
|
|
1559
|
+
(payload) => {
|
|
1560
|
+
if (payload.requestId !== requestId) return;
|
|
1561
|
+
clearTimeout(timer);
|
|
1562
|
+
off();
|
|
1563
|
+
if (!payload.success) {
|
|
1564
|
+
reject(new Error(payload.error || "Viewer failed to apply view"));
|
|
1565
|
+
return;
|
|
1566
|
+
}
|
|
1567
|
+
resolve({
|
|
1568
|
+
id: payload.id,
|
|
1569
|
+
type: payload.type,
|
|
1570
|
+
timestamp: payload.timestamp
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1573
|
+
);
|
|
1574
|
+
this.viewer.postToViewer("viewer-views-apply" /* VIEWS_APPLY */, {
|
|
1575
|
+
requestId,
|
|
1576
|
+
id: input.id,
|
|
1577
|
+
type: input.type
|
|
1578
|
+
});
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1440
1583
|
// src/viewer.ts
|
|
1441
1584
|
var Viewer3D = class {
|
|
1442
1585
|
constructor(options) {
|
|
@@ -1453,7 +1596,7 @@ var Viewer3D = class {
|
|
|
1453
1596
|
};
|
|
1454
1597
|
this.emitter = new Emitter();
|
|
1455
1598
|
this.handleMessage = (event) => {
|
|
1456
|
-
var _a, _b, _c;
|
|
1599
|
+
var _a, _b, _c, _d;
|
|
1457
1600
|
const data = event.data;
|
|
1458
1601
|
if (!data || typeof data !== "object") return;
|
|
1459
1602
|
switch (data.type) {
|
|
@@ -1512,6 +1655,30 @@ var Viewer3D = class {
|
|
|
1512
1655
|
});
|
|
1513
1656
|
break;
|
|
1514
1657
|
}
|
|
1658
|
+
case "viewer-node-locked-state" /* NODE_LOCKED_STATE */: {
|
|
1659
|
+
const payload = data.payload;
|
|
1660
|
+
if (!payload) break;
|
|
1661
|
+
this._emit("node:locked-state", {
|
|
1662
|
+
requestId: payload.requestId ? String(payload.requestId) : void 0,
|
|
1663
|
+
persistentIds: Array.isArray(payload.persistentIds) ? payload.persistentIds.map(String) : [],
|
|
1664
|
+
treeNodeIds: Array.isArray(payload.treeNodeIds) ? payload.treeNodeIds.map(String) : [],
|
|
1665
|
+
renderedNodeIds: Array.isArray(payload.renderedNodeIds) ? payload.renderedNodeIds.map(String) : [],
|
|
1666
|
+
timestamp: Number(payload.timestamp) || Date.now()
|
|
1667
|
+
});
|
|
1668
|
+
break;
|
|
1669
|
+
}
|
|
1670
|
+
case "viewer-node-locked-state-change" /* NODE_LOCKED_STATE_CHANGE */: {
|
|
1671
|
+
const payload = data.payload;
|
|
1672
|
+
if (!payload) break;
|
|
1673
|
+
this._emit("node:locked-state-change", {
|
|
1674
|
+
requestId: payload.requestId ? String(payload.requestId) : void 0,
|
|
1675
|
+
persistentIds: Array.isArray(payload.persistentIds) ? payload.persistentIds.map(String) : [],
|
|
1676
|
+
treeNodeIds: Array.isArray(payload.treeNodeIds) ? payload.treeNodeIds.map(String) : [],
|
|
1677
|
+
renderedNodeIds: Array.isArray(payload.renderedNodeIds) ? payload.renderedNodeIds.map(String) : [],
|
|
1678
|
+
timestamp: Number(payload.timestamp) || Date.now()
|
|
1679
|
+
});
|
|
1680
|
+
break;
|
|
1681
|
+
}
|
|
1515
1682
|
case "viewer-pan-change" /* PAN_CHANGE */:
|
|
1516
1683
|
this._emit("interaction:pan-change", {
|
|
1517
1684
|
enabled: Boolean((_a = data.payload) == null ? void 0 : _a.enabled)
|
|
@@ -1629,13 +1796,69 @@ var Viewer3D = class {
|
|
|
1629
1796
|
});
|
|
1630
1797
|
break;
|
|
1631
1798
|
}
|
|
1799
|
+
case "viewer-views-list" /* VIEWS_LIST */: {
|
|
1800
|
+
const payload = data.payload;
|
|
1801
|
+
if (!payload || !payload.requestId) break;
|
|
1802
|
+
this._emit("views:list", {
|
|
1803
|
+
requestId: String(payload.requestId),
|
|
1804
|
+
success: Boolean(payload.success),
|
|
1805
|
+
cadViews: Array.isArray(payload.cadViews) ? payload.cadViews.filter((item) => item && typeof item === "object").map((item) => {
|
|
1806
|
+
var _a2, _b2, _c2;
|
|
1807
|
+
return {
|
|
1808
|
+
id: String((_a2 = item.id) != null ? _a2 : ""),
|
|
1809
|
+
name: String((_b2 = item.name) != null ? _b2 : ""),
|
|
1810
|
+
type: item.type === "saved" ? "saved" : "cad",
|
|
1811
|
+
modelFileId: item.modelFileId ? String(item.modelFileId) : void 0,
|
|
1812
|
+
sheetId: (_c2 = item.sheetId) != null ? _c2 : null,
|
|
1813
|
+
createdBy: item.createdBy ? String(item.createdBy) : void 0,
|
|
1814
|
+
createdDate: typeof item.createdDate === "number" ? item.createdDate : void 0,
|
|
1815
|
+
modifiedDate: typeof item.modifiedDate === "number" ? item.modifiedDate : void 0,
|
|
1816
|
+
isPerspective: typeof item.isPerspective === "boolean" ? item.isPerspective : void 0,
|
|
1817
|
+
drawMode: typeof item.drawMode === "number" ? item.drawMode : void 0
|
|
1818
|
+
};
|
|
1819
|
+
}) : [],
|
|
1820
|
+
savedViews: Array.isArray(payload.savedViews) ? payload.savedViews.filter((item) => item && typeof item === "object").map((item) => {
|
|
1821
|
+
var _a2, _b2, _c2;
|
|
1822
|
+
return {
|
|
1823
|
+
id: String((_a2 = item.id) != null ? _a2 : ""),
|
|
1824
|
+
name: String((_b2 = item.name) != null ? _b2 : ""),
|
|
1825
|
+
type: item.type === "cad" ? "cad" : "saved",
|
|
1826
|
+
modelFileId: item.modelFileId ? String(item.modelFileId) : void 0,
|
|
1827
|
+
sheetId: (_c2 = item.sheetId) != null ? _c2 : null,
|
|
1828
|
+
createdBy: item.createdBy ? String(item.createdBy) : void 0,
|
|
1829
|
+
createdDate: typeof item.createdDate === "number" ? item.createdDate : void 0,
|
|
1830
|
+
modifiedDate: typeof item.modifiedDate === "number" ? item.modifiedDate : void 0,
|
|
1831
|
+
isPerspective: typeof item.isPerspective === "boolean" ? item.isPerspective : void 0,
|
|
1832
|
+
drawMode: typeof item.drawMode === "number" ? item.drawMode : void 0
|
|
1833
|
+
};
|
|
1834
|
+
}) : [],
|
|
1835
|
+
selectedViewId: payload.selectedViewId ? String(payload.selectedViewId) : null,
|
|
1836
|
+
selectedViewType: payload.selectedViewType === "saved" ? "saved" : payload.selectedViewType === "cad" ? "cad" : null,
|
|
1837
|
+
error: payload.error ? String(payload.error) : void 0,
|
|
1838
|
+
timestamp: Number(payload.timestamp) || Date.now()
|
|
1839
|
+
});
|
|
1840
|
+
break;
|
|
1841
|
+
}
|
|
1842
|
+
case "viewer-views-apply-result" /* VIEWS_APPLY_RESULT */: {
|
|
1843
|
+
const payload = data.payload;
|
|
1844
|
+
if (!payload || !payload.requestId) break;
|
|
1845
|
+
this._emit("views:apply-result", {
|
|
1846
|
+
requestId: String(payload.requestId),
|
|
1847
|
+
success: Boolean(payload.success),
|
|
1848
|
+
id: String((_c = payload.id) != null ? _c : ""),
|
|
1849
|
+
type: payload.type === "saved" ? "saved" : "cad",
|
|
1850
|
+
error: payload.error ? String(payload.error) : void 0,
|
|
1851
|
+
timestamp: Number(payload.timestamp) || Date.now()
|
|
1852
|
+
});
|
|
1853
|
+
break;
|
|
1854
|
+
}
|
|
1632
1855
|
case "viewer-object-properties-list" /* OBJECT_PROPERTIES_LIST */: {
|
|
1633
1856
|
const payload = data.payload;
|
|
1634
1857
|
if (!payload || !payload.requestId || !Array.isArray(payload.properties))
|
|
1635
1858
|
break;
|
|
1636
1859
|
this._emit("object-properties:list", {
|
|
1637
1860
|
requestId: String(payload.requestId),
|
|
1638
|
-
selectionKey: String((
|
|
1861
|
+
selectionKey: String((_d = payload.selectionKey) != null ? _d : ""),
|
|
1639
1862
|
nodeIds: Array.isArray(payload.nodeIds) ? payload.nodeIds.map(String) : [],
|
|
1640
1863
|
persistentIds: Array.isArray(payload.persistentIds) ? payload.persistentIds.map(String) : [],
|
|
1641
1864
|
properties: payload.properties.filter((item) => item && typeof item === "object").map((item) => ({ ...item })),
|
|
@@ -1661,7 +1884,7 @@ var Viewer3D = class {
|
|
|
1661
1884
|
this._emit("states-objects:list", {
|
|
1662
1885
|
requestId: String(payload.requestId),
|
|
1663
1886
|
statesObjects: payload.statesObjects.map((item) => {
|
|
1664
|
-
var _a2, _b2, _c2,
|
|
1887
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g;
|
|
1665
1888
|
return {
|
|
1666
1889
|
id: String((_a2 = item.id) != null ? _a2 : ""),
|
|
1667
1890
|
name: String((_b2 = item.name) != null ? _b2 : ""),
|
|
@@ -1674,7 +1897,7 @@ var Viewer3D = class {
|
|
|
1674
1897
|
};
|
|
1675
1898
|
}) : [],
|
|
1676
1899
|
states: {
|
|
1677
|
-
color: String((_e = (
|
|
1900
|
+
color: String((_e = (_d2 = item.states) == null ? void 0 : _d2.color) != null ? _e : ""),
|
|
1678
1901
|
type: String((_g = (_f = item.states) == null ? void 0 : _f.type) != null ? _g : "")
|
|
1679
1902
|
}
|
|
1680
1903
|
};
|
|
@@ -1744,6 +1967,7 @@ var Viewer3D = class {
|
|
|
1744
1967
|
this.markup = new MarkupModule(this);
|
|
1745
1968
|
this.language = new LanguageModule(this);
|
|
1746
1969
|
this.objectProperties = new ObjectPropertiesModule(this);
|
|
1970
|
+
this.views = new ViewsModule(this);
|
|
1747
1971
|
}
|
|
1748
1972
|
// ===== options helpers =====
|
|
1749
1973
|
getOptions() {
|