@vitrosoftware/common-ui-ts 1.1.81 → 1.1.82

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.
@@ -1,5 +1,5 @@
1
- import { Viewer, Plugin, math, ContextMenu, TreeViewPlugin, MetaObject } from "/resource/bimViewer/js/xeokit/xeokit-sdk.es.js";
2
- import { BIMModel } from '/resource/bimViewer/js/bim-viewer-models.js';
1
+ import { Viewer, Plugin, math, ContextMenu, TreeViewPlugin, MetaObject } from "/resource/bimViewer/js/xeokit/xeokit-sdk.es.js?version=v5";
2
+ import { BIMModel } from '/resource/bimViewer/js/bim-viewer-models.js?version=v5';
3
3
 
4
4
  const processByChildIdList = (treeViewNode, event) => {
5
5
  viewer.scene.canvas.spinner.processes++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrosoftware/common-ui-ts",
3
- "version": "1.1.81",
3
+ "version": "1.1.82",
4
4
  "description": "vitro software common ui ts",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -68,7 +68,8 @@
68
68
  "src/controls/PdfViewer/js/init-viewer-page.js",
69
69
  "src/controls/PdfViewer/js/pdf-viewer.js",
70
70
  "src/controls/BimViewer/js/init-viewer-page.js",
71
- "src/controls/BimViewer/js/bim-viewer.js"
71
+ "src/controls/BimViewer/js/bim-viewer.js",
72
+ "src/controls/BimViewer/js/bim-viewer-models.js"
72
73
  ],
