architwin 1.15.5 → 1.16.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.
@@ -270,6 +270,8 @@ i18n
270
270
  "SuccessWindowDelete": "Succesfully deleted window",
271
271
  "EnterFloorMaterial": "Enter floor material",
272
272
  "EnterWallMaterial": "Enter wall material",
273
+ "ShowAll": "Show All",
274
+ "HideAll": "Hide All",
273
275
  "PressEscCancelRelocation": "Press Esc key to cancel relocation.",
274
276
  "MoveTagCancelled": "Move Tag Cancelled",
275
277
  "Window": "Window",
@@ -539,6 +541,8 @@ i18n
539
541
  "SuccessWindowDelete": "建具の削除が完了しました",
540
542
  "EnterFloorMaterial": "仕上げ(床)を入力",
541
543
  "EnterWallMaterial": "仕上げ(壁)を入力",
544
+ "ShowAll": "全て表示",
545
+ "HideAll": "全て非表示",
542
546
  "MoveTagCancelled": "タグの移動がキャンセルされました",
543
547
  "PressEscCancelRelocation": "再配置をキャンセルするには、Esc キーを押します。",
544
548
  "Window": "建具",
@@ -1,5 +1,7 @@
1
- import { FORM_MODE, PartitionNode, PolygonData, WallPolyData, IObjectData } from "../../../../types";
1
+ import { FORM_MODE, PartitionNode, PolygonData, WallPolyData, IObjectData, WindowPolyData } from "../../../../types";
2
2
  export declare let isEditWindow: boolean;
3
+ export declare let currentEditWindowIndex: number;
4
+ export declare let currentWindow: WindowPolyData;
3
5
  export declare function renderRoomFormPane(): HTMLDivElement;
4
6
  /**
5
7
  * Toggles the state of the partition drawing functionality.
@@ -105,6 +107,7 @@ export declare function getCurrentPolygonData(): PolygonData;
105
107
  */
106
108
  export declare function setCurrentPartitionData(): Promise<void>;
107
109
  export declare function removeWindow(index?: number): void;
110
+ export declare function toggleUndoRedoButtons(undo: boolean, redo: boolean): void;
108
111
  export declare function getCurrentPartitionData(): PartitionNode;
109
112
  export declare function getNewlyAddedPartition(): Array<PartitionNode>;
110
113
  export declare function getDeletedSavedPartitionArray(): Array<PartitionNode>;
@@ -121,3 +124,4 @@ export declare function setPreviousPartitionData(payload: PartitionNode): void;
121
124
  export declare function handlePartitionWallEditBtn(wallUuid: string): Promise<void>;
122
125
  export declare function getTempCurrentRoomEditData(): Array<PartitionNode>;
123
126
  export declare function setTempCurrentRoomEditData(roomEditData: Array<PartitionNode>): void;
127
+ export declare function getCurrentWall(): WallPolyData;
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import i18n from '../i18n';
11
11
  import { SPACE_EVENTS } from "../../../../types";
12
12
  import { batchAddEventListenerByClassName } from "../../../events";
13
- import { startDraw, cancelDraw, disposeModel, _3DXObjects, getCurrentPolygon, dispatchSpaceEvent, enableVerticeControls, setCurrentPolygon, setMeshChildrenMaterialProperty, get3DXObjects, getChildrenOfModel, clearSelectedObject, renderPolygon, addUndoDrawActions, setWallBaseHeight, clearWallBaseHeight, setDrawingConfig, resetDrawingConfig, goToPosition, clearFloorBaseHeight, clearDrawActionHistory } from '../../../../architwin';
13
+ import { startDraw, cancelDraw, disposeModel, _3DXObjects, getCurrentPolygon, dispatchSpaceEvent, enableVerticeControls, setCurrentPolygon, setMeshChildrenMaterialProperty, get3DXObjects, getChildrenOfModel, clearSelectedObject, renderPolygon, setWallBaseHeight, clearWallBaseHeight, setDrawingConfig, resetDrawingConfig, goToPosition, partitionHistory } from '../../../../architwin';
14
14
  import { generateUUID, extractUUID } from '../../../../utils';
15
15
  import { getCurrentEditRoomData } from './roomTreePane';
16
16
  import { toggleModal, setModalAction } from "../modal";
@@ -42,7 +42,8 @@ let floorMaterial = '';
42
42
  let inputWallMaterial;
43
43
  let wallMaterial = '';
44
44
  export let isEditWindow = false;
45
- let currentEditWindowIndex = null;
45
+ export let currentEditWindowIndex = null;
46
+ export let currentWindow = null;
46
47
  let tempCurrentEditRoom = null;
