architwin 1.14.8 → 1.14.10

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.
@@ -27,7 +27,7 @@ export declare function displayChildPartitions(partitions: PartitionNode[], pare
27
27
  * @param partitionItems - The details of the partition items to be rendered.
28
28
  * @returns {HTMLElement}
29
29
  */
30
- export declare function displayPartitionItems(partitionItems: any, partitionId?: string, object?: any): string;
30
+ export declare function displayPartitionItems(partitionItems: any, partitionId?: string, object?: any, parentUuid?: string): string;
31
31
  export declare function updateParentVisibility(isPartition: boolean, currentBtn: HTMLElement): void;
32
32
  /**
33
33
  * Retrieves the stored room data.
@@ -68,3 +68,9 @@ export declare function setFilteredDisplay(type: String): void;
68
68
  * @param isVisible - Visibility value
69
69
  */
70
70
  export declare function updateRoomVisibilityUI(parentId: string, isVisible: boolean): void;
71
+ /**
72
+ * Highlights the selected child element within a partition by toggling CSS classes.
73
+ * @param partitionId - The unique identifier of the partition containing the child elements
74
+ * @param name - The specific name/identifier of the child element to highlight
75
+ */
76
+ export declare function highlightSelectedPartitionChild(partitionId: string, name: string): void;
@@ -10,9 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { getBundleVersion, extractUUID } from "../../../../utils";
11
11
  import { batchAddEventListenerByClassName, handleDeletePartition, handlePartitionVisibility, handlePolygonVisibility, toggleDisplayPane } from "../../../events";
12
12
  import i18n from "../i18n";
13
- import { getCurrentPolygonData, setPartitionFormMode } from "./roomFormPane";
13
+ import { getCurrentPolygonData, handlePartitionRowEditBtnClickEvent, handlePartitionWallEditBtn, setPartitionFormMode } from "./roomFormPane";
14
14
  import { SPACE_EVENTS } from "../../../../types";
15
- import { _3DXObjects, dispatchSpaceEvent, getChildrenOfModel, goToModel, renderPolygon, setSelectedObject } from "../../../../architwin";
15
+ import { _3DXObjects, dispatchSpaceEvent, getChildrenOfModel, goToModel, goToPosition, renderPolygon, setSelectedObject } from "../../../../architwin";
16
16
  import log from 'loglevel';
17
17
  import { getShortcutTooltipHTML } from "../static/common";
18
18
  let roomDataArray = [];
@@ -167,13 +167,13 @@ export function displayChildPartitions(partitions, parentPartitionId, objectData
167
167
  // Render floor
168
168
  const floorObj = modelChildren.find(item => item.name.includes('floor'));
169
169
  log.info("modelChildren floorObj: ", floorObj);
170
- childHTML += displayPartitionItems(polygonJson.floor, partition.uuid, floorObj);
170
+ childHTML += displayPartitionItems(polygonJson.floor, partition.uuid, floorObj, partition.parent_uuid);
171
171
  // Render walls
172
172
  if (polygonJson.walls.length > 0) {
173
173
  // modelChildren.splice(index, 1); // Remove processed child
174
174
  const wallObjs = modelChildren.filter(item => !item.name.includes("floor"));
175
175
  log.info("modelChildren wallObjs: ", wallObjs);
176
- childHTML += displayPartitionItems(polygonJson.walls, partition.uuid, wallObjs);
176
+ childHTML += displayPartitionItems(polygonJson.walls, partition.uuid, wallObjs, partition.parent_uuid);
177
177
  }
178
178
  }
179
179
  // @ts-ignore
@@ -203,7 +203,7 @@ export function displayChildPartitions(partitions, parentPartitionId, objectData
203
203
  * @param partitionItems - The details of the partition items to be rendered.
204
204
  * @returns {HTMLElement}
205
205
  */
206
- export function displayPartitionItems(partitionItems, partitionId, object) {
206
+ export function displayPartitionItems(partitionItems, partitionId, object, parentUuid) {
207
207
  log.info("__@ displayPartitionItems: ", object === null || object === void 0 ? void 0 : object.name);
208
208
  let itemsHTML = '';
209
209
  // Check if item is an array, e.g.: walls
@@ -219,9 +219,14 @@ export function displayPartitionItems(partitionItems, partitionId, object) {
219
219
  const isVisible = item.options.is_visible;
220
220
  const objName = object[index].name.includes('_') ? object[index].name : `${partitionId}_${object[index].name}`;
221
221
  log.info("__@ objName: ", objName);
222
+ const wallCoords = JSON.stringify(item.edges);
223
+ const wallCoordsEncoded = btoa(wallCoords);
222
224
  itemsHTML += `
223
- <li class="at_toggle">${i18n.t(`Wall`)} ${wallNumber}
224
- <span id="${objName}" partition-id="${partitionId}" polygon-item-id="${item.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn at_pull_right"></span>
225
+ <li wall-coords="${wallCoordsEncoded}" object-name="${objName}" partition-li-id="${partitionId}" id="partition-child-${objName}" class="at_toggle at_partition_wall_row_item">${i18n.t(`Wall`)} ${wallNumber}
226
+ <div>
227
+ <span id="${objName}" partition-id="${partitionId}" partition-parent-uuid="${parentUuid}" polygon-item-id="${item.uuid}" is-wall="true" class="mdi mdi-pencil at_child_edit_btn"></span>
228
+ <span id="${objName}" partition-id="${partitionId}" polygon-item-id="${item.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn"></span>
229
+ </div>
225
230
  </li>
226
231
  `;
227
232
  }
@@ -231,10 +236,15 @@ export function displayPartitionItems(partitionItems, partitionId, object) {
231
236
  else {
232
237
  // This is for the floor
233
238
  const isVisible = partitionItems.options.is_visible;
239
+ const floorCoords = JSON.stringify(partitionItems.edges);
240
+ const floorCoordsEncoded = btoa(floorCoords);
234
241
  if (!partitionItems.hide) {
235
242
  itemsHTML += `
236
- <li class="at_toggle"> ${i18n.t(`Floor`)}
237
- <span id="${object.name}" partition-id="${partitionId}" polygon-item-id="${partitionItems.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn at_pull_right"></span>
243
+ <li floor-coords="${floorCoordsEncoded}" id="partition-child-${object.name}" object-name="${object.name}" partition-li-id="${partitionId}" class="at_toggle at_partition_floor_row_item"> ${i18n.t(`Floor`)}
244
+ <div>
245
+ <span id="${object}" partition-id="${partitionId}" partition-parent-uuid="${parentUuid}" polygon-item-id="${partitionItems.uuid}" class="mdi mdi-pencil at_child_edit_btn"></span>
246
+ <span id="${object.name}" partition-id="${partitionId}" polygon-item-id="${partitionItems.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn"></span>
247
+ </div>
238
248
  </li>
239
249
  `;
240
250
  }
@@ -331,6 +341,80 @@ function toggleSelectedPartition() {
331
341
  const target = event.target;
332
342
  handlePolygonVisibility(target.id);
333
343
  }));
344
+ batchAddEventListenerByClassName('at_partition_wall_row_item', (event) => __awaiter(this, void 0, void 0, function* () {
345
+ event.stopPropagation();
346
+ const target = event.target;
347
+ const partitionId = target.getAttribute('partition-li-id');
348
+ const objectName = target.getAttribute('object-name');
349
+ const wallCoordsEncoded = target.getAttribute('wall-coords');
350
+ const wallCoordsJSON = atob(wallCoordsEncoded);
351
+ const wallCoords = JSON.parse(wallCoordsJSON);
352
+ const wallBottomMidPoint = {
353
+ x: ((wallCoords[0].start.x + wallCoords[1].start.x + wallCoords[2].start.x + wallCoords[3].start.x) / 4),
354
+ y: ((wallCoords[0].start.y + wallCoords[1].start.y + wallCoords[2].start.y + wallCoords[3].start.y) / 4),
355
+ z: ((wallCoords[0].start.z + wallCoords[1].start.z + wallCoords[2].start.z + wallCoords[3].start.z) / 4),
356
+ };
357
+ try {
358
+ yield goToPosition(wallBottomMidPoint);
359
+ highlightSelectedPartitionChild(partitionId, objectName);
360
+ }
361
+ catch (e) {
362
+ log.info('goToPosition failed: ', e);
363
+ }
364
+ }));
365
+ batchAddEventListenerByClassName('at_partition_floor_row_item', (event) => __awaiter(this, void 0, void 0, function* () {
366
+ event.stopPropagation();
367
+ const target = event.target;
368
+ const partitionId = target.getAttribute('partition-li-id');
369
+ const objectName = target.getAttribute('object-name');
370
+ const floorCoordsEncoded = target.getAttribute('floor-coords');
371
+ const floorCoordsJSON = atob(floorCoordsEncoded);
372
+ const floorCoords = JSON.parse(floorCoordsJSON);
373
+ const wallBottomMidPoint = {
374
+ x: ((floorCoords[0].start.x + floorCoords[1].start.x + floorCoords[2].start.x) / 3),
375
+ y: ((floorCoords[0].start.y + floorCoords[1].start.y + floorCoords[2].start.y) / 3),
376
+ z: ((floorCoords[0].start.z + floorCoords[1].start.z + floorCoords[2].start.z) / 3),
377
+ };
378
+ try {
379
+ yield goToPosition(wallBottomMidPoint);
380
+ highlightSelectedPartitionChild(partitionId, objectName);
381
+ }
382
+ catch (e) {
383
+ log.info('goToPosition failed: ', e);
384
+ }
385
+ }));
386
+ batchAddEventListenerByClassName('at_child_edit_btn', (event) => __awaiter(this, void 0, void 0, function* () {
387
+ var _a;
388
+ const target = event.target;
389
+ const isWall = ((_a = target.getAttribute('is-wall')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
390
+ const partitionId = target.getAttribute('partition-id');
391
+ const parentRoomUuid = target.getAttribute('partition-parent-uuid');
392
+ const parentRoom = document.getElementById(`at-room-edit-${parentRoomUuid}-btn`);
393
+ function openRoomEdit() {
394
+ highlightSelectedItem({ target: parentRoom });
395
+ setPartitionFormMode("EDIT" /* FORM_MODE.EDIT */);
396
+ setCurrentEditRoomData(`at-room-edit-${parentRoomUuid}-btn`);
397
+ toggleDisplayPane(`at-room-edit-${parentRoomUuid}-btn`);
398
+ }
399
+ if (parentRoom) {
400
+ openRoomEdit();
401
+ const partitionRowEdit = document.getElementById(`at-edit-partition-${partitionId}`);
402
+ if (partitionRowEdit) {
403
+ const currentEditRoomData = getCurrentEditRoomData();
404
+ handlePartitionRowEditBtnClickEvent(currentEditRoomData.children, partitionRowEdit);
405
+ if (isWall) {
406
+ const polygonId = target.getAttribute('polygon-item-id');
407
+ handlePartitionWallEditBtn(polygonId);
408
+ }
409
+ }
410
+ else {
411
+ log.warn('Partition row edit element not found');
412
+ }
413
+ }
414
+ else {
415
+ log.warn('Partition room element not found');
416
+ }
417
+ }));
334
418
  batchAddEventListenerByClassName('at_room_delete_btn', (event) => __awaiter(this, void 0, void 0, function* () {
335
419
  const target = event.target;
336
420
  handleDeletePartition(target.id);
@@ -581,3 +665,14 @@ export function updateRoomVisibilityUI(parentId, isVisible) {
581
665
  toggleVisibilityState(roomElement, true);
582
666
  }
583
667
  }
668
+ /**
669
+ * Highlights the selected child element within a partition by toggling CSS classes.
670
+ * @param partitionId - The unique identifier of the partition containing the child elements
671
+ * @param name - The specific name/identifier of the child element to highlight
672
+ */
673
+ export function highlightSelectedPartitionChild(partitionId, name) {
674
+ const partitionChildren = document.querySelectorAll(`li[partition-li-id="${partitionId}"]`);
675
+ partitionChildren.forEach(el => {
676
+ el.classList.toggle('selected', el.id === `partition-child-${name}`);
677
+ });
678
+ }
@@ -4,6 +4,7 @@ export declare let selectedIoTSystem: string;
4
4
  export declare let selectedIotTag: any;
5
5
  export declare function renderTagIOTFormPane(): HTMLDivElement;
6
6
  export declare function setIotCategoryOptions(): void;
7
+ export declare function getIotCategoryOption(): ITagIOTCategory;
7
8
  export declare function toggleIoTCategoryOptions(): void;
8
9
  export declare function toggleIoTDevicesOptions(): void;
9
10
  /**