73
74
  "dependencies": {
74
75
  "rollup-plugin-postcss": "^3.1.3",
@@ -0,0 +1,361 @@
1
+ var BIMCommon = BIMCommon ||
2
+ {
3
+ FileItemId: undefined,
4
+ FileVersion: undefined,
5
+
6
+ GetFileItem: function (itemId, version, callback, error) {
7
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
8
+
9
+ jQuery.ajax({
10
+ type: "GET",
11
+ url: webRelativeUrl +
12
+ "/bimViewer/api/Model/Get/" +
13
+ itemId + "/" +
14
+ version,
15
+ cache: false,
16
+ contentType: "application/json",
17
+ error: function (jqXHR, textStatus, errorThrown) {
18
+ if (error) {
19
+ error();
20
+ }
21
+ },
22
+ success: function(modelId, status, jqXHR) {
23
+ if (callback) {
24
+ callback(modelId);
25
+ }
26
+ }
27
+ });
28
+ },
29
+
30
+ GetURLParameter: function(sParam) {
31
+ var sPageURL = window.location.search.substring(1);
32
+
33
+ var sURLVariables = sPageURL.split("&");
34
+ for (var i = 0; i < sURLVariables.length; i++) {
35
+ var sParameterName = sURLVariables[i].split("=");
36
+ if (sParameterName[0] == sParam) {
37
+ return sParameterName[1];
38
+ }
39
+ }
40
+ },
41
+
42
+ CreateWebServerUrl: function() {
43
+ var path = window.location.pathname;
44
+ var idx = path.indexOf("/bimViewer");
45
+
46
+ return path.substring(0, idx);
47
+ }
48
+ }
49
+
50
+ var BIMAnnotation = BIMAnnotation ||
51
+ {
52
+ GetNote: function (callback) {
53
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
54
+ $.ajax({
55
+ type: "POST",
56
+ url: webRelativeUrl + "/_vti_bin/Vitro/TableView/Comment/AnnotationWebService.svc/Get",
57
+ data: JSON.stringify(BIMCommon.FileItem),
58
+ contentType: "application/json; charset=utf-8",
59
+ dataType: "json",
60
+ async: false,
61
+ beforeSend: function (data) {
62
+ },
63
+ error: function (jqXHR, textStatus, errorThrown) {
64
+ },
65
+ success: function (data, status, jqXHR) {
66
+ if (callback) {
67
+ callback(data);
68
+ }
69
+ }
70
+ });
71
+ },
72
+
73
+ SaveNote: function (options, callback) {
74
+
75
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
76
+
77
+ var annotation = {};
78
+ annotation.FileItem = BIMCommon.FileItem;
79
+
80
+ annotation.Comment = BIMAnnotation.CreateComment(options.values.title, options.values.description);
81
+
82
+ options.worldPos = [];
83
+ options.worldPos.push(options.pickResult._worldPos[0]);
84
+ options.worldPos.push(options.pickResult._worldPos[1]);
85
+ options.worldPos.push(options.pickResult._worldPos[2]);
86
+
87
+ var eye = options.eye;
88
+ options.eye = [];
89
+ options.eye.push(eye[0]);
90
+ options.eye.push(eye[1]);
91
+ options.eye.push(eye[2]);
92
+
93
+ var look = options.look;
94
+ options.look = [];
95
+ options.look.push(look[0]);
96
+ options.look.push(look[1]);
97
+ options.look.push(look[2]);
98
+
99
+ var up = options.up;
100
+ options.up = [];
101
+ options.up.push(up[0]);
102
+ options.up.push(up[1]);
103
+ options.up.push(up[2]);
104
+
105
+ var pickResult = options.pickResult;
106
+ options.pickResult = null;
107
+
108
+ annotation.AnnotationInfo = options;
109
+ var jsonString = JSON.stringify(annotation);
110
+
111
+ $.ajax({
112
+ type: "POST",
113
+ url: webRelativeUrl + "/_vti_bin/Vitro/TableView/Comment/AnnotationWebService.svc/Create",
114
+ data: jsonString,
115
+ contentType: "application/json; charset=utf-8",
116
+ dataType: "json",
117
+ async: false,
118
+ beforeSend: function (data) {
119
+ },
120
+ error: function (jqXHR, textStatus, errorThrown) {
121
+ },
122
+ success: function (data, status, jqXHR) {
123
+ if (callback) {
124
+ options.id = data;
125
+ options.values.glyph = options.id;
126
+ options.pickResult = pickResult;
127
+ callback(options);
128
+ }
129
+ }
130
+ });
131
+ },
132
+
133
+ UpdateNote: function (id, noteTitle, noteDesc, callback) {
134
+
135
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
136
+
137
+ var annotation = {};
138
+ annotation.Id = id;
139
+ annotation.FileItem = BIMCommon.FileItem;
140
+ annotation.Comment = BIMAnnotation.CreateComment(noteTitle, noteDesc);
141
+ var jsonString = JSON.stringify(annotation);
142
+
143
+ $.ajax({
144
+ type: "POST",
145
+ url: webRelativeUrl + "/_vti_bin/Vitro/TableView/Comment/AnnotationWebService.svc/Update",
146
+ data: jsonString,
147
+ contentType: "application/json; charset=utf-8",
148
+ dataType: "json",
149
+ async: false,
150
+ beforeSend: function (data) {
151
+ },
152
+ error: function (jqXHR, textStatus, errorThrown) {
153
+ },
154
+ success: function (data, status, jqXHR) {
155
+ if (callback) {
156
+ callback();
157
+ }
158
+ }
159
+ });
160
+ },
161
+
162
+ DeleteNote: function (id, callback) {
163
+
164
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
165
+
166
+ var annotation = {};
167
+ annotation.Id = id;
168
+ annotation.FileItem = BIMCommon.FileItem;
169
+ var jsonString = JSON.stringify(annotation);
170
+
171
+ $.ajax({
172
+ type: "POST",
173
+ url: webRelativeUrl + "/_vti_bin/Vitro/TableView/Comment/AnnotationWebService.svc/Delete",
174
+ data: jsonString,
175
+ contentType: "application/json; charset=utf-8",
176
+ dataType: "json",
177
+ async: false,
178
+ beforeSend: function (data) {
179
+ },
180
+ error: function (jqXHR, textStatus, errorThrown) {
181
+ },
182
+ success: function (data, status, jqXHR) {
183
+ if (callback) {
184
+ callback(id);
185
+ }
186
+ }
187
+ });
188
+ },
189
+
190
+ GoToCommentList: function(id) {
191
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
192
+ window.open(webRelativeUrl + '/_layouts/15/Vitro/TableView/ListView.aspx?List=CommentList&listname=%D0%97%D0%B0%D0%BC%D0%B5%D1%87%D0%B0%D0%BD%D0%B8%D1%8F&Id=' + id);
193
+ },
194
+
195
+ CreateComment: function(title, description) {
196
+ var text = [title, description].filter(Boolean).join(" ");
197
+ return text;
198
+ }
199
+ }
200
+
201
+
202
+ var BIMModel = BIMModel ||
203
+ {
204
+
205
+ GetParentIdList: function (elementId, recurse, isGeometry, callback, error, async = true) {
206
+
207
+ var paramObj = {};
208
+ paramObj.itemId = BIMCommon.FileItemId;
209
+ paramObj.version = BIMCommon.FileVersion;
210
+ paramObj.elementId = elementId.toString();
211
+
212
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
213
+ $.ajax({
214
+ type: "POST",
215
+ url: webRelativeUrl + "/bimViewer/api/ModelElement/GetParentIdList",
216
+ data: JSON.stringify(paramObj),
217
+ contentType: "application/json; charset=utf-8",
218
+ dataType: "json",
219
+ async: async,
220
+ beforeSend: function (data) {
221
+ },
222
+ error: function (jqXHR, textStatus, errorThrown) {
223
+ if (error) {
224
+ error(jqXHR, textStatus, errorThrown);
225
+ }
226
+ },
227
+ success: function (data, status, jqXHR) {
228
+ //console.log(data);
229
+ if (callback) {
230
+ callback(data);
231
+ }
232
+ }
233
+ });
234
+ },
235
+
236
+ GetPropertyList: function (elementId, callback, error, async = true) {
237
+ var paramObj = {};
238
+ paramObj.itemId = BIMCommon.FileItemId;
239
+ paramObj.version = BIMCommon.FileVersion;
240
+ paramObj.elementId = elementId.toString();
241
+
242
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
243
+ $.ajax({
244
+ type: "POST",
245
+ url: webRelativeUrl + "/bimViewer/api/ModelElement/GetPropertyList",
246
+ data: JSON.stringify(paramObj),
247
+ contentType: "application/json; charset=utf-8",
248
+ dataType: "json",
249
+ async: async,
250
+ beforeSend: function (data) {
251
+ },
252
+ error: function (jqXHR, textStatus, errorThrown) {
253
+ if (error) {
254
+ error(jqXHR, textStatus, errorThrown);
255
+ }
256
+ },
257
+ success: function (data, status, jqXHR) {
258
+ //console.log(data);
259
+ if (callback) {
260
+ callback(data);
261
+ }
262
+ }
263
+ });
264
+ },
265
+
266
+ GetChildList: function (elementId, recurse, isGeometry, callback, error, async = true) {
267
+
268
+ var paramObj = {};
269
+ paramObj.itemId = BIMCommon.FileItemId;
270
+ paramObj.version = BIMCommon.FileVersion;
271
+ paramObj.elementId = elementId.toString();
272
+ paramObj.recurse = recurse;
273
+ paramObj.isGeometry = isGeometry;
274
+
275
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
276
+ $.ajax({
277
+ type: "POST",
278
+ url: webRelativeUrl + "/bimViewer/api/ModelElement/GetChildList",
279
+ data: JSON.stringify(paramObj),
280
+ contentType: "application/json; charset=utf-8",
281
+ dataType: "json",
282
+ async: async,
283
+ beforeSend: function (data) {
284
+ },
285
+ error: function (jqXHR, textStatus, errorThrown) {
286
+ if (error) {
287
+ error(jqXHR, textStatus, errorThrown);
288
+ }
289
+ },
290
+ success: function (data, status, jqXHR) {
291
+ //console.log(data);
292
+ if (callback) {
293
+ callback(data);
294
+ }
295
+ }
296
+ });
297
+ },
298
+
299
+ GetChildIdList: function (elementId, recurse, isGeometry, callback, error, async = true) {
300
+
301
+ var paramObj = {};
302
+ paramObj.itemId = BIMCommon.FileItemId;
303
+ paramObj.version = BIMCommon.FileVersion;
304
+ paramObj.elementId = elementId.toString();
305
+ paramObj.recurse = recurse;
306
+ paramObj.isGeometry = isGeometry;
307
+
308
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
309
+ $.ajax({
310
+ type: "POST",
311
+ url: webRelativeUrl + "/bimViewer/api/ModelElement/GetChildIdList",
312
+ data: JSON.stringify(paramObj),
313
+ contentType: "application/json; charset=utf-8",
314
+ dataType: "json",
315
+ async: async,
316
+ beforeSend: function (data) {
317
+ },
318
+ error: function (jqXHR, textStatus, errorThrown) {
319
+ if (error) {
320
+ error(jqXHR, textStatus, errorThrown);
321
+ }
322
+ },
323
+ success: function (data, status, jqXHR) {
324
+ //console.log(data);
325
+ if (callback) {
326
+ callback(data);
327
+ }
328
+ }
329
+ });
330
+ },
331
+
332
+ Compare: function (successFn, failFn) {
333
+
334
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
335
+
336
+ var obj = {};
337
+ obj.source = window.model1DataUrl;
338
+ obj.compared = window.model2DataUrl;
339
+ var jsonString = JSON.stringify(obj);
340
+
341
+ $.ajax({
342
+ type: "POST",
343
+ url: webRelativeUrl + "/_vti_bin/Vitro/Viewer/BIM/BIMWebService.svc/CompareModel",
344
+ data: jsonString,
345
+ contentType: "application/json; charset=utf-8",
346
+ dataType: "json",
347
+ async: false,
348
+ beforeSend: function (data) {
349
+ },
350
+ error: function (jqXHR, textStatus, errorThrown) {
351
+ failFn();
352
+ },
353
+ success: function (data, status, jqXHR) {
354
+ if (successFn) {
355
+ successFn(data);
356
+ }
357
+ }
358
+ });
359
+ }
360
+ }
361
+ export {BIMCommon, BIMAnnotation, BIMModel}
@@ -1,12 +1,12 @@
1
- import { BIMModel, BIMCommon, BIMAnnotation } from '/resource/bimViewer/js/bim-viewer-models.js';
1
+ import { BIMModel, BIMCommon, BIMAnnotation } from '/resource/bimViewer/js/bim-viewer-models.js?version=v5';
2
2
 
3
3
  import {
4
4
  Viewer, XKTLoaderPlugin, NavCubePlugin, SectionPlanesPlugin, math, BCFViewpointsPlugin, AnnotationsPlugin,
5
5
  ContextMenu, TreeViewPlugin, StoreyViewsPlugin, AngleMeasurementsPlugin, CameraMemento, DistanceMeasurementsPlugin,
6
6
  GLTFLoaderPlugin, utils, FastNavPlugin
7
7
  }
8
- from '/resource/bimViewer/js/xeokit/xeokit-sdk.es.js';
9
- import { VitroTreeViewPlugin } from "/resource/bimViewer/js/xeokit/VitroTreeViewPlugin.js";
8
+ from '/resource/bimViewer/js/xeokit/xeokit-sdk.es.js?version=v5';
9
+ import { VitroTreeViewPlugin } from "/resource/bimViewer/js/xeokit/VitroTreeViewPlugin.js?version=v5";
10
10
  window.initBimViewer = function(context) {var angleMeasurementsData = [
11
11
 
12
12
  ];
@@ -2272,6 +2272,7 @@ function bindBtnToggleCreateNotes() {
2272
2272
  annotationByClick = true;
2273
2273
  } else {
2274
2274
  annotationByClick = false;
2275
+ collapseSidebarIssueDetail();
2275
2276
  }
2276
2277
  });
