architwin 1.14.15 → 1.15.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.
- package/lib/architwin.d.ts +13 -2
- package/lib/architwin.js +1 -1
- package/lib/atwinui/components/toolbar/i18n.js +71 -3
- package/lib/atwinui/components/toolbar/index.js +5 -1
- package/lib/atwinui/components/toolbar/menuBar.d.ts +1 -0
- package/lib/atwinui/components/toolbar/menuBar.js +12 -0
- package/lib/atwinui/components/toolbar/spacePartition/roomFormPane.d.ts +2 -0
- package/lib/atwinui/components/toolbar/spacePartition/roomFormPane.js +62 -24
- package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.d.ts +21 -3
- package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.js +62 -25
- package/lib/atwinui/components/toolbar/tagFormPane.js +2 -1
- package/lib/atwinui/components/toolbar/tagListPane.d.ts +7 -2
- package/lib/atwinui/components/toolbar/tagListPane.js +126 -38
- package/lib/atwinui/events.d.ts +5 -3
- package/lib/atwinui/events.js +633 -79
- package/lib/atwinui/index.js +9 -1
- package/lib/color.js +12 -1
- package/lib/loaders/polydrawerLoader.js +3 -0
- package/lib/types.d.ts +75 -1
- package/lib/types.js +17 -0
- package/package.json +1 -1
- package/static/atwinui.css +88 -7
- package/static/colors/SOFT_ROYAL_BLUE.png +0 -0
- package/static/colors/YELLOW_ORANGE.png +0 -0
- package/static/utility.css +157 -538
- package/lib/atwinui/components/toolbar/roomCreation/roomFormPane.d.ts +0 -68
- package/lib/atwinui/components/toolbar/roomCreation/roomFormPane.js +0 -798
- package/lib/atwinui/components/toolbar/roomCreation/roomLayerListPane.d.ts +0 -33
- package/lib/atwinui/components/toolbar/roomCreation/roomLayerListPane.js +0 -447
- package/lib/atwinui/components/toolbar/tagIotForm.d.ts +0 -20
- package/lib/atwinui/components/toolbar/tagIotForm.js +0 -391
- package/lib/atwinui/components/toolbar/usersPane.d.ts +0 -14
- package/lib/atwinui/components/toolbar/usersPane.js +0 -273
- package/lib/convert.d.ts +0 -13
- package/lib/convert.js +0 -54
|
@@ -27,7 +27,7 @@ export function renderRoomTreePane() {
|
|
|
27
27
|
log.info("__@ renderRoomTreePane");
|
|
28
28
|
const element = document.createElement('div');
|
|
29
29
|
element.classList.add('at_container');
|
|
30
|
-
element.classList.add('at_w-
|
|
30
|
+
element.classList.add('at_w-15');
|
|
31
31
|
element.classList.add('at_h-full');
|
|
32
32
|
element.setAttribute('id', 'at-room-tree-pane');
|
|
33
33
|
element.setAttribute('data-cy', 'at-room-tree-pane');
|
|
@@ -351,14 +351,27 @@ function toggleSelectedPartition() {
|
|
|
351
351
|
handlePartitionVisibility(target.id);
|
|
352
352
|
}));
|
|
353
353
|
batchAddEventListenerByClassName('at_child_visible_btn', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
354
|
+
var _a;
|
|
354
355
|
const target = event.target;
|
|
355
356
|
const li = target.closest('li');
|
|
356
|
-
if (li === null || li === void 0 ? void 0 : li.getAttribute('id').toLowerCase().includes('window')) {
|
|
357
|
+
if ((_a = li === null || li === void 0 ? void 0 : li.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('window')) {
|
|
357
358
|
event.stopPropagation();
|
|
358
|
-
handleWindowVisibility(target);
|
|
359
|
+
handleWindowVisibility(target, true);
|
|
359
360
|
}
|
|
360
361
|
else {
|
|
361
|
-
handlePolygonVisibility(target.id);
|
|
362
|
+
const parentVisibleState = yield handlePolygonVisibility(target.id);
|
|
363
|
+
yield new Promise(resolve => setTimeout(resolve, 0));
|
|
364
|
+
yield new Promise(resolve => requestAnimationFrame(resolve));
|
|
365
|
+
const wallId = target.getAttribute('polygon-item-id');
|
|
366
|
+
const windowItems = document.querySelectorAll(`li.at_wall_window_row_item[wall-id="${wallId}"]`);
|
|
367
|
+
if (windowItems && windowItems.length > 0) {
|
|
368
|
+
windowItems.forEach((windowLi) => {
|
|
369
|
+
const visibilityBtn = windowLi.querySelector('.at_child_visible_btn');
|
|
370
|
+
if (visibilityBtn) {
|
|
371
|
+
handleWindowVisibility(visibilityBtn, false, parentVisibleState);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
362
375
|
}
|
|
363
376
|
}));
|
|
364
377
|
batchAddEventListenerByClassName('at_partition_wall_row_item', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -374,7 +387,6 @@ function toggleSelectedPartition() {
|
|
|
374
387
|
yield goToPosition(wallBottomMidPoint);
|
|
375
388
|
highlightSelectedPartitionChild(partitionId, objectName);
|
|
376
389
|
toggleHighlightedWindowItem();
|
|
377
|
-
toggeleExpandParitionWallChild(partitionId, objectName);
|
|
378
390
|
}
|
|
379
391
|
catch (e) {
|
|
380
392
|
log.info('goToPosition failed: ', e);
|
|
@@ -398,10 +410,10 @@ function toggleSelectedPartition() {
|
|
|
398
410
|
}
|
|
399
411
|
}));
|
|
400
412
|
batchAddEventListenerByClassName('at_child_edit_btn', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
401
|
-
var
|
|
413
|
+
var _b;
|
|
402
414
|
event.stopPropagation();
|
|
403
415
|
const target = event.target;
|
|
404
|
-
const isWall = ((
|
|
416
|
+
const isWall = ((_b = target.getAttribute('is-wall')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'true';
|
|
405
417
|
const partitionId = target.getAttribute('partition-id');
|
|
406
418
|
const parentRoomUuid = target.getAttribute('partition-parent-uuid');
|
|
407
419
|
const parentRoom = document.getElementById(`at-room-edit-${parentRoomUuid}-btn`);
|
|
@@ -440,7 +452,7 @@ function toggleSelectedPartition() {
|
|
|
440
452
|
try {
|
|
441
453
|
const windowBottomMidPoint = calculateMidPoint(windowCoords);
|
|
442
454
|
yield goToPosition(windowBottomMidPoint);
|
|
443
|
-
|
|
455
|
+
highlightSelectedWindow(wallUuid, windowIndex);
|
|
444
456
|
}
|
|
445
457
|
catch (e) {
|
|
446
458
|
log.info('goToPosition failed: ', e);
|
|
@@ -600,6 +612,8 @@ export function updatePolygonVisibilityData(isVisible, currPartition, isFloor, p
|
|
|
600
612
|
log.info("WALL!");
|
|
601
613
|
// WALLS
|
|
602
614
|
targetItem = polygonJson.walls.find(item => item.uuid === polygonItemId) || null;
|
|
615
|
+
const windows = (targetItem === null || targetItem === void 0 ? void 0 : targetItem.windows) || null;
|
|
616
|
+
windows === null || windows === void 0 ? void 0 : windows.forEach(w => w.options.is_visible = isVisible);
|
|
603
617
|
}
|
|
604
618
|
log.info("targetItem:", targetItem);
|
|
605
619
|
if (targetItem) {
|
|
@@ -652,6 +666,9 @@ function updatePolygonData(currPartition, isVisible, isUpdateAllChildren) {
|
|
|
652
666
|
polygonJson.floor.options.is_visible = isVisible;
|
|
653
667
|
polygonJson.walls.forEach(wall => {
|
|
654
668
|
wall.options.is_visible = isVisible;
|
|
669
|
+
if (wall === null || wall === void 0 ? void 0 : wall.windows) {
|
|
670
|
+
wall === null || wall === void 0 ? void 0 : wall.windows.forEach(window => window.options.is_visible = isVisible);
|
|
671
|
+
}
|
|
655
672
|
});
|
|
656
673
|
}
|
|
657
674
|
}
|
|
@@ -707,18 +724,25 @@ export function highlightSelectedPartitionChild(partitionId, name) {
|
|
|
707
724
|
header.classList.toggle('selected', isSelected);
|
|
708
725
|
const arrow = header.querySelector('.at_partition_child_expand_icon');
|
|
709
726
|
if (arrow && arrow.textContent) {
|
|
710
|
-
// Use replace to only affect elements that have arrows
|
|
711
727
|
if (isSelected) {
|
|
712
728
|
arrow.textContent = arrow.textContent.replace('▶', '▼');
|
|
729
|
+
toggleExpandParitionWallChild(partitionId, name, false);
|
|
713
730
|
}
|
|
714
731
|
else {
|
|
715
732
|
arrow.textContent = arrow.textContent.replace('▼', '▶');
|
|
733
|
+
toggleExpandParitionWallChild(partitionId, name, true);
|
|
716
734
|
}
|
|
717
735
|
}
|
|
718
736
|
}
|
|
719
737
|
});
|
|
720
738
|
}
|
|
721
|
-
|
|
739
|
+
/**
|
|
740
|
+
* Toggles the visibility of child elements within a partition wall by managing CSS classes.
|
|
741
|
+
* @param partitionId - The unique identifier of the partition containing the child elements
|
|
742
|
+
* @param name - The specific name/identifier of the child element whose container to toggle
|
|
743
|
+
* @param expand - Optional boolean to explicitly set expansion state (true = show, false = hide). If undefined, toggles current state
|
|
744
|
+
*/
|
|
745
|
+
export function toggleExpandParitionWallChild(partitionId, name, expand) {
|
|
722
746
|
const partitionChildren = document.querySelectorAll(`li[partition-li-id="${partitionId}"]`);
|
|
723
747
|
const targetId = `partition-child-${name}`;
|
|
724
748
|
partitionChildren.forEach((partitionChild) => {
|
|
@@ -726,7 +750,7 @@ export function toggeleExpandParitionWallChild(partitionId, name) {
|
|
|
726
750
|
const listContainer = partitionChild.querySelector('.at_wall_children_container');
|
|
727
751
|
if (listContainer) {
|
|
728
752
|
if (isSelected) {
|
|
729
|
-
listContainer.classList.toggle('at_hidden');
|
|
753
|
+
listContainer.classList.toggle('at_hidden', expand !== undefined ? !expand : undefined);
|
|
730
754
|
}
|
|
731
755
|
else {
|
|
732
756
|
listContainer.classList.add('at_hidden');
|
|
@@ -743,13 +767,13 @@ function displayWindows(wall, partitionId, parentId) {
|
|
|
743
767
|
const windowCoords = JSON.stringify(window.edges);
|
|
744
768
|
const windowCoordsEncoded = btoa(windowCoords);
|
|
745
769
|
itemsHTML += `
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
770
|
+
<li window-coords="${windowCoordsEncoded}" id="window-${wall.uuid}-${window.index}" wall-id="${wall.uuid}" window-name="${window.name}" window-index="${window.index}" class="at_wall_window_row_item">
|
|
771
|
+
<div>${window.name}</div>
|
|
772
|
+
<div>
|
|
773
|
+
<span window-coords="${windowCoordsEncoded}" partition-id="${partitionId}" partition-parent-uuid="${parentId}" polygon-item-id="${wall.uuid}" index="${window.index}" class="mdi mdi-pencil at_window_edit_btn"></span>
|
|
774
|
+
<span id="${window.name}" partition-id="${partitionId}" partition-parent-uuid="${parentId}" polygon-item-id="${wall.uuid}" class="mdi ${window.options.is_visible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn"></span>
|
|
775
|
+
</div>
|
|
776
|
+
</li>
|
|
753
777
|
`;
|
|
754
778
|
}
|
|
755
779
|
});
|
|
@@ -806,25 +830,38 @@ function openWindowEdit(targetElement, parentRoomElement, parentRoomUuid, partit
|
|
|
806
830
|
}
|
|
807
831
|
});
|
|
808
832
|
}
|
|
809
|
-
|
|
833
|
+
/**
|
|
834
|
+
* Highlights the selected window element by toggling CSS classes and ensures its parent partition is expanded.
|
|
835
|
+
* @param wallUuid - The unique identifier of the wall containing the window elements
|
|
836
|
+
* @param index - The index or identifier of the specific window element to highlight
|
|
837
|
+
*/
|
|
838
|
+
export function highlightSelectedWindow(wallUuid, index) {
|
|
810
839
|
const wallWindow = document.querySelectorAll(`li[wall-id="${wallUuid}"]`);
|
|
811
840
|
const targetId = `window-${wallUuid}-${index}`;
|
|
812
841
|
wallWindow.forEach((windowElement) => {
|
|
842
|
+
if (windowElement.id === targetId) {
|
|
843
|
+
const parentWallItem = windowElement.closest('li.at_partition_wall_row_item');
|
|
844
|
+
const partitionId = parentWallItem.getAttribute('partition-li-id');
|
|
845
|
+
const objectName = parentWallItem.getAttribute('object-name');
|
|
846
|
+
toggleExpandParitionWallChild(partitionId, objectName, true);
|
|
847
|
+
}
|
|
813
848
|
windowElement.classList.toggle('selected', windowElement.id === targetId);
|
|
814
849
|
});
|
|
815
850
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
el.classList.remove('selected');
|
|
820
|
-
});
|
|
821
|
-
}
|
|
851
|
+
/**
|
|
852
|
+
* Removes the highlight from all selected window items by removing the 'selected' CSS class.
|
|
853
|
+
*/
|
|
822
854
|
export function toggleHighlightedWindowItem() {
|
|
823
855
|
const windowItems = document.querySelectorAll('li.at_wall_window_row_item.selected');
|
|
824
856
|
windowItems.forEach(el => {
|
|
825
857
|
el.classList.remove('selected');
|
|
826
858
|
});
|
|
827
859
|
}
|
|
860
|
+
/**
|
|
861
|
+
* Calculates the midpoint (centroid) of multiple 3D coordinates by averaging their x, y, and z values.
|
|
862
|
+
* @param coords - An array of objects containing start Vector3 coordinates
|
|
863
|
+
* @returns A Vector3 representing the calculated midpoint of all input coordinates
|
|
864
|
+
*/
|
|
828
865
|
export function calculateMidPoint(coords) {
|
|
829
866
|
const count = coords.length;
|
|
830
867
|
const sum = coords.reduce((acc, coord) => ({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { _tagCategories, _tags, getMpTags } from "../../../architwin";
|
|
2
2
|
import { convertToCssRgb, stringContains } from "../../../utils";
|
|
3
|
+
import { TAG_TYPE } from "../../../types";
|
|
3
4
|
import { renderTags, setSelectedCategoryFilter, setSelectedSubcategoryFilter, filterTagList, getAllSubcategories, selectedCategoryFilterId, sortTags, selectedTagSortOption } from './tagListPane';
|
|
4
5
|
import i18n from './i18n';
|
|
5
6
|
let mode = 'adding';
|
|
@@ -341,7 +342,7 @@ function selectOption(option, elementId, skipToggle = false) {
|
|
|
341
342
|
const elementId = isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options';
|
|
342
343
|
clearInnerHTML(elementId);
|
|
343
344
|
}
|
|
344
|
-
|
|
345
|
+
let tags = getMpTags().filter(tag => !tag.tag_type || tag.tag_type !== TAG_TYPE.IOT);
|
|
345
346
|
const filteredTags = filterTagList(tags);
|
|
346
347
|
const sortedTags = sortTags(filteredTags ? filteredTags : tags, selectedTagSortOption);
|
|
347
348
|
renderTags(sortedTags);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { ITag, ITagCategory, SortConfig } from "../../../types";
|
|
1
|
+
import { ITag, ITagCategory, SortConfig, TAG_TYPE } from "../../../types";
|
|
2
2
|
import { MpSdk } from "../../../../bundle/sdk";
|
|
3
3
|
export declare let selectedCategoryFilterId: any;
|
|
4
4
|
export declare let selectedSubCategoryFilterId: any;
|
|
5
|
+
export declare let isTagPaneActive: boolean;
|
|
6
|
+
export declare let currentTagPaneMode: TAG_TYPE | null;
|
|
5
7
|
export declare let selectedTagSortOption: SortConfig;
|
|
6
8
|
export declare function renderTagListPane(): HTMLElement;
|
|
7
9
|
export declare function isTagPartOfCategory(categoryUUID: string): boolean;
|
|
8
10
|
export declare function renderTags(tags: Array<ITag>, showOwnTagsOnly?: boolean): void;
|
|
9
|
-
export declare function renderTagRow(tag: MpSdk.Tag.TagData, tagIconUrl: string): HTMLElement;
|
|
11
|
+
export declare function renderTagRow(tag: MpSdk.Tag.TagData, tagIconUrl: string, tag_type?: string): HTMLElement;
|
|
10
12
|
export declare function setTagLink(link: string): void;
|
|
11
13
|
export declare function getTagLink(): void;
|
|
12
14
|
export declare function addClickEventToTagRow(tag: MpSdk.Tag.TagData): void;
|
|
@@ -18,6 +20,9 @@ export declare function getSearchTagTerm(): string;
|
|
|
18
20
|
export declare function searchTagList(tags: Array<ITag>): Array<ITag>;
|
|
19
21
|
export declare function setSearchTagTerm(searchTagName: string): void;
|
|
20
22
|
export declare function searchClearfield(): void;
|
|
23
|
+
export declare function filterIotTagList(tags: Array<ITag>): Array<ITag>;
|
|
24
|
+
export declare function setTagPaneActive(value: boolean): void;
|
|
25
|
+
export declare function setCurrentTagPaneMode(value: TAG_TYPE | null): void;
|
|
21
26
|
export declare const sortTags: (items: ITag[], options: SortConfig) => ITag[];
|
|
22
27
|
export declare function updateSelectedTagSortOption(sortOption: string): void;
|
|
23
28
|
export declare function resetSelectedTagSortOption(): void;
|
|
@@ -7,24 +7,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { SPACE_EVENTS, sortTagOptions } from "../../../types";
|
|
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 } from "../../../architwin";
|
|
13
|
+
import { gotoTag, disposeTag, dispatchSpaceEvent, _tags, getUserAssignedCategories, _mpConfig, moveTag, getAtwinSdk } from "../../../architwin";
|
|
14
14
|
import { initFormData, toggleDropdown } from "./tagFormPane";
|
|
15
15
|
import { toggleModal, setModalAction } from "./modal";
|
|
16
|
+
import { initIoTFormData, setIoTFormMode } from './tagIotFormPane';
|
|
16
17
|
import { Notyf } from 'notyf';
|
|
17
18
|
import { _tagCategories } from "../../../architwin";
|
|
18
19
|
import i18n from './i18n';
|
|
19
20
|
import log from 'loglevel';
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
import { cancelMoveTag } from "../../../tag";
|
|
22
|
+
const notify = new Notyf({
|
|
23
|
+
position: { x: 'left', y: 'bottom' },
|
|
24
|
+
types: [
|
|
25
|
+
{
|
|
26
|
+
type: 'info',
|
|
27
|
+
background: '#3b82f6',
|
|
28
|
+
message: 'white',
|
|
29
|
+
icon: false,
|
|
30
|
+
duration: 3000,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
});
|
|
22
34
|
let _tagLink;
|
|
23
35
|
let isChevronEventAdded = false;
|
|
24
36
|
let allSubcategories = [];
|
|
25
37
|
let tagSearchTerm = '';
|
|
38
|
+
let iotTags = [];
|
|
26
39
|
export let selectedCategoryFilterId = undefined;
|
|
27
40
|
export let selectedSubCategoryFilterId = undefined;
|
|
41
|
+
export let isTagPaneActive = true;
|
|
42
|
+
export let currentTagPaneMode = null;
|
|
28
43
|
export let selectedTagSortOption = { by: 'label', order: 'asc' };
|
|
29
44
|
export function renderTagListPane() {
|
|
30
45
|
const element = document.createElement('div');
|
|
@@ -35,27 +50,27 @@ export function renderTagListPane() {
|
|
|
35
50
|
element.setAttribute('data-cy', 'at-tag-list-pane');
|
|
36
51
|
element.innerHTML = `
|
|
37
52
|
<div class="at_panel_header">
|
|
38
|
-
<span>${i18n.t('Tags')}</span>
|
|
53
|
+
<span id="at-tag-list-title">${i18n.t('Tags')}</span>
|
|
39
54
|
</div>
|
|
40
|
-
<div class="at_form_container
|
|
41
|
-
<div class="at_tags_filter_section">
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</div>
|
|
58
|
-
<div class="at_field at_flex_column" style="${_tagCategories ? '' : 'display: none;'}">
|
|
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">
|
|
64
|
+
<span id="at-tag-sort-options-tooltip" class="at_custom_tooltip">
|
|
65
|
+
<p class="at_tag_sort_option at_sort_option_selected" data-sort="Ascending">${i18n.t('Ascending')}</p>
|
|
66
|
+
<p class="at_tag_sort_option" data-sort="Descending">${i18n.t('Descending')}</p>
|
|
67
|
+
<p class="at_tag_sort_option" data-sort="Newest">${i18n.t('Newest')}</p>
|
|
68
|
+
<p class="at_tag_sort_option" data-sort="Oldest">${i18n.t('Oldest')}</p>
|
|
69
|
+
</span>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="at_field at_flex_column" style="${_tagCategories ? '' : 'display: none;'}" id="at-custom-category-filter-dropdown-container">
|
|
59
74
|
<label for="">${i18n.t('Category')}</label>
|
|
60
75
|
<div id="at-custom-category-filter-dropdown" data-cy="at-custom-category-filter-dropdown">
|
|
61
76
|
<div id="at-category-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
|
|
@@ -69,7 +84,7 @@ export function renderTagListPane() {
|
|
|
69
84
|
</div>
|
|
70
85
|
</div>
|
|
71
86
|
</div>
|
|
72
|
-
<div class="at_field at_flex_column" style="${_tagCategories ? '' : 'display: none;'}">
|
|
87
|
+
<div class="at_field at_flex_column" style="${_tagCategories ? '' : 'display: none;'}" id="at-custom-subcategory-filter-dropdown-container">
|
|
73
88
|
<label for="">${i18n.t('Subcategory')}</label>
|
|
74
89
|
<div id="at-custom-subcategory-filter-dropdown" data-cy="at-custom-subcategory-filter-dropdown">
|
|
75
90
|
<div id="at-subcategory-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
|
|
@@ -84,7 +99,7 @@ export function renderTagListPane() {
|
|
|
84
99
|
</div>
|
|
85
100
|
</div>
|
|
86
101
|
</div>
|
|
87
|
-
<div class="at_scrollable_container at_h-min-45">
|
|
102
|
+
<div class="at_scrollable_container at_h-min-45" id="at-tag-list-scrollable-container">
|
|
88
103
|
<table id="at-tag-list-container">
|
|
89
104
|
</table>
|
|
90
105
|
</div>
|
|
@@ -128,6 +143,7 @@ export function isTagPartOfCategory(categoryUUID) {
|
|
|
128
143
|
}
|
|
129
144
|
export function renderTags(tags, showOwnTagsOnly = false) {
|
|
130
145
|
console.log("renderTags", tags);
|
|
146
|
+
iotTags = tags;
|
|
131
147
|
const tagContainer = document.getElementById('at-tag-list-container');
|
|
132
148
|
// get value from mp config
|
|
133
149
|
const isReadOnly = _mpConfig.restrictionConfig.isTagReadOnly;
|
|
@@ -142,14 +158,16 @@ export function renderTags(tags, showOwnTagsOnly = false) {
|
|
|
142
158
|
}
|
|
143
159
|
tagContainer.innerHTML = ``;
|
|
144
160
|
tags.forEach(tag => {
|
|
161
|
+
console.log('@caroline render tag checking: ', tag);
|
|
145
162
|
if (showOwnTagsOnly) {
|
|
146
163
|
if (isTagPartOfCategory(tag.category_uuid)) {
|
|
147
|
-
const row = renderTagRow(tag.json_data, tag.tag_icon_url);
|
|
164
|
+
const row = renderTagRow(tag.json_data, tag.tag_icon_url, tag.tag_type);
|
|
148
165
|
tagContainer.appendChild(row);
|
|
149
166
|
}
|
|
150
167
|
}
|
|
151
168
|
else {
|
|
152
|
-
|
|
169
|
+
console.log('@caroline render tag checking 2: ', tag);
|
|
170
|
+
const row = renderTagRow(tag.json_data, tag.tag_icon_url, tag.tag_type);
|
|
153
171
|
tagContainer.appendChild(row);
|
|
154
172
|
}
|
|
155
173
|
});
|
|
@@ -161,9 +179,17 @@ export function renderTags(tags, showOwnTagsOnly = false) {
|
|
|
161
179
|
const tag = document.getElementById(event.target.id);
|
|
162
180
|
if (tag) {
|
|
163
181
|
const tagId = tag.getAttribute('tag-id');
|
|
182
|
+
const el = document.getElementById(`at-edit-tag-${tagId}`);
|
|
183
|
+
const targetPane = el.getAttribute('target-pane');
|
|
164
184
|
if (tagId && tagId != null) {
|
|
165
|
-
|
|
166
|
-
|
|
185
|
+
if (targetPane == 'at-tag-iot-form-pane') {
|
|
186
|
+
setIoTFormMode("EDIT" /* FORM_MODE.EDIT */);
|
|
187
|
+
initIoTFormData(tagId);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
initFormData(tagId);
|
|
191
|
+
// setTagCategoriesOption()
|
|
192
|
+
}
|
|
167
193
|
}
|
|
168
194
|
}
|
|
169
195
|
}));
|
|
@@ -230,9 +256,11 @@ export function renderTags(tags, showOwnTagsOnly = false) {
|
|
|
230
256
|
}));
|
|
231
257
|
batchAddEventListenerByClassName('at_tag_row', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
232
258
|
console.log('Event', event);
|
|
233
|
-
|
|
234
|
-
const tagRow =
|
|
235
|
-
|
|
259
|
+
const target = event.target;
|
|
260
|
+
const tagRow = target.closest('.at_tag_row');
|
|
261
|
+
const targetElementId = target.id;
|
|
262
|
+
const isTargetRelocateBtn = targetElementId.startsWith('at-relocate-tag') ? true : false;
|
|
263
|
+
if (tagRow && !isTargetRelocateBtn) {
|
|
236
264
|
const tagId = tagRow.children[1].getAttribute('tag-id');
|
|
237
265
|
if (tagId && tagId != null) {
|
|
238
266
|
yield gotoTag(tagId);
|
|
@@ -254,22 +282,69 @@ export function renderTags(tags, showOwnTagsOnly = false) {
|
|
|
254
282
|
]
|
|
255
283
|
});
|
|
256
284
|
}
|
|
285
|
+
batchAddEventListenerByClassName('at_locate_tag_btn ', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
286
|
+
log.info("event: IoT Relocate", event);
|
|
287
|
+
const relocateTagBtn = event.target;
|
|
288
|
+
const tagId = relocateTagBtn.getAttribute('tag-id');
|
|
289
|
+
const index = _tags.findIndex(tag => tag.json_data.id == tagId);
|
|
290
|
+
_tags[index].uuid = _tags[index].id.toString();
|
|
291
|
+
// Move tag
|
|
292
|
+
moveTag(tagId, () => {
|
|
293
|
+
// save edited tag location
|
|
294
|
+
let payload = { tag: _tags[index] };
|
|
295
|
+
dispatchSpaceEvent(SPACE_EVENTS.IOT_TAG_SAVED, payload);
|
|
296
|
+
notify.success(i18n.t("SuccessUpdateTag"));
|
|
297
|
+
// remove lister right after clicking 'Escape'
|
|
298
|
+
document.removeEventListener('keydown', handleEscKey);
|
|
299
|
+
});
|
|
300
|
+
// notification info to inform the user clicking 'Escape' stops tag relocation
|
|
301
|
+
notify.open({ type: 'info', message: i18n.t('PressEscCancelRelocation') });
|
|
302
|
+
// Escape event listener
|
|
303
|
+
const handleEscKey = (event) => {
|
|
304
|
+
log.info("event: handleEscKey", event);
|
|
305
|
+
// remove lister right after clicking 'Escape'
|
|
306
|
+
document.removeEventListener('keydown', handleEscKey);
|
|
307
|
+
if (event.key === "Escape") {
|
|
308
|
+
cancelMoveTag();
|
|
309
|
+
const sdk = getAtwinSdk();
|
|
310
|
+
if (sdk !== null) {
|
|
311
|
+
sdk.Tag.editPosition(_tags[index].json_data.id, {
|
|
312
|
+
anchorPosition: _tags[index].json_data.anchorPosition,
|
|
313
|
+
stemVector: Object.assign({}, _tags[index].json_data.stemVector),
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
notify.open({ type: 'info', message: i18n.t('MoveTagCancelled') });
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
// Attach it once
|
|
320
|
+
document.addEventListener('keydown', handleEscKey);
|
|
321
|
+
}));
|
|
257
322
|
initDropdownEventListeners();
|
|
258
323
|
}
|
|
259
|
-
export function renderTagRow(tag, tagIconUrl) {
|
|
324
|
+
export function renderTagRow(tag, tagIconUrl, tag_type = null) {
|
|
325
|
+
log.info('@caroline rendertagrow: ', tag);
|
|
260
326
|
const element = document.createElement('tr');
|
|
261
327
|
element.classList.add('at_tag_row'); //this class is not defined and I only use it as an identifier for attaching events
|
|
262
328
|
element.setAttribute('id', `at-tag-row-${tag.id}`);
|
|
263
329
|
element.setAttribute('data-toggle-pane', '');
|
|
330
|
+
log.info("tag_type", tag_type);
|
|
331
|
+
log.info("tagIconUrl", tagIconUrl);
|
|
264
332
|
// element.setAttribute('tag-id',tag.json_data.id)
|
|
265
333
|
// get read only value from mpconfig
|
|
266
334
|
const isTagReadOnly = _mpConfig.restrictionConfig.isTagReadOnly;
|
|
267
335
|
console.log("_isTagReadOnly: ", isTagReadOnly);
|
|
268
336
|
// Displays tag icon with tag color indicator
|
|
269
337
|
const thisTagIconURL = tagIconUrl === 'button.png' || tagIconUrl === '' || tagIconUrl === undefined ? "https://cdn.jsdelivr.net/npm/architwin@latest/static/images/button.png" : tagIconUrl;
|
|
338
|
+
let tagIconIndicatorBg = convertToCssRgb(tag.color);
|
|
339
|
+
let alert_iot_indicator = '';
|
|
340
|
+
if (tag_type === TAG_TYPE.IOT && tagIconUrl.includes('alert.png')) {
|
|
341
|
+
element.classList.add('at_bg_red_850');
|
|
342
|
+
tagIconIndicatorBg = 'hsl(337.56deg 85.62% 30%)';
|
|
343
|
+
alert_iot_indicator = 'at_border_red_800';
|
|
344
|
+
}
|
|
270
345
|
element.innerHTML = `
|
|
271
346
|
<td style="padding-top: 5px;">
|
|
272
|
-
<div class="at_colored-indicator" style="background-color:${
|
|
347
|
+
<div class="at_colored-indicator ${alert_iot_indicator}" style="background-color:${tagIconIndicatorBg}">
|
|
273
348
|
<div class="at_colored-indicator-img" style="background-image: url(${thisTagIconURL});"></div>
|
|
274
349
|
</div>
|
|
275
350
|
</td>
|
|
@@ -277,9 +352,10 @@ export function renderTagRow(tag, tagIconUrl) {
|
|
|
277
352
|
<span>${tag.label}</span>
|
|
278
353
|
</td>
|
|
279
354
|
<td class="at_table_button_row">
|
|
280
|
-
<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
|
|
281
|
-
<span class="mdi mdi-content-copy at_copy_tag_btn ${isTagReadOnly ? 'at_disabled' : ''} id="at-edit-tag-${tag.id}"
|
|
282
|
-
<span class="mdi mdi-message at_message_tag_btn" id="at-message-tag-${tag.id}"
|
|
355
|
+
<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>
|
|
356
|
+
<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>
|
|
357
|
+
<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>
|
|
358
|
+
<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>
|
|
283
359
|
<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>
|
|
284
360
|
</td>
|
|
285
361
|
`;
|
|
@@ -499,6 +575,18 @@ export function searchClearfield() {
|
|
|
499
575
|
tagSearchTerm = '';
|
|
500
576
|
}
|
|
501
577
|
}
|
|
578
|
+
export function filterIotTagList(tags) {
|
|
579
|
+
log.info("filterIotTagList", tags);
|
|
580
|
+
const iotTags = tags.filter((tag) => tag.tag_type === TAG_TYPE.IOT);
|
|
581
|
+
log.info("iotTags", iotTags);
|
|
582
|
+
return iotTags;
|
|
583
|
+
}
|
|
584
|
+
export function setTagPaneActive(value) {
|
|
585
|
+
isTagPaneActive = value;
|
|
586
|
+
}
|
|
587
|
+
export function setCurrentTagPaneMode(value) {
|
|
588
|
+
currentTagPaneMode = value;
|
|
589
|
+
}
|
|
502
590
|
export const sortTags = (items, options) => {
|
|
503
591
|
if (!(items === null || items === void 0 ? void 0 : items.length))
|
|
504
592
|
return [];
|
package/lib/atwinui/events.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ declare function batchAddEventListenerByClassNames(classNames: Array<string>, ca
|
|
|
19
19
|
declare function batchAddEventListenerById(ids: Array<string>, callback: EventListener): void;
|
|
20
20
|
declare function setActiveToolbarItem(itemId: string): void;
|
|
21
21
|
declare function toggleDisplayPane(targetId: string): Promise<void>;
|
|
22
|
+
declare function renderTagPaneContent(): Promise<void>;
|
|
22
23
|
declare function toggleActionBar(state: string): void;
|
|
23
24
|
export declare function handleUserLeaveSessionClick(): void;
|
|
24
25
|
declare function setupIndividualEventListeners(): void;
|
|
@@ -37,12 +38,13 @@ declare function handlePartitionVisibility(targetId: string): Promise<void>;
|
|
|
37
38
|
* Toggles the visibility of the child partitions within a partition tree. (FLOOR and WALLS)
|
|
38
39
|
* @param {string} targetId - ID of the target partition element.
|
|
39
40
|
*/
|
|
40
|
-
declare function handlePolygonVisibility(targetId: string): Promise<
|
|
41
|
+
declare function handlePolygonVisibility(targetId: string): Promise<boolean>;
|
|
41
42
|
declare function handleDeletePartition(targetId: string): void;
|
|
42
43
|
/**
|
|
43
44
|
* Handles the display logic for showing the custom minimap.
|
|
44
45
|
*/
|
|
45
46
|
declare function handleShowCustomMinimap(): void;
|
|
46
|
-
declare function
|
|
47
|
+
declare function handleDisplayElements(id: string): void;
|
|
48
|
+
declare function handleWindowVisibility(visibilityBtn: HTMLElement, updateStateDB: boolean, fromParentVisibilityState?: boolean): Promise<void>;
|
|
47
49
|
declare function clearActivePane(): void;
|
|
48
|
-
export { activeToolbarItem, activeActionItem, cancelModelPlacementPrompt, isCustomMapControlsVisible, pipeColor, batchAddEventListenerById, batchAddEventListenerByClassName, batchAddEventListenerByClassNames, batchAddEventListenerByDataAttribute, setActiveToolbarItem, toggleDisplayPane, toggleActionBar, setupIndividualEventListeners, setupSpaceEventSubscriptions, handleModelVisibility, handleDeleteModel, handleShowMinimap, handleScrollToView, handleRenderMeetingUI, handleShowCustomMinimap, handlePartitionVisibility, handlePolygonVisibility, handleDeletePartition, handleWindowVisibility, clearActivePane };
|
|
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 };
|