architwin 1.18.7 → 1.18.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -290,6 +290,7 @@ i18n
290
290
  "SuccessUpdatedFloorLevel": "Updated the partition's floor level",
291
291
  "DuplicatePartitionName": "This partition name is already used in this room. Please choose a different name.",
292
292
  "PleaseOnPolygonVisibility": "Action cannot be done, please turn on room visibility.",
293
+ "IoTType": "IoT Type"
293
294
  }
294
295
  },
295
296
  ja: {
@@ -574,7 +575,8 @@ i18n
574
575
  "IotCategoryRequired": "IoTカテゴリは必須です",
575
576
  "SuccessUpdatedFloorLevel": "区画のフロアオフセット値が更新されました",
576
577
  "DuplicatePartitionName": "このパーティション名は既にこの部屋で使用されています。別の名前を選択してください。",
577
- "PleaseOnPolygonVisibility": "操作を行う前に、部屋の表示をオンにしてください。"
578
+ "PleaseOnPolygonVisibility": "操作を行う前に、部屋の表示をオンにしてください。",
579
+ "IoTType": "IoTタイプ"
578
580
  }
579
581
  }
580
582
  },
@@ -1,4 +1,4 @@
1
- import { FORM_MODE, ITagCategory } from "../../../types";
1
+ import { FORM_MODE, ITagCategory, ITag } from "../../../types";
2
2
  export declare let tagFormMode: FORM_MODE;
3
3
  export declare let selectedTag: any;
4
4
  export declare function renderTagFormPane(): HTMLDivElement;