2277
2278
  }
@@ -2288,14 +2289,18 @@ function bindBtnToggleSidebarNotes() {
2288
2289
  expandSidebarNotes();
2289
2290
  }
2290
2291
  } else {
2291
- $('#navCubeCanvas').css('right', 10);
2292
- $('#sectionPlanesOverviewCanvas').css('right', 10);
2293
- $('.sidebar').hide();
2294
- $('body').removeClass('sidebar-expanded');
2292
+ collapseSidebarNotes();
2295
2293
  }
2296
2294
  });
2297
2295
  }
2298
2296
 
2297
+ function bindSidebarNotesClose() {
2298
+ $('.sidebar-close').on('click', function () {
2299
+ $('#btnToggleSidebarNotes').removeClass('toggled');
2300
+ collapseSidebarNotes();
2301
+ });
2302
+ }
2303
+
2299
2304
  function expandSidebarNotes() {
2300
2305
  hidePropInspector();
2301
2306
  collapseSidebarIssueDetail();
@@ -2390,10 +2395,12 @@ function updatePage(e) {
2390
2395
  }
2391
2396
 
2392
2397
  function goToNoteMarker(issue) {
2393
- var annotation = annotations.annotations[issue.id];
2394
- console.log('annotation', annotation);
2395
- viewer.cameraFlight.flyTo(annotation);
2396
- highlightSidebarNote(issue.id);
2398
+ if (!$('#btnCreateNotes').hasClass('toggled')) {
2399
+ var annotation = annotations.annotations[issue.id];
2400
+ console.log('annotation', annotation);
2401
+ viewer.cameraFlight.flyTo(annotation);
2402
+ highlightSidebarNote(issue.id);
2403
+ }
2397
2404
  }
2398
2405
 
2399
2406
  function onIssueShowMoreClick(issue) {
@@ -2420,6 +2427,7 @@ function onIssueShowMoreClick(issue) {
2420
2427
  }
2421
2428
 
2422
2429
  function collapseSidebarNotes() {
2430
+ $('#sidebarWrap').hide();
2423
2431
  $('#navCubeCanvas').css('right', 10);
2424
2432
  $('#sectionPlanesOverviewCanvas').css('right', 10);
2425
2433
  $('.sidebar').hide();
@@ -1,7 +1,7 @@
1
1
  async function initHtml() {
2
2
  let htmlContainer = document.getElementsByTagName('html')[0];
3
3
  htmlContainer.dir = 'ltr';
4
- const resp = await fetch('resource/bimViewer/viewer.html?version=v2');
4
+ const resp = await fetch('resource/bimViewer/viewer.html?version=v5');
5
5
  const viewer = await resp.text();
6
6
  let container = document.getElementsByTagName('body')[0];
7
7
  container.insertAdjacentHTML('beforeend', viewer);
@@ -9,15 +9,15 @@ async function initHtml() {
9
9
 
10
10
  async function initPage() {
11
11
  let container = document.getElementsByTagName('head')[0];
12
- container.innerHTML += '<link rel="resource" type="application/l10n" href="resource/bimViewer/locale/locale.js?version=v2">';
13
- container.innerHTML += '<link href="/resource/bimViewer/css/bim-viewer.css?version=v2" rel="stylesheet">';
12
+ container.innerHTML += '<link rel="resource" type="application/l10n" href="resource/bimViewer/locale/locale.js?version=v5">';
13
+ container.innerHTML += '<link href="/resource/bimViewer/css/bim-viewer.css?version=v5" rel="stylesheet">';
14
14
 
15
15
  await initHtml();
16
16
 
17
17
  const script = document.createElement('script');
18
18
  script.type = 'module';
19
19
  script.id = 'bim-viewer';
20
- script.src = 'resource/bimViewer/js/bim-viewer.js?version=v2';
20
+ script.src = 'resource/bimViewer/js/bim-viewer.js?version=v5';
21
21
  document.head.appendChild(script);
22
22
  }
23
23