47
48
  export function renderRoomFormPane() {
48
49
  log.info("__@ renderRoomFormPane: ", roomFormMode);
@@ -211,10 +212,6 @@ export function toggleDrawPartitionButton() {
211
212
  const vertexList = document.getElementById('at-face-vertex-container');
212
213
  const partitionNameInput = document.getElementById('at-edit-partition-name-input');
213
214
  partitionNameInput.value = '';
214
- const undoBtn = document.getElementById('at-draw-undo-btn');
215
- const redoBtn = document.getElementById('at-draw-redo-btn');
216
- undoBtn.classList.add('at_disabled');
217
- redoBtn.classList.add('at_disabled');
218
215
  const formMode = getPartitionFormMode();
219
216
  if (formMode == "ADD" /* FORM_MODE.ADD */) {
220
217
  tempCurrentPolygon = getCurrentPolygon();
@@ -231,6 +228,7 @@ export function toggleDrawPartitionButton() {
231
228
  isEditPartition = false;
232
229
  previousPartitionData = null;
233
230
  }
231
+ // toggleUndoRedoButtons(false, false)
234
232
  }
235
233
  export function toggleDrawWindowButton() {
236
234
  var _a, _b;
@@ -251,7 +249,6 @@ export function toggleDrawWindowButton() {
251
249
  }
252
250
  const objectIndex = _3DXObjects.findIndex(obj => obj.object.id == currentObject.object.id);
253
251
  log.info("objectIndex", objectIndex);
254
- clearFloorBaseHeight();
255
252
  drawingConfig = {
256
253
  lineTypeComponentConfig: {
257
254
  renderPolygonOnAdd: false,
@@ -302,6 +299,7 @@ export function toggleDrawWindowButton() {
302
299
  }
303
300
  }
304
301
  }
302
+ // toggleUndoRedoButtons(false, false)
305
303
  }
306
304
  /**
307
305
  * Displays the partition form based on the current form mode.
@@ -339,12 +337,12 @@ function populatePartitionForm(partition) {
339
337
  const memo = document.getElementById('at-room-memo-input');
340
338
  if (partition.polygon_json != null) {
341
339
  memo.value = JSON.parse(partition.polygon_json).memo;
340
+ floorLevel.value = JSON.parse(partition.polygon_json).floor_level;
342
341
  }
343
342
  // Display Partitions
344
343
  currentPartitionDataArray = partition.children;
345
344
  savedPartitionDataArray = partition.children;
346
345
  if (currentPartitionDataArray.length !== 0) {
347
- floorLevel.value = JSON.parse(partition.children[0].polygon_json).floor.floor_level;
348
346
  wallheight.value = JSON.parse(partition.children[0].polygon_json).walls[0].wall_height;
349
347
  displayPartitions(currentPartitionDataArray);
350
348
  }
@@ -699,14 +697,6 @@ function displayFaces(polygon) {
699
697
  console.log("renderPolygon:", payload, getCurrentPolygon());
700
698
  // Re-render polygon
701
699
  renderPolygon(payload);
702
- const undoPaylaod = {
703
- action: "deleteWall",
704
- wallId: wallId,
705
- payload: payload
706
- };
707
- addUndoDrawActions(undoPaylaod);
708
- const redoBtn = document.getElementById('at-draw-redo-btn');
709
- redoBtn.classList.add('at_disabled');
710
700
  toggleModal(false);
711
701
  notify.success(`${i18n.t('SuccessWallDelete')}`);
712
702
  }));
@@ -929,6 +919,7 @@ function setupEditWindow(element, window) {
929
919
  const confirmBtn = element.querySelector(`#at-confirm-edit-window-${window.index}`);
930
920
  if (!editBtn || !editNameContainer || !inputName || !nameLabel || !editMaterialContainer || !inputMaterial)
931
921
  return;
922
+ currentWindow = window;
932
923
  // Show inputs when edit icon is clicked
933
924
  editBtn.addEventListener("click", () => {
934
925
  if (isDrawing) {
@@ -965,6 +956,17 @@ function setupEditWindow(element, window) {
965
956
  };
966
957
  enableVerticeControls(windowComponent);
967
958
  isDrawing = true;
959
+ let data;
960
+ if (currentPartitionData) {
961
+ data = {
962
+ polygon: {
963
+ uuid: currentPartitionData.uuid,
964
+ polygon_json: currentPolygonData
965
+ },
966
+ verticePath: window.path,
967
+ };
968
+ }
969
+ // partitionHistory.setCurrent(data)
968
970
  });
969
971
  // // Confirm edit name and material
970
972
  confirmBtn.addEventListener("click", () => {
@@ -998,6 +1000,8 @@ function setupEditWindow(element, window) {
998
1000
  saveWallChanges();
999
1001
  isDrawing = false;
1000
1002
  isEditWindow = false;
1003
+ partitionHistory.clearHistory();
1004
+ // toggleUndoRedoButtons(false, false)
1001
1005
  });
1002
1006
  }
1003
1007
  function saveWallChanges() {
@@ -1365,17 +1369,17 @@ export function getPartitionFormData() {
1365
1369
  const name = ((_a = document.getElementById('at-room-name-input')) === null || _a === void 0 ? void 0 : _a.value) || null;
1366
1370
  const wallheight = ((_b = document.getElementById('at-room-wall-height-input')) === null || _b === void 0 ? void 0 : _b.value) || null;
1367
1371
  const floorLevel = ((_c = document.getElementById('at-room-floor-level-input')) === null || _c === void 0 ? void 0 : _c.value) || null;
1368
- let memo = ((_d = document.getElementById('at-room-memo-input')) === null || _d === void 0 ? void 0 : _d.value) || null;
1372
+ const memo = ((_d = document.getElementById('at-room-memo-input')) === null || _d === void 0 ? void 0 : _d.value) || null;
1369
1373
  const currentUrl = window.location.href;
1370
1374
  const spaceUUID = extractUUID(currentUrl);
1371
1375
  let payload = {
1372
1376
  space_uuid: spaceUUID,
1373
1377
  name: name,
1374
1378
  parent_uuid: null,
1375
- polygon_json: JSON.stringify({ memo: memo }),
1379
+ polygon_json: JSON.stringify({ memo: memo, floor_level: Number(floorLevel) }),
1376
1380
  children: currentPartitionDataArray,
1377
1381
  };
1378
- if (!memo) {
1382
+ if (!memo && !floorLevel) {
1379
1383
  payload.polygon_json = null;
1380
1384
  }
1381
1385
  currentPartitionDataArray.forEach(partition => {
@@ -1391,7 +1395,7 @@ export function getPartitionFormData() {
1391
1395
  currentEditRoomData.children = currentPartitionDataArray;
1392
1396
  payload = currentEditRoomData;
1393
1397
  payload.name = name;
1394
- payload.polygon_json = JSON.stringify({ memo: memo });
1398
+ payload.polygon_json = JSON.stringify({ memo: memo, floor_level: Number(floorLevel) });
1395
1399
  }
1396
1400
  return payload;
1397
1401
  }
@@ -1655,6 +1659,25 @@ export function removeWindow(index = -1) {
1655
1659
  faceVertexContainer.innerHTML = '';
1656
1660
  faceVertexContainer.append(displayWall(currentWall));
1657
1661
  }
1662
+ export function toggleUndoRedoButtons(undo, redo) {
1663
+ console.log("toggleUndoRedoButtons", undo, redo);
1664
+ if (!undo) {
1665
+ const undoBtn = document.getElementById('at-draw-undo-btn');
1666
+ undoBtn.classList.add('at_disabled');
1667
+ }
1668
+ else {
1669
+ const undoBtn = document.getElementById('at-draw-undo-btn');
1670
+ undoBtn.classList.remove('at_disabled');
1671
+ }
1672
+ if (!redo) {
1673
+ const redoBtn = document.getElementById('at-draw-redo-btn');
1674
+ redoBtn.classList.add('at_disabled');
1675
+ }
1676
+ else {
1677
+ const redoBtn = document.getElementById('at-draw-redo-btn');
1678
+ redoBtn.classList.remove('at_disabled');
1679
+ }
1680
+ }
1658
1681
  function setFloorMaterial(material) {
1659
1682
  console.log('setFloorMaterial()', material);
1660
1683
  floorMaterial = material;
@@ -1785,7 +1808,6 @@ export function handlePartitionWallEditBtn(wallUuid) {
1785
1808
  currentPolygonData = JSON.parse(currentPartitionData.polygon_json);
1786
1809
  setDrawingMode(false);
1787
1810
  cancelDrawing();
1788
- clearDrawActionHistory();
1789
1811
  });
1790
1812
  }
1791
1813
  export function getTempCurrentRoomEditData() {
@@ -1794,3 +1816,6 @@ export function getTempCurrentRoomEditData() {
1794
1816
  export function setTempCurrentRoomEditData(roomEditData) {
1795
1817
  tempCurrentEditRoom = roomEditData;
1796
1818
  }
1819
+ export function getCurrentWall() {
1820
+ return currentWall;
1821
+ }
@@ -1,5 +1,6 @@
1
1
  import { ITag, ITagCategory, SortConfig, TAG_TYPE } from "../../../types";
2
2
  import { MpSdk } from "../../../../bundle/sdk";
3
+ export declare const tagVisibility: Record<TAG_TYPE, Record<string, boolean>>;
3
4
  export declare let selectedCategoryFilterId: any;
4
5
  export declare let selectedSubCategoryFilterId: any;
5
6
  export declare let isTagPaneActive: boolean;
@@ -26,3 +27,7 @@ export declare function setCurrentTagPaneMode(value: TAG_TYPE | null): void;
26
27
  export declare const sortTags: (items: ITag[], options: SortConfig) => ITag[];
27
28
  export declare function updateSelectedTagSortOption(sortOption: string): void;
28
29
  export declare function resetSelectedTagSortOption(): void;
30
+ export declare function saveTagVisibilityToStorage(tagVisibility: Record<TAG_TYPE, Record<string, boolean>>): void;
31
+ export declare function initializeTagVisibility(): void;
32
+ export declare function updateShowAllButton(): void;
33
+ export declare function clearTagVisibilityStorage(): void;
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { SPACE_EVENTS, sortTagOptions, TAG_TYPE } from "../../../types";
11
11
  import { batchAddEventListenerByClassName, toggleDisplayPane, batchAddEventListenerByDataAttribute } from "../../events";
12
12
  import { convertToCssRgb, getBundleVersion } from "../../../utils";
13
- import { gotoTag, disposeTag, dispatchSpaceEvent, _tags, getUserAssignedCategories, _mpConfig, moveTag, getAtwinSdk } from "../../../architwin";
13
+ import { gotoTag, disposeTag, dispatchSpaceEvent, _tags, getUserAssignedCategories, _mpConfig, moveTag, getAtwinSdk, toggleVisibilityTag } from "../../../architwin";
14
14
  import { initFormData, toggleDropdown } from "./tagFormPane";
15
15
  import { toggleModal, setModalAction } from "./modal";
16
16
  import { initIoTFormData, setIoTFormMode } from './tagIotFormPane';
@@ -35,6 +35,10 @@ let _tagLink;
35
35
  let isChevronEventAdded = false;
36
36
  let allSubcategories = [];
37
37
  let tagSearchTerm = '';
38
+ export const tagVisibility = {
39
+ [TAG_TYPE.MP]: {},
40
+ [TAG_TYPE.IOT]: {}
41
+ };
38
42
  let iotTags = [];
39
43
  export let selectedCategoryFilterId = undefined;
40
44
  export let selectedSubCategoryFilterId = undefined;
@@ -44,7 +48,7 @@ export let selectedTagSortOption = { by: 'label', order: 'asc' };
44
48
  export function renderTagListPane() {
45
49
  const element = document.createElement('div');
46
50
  element.classList.add('at_container');
47
- element.classList.add('at_w-12');
51
+ element.classList.add('at_w-13');
48
52
  element.classList.add('at_h-full');
49
53
  element.setAttribute('id', 'at-tag-list-pane');
50
54
  element.setAttribute('data-cy', 'at-tag-list-pane');
@@ -52,25 +56,40 @@ export function renderTagListPane() {
52
56
  <div class="at_panel_header">
53
57
  <span id="at-tag-list-title">${i18n.t('Tags')}</span>
54
58
  </div>
55
- <div class="at_form_container at_tag_list_pane">
56
- <div class="at_tags_filter_section">
57
- <input class="at_field_search_input" type="text" name="search_name" id="at-tag-name-search" data-cy="at-tag-name-search" placeholder=${i18n.t('Search...')}>
58
- <span class="mdi mdi-close at_button_search_tag" id="at-clear-search-tag-name" style="display:none"></span>
59
- <button class="at_search_button" id="at-search-tag-button">
60
- <span class="mdi mdi-magnify"></span>
61
- </button>
62
- <div class="at_sort_btn_container">
63
- <div id="at-tag-sort-icon" class="mdi mdi-filter mdi-24px at_icon_hover">
59
+ <div class="at_form_container at_h-min-65 at_tag_list_pane">
60
+ <div class="at_button_row at_justify_end ${_mpConfig.restrictionConfig.isTagReadOnly ? 'at_disabled' : ''}">
61
+ <div class="at_button at_ghost">
62
+ <span class="mdi mdi-sort at_icon_hover" id="at-tag-sort-icon" data-cy="at-tag-sort-btn" >
64
63
  <span id="at-tag-sort-options-tooltip" class="at_custom_tooltip">
65
64
  <p class="at_tag_sort_option at_sort_option_selected" data-sort="Ascending">${i18n.t('Ascending')}</p>
66
65
  <p class="at_tag_sort_option" data-sort="Descending">${i18n.t('Descending')}</p>
67
66
  <p class="at_tag_sort_option" data-sort="Newest">${i18n.t('Newest')}</p>
68
67
  <p class="at_tag_sort_option" data-sort="Oldest">${i18n.t('Oldest')}</p>
69
68
  </span>
70
- </div>
69
+ </span>
70
+ </div>
71
+ <div class="at_button at_ghost" id="at-visibility-tag-btn" data-cy="at-visibility-tag-btn" >
72
+ <span class="mdi mdi-eye at_icon_hover" id="at-visibility-tag-btn">
73
+ <span class="at_custom_tooltip">
74
+ <p class="at_tag_sort_option">${i18n.t('HideAll')}</p>
75
+ </span>
76
+ </span>
71
77
  </div>
78
+ <div class="at_button at_ghost" id="at-add-tag-btn" data-cy="at-add-tag-btn" target-pane="at-tag-form-pane">
79
+ ${i18n.t('AddTag')}
80
+ <span class="mdi mdi-plus-circle-outline" id="at-add-tag-btn"></span>
81
+ </div>
82
+ </div>
83
+
84
+ <div class="at_tags_filter_section">
85
+ <input class="at_field_search_input" type="text" name="search_name" id="at-tag-name-search" data-cy="at-tag-name-search" placeholder=${i18n.t('Search...')}>
86
+ <span class="mdi mdi-close at_button_search_tag" id="at-clear-search-tag-name" style="display:none"></span>
87
+ <button class="at_search_button" id="at-search-tag-button">
88
+ <span class="mdi mdi-magnify"></span>
89
+ </button>
90
+
72
91
  </div>
73
- <div class="at_field at_flex_column" style="${_tagCategories ? '' : 'display: none;'}" id="at-custom-category-filter-dropdown-container">
92
+ <div class="at_field at_flex_column" style="${_tagCategories ? '' : 'display: none;'}">
74
93
  <label for="">${i18n.t('Category')}</label>
75
94
  <div id="at-custom-category-filter-dropdown" data-cy="at-custom-category-filter-dropdown">
76
95
  <div id="at-category-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
@@ -99,16 +118,11 @@ export function renderTagListPane() {
99
118
  </div>
100
119
  </div>
101
120
  </div>
102
- <div class="at_scrollable_container at_h-min-45" id="at-tag-list-scrollable-container">
121
+ <div class="at_form_container at_scrollable_container at_h-min-45" id="at-tag-list-scrollable-container">
103
122
  <table id="at-tag-list-container">
104
123
  </table>
105
124
  </div>
106
- <div class="at_button_row at_justify_end ${_mpConfig.restrictionConfig.isTagReadOnly ? 'at_disabled' : ''}">
107
- <div class="at_button at_ghost" id="at-add-tag-btn" data-cy="at-add-tag-btn" target-pane="at-tag-form-pane">
108
- ${i18n.t('AddTag')}
109
- <span class="mdi mdi-plus-circle-outline" id="at-add-tag-btn"></span>
110
- </div>
111
- </div>
125
+
112
126
  <div class="at_flex at_justify_center at_price" id="at-bundle-version" data-cy="at-bundle-version">
113
127
  <small class="at_text_xxs at_text_white at_opacity_5">${getBundleVersion()}</small>
114
128
  </div>
@@ -156,6 +170,9 @@ export function renderTags(tags, showOwnTagsOnly = false) {
156
170
  tagContainer.innerHTML = ``;
157
171
  return;
158
172
  }
173
+ const disabled = _mpConfig.restrictionConfig.isIoTtagReadonly;
174
+ const addTagButton = document.getElementById('at-add-tag-btn');
175
+ const visibilityTagButton = document.getElementById('at-visibility-tag-btn');
159
176
  tagContainer.innerHTML = ``;
160
177
  tags.forEach(tag => {
161
178
  console.log('@caroline render tag checking: ', tag);
@@ -163,12 +180,16 @@ export function renderTags(tags, showOwnTagsOnly = false) {
163
180
  if (isTagPartOfCategory(tag.category_uuid)) {
164
181
  const row = renderTagRow(tag.json_data, tag.tag_icon_url, tag.tag_type);
165
182
  tagContainer.appendChild(row);
183
+ addTagButton.classList.remove('at_disabled');
184
+ visibilityTagButton.classList.remove('at_disabled');
166
185
  }
167
186
  }
168
187
  else {
169
188
  console.log('@caroline render tag checking 2: ', tag);
170
189
  const row = renderTagRow(tag.json_data, tag.tag_icon_url, tag.tag_type);
171
190
  tagContainer.appendChild(row);
191
+ addTagButton.classList.toggle('at_disabled', disabled);
192
+ visibilityTagButton.classList.toggle('at_disabled', disabled);
172
193
  }
173
194
  });
174
195
  batchAddEventListenerByClassName('at_edit_tag_btn', (event) => __awaiter(this, void 0, void 0, function* () {
@@ -267,6 +288,28 @@ export function renderTags(tags, showOwnTagsOnly = false) {
267
288
  }
268
289
  }
269
290
  }));
291
+ // Toggle individual tag visibility
292
+ batchAddEventListenerByClassName('at_visibility_tag_btn', (event) => __awaiter(this, void 0, void 0, function* () {
293
+ var _a;
294
+ const btn = event.target;
295
+ const tagId = btn.getAttribute('tag-id');
296
+ if (!tagId)
297
+ return;
298
+ // Find the tag to determine its type
299
+ const tag = _tags.find(t => t.json_data.id == tagId);
300
+ if (!tag)
301
+ return;
302
+ const tagType = tag.tag_type || TAG_TYPE.MP;
303
+ const current = (_a = tagVisibility[tagType][tagId]) !== null && _a !== void 0 ? _a : true;
304
+ const newState = !current;
305
+ tagVisibility[tagType][tagId] = newState;
306
+ yield toggleVisibilityTag({ tagId, visibility: newState });
307
+ btn.classList.remove(newState ? "mdi-eye-off-outline" : "mdi-eye");
308
+ btn.classList.add(newState ? "mdi-eye" : "mdi-eye-off-outline");
309
+ // update main toggle button, not event
310
+ updateShowAllButton();
311
+ saveTagVisibilityToStorage(tagVisibility);
312
+ }));
270
313
  if (Number(window.innerWidth) <= 540) {
271
314
  batchAddEventListenerByDataAttribute('toggle-pane', (event) => __awaiter(this, void 0, void 0, function* () {
272
315
  toggleDisplayPane('at-cancel-tag-form-btn');
@@ -275,6 +318,7 @@ export function renderTags(tags, showOwnTagsOnly = false) {
275
318
  activeElement.classList.remove('at_sidebar_button_icon_active');
276
319
  }), {
277
320
  ignoreSelectors: [
321
+ 'at_visibility_tag_btn',
278
322
  '.at_edit_tag_btn',
279
323
  '.at_copy_tag_btn',
280
324
  '.at_delete_tag_btn',
@@ -320,6 +364,16 @@ export function renderTags(tags, showOwnTagsOnly = false) {
320
364
  document.addEventListener('keydown', handleEscKey);
321
365
  }));
322
366
  initDropdownEventListeners();
367
+ Object.entries(tagVisibility).forEach(([tagType, visibilityMap]) => {
368
+ Object.entries(visibilityMap).forEach(([tagId, visible]) => {
369
+ console.log(tagType, tagId, visible);
370
+ const toggleBtn = document.getElementById(`at-visibility-tag-${tagId}`);
371
+ if (toggleBtn) {
372
+ toggleBtn.classList.remove(visible ? "mdi-eye-off-outline" : "mdi-eye");
373
+ toggleBtn.classList.add(visible ? "mdi-eye" : "mdi-eye-off-outline");
374
+ }
375
+ });
376
+ });
323
377
  }
324
378
  export function renderTagRow(tag, tagIconUrl, tag_type = null) {
325
379
  log.info('@caroline rendertagrow: ', tag);
@@ -332,7 +386,11 @@ export function renderTagRow(tag, tagIconUrl, tag_type = null) {
332
386
  // element.setAttribute('tag-id',tag.json_data.id)
333
387
  // get read only value from mpconfig
334
388
  const isTagReadOnly = _mpConfig.restrictionConfig.isTagReadOnly;
389
+ const isIotTagReadOnly = _mpConfig.restrictionConfig.isIoTtagReadonly;
390
+ const isIoT = tag_type === TAG_TYPE.IOT;
391
+ const isGenerallyDisabled = isTagReadOnly || (isIoT && isIotTagReadOnly);
335
392
  console.log("_isTagReadOnly: ", isTagReadOnly);
393
+ console.log("@___isIotTagReadOnly: ", isIotTagReadOnly);
336
394
  // Displays tag icon with tag color indicator
337
395
  const thisTagIconURL = tagIconUrl === 'button.png' || tagIconUrl === '' || tagIconUrl === undefined ? "https://cdn.jsdelivr.net/npm/architwin@latest/static/images/button.png" : tagIconUrl;
338
396
  let tagIconIndicatorBg = convertToCssRgb(tag.color);
@@ -353,12 +411,15 @@ export function renderTagRow(tag, tagIconUrl, tag_type = null) {
353
411
  <span title="${tag.label.length > 12 ? tag.label : ''}">${tag.label}</span>
354
412
  </div>
355
413
  </td>
356
- <td class="at_table_button_row">
357
- <span class="mdi mdi-pencil at_edit_tag_btn ${isTagReadOnly ? 'at_disabled' : ''}" id="at-edit-tag-${tag.id}" data-cy="at-edit-tag-${tag.id}" tag-id="${tag.id}" target-pane=${tag_type === TAG_TYPE.IOT ? "at-tag-iot-form-pane" : "at-tag-form-pane"}></span>
358
- <span class="mdi mdi-content-copy at_copy_tag_btn ${isTagReadOnly ? 'at_disabled' : ''} id="at-edit-tag-${tag.id}" id="at-copy-tag-${tag.id}" data-cy="at-copy-tag-${tag.id}" tag-id="${tag.id}"></span>
359
- <span class="mdi mdi-message at_message_tag_btn ${tag_type === TAG_TYPE.IOT ? 'at_hidden' : ''}" id="at-message-tag-${tag.id}" data-cy="at-message-tag-${tag.id}" tag-id="${tag.id}" target-pane="at-tag-messaging-pane"></span>
360
- <span class="mdi mdi-map-marker at_locate_tag_btn ${tag_type === TAG_TYPE.IOT ? '' : 'at_hidden'}" id="at-relocate-tag-${tag.id}" data-cy="at-relocate-tag-${tag.id}" tag-id="${tag.id}"></span>
361
- <span class="mdi mdi-trash-can-outline at_delete_tag_btn ${isTagReadOnly ? 'at_disabled' : ''}" id="at-delete-tag-${tag.id}" data-cy="at-delete-tag-${tag.id}" tag-id="${tag.id}"></span>
414
+ <td>
415
+ <div class="at_table_button_row">
416
+ <span class="mdi mdi-eye at_visibility_tag_btn ${isGenerallyDisabled ? 'at_disabled' : ''}" id="at-visibility-tag-${tag.id}" data-cy="at-visibility-tag-${tag.id}" tag-id="${tag.id}" tag-id="${tag.id}"></span>
417
+ <span class="mdi mdi-pencil at_edit_tag_btn ${isGenerallyDisabled ? 'at_disabled' : ''}" id="at-edit-tag-${tag.id}" data-cy="at-edit-tag-${tag.id}" tag-id="${tag.id}" target-pane="at-tag-form-pane"></span>
418
+ <span class="mdi mdi-content-copy at_copy_tag_btn ${isTagReadOnly ? 'at_disabled' : ''} id="at-edit-tag-${tag.id}"" id="at-copy-tag-${tag.id}" data-cy="at-copy-tag-${tag.id}" tag-id="${tag.id}"></span>
419
+ <span class="mdi mdi-message at_message_tag_btn ${isIoT ? 'at_hidden' : ''}" id="at-message-tag-${tag.id}" data-cy="at-message-tag-${tag.id}" tag-id="${tag.id}" target-pane="at-tag-messaging-pane"></span>
420
+ <span class="mdi mdi-map-marker at_locate_tag_btn ${!isIoT ? 'at_hidden' : ''} ${isIotTagReadOnly ? 'at_disabled' : ''}" id="at-relocate-tag-${tag.id}" data-cy="at-relocate-tag-${tag.id}" tag-id="${tag.id}"></span>
421
+ <span class="mdi mdi-trash-can-outline at_delete_tag_btn ${isGenerallyDisabled ? 'at_disabled' : ''}" id="at-delete-tag-${tag.id}" data-cy="at-delete-tag-${tag.id}" tag-id="${tag.id}"></span>
422
+ </div>
362
423
  </td>
363
424
  `;
364
425
  return element;
@@ -379,6 +440,7 @@ export function addClickEventToTagRow(tag) {
379
440
  const editTagBtn = document.getElementById(`at-edit-tag-${tag.id}`);
380
441
  const copyTagBtn = document.getElementById(`at-copy-tag-${tag.id}`);
381
442
  const deleteTagBtn = document.getElementById(`at-delete-tag-${tag.id}`);
443
+ const visibilityTagBtn = document.getElementById(`at-visibility-tag-${tag.id}`);
382
444
  if (editTagBtn) {
383
445
  editTagBtn.addEventListener('click', (event) => __awaiter(this, void 0, void 0, function* () {
384
446
  console.log('Event', event);
@@ -424,6 +486,11 @@ export function addClickEventToTagRow(tag) {
424
486
  }
425
487
  }));
426
488
  }
489
+ if (visibilityTagBtn) {
490
+ visibilityTagBtn.addEventListener('click', (event) => __awaiter(this, void 0, void 0, function* () {
491
+ console.log("CLICK ==>");
492
+ }));
493
+ }
427
494
  }
428
495
  // Original Implementation
429
496
  // export function filterTagList(tags:Array<ITag>):Array<ITag>{
@@ -653,3 +720,108 @@ export function resetSelectedTagSortOption() {
653
720
  }
654
721
  }
655
722
  }
723
+ // create local storage functions to save tag visibility states
724
+ export function saveTagVisibilityToStorage(tagVisibility) {
725
+ try {
726
+ localStorage.setItem('tagVisibility', JSON.stringify(tagVisibility));
727
+ log.info('Saved tag visibility:', tagVisibility);
728
+ }
729
+ catch (error) {
730
+ log.error('Failed to save tag visibility to localStorage:', error);
731
+ }
732
+ }
733
+ // load tag visibility states from local storage
734
+ function loadTagVisibilityFromStorage() {
735
+ var _a, _b;
736
+ try {
737
+ const parsed = JSON.parse(localStorage.getItem('tagVisibility') || '{}');
738
+ return {
739
+ [TAG_TYPE.MP]: (_a = parsed[TAG_TYPE.MP]) !== null && _a !== void 0 ? _a : {},
740
+ [TAG_TYPE.IOT]: (_b = parsed[TAG_TYPE.IOT]) !== null && _b !== void 0 ? _b : {}
741
+ };
742
+ }
743
+ catch (error) {
744
+ log.error('Failed to load tag visibility from localStorage:', error);
745
+ return { [TAG_TYPE.MP]: {}, [TAG_TYPE.IOT]: {} };
746
+ }
747
+ }
748
+ // initialize tag visibility states on app load
749
+ export function initializeTagVisibility() {
750
+ var _a;
751
+ const savedVisibility = loadTagVisibilityFromStorage();
752
+ for (const tag of _tags) {
753
+ const tagId = tag.json_data.id;
754
+ const tagType = tag.tag_type || TAG_TYPE.MP;
755
+ // Initialize type object if it doesn't exist
756
+ if (!tagVisibility[tagType]) {
757
+ tagVisibility[tagType] = {};
758
+ }
759
+ // Use saved state if it exists, otherwise default to true
760
+ tagVisibility[tagType][tagId] = ((_a = savedVisibility[tagType]) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(tagId))
761
+ ? savedVisibility[tagType][tagId]
762
+ : true;
763
+ }
764
+ setTagVisibilityStates();
765
+ }
766
+ // apply visibility states to tags
767
+ function setTagVisibilityStates() {
768
+ return __awaiter(this, void 0, void 0, function* () {
769
+ for (const tag of _tags) {
770
+ const tagId = tag.json_data.id;
771
+ const tagType = tag.tag_type || TAG_TYPE.MP;
772
+ const isVisible = tagVisibility[tagType][tagId];
773
+ yield toggleVisibilityTag({ tagId: tagId, visibility: isVisible });
774
+ const btn = document.getElementById(`at-visibility-tag-${tagId}`);
775
+ if (btn) {
776
+ btn.classList.toggle("mdi-eye", isVisible);
777
+ btn.classList.toggle("mdi-eye-off-outline", !isVisible);
778
+ }
779
+ }
780
+ updateShowAllButton();
781
+ });
782
+ }
783
+ // update the main show/hide all button based on current tag visibility states
784
+ export function updateShowAllButton() {
785
+ const toggleVisibilityBtn = document.getElementById('at-visibility-tag-btn');
786
+ if (!toggleVisibilityBtn)
787
+ return;
788
+ // Check visibility based on current tag pane mode
789
+ let allHidden = false;
790
+ if (currentTagPaneMode === TAG_TYPE.IOT) {
791
+ // Check only IOT tags
792
+ allHidden = Object.values(tagVisibility[TAG_TYPE.IOT]).every(v => v === false);
793
+ }
794
+ else if (currentTagPaneMode === TAG_TYPE.MP) {
795
+ // Check only MP tags
796
+ allHidden = Object.values(tagVisibility[TAG_TYPE.MP]).every(v => v === false);
797
+ }
798
+ else {
799
+ // Check all tags when no specific mode is set
800
+ const allValues = [
801
+ ...Object.values(tagVisibility[TAG_TYPE.MP]),
802
+ ...Object.values(tagVisibility[TAG_TYPE.IOT])
803
+ ];
804
+ allHidden = allValues.length > 0 && allValues.every(v => v === false);
805
+ }
806
+ toggleVisibilityBtn.innerHTML = allHidden
807
+ ? `<span class="mdi mdi-eye-off-outline at_icon_hover">
808
+ <span class="at_custom_tooltip">
809
+ <p class="at_tag_sort_option">${i18n.t('ShowAll')}</p>
810
+ </span>
811
+ </span>`
812
+ : `<span class="mdi mdi-eye at_icon_hover">
813
+ <span class="at_custom_tooltip">
814
+ <p class="at_tag_sort_option">${i18n.t('HideAll')}</p>
815
+ </span>
816
+ </span>`;
817
+ }
818
+ // clear tag visibility states from local storage
819
+ export function clearTagVisibilityStorage() {
820
+ if (localStorage.getItem('tagVisibility')) {
821
+ localStorage.removeItem('tagVisibility');
822
+ log.info('Tag visibility storage cleared');
823
+ }
824
+ else {
825
+ log.info('No tag in storage found');
826
+ }
827
+ }
@@ -23,6 +23,7 @@ declare function renderTagPaneContent(): Promise<void>;
23
23
  declare function toggleActionBar(state: string): void;
24
24
  export declare function handleUserLeaveSessionClick(): void;
25
25
  declare function setupIndividualEventListeners(): void;
26
+ declare function handleToggleVisibilityTags(): void;
26
27
  declare function handleModelVisibility(objId: string): Promise<void>;
27
28
  declare function handleDeleteModel(objId: string): Promise<void>;
28
29
  declare function handleShowMinimap(): void;
@@ -47,4 +48,4 @@ declare function handleShowCustomMinimap(): void;
47
48
  declare function handleDisplayElements(id: string): void;
48
49
  declare function handleWindowVisibility(visibilityBtn: HTMLElement, updateStateDB: boolean, fromParentVisibilityState?: boolean): Promise<void>;
49
50
  declare function clearActivePane(): void;
50
- export { activeToolbarItem, activeActionItem, cancelModelPlacementPrompt, isCustomMapControlsVisible, pipeColor, batchAddEventListenerById, batchAddEventListenerByClassName, batchAddEventListenerByClassNames, batchAddEventListenerByDataAttribute, setActiveToolbarItem, toggleDisplayPane, toggleActionBar, setupIndividualEventListeners, setupSpaceEventSubscriptions, handleModelVisibility, handleDeleteModel, handleShowMinimap, handleScrollToView, handleRenderMeetingUI, handleShowCustomMinimap, renderTagPaneContent, handlePartitionVisibility, handlePolygonVisibility, handleDeletePartition, handleDisplayElements, handleWindowVisibility, clearActivePane };
51
+ export { activeToolbarItem, activeActionItem, cancelModelPlacementPrompt, isCustomMapControlsVisible, pipeColor, batchAddEventListenerById, batchAddEventListenerByClassName, batchAddEventListenerByClassNames, batchAddEventListenerByDataAttribute, setActiveToolbarItem, toggleDisplayPane, toggleActionBar, setupIndividualEventListeners, setupSpaceEventSubscriptions, handleModelVisibility, handleDeleteModel, handleShowMinimap, handleScrollToView, handleRenderMeetingUI, handleShowCustomMinimap, renderTagPaneContent, handlePartitionVisibility, handlePolygonVisibility, handleDeletePartition, handleToggleVisibilityTags, handleDisplayElements, handleWindowVisibility, clearActivePane };