@@ -13,6 +13,8 @@ export declare function getTagFormData(): {
13
13
  export declare function setTagCategoriesOption(): void;
14
14
  export declare function toggleDropdown(elementId: string): void;
15
15
  export declare function clearInnerHTML(elementId: string): void;
16
+ export declare function hideTagsFromSpace(tags?: ITag[]): Promise<void>;
17
+ export declare function renderTagsInSpace(tags: ITag[], _withIcon?: boolean, iframeId?: string): Promise<void>;
16
18
  export declare function renderCategoryDropdownOptions(elementId: string, items: Array<ITagCategory>, toggleId?: string): void;
17
19
  export declare function renderSubcategoryDropdownOptions(elementId: string, items: Array<ITagCategory>): void;
18
20
  export declare function clearTagFormDropdown(): void;
@@ -1,8 +1,20 @@
1
- import { _tagCategories, _tags, getMpTags } from "../../../architwin";
2
- import { convertToCssRgb, stringContains } from "../../../utils";
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { _atwin, _atwinConnections, _tagCategories, _tags, attachSandbox, disposeTags, getIoTDeviceTagIcons, getMpTags, renderTag, setTagIcon } from "../../../architwin";
11
+ import { convertToCssRgb, stringContains, useHexToRgb } from "../../../utils";
3
12
  import { TAG_TYPE } from "../../../types";
4
13
  import { renderTags, setSelectedCategoryFilter, setSelectedSubcategoryFilter, filterTagList, getAllSubcategories, selectedCategoryFilterId, sortTags, selectedTagSortOption } from './tagListPane';
5
14
  import i18n from './i18n';
15
+ import log from "loglevel";
16
+ import ShortUniqueId from "short-unique-id";
17
+ import * as _tag from './../../../tag';
6
18
  let mode = 'adding';
7
19
  let tagNameInput, tagDescriptionInput, tagEmbedInput, tagCategoryDropdown, tagSubcategoryDropdown;
8
20
  let selectedCategoryId = undefined;
@@ -261,109 +273,228 @@ export function clearInnerHTML(elementId) {
261
273
  targetElement.innerHTML = ``;
262
274
  }
263
275
  function selectOption(option, elementId, skipToggle = false) {
264
- console.log("selectOption()");
265
- //const dropdownToggle = document.querySelector('.at_dropdown_toggle');
266
- if (!elementId || elementId === '' || elementId == null) {
267
- console.error("ElementId is empty or undefined");
268
- return;
269
- }
270
- const dropdownToggle = document.getElementById(elementId);
271
- //dropdownToggle.textContent = option.textContent;
272
- dropdownToggle.innerHTML = option.innerHTML;
273
- //selectedText = option.textContent;
274
- const isFilterDropdown = stringContains(elementId, 'filter');
275
- const categoryUUID = option.getAttribute('category-uuid');
276
- const categoryType = option.getAttribute('dropdown-type');
277
- console.log("categoryUUID ", categoryUUID);
278
- console.log("categoryType ", categoryType);
279
- if (categoryUUID && categoryUUID !== null) {
280
- if (categoryType == 'category' && isFilterDropdown == false) {
281
- selectedCategoryId = categoryUUID;
282
- }
283
- else if (categoryType == 'category' && isFilterDropdown) {
284
- setSelectedCategoryFilter(categoryUUID);
285
- setSelectedSubcategoryFilter(undefined); //reset selected subcategory
286
- const tags = getMpTags();
287
- const filteredTags = filterTagList(tags);
288
- const sortedTags = sortTags(filteredTags, { by: 'label', order: 'asc' });
289
- renderTags(sortedTags);
290
- }
291
- else if (categoryType == 'subcategory' && isFilterDropdown == false) {
292
- selectedSubCategoryId = categoryUUID;
293
- }
294
- else if (categoryType == 'subcategory' && isFilterDropdown) {
295
- setSelectedSubcategoryFilter(categoryUUID);
296
- const tags = getMpTags();
297
- const filteredTags = filterTagList(tags);
298
- const sortedTags = sortTags(filteredTags, { by: 'label', order: 'asc' });
299
- renderTags(filteredTags);
300
- }
301
- //Populate subcategory dropdown
302
- const targetCategory = _tagCategories.find(cat => cat.uuid === categoryUUID);
303
- if (targetCategory && targetCategory.subcategories && targetCategory.subcategories.length > 0) {
304
- console.log("Subcategories found", targetCategory.subcategories);
305
- renderSubcategoryDropdownOptions(isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options', targetCategory.subcategories);
276
+ var _a;
277
+ return __awaiter(this, void 0, void 0, function* () {
278
+ console.log("selectOption()");
279
+ //const dropdownToggle = document.querySelector('.at_dropdown_toggle');
280
+ if (!elementId || elementId === '' || elementId == null) {
281
+ console.error("ElementId is empty or undefined");
282
+ return;
306
283
  }
307
- else {
308
- if (categoryType == 'category') {
309
- const elementId = isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options';
310
- const subcatToggleId = isFilterDropdown ? 'at-subcategory-filter-dropdown-toggle' : 'at-subcategory-dropdown-toggle';
311
- const subcategoryToggle = document.getElementById(elementId);
312
- const subcatDropdownToggle = document.getElementById(subcatToggleId);
313
- subcategoryToggle.innerHTML = `
284
+ const dropdownToggle = document.getElementById(elementId);
285
+ //dropdownToggle.textContent = option.textContent;
286
+ dropdownToggle.innerHTML = option.innerHTML;
287
+ //selectedText = option.textContent;
288
+ const isFilterDropdown = stringContains(elementId, 'filter');
289
+ const categoryUUID = option.getAttribute('category-uuid');
290
+ const categoryType = option.getAttribute('dropdown-type');
291
+ console.log("categoryUUID ", categoryUUID);
292
+ console.log("categoryType ", categoryType);
293
+ if (categoryUUID && categoryUUID !== null) {
294
+ if (categoryType == 'category' && isFilterDropdown == false) {
295
+ selectedCategoryId = categoryUUID;
296
+ }
297
+ else if (categoryType == 'category' && isFilterDropdown) {
298
+ setSelectedCategoryFilter(categoryUUID);
299
+ setSelectedSubcategoryFilter(undefined); //reset selected subcategory
300
+ const tags = getMpTags();
301
+ const filteredTags = filterTagList(tags);
302
+ const sortedTags = sortTags(filteredTags, { by: 'label', order: 'asc' });
303
+ const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
304
+ // remove tags that is not part in the sorted Tags
305
+ yield hideTagsFromSpace(removeTags);
306
+ // show filtered tags only
307
+ yield renderTagsInSpace(sortedTags, true);
308
+ log.info("sortedTags", sortedTags);
309
+ renderTags(sortedTags);
310
+ }
311
+ else if (categoryType == 'subcategory' && isFilterDropdown == false) {
312
+ selectedSubCategoryId = categoryUUID;
313
+ }
314
+ else if (categoryType == 'subcategory' && isFilterDropdown) {
315
+ setSelectedSubcategoryFilter(categoryUUID);
316
+ const tags = getMpTags();
317
+ const filteredTags = filterTagList(tags);
318
+ const sortedTags = sortTags(filteredTags, { by: 'label', order: 'asc' });
319
+ const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
320
+ // remove tags that is not part in the sorted Tags
321
+ yield hideTagsFromSpace(removeTags);
322
+ // show filtered tags only
323
+ yield renderTagsInSpace(filteredTags, true);
324
+ renderTags(filteredTags);
325
+ }
326
+ //Populate subcategory dropdown
327
+ const targetCategory = _tagCategories.find(cat => cat.uuid === categoryUUID);
328
+ if (targetCategory && targetCategory.subcategories && targetCategory.subcategories.length > 0) {
329
+ console.log("Subcategories found", targetCategory.subcategories);
330
+ renderSubcategoryDropdownOptions(isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options', targetCategory.subcategories);
331
+ }
332
+ else {
333
+ if (categoryType == 'category') {
334
+ const elementId = isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options';
335
+ const subcatToggleId = isFilterDropdown ? 'at-subcategory-filter-dropdown-toggle' : 'at-subcategory-dropdown-toggle';
336
+ const subcategoryToggle = document.getElementById(elementId);
337
+ const subcatDropdownToggle = document.getElementById(subcatToggleId);
338
+ subcategoryToggle.innerHTML = `
314
339
  <span class="mdi mdi-circle-slice-1"></span> ${i18n.t('NoSelection')}
315
340
  `;
316
- subcatDropdownToggle.innerHTML = `
341
+ subcatDropdownToggle.innerHTML = `
317
342
  <span class="mdi mdi-circle-slice-1"></span> ${i18n.t('NoSelection')}
318
343
  `;
344
+ }
319
345
  }
320
346
  }
321
- }
322
- else {
323
- console.log("categoryUUID is undefined");
324
- if (categoryType == 'category' && isFilterDropdown) {
325
- console.log("Clearing subcategory filter");
326
- const subcategoryToggle = document.getElementById('at-subcategory-filter-dropdown-toggle');
327
- subcategoryToggle.textContent = `${i18n.t('NoSelection')}`;
328
- subcategoryToggle.innerHTML = `
347
+ else {
348
+ console.log("categoryUUID is undefined");
349
+ if (categoryType == 'category' && isFilterDropdown) {
350
+ console.log("Clearing subcategory filter");
351
+ const subcategoryToggle = document.getElementById('at-subcategory-filter-dropdown-toggle');
352
+ subcategoryToggle.textContent = `${i18n.t('NoSelection')}`;
353
+ subcategoryToggle.innerHTML = `
329
354
  <span class="mdi mdi-circle-slice-1"></span> ${i18n.t('NoSelection')}
330
355
  `;
331
- setSelectedCategoryFilter(undefined);
356
+ setSelectedCategoryFilter(undefined);
357
+ }
358
+ if (isFilterDropdown) {
359
+ setSelectedSubcategoryFilter(undefined); //reset selected subcategory
360
+ }
361
+ //Populate subcategory dropdown
362
+ const targetCategory = _tagCategories.find(cat => cat.uuid === selectedCategoryFilterId);
363
+ if (targetCategory && targetCategory.subcategories && targetCategory.subcategories.length > 0) {
364
+ console.log("Subcategories found", targetCategory.subcategories);
365
+ renderSubcategoryDropdownOptions(isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options', targetCategory.subcategories);
366
+ }
367
+ else {
368
+ const elementId = isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options';
369
+ clearInnerHTML(elementId);
370
+ }
371
+ let tags = getMpTags().filter(tag => !tag.tag_type || tag.tag_type !== TAG_TYPE.IOT);
372
+ const filteredTags = (_a = filterTagList(tags)) !== null && _a !== void 0 ? _a : [];
373
+ const sortedTags = sortTags(filteredTags.length ? filteredTags : tags, selectedTagSortOption);
374
+ const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
375
+ if (filteredTags.length > 0) {
376
+ // remove tags that is not part in the sorted Tags
377
+ yield hideTagsFromSpace(removeTags);
378
+ }
379
+ // show filtered tags only
380
+ yield renderTagsInSpace(sortedTags, true);
381
+ renderTags(sortedTags);
382
+ }
383
+ let toggleId = '';
384
+ if (elementId === 'at-category-dropdown-toggle') {
385
+ toggleId = 'at-category-options';
386
+ }
387
+ else if (elementId === 'at-subcategory-dropdown-toggle') {
388
+ toggleId = 'at-subcategory-options';
389
+ }
390
+ else if (elementId === 'at-category-filter-dropdown-toggle') {
391
+ toggleId = 'at-category-filter-options';
332
392
  }
333
- if (isFilterDropdown) {
334
- setSelectedSubcategoryFilter(undefined); //reset selected subcategory
393
+ else if (elementId === 'at-subcategory-filter-dropdown-toggle') {
394
+ toggleId = 'at-subcategory-filter-options';
335
395
  }
336
- //Populate subcategory dropdown
337
- const targetCategory = _tagCategories.find(cat => cat.uuid === selectedCategoryFilterId);
338
- if (targetCategory && targetCategory.subcategories && targetCategory.subcategories.length > 0) {
339
- console.log("Subcategories found", targetCategory.subcategories);
340
- renderSubcategoryDropdownOptions(isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options', targetCategory.subcategories);
396
+ if (skipToggle == false) {
397
+ toggleDropdown(toggleId);
398
+ }
399
+ });
400
+ }
401
+ export function hideTagsFromSpace(tags = null) {
402
+ return __awaiter(this, void 0, void 0, function* () {
403
+ log.info('hideTagsFromSpace', tags);
404
+ if (tags != null) {
405
+ tags.map((tag) => __awaiter(this, void 0, void 0, function* () {
406
+ yield _tag.disposeTag({ tagId: tag.json_data.id, sdk: _atwin, tags: _tags });
407
+ }));
341
408
  }
342
409
  else {
343
- const elementId = isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options';
344
- clearInnerHTML(elementId);
410
+ disposeTags();
345
411
  }
346
- let tags = getMpTags().filter(tag => !tag.tag_type || tag.tag_type !== TAG_TYPE.IOT);
347
- const filteredTags = filterTagList(tags);
348
- const sortedTags = sortTags(filteredTags ? filteredTags : tags, selectedTagSortOption);
349
- renderTags(sortedTags);
350
- }
351
- let toggleId = '';
352
- if (elementId === 'at-category-dropdown-toggle') {
353
- toggleId = 'at-category-options';
354
- }
355
- else if (elementId === 'at-subcategory-dropdown-toggle') {
356
- toggleId = 'at-subcategory-options';
357
- }
358
- else if (elementId === 'at-category-filter-dropdown-toggle') {
359
- toggleId = 'at-category-filter-options';
360
- }
361
- else if (elementId === 'at-subcategory-filter-dropdown-toggle') {
362
- toggleId = 'at-subcategory-filter-options';
363
- }
364
- if (skipToggle == false) {
365
- toggleDropdown(toggleId);
366
- }
412
+ });
413
+ }
414
+ // render tags to space
415
+ export function renderTagsInSpace(tags, _withIcon = false, iframeId = undefined) {
416
+ var _a;
417
+ return __awaiter(this, void 0, void 0, function* () {
418
+ log.info('renderTagsInSpace', tags);
419
+ let renderedTagIds = [];
420
+ const sdk = iframeId ? _atwinConnections[iframeId] : _atwin;
421
+ for (let tag of tags) {
422
+ log.info('tag', tag);
423
+ const isDuplicate = renderedTagIds.includes(tag.json_data.id);
424
+ const rsid = new ShortUniqueId({ length: 10 });
425
+ if (isDuplicate) {
426
+ //assign a different unique id if the existing tag id is a duplicate
427
+ tag.json_data.id = rsid.rnd();
428
+ }
429
+ renderedTagIds.push(tag.json_data.id);
430
+ try {
431
+ const renderedTag = yield renderTag({ tag: tag.json_data }, false, iframeId);
432
+ }
433
+ catch (error) {
434
+ log.info("Tag is already rendered in space");
435
+ continue;
436
+ }
437
+ // check if tag needs tag icon display
438
+ if (_withIcon && tag.tag_icon_base64 !== '') {
439
+ // set tag icon
440
+ log.info("__@ showTags: ", tags);
441
+ yield setTagIcon({ tag: tag.json_data, iconName: tag.tag_icon_name, iconUrl: tag.tag_icon_base64, color: tag.json_data.color, iframeId });
442
+ }
443
+ if (tag.media_url && tag.media_url !== '') {
444
+ try {
445
+ const attachments = [tag.media_url];
446
+ yield _tag.attachTagMedia({ sdk, tag: tag.json_data, attachments });
447
+ }
448
+ catch (error) {
449
+ log.warn(error);
450
+ }
451
+ }
452
+ if (tag.sandboxId) {
453
+ try {
454
+ yield attachSandbox({ sandboxId: tag.sandboxId, tagIds: [tag.json_data.id] });
455
+ }
456
+ catch (error) {
457
+ log.error("Attach sandbox error ", error);
458
+ }
459
+ }
460
+ if (tag.tag_type === TAG_TYPE.IOT) {
461
+ const icons = getIoTDeviceTagIcons();
462
+ let iconUrl = icons.normal;
463
+ let iconName = "normal.png";
464
+ let color = { r: 0.3, g: 0.5, b: 1.0 }; // default soft royal blue
465
+ for (const device of tag.iot_tag.linked_devices) {
466
+ if (!device)
467
+ continue;
468
+ const { quality, status } = device;
469
+ // If any device is offline, override color to gray and stop checking further
470
+ if (status === "offline") {
471
+ iconUrl = icons.normal;
472
+ iconName = "normal.png";
473
+ color = useHexToRgb("667c89"); // gray
474
+ break;
475
+ }
476
+ // If any device is alert (highest priority), set red and stop
477
+ if (quality === 2) {
478
+ iconUrl = icons.alert;
479
+ iconName = "alert.png";
480
+ color = { r: 1, g: 0, b: 0 }; // red
481
+ break;
482
+ }
483
+ // If any device is attention, set orange but keep checking in case of alert
484
+ if (quality === 3) {
485
+ iconUrl = icons.alert;
486
+ iconName = "normal.png";
487
+ color = useHexToRgb("ffae42"); // orange
488
+ // continue loop to see if alert is present
489
+ }
490
+ }
491
+ tag.tag_icon_url = iconUrl;
492
+ tag.tag_icon_name = iconName;
493
+ tag.json_data.color = color;
494
+ yield setTagIcon({ tag: tag.json_data, iconName: (_a = tag.tag_icon_base64) !== null && _a !== void 0 ? _a : '', iconUrl: tag.tag_icon_url, color: tag.json_data.color });
495
+ }
496
+ }
497
+ });
367
498
  }
368
499
  function createOptionElement(item, dropdownType) {
369
500
  console.log("createOptionElement");
@@ -51,7 +51,7 @@ export function renderTagIOTFormPane() {
51
51
  </div>
52
52
  </div>
53
53
 
54
- <label for="">${i18n.t('Category')}</label>
54
+ <label for="">${i18n.t('IoTType')}</label>
55
55
  <div id="at-iot-category-dropdown" data-cy="at-iot-category-dropdown">
56
56
  <div id="at-iot-cat-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
57
57
  <div class="at_dropdown_toggle" id="at-iot-selected-cat" data-cy="at-iot-selected-cat">${i18n.t(selectedIoTCatOption)}</div>
@@ -32,6 +32,6 @@ export declare function initializeTagVisibility(): void;
32
32
  export declare function updateShowAllButton(): void;
33
33
  export declare function clearTagVisibilityStorage(): void;
34
34
  export declare function setIotCategoryFilterOptions(): void;
35
- export declare function filterIotTagByCategory(tags: ITag[]): void;
35
+ export declare function filterIotTagByCategory(tags: ITag[]): Promise<void>;
36
36
  export declare function setSelectedIoTCategoryFilter(payload: ITagIOTCategory): void;
37
37
  export declare function renderIotCategoryDropdownFilterOptions(elementId: string, items: Array<ITagIOTCategory>): void;
@@ -11,7 +11,7 @@ import { SPACE_EVENTS, sortTagOptions, TAG_TYPE } from "../../../types";
11
11
  import { batchAddEventListenerByClassName, toggleDisplayPane, batchAddEventListenerByDataAttribute } from "../../events";
12
12
  import { convertToCssRgb, getBundleVersion, stringContains } from "../../../utils";
13
13
  import { gotoTag, disposeTag, dispatchSpaceEvent, _tags, getUserAssignedCategories, _mpConfig, moveTag, getAtwinSdk, toggleVisibilityTag, _tagIotCategoryTypes } from "../../../architwin";
14
- import { initFormData, toggleDropdown } from "./tagFormPane";
14
+ import { hideTagsFromSpace, initFormData, renderTagsInSpace, toggleDropdown } from "./tagFormPane";
15
15
  import { toggleModal, setModalAction } from "./modal";
16
16
  import { initIoTFormData, setIoTFormMode } from './tagIotFormPane';
17
17
  import { Notyf } from 'notyf';
@@ -121,7 +121,7 @@ export function renderTagListPane() {
121
121
  </div>
122
122
 
123
123
  <div class="at_field at_flex_column" id="at-custom-iot-category-filter-dropdown-container">
124
- <label for="">${i18n.t('Category')}</label>
124
+ <label for="">${i18n.t('IoTType')}</label>
125
125
  <div id="at-custom-iot-category-filter-dropdown" data-cy="at-custom-iot-category-filterdropdown">
126
126
  <div id="at-custom-iot-cat-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
127
127
  <div class="at_dropdown_toggle" id="at-custom-iot-selected-filter-category" data-cy="at-custom-iot-selected-filter-category">${i18n.t('NoSelection')}</div>
@@ -853,7 +853,7 @@ export function setIotCategoryFilterOptions() {
853
853
  log.info('setIotCategoryOptions()');
854
854
  if (_tagIotCategoryTypes) {
855
855
  renderIotCategoryDropdownFilterOptions('at-iot-category-filter-options', _tagIotCategoryTypes);
856
- batchAddEventListenerByClassName('at_iot_cat_filter_option', (event) => {
856
+ batchAddEventListenerByClassName('at_iot_cat_filter_option', (event) => __awaiter(this, void 0, void 0, function* () {
857
857
  log.info("category filter clicked");
858
858
  //@ts-ignore
859
859
  const selectedCat = event.target;
@@ -863,6 +863,7 @@ export function setIotCategoryFilterOptions() {
863
863
  // no selection selected
864
864
  selectedIoTCategoryFilter = { uuid: '', name: 'NoSelection' };
865
865
  setSelectedIoTCategoryFilter(selectedIoTCategoryFilter);
866
+ yield renderTagsInSpace(iotTags, true);
866
867
  renderTags(iotTags);
867
868
  }
868
869
  const getCatName = _tagIotCategoryTypes.find(cat => cat.uuid === catUUID);
@@ -873,13 +874,18 @@ export function setIotCategoryFilterOptions() {
873
874
  filterIotTagByCategory(iotTags);
874
875
  }
875
876
  toggleDropdown('at-iot-category-filter-options');
876
- });
877
+ }));
877
878
  }
878
879
  }
879
880
  export function filterIotTagByCategory(tags) {
880
- log.info("selectedIoTCategoryFilter", selectedIoTCategoryFilter, _tags);
881
- const filteredTags = tags.filter(tag => tag.iot_tag.iot_category == selectedIoTCategoryFilter.name);
882
- renderTags(filteredTags);
881
+ return __awaiter(this, void 0, void 0, function* () {
882
+ log.info("selectedIoTCategoryFilter", selectedIoTCategoryFilter, _tags);
883
+ const filteredTags = tags.filter(tag => tag.iot_tag.iot_category == selectedIoTCategoryFilter.name);
884
+ const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.IOT);
885
+ yield hideTagsFromSpace(removeTags);
886
+ yield renderTagsInSpace(filteredTags, true);
887
+ renderTags(filteredTags);
888
+ });
883
889
  }
884
890
  // displays selected Category in the dropdown
885
891
  export function setSelectedIoTCategoryFilter(payload) {
@@ -14,7 +14,7 @@ import { getTargetPosition, addMediaScreen, _3DXObjects, selectedObject, setTran
14
14
  import { Notyf } from 'notyf';
15
15
  import 'notyf/notyf.min.css';
16
16
  import { SPACE_EVENTS, COORDINATE_SYSTEM, UNITS, DEGREE, MAP_OPTIONS, sortTagOptions, sortObjectOptions, CUSTOM_MAP_MODE, TAG_TYPE } from "../types";
17
- import { initFormData, setTagFormMode } from "./components/toolbar/tagFormPane";
17
+ import { initFormData, hideTagsFromSpace, renderTagsInSpace, setTagFormMode } from "./components/toolbar/tagFormPane";
18
18
  import { renderObjectList, resetSelectedObjectSortOption, selectedObjectSortOption, sortShowcaseObjects, updateSelectedObjectSortOption } from "./components/toolbar/objectListPane";
19
19
  import { renderLibraryList } from "./components/toolbar/libraryPane";
20
20
  import { renderObjectCard } from "./components/toolbar/card";
@@ -3281,37 +3281,35 @@ function handleClearSearchTagName() {
3281
3281
  log.info('handleClearSearchTagName()');
3282
3282
  const searchTagName = document.getElementById('at-clear-search-tag-name');
3283
3283
  if (searchTagName) {
3284
- searchTagName.addEventListener('click', () => {
3284
+ searchTagName.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
3285
3285
  searchClearfield();
3286
3286
  // commented out due to iot Dummy Data
3287
3287
  // const tags = getMpTags()
3288
3288
  const tags = [..._tags];
3289
- const filteredTags = filterTagList(tags);
3290
3289
  if (selectedCategoryFilterId || selectedSubCategoryFilterId && isTagPaneActive) {
3291
- const filteredTags = filterTagList(tags);
3290
+ const filteredTags = filterTagList(tags).filter(tag => tag.tag_type === TAG_TYPE.MP);
3291
+ // show filtered tags only
3292
+ yield renderTagsInSpace(filteredTags, true);
3292
3293
  renderTags(filteredTags);
3293
3294
  }
3294
3295
  else if (tags.length > 0 && isTagPaneActive) {
3295
- renderTags(tags, true);
3296
+ const filteredMPTags = tags.filter(tag => tag.tag_type === TAG_TYPE.MP);
3297
+ yield renderTagsInSpace(filteredMPTags, true);
3298
+ renderTags(filteredMPTags, true);
3296
3299
  }
3297
3300
  else if (!isTagPaneActive) {
3298
3301
  const filteredIotTags = filterIotTagList(tags);
3302
+ yield renderTagsInSpace(filteredIotTags, true);
3299
3303
  renderTags(filteredIotTags);
3300
- // if (selectedCategoryFilterId || selectedSubCategoryFilterId) {
3301
- // const sortedTags = sortTags(filteredTags, {by: 'label', order: 'asc'})
3302
- // renderTags(sortedTags)
3303
- // } else if (tags.length > 0) {
3304
- // const sortedTags = sortTags(tags, {by: 'label', order: 'asc'})
3305
- // renderTags(sortedTags,true)
3306
3304
  }
3307
- });
3305
+ }));
3308
3306
  }
3309
3307
  }
3310
3308
  function handleSearchFromTagListButton() {
3311
3309
  log.info('handleSearchFromTagListButton()');
3312
3310
  const searchTagNameButton = document.getElementById('at-search-tag-button');
3313
3311
  if (searchTagNameButton) {
3314
- searchTagNameButton.addEventListener('click', () => {
3312
+ searchTagNameButton.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
3315
3313
  const tags = getMpTags();
3316
3314
  const tagSearch = getSearchTagTerm();
3317
3315
  if (tagSearch) {
@@ -3321,18 +3319,36 @@ function handleSearchFromTagListButton() {
3321
3319
  if (foundTag) {
3322
3320
  if (selectedCategoryFilterId || selectedSubCategoryFilterId && isTagPaneActive) {
3323
3321
  const filteredTags = filterTagList(foundTag);
3322
+ const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
3323
+ log.info("removeTags", removeTags);
3324
+ // remove tags that is not part in the sorted Tags
3325
+ yield hideTagsFromSpace(removeTags);
3326
+ // show filtered tags only
3327
+ yield renderTagsInSpace(filteredTags, true);
3324
3328
  renderTags(filteredTags);
3325
3329
  }
3326
3330
  else if (foundTag.length > 0 && isTagPaneActive) {
3331
+ const removeTags = tags.filter(tag => !foundTag.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
3332
+ log.info("removeTags", removeTags);
3333
+ // remove tags that is not part in the sorted Tags
3334
+ yield hideTagsFromSpace(removeTags);
3335
+ // show filtered tags only
3336
+ yield renderTagsInSpace(foundTag, true);
3327
3337
  renderTags(foundTag, true);
3328
3338
  }
3329
3339
  else if (!isTagPaneActive) {
3330
3340
  const filteredIotTags = filterIotTagList(foundTag);
3341
+ const removeTags = tags.filter(tag => !filteredIotTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.IOT);
3342
+ log.info("removeTags", removeTags);
3343
+ // remove tags that is not part in the sorted Tags
3344
+ yield hideTagsFromSpace(removeTags);
3345
+ // show filtered tags only
3346
+ yield renderTagsInSpace(filteredIotTags, true);
3331
3347
  renderTags(filteredIotTags);
3332
3348
  }
3333
3349
  }
3334
3350
  }
3335
- });
3351
+ }));
3336
3352
  }
3337
3353
  }
3338
3354
  function handleCustomMapFloorImageUploaded(payload) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.18.7",
3
+ "version": "1.18.8",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",