architwin 1.19.0 → 1.19.2
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.js +1 -1
- package/lib/atwinui/components/toolbar/i18n.js +9 -7
- package/lib/atwinui/components/toolbar/tagFormPane.d.ts +3 -1
- package/lib/atwinui/components/toolbar/tagFormPane.js +126 -5
- package/lib/atwinui/components/toolbar/tagIotFormPane.js +1 -1
- package/lib/atwinui/components/toolbar/tagListPane.d.ts +1 -1
- package/lib/atwinui/components/toolbar/tagListPane.js +15 -9
- package/lib/atwinui/events.js +36 -16
- package/lib/tag.js +6 -4
- package/package.json +1 -1
|
@@ -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
|
"ImportMTagHeader": "Import Mattertags",
|
|
294
295
|
"ImportMTButton": "Import",
|
|
295
296
|
"ImportMTagInfo": "Importing the same tags more than once from your Matterport Space will cause duplicates",
|
|
@@ -582,13 +583,14 @@ i18n
|
|
|
582
583
|
"SuccessUpdatedFloorLevel": "区画のフロアオフセット値が更新されました",
|
|
583
584
|
"DuplicatePartitionName": "このパーティション名は既にこの部屋で使用されています。別の名前を選択してください。",
|
|
584
585
|
"PleaseOnPolygonVisibility": "操作を行う前に、部屋の表示をオンにしてください。",
|
|
585
|
-
"
|
|
586
|
-
"
|
|
587
|
-
"
|
|
588
|
-
"
|
|
589
|
-
"
|
|
590
|
-
"
|
|
591
|
-
"
|
|
586
|
+
"IoTType": "IoTタイプ",
|
|
587
|
+
"ImportMTagHeader": "Mattertagsインポート",
|
|
588
|
+
"ImportMTButton": "インポート",
|
|
589
|
+
"ImportMTagInfo": "Matterportから複数回インポートすると、タグの重複が発生します。",
|
|
590
|
+
"ImportResultPartial": "{{errorCount}}個のタグのインポートに失敗しました",
|
|
591
|
+
"ImportResultNone": "タグのインポートに失敗しました",
|
|
592
|
+
"ImportResultSuccess": "{{count}}個のタグのインポートに成功しました",
|
|
593
|
+
"NothingToImport": "インポートするタグがありませんでした"
|
|
592
594
|
}
|
|
593
595
|
}
|
|
594
596
|
},
|
|
@@ -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 let originalTagBackup: any;
|
|
@@ -14,6 +14,8 @@ export declare function getTagFormData(): {
|
|
|
14
14
|
export declare function setTagCategoriesOption(): void;
|
|
15
15
|
export declare function toggleDropdown(elementId: string): void;
|
|
16
16
|
export declare function clearInnerHTML(elementId: string): void;
|
|
17
|
+
export declare function hideTagsFromSpace(tags?: ITag[]): Promise<void>;
|
|
18
|
+
export declare function renderTagsInSpace(tags: ITag[], _withIcon?: boolean, iframeId?: string): Promise<void>;
|
|
17
19
|
export declare function renderCategoryDropdownOptions(elementId: string, items: Array<ITagCategory>, toggleId?: string): void;
|
|
18
20
|
export declare function renderSubcategoryDropdownOptions(elementId: string, items: Array<ITagCategory>): void;
|
|
19
21
|
export declare function clearTagFormDropdown(): void;
|
|
@@ -7,11 +7,14 @@ 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 { _atwin, _tagCategories, _tags, editTagColor, getMpTags } from "../../../architwin";
|
|
11
|
-
import { convertToCssRgb, stringContains } from "../../../utils";
|
|
10
|
+
import { _atwin, _atwinConnections, _tagCategories, _tags, editTagColor, attachSandbox, disposeTags, getIoTDeviceTagIcons, getMpTags, renderTag, setTagIcon } from "../../../architwin";
|
|
11
|
+
import { convertToCssRgb, stringContains, useHexToRgb } from "../../../utils";
|
|
12
12
|
import { TAG_TYPE } from "../../../types";
|
|
13
13
|
import { renderTags, setSelectedCategoryFilter, setSelectedSubcategoryFilter, filterTagList, getAllSubcategories, selectedCategoryFilterId, sortTags, selectedTagSortOption } from './tagListPane';
|
|
14
14
|
import i18n from './i18n';
|
|
15
|
+
import log from "loglevel";
|
|
16
|
+
import ShortUniqueId from "short-unique-id";
|
|
17
|
+
import * as _tag from './../../../tag';
|
|
15
18
|
let mode = 'adding';
|
|
16
19
|
let tagNameInput, tagDescriptionInput, tagEmbedInput, tagCategoryDropdown, tagSubcategoryDropdown;
|
|
17
20
|
let selectedCategoryId = undefined;
|
|
@@ -177,7 +180,8 @@ export function getTagFormData() {
|
|
|
177
180
|
}
|
|
178
181
|
if (tagNameInput) {
|
|
179
182
|
const tagName = tagNameInput.value;
|
|
180
|
-
const tagDescription = tagDescriptionInput.value
|
|
183
|
+
const tagDescription = tagDescriptionInput.value;
|
|
184
|
+
//const tagDescription = tagDescriptionInput.value.split('\n')[0]
|
|
181
185
|
const tagEmbed = tagEmbedInput.value;
|
|
182
186
|
const formData = {
|
|
183
187
|
tagName: tagName,
|
|
@@ -269,6 +273,7 @@ export function clearInnerHTML(elementId) {
|
|
|
269
273
|
targetElement.innerHTML = ``;
|
|
270
274
|
}
|
|
271
275
|
function selectOption(option, elementId, skipToggle = false) {
|
|
276
|
+
var _a;
|
|
272
277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
273
278
|
console.log("selectOption()");
|
|
274
279
|
//const dropdownToggle = document.querySelector('.at_dropdown_toggle');
|
|
@@ -295,6 +300,12 @@ function selectOption(option, elementId, skipToggle = false) {
|
|
|
295
300
|
const tags = getMpTags();
|
|
296
301
|
const filteredTags = filterTagList(tags);
|
|
297
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);
|
|
298
309
|
renderTags(sortedTags);
|
|
299
310
|
}
|
|
300
311
|
else if (categoryType == 'subcategory' && isFilterDropdown == false) {
|
|
@@ -314,6 +325,11 @@ function selectOption(option, elementId, skipToggle = false) {
|
|
|
314
325
|
const tags = getMpTags();
|
|
315
326
|
const filteredTags = filterTagList(tags);
|
|
316
327
|
const sortedTags = sortTags(filteredTags, { by: 'label', order: 'asc' });
|
|
328
|
+
const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
|
|
329
|
+
// remove tags that is not part in the sorted Tags
|
|
330
|
+
yield hideTagsFromSpace(removeTags);
|
|
331
|
+
// show filtered tags only
|
|
332
|
+
yield renderTagsInSpace(filteredTags, true);
|
|
317
333
|
renderTags(filteredTags);
|
|
318
334
|
}
|
|
319
335
|
//Populate subcategory dropdown
|
|
@@ -362,8 +378,15 @@ function selectOption(option, elementId, skipToggle = false) {
|
|
|
362
378
|
clearInnerHTML(elementId);
|
|
363
379
|
}
|
|
364
380
|
let tags = getMpTags().filter(tag => !tag.tag_type || tag.tag_type !== TAG_TYPE.IOT);
|
|
365
|
-
const filteredTags = filterTagList(tags);
|
|
366
|
-
const sortedTags = sortTags(filteredTags ? filteredTags : tags, selectedTagSortOption);
|
|
381
|
+
const filteredTags = (_a = filterTagList(tags)) !== null && _a !== void 0 ? _a : [];
|
|
382
|
+
const sortedTags = sortTags(filteredTags.length ? filteredTags : tags, selectedTagSortOption);
|
|
383
|
+
const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
|
|
384
|
+
if (filteredTags.length > 0) {
|
|
385
|
+
// remove tags that is not part in the sorted Tags
|
|
386
|
+
yield hideTagsFromSpace(removeTags);
|
|
387
|
+
}
|
|
388
|
+
// show filtered tags only
|
|
389
|
+
yield renderTagsInSpace(sortedTags, true);
|
|
367
390
|
renderTags(sortedTags);
|
|
368
391
|
}
|
|
369
392
|
let toggleId = '';
|
|
@@ -384,6 +407,104 @@ function selectOption(option, elementId, skipToggle = false) {
|
|
|
384
407
|
}
|
|
385
408
|
});
|
|
386
409
|
}
|
|
410
|
+
export function hideTagsFromSpace(tags = null) {
|
|
411
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
412
|
+
log.info('hideTagsFromSpace', tags);
|
|
413
|
+
if (tags != null) {
|
|
414
|
+
tags.map((tag) => __awaiter(this, void 0, void 0, function* () {
|
|
415
|
+
yield _tag.disposeTag({ tagId: tag.json_data.id, sdk: _atwin, tags: _tags });
|
|
416
|
+
}));
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
disposeTags();
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
// render tags to space
|
|
424
|
+
export function renderTagsInSpace(tags, _withIcon = false, iframeId = undefined) {
|
|
425
|
+
var _a;
|
|
426
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
427
|
+
log.info('renderTagsInSpace', tags);
|
|
428
|
+
let renderedTagIds = [];
|
|
429
|
+
const sdk = iframeId ? _atwinConnections[iframeId] : _atwin;
|
|
430
|
+
for (let tag of tags) {
|
|
431
|
+
log.info('tag', tag);
|
|
432
|
+
const isDuplicate = renderedTagIds.includes(tag.json_data.id);
|
|
433
|
+
const rsid = new ShortUniqueId({ length: 10 });
|
|
434
|
+
if (isDuplicate) {
|
|
435
|
+
//assign a different unique id if the existing tag id is a duplicate
|
|
436
|
+
tag.json_data.id = rsid.rnd();
|
|
437
|
+
}
|
|
438
|
+
renderedTagIds.push(tag.json_data.id);
|
|
439
|
+
try {
|
|
440
|
+
const renderedTag = yield renderTag({ tag: tag.json_data }, false, iframeId);
|
|
441
|
+
}
|
|
442
|
+
catch (error) {
|
|
443
|
+
log.info("Tag is already rendered in space");
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
// check if tag needs tag icon display
|
|
447
|
+
if (_withIcon && tag.tag_icon_base64 !== '') {
|
|
448
|
+
// set tag icon
|
|
449
|
+
log.info("__@ showTags: ", tags);
|
|
450
|
+
yield setTagIcon({ tag: tag.json_data, iconName: tag.tag_icon_name, iconUrl: tag.tag_icon_base64, color: tag.json_data.color, iframeId });
|
|
451
|
+
}
|
|
452
|
+
if (tag.media_url && tag.media_url !== '') {
|
|
453
|
+
try {
|
|
454
|
+
const attachments = [tag.media_url];
|
|
455
|
+
yield _tag.attachTagMedia({ sdk, tag: tag.json_data, attachments });
|
|
456
|
+
}
|
|
457
|
+
catch (error) {
|
|
458
|
+
log.warn(error);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
if (tag.sandboxId) {
|
|
462
|
+
try {
|
|
463
|
+
yield attachSandbox({ sandboxId: tag.sandboxId, tagIds: [tag.json_data.id] });
|
|
464
|
+
}
|
|
465
|
+
catch (error) {
|
|
466
|
+
log.error("Attach sandbox error ", error);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
if (tag.tag_type === TAG_TYPE.IOT) {
|
|
470
|
+
const icons = getIoTDeviceTagIcons();
|
|
471
|
+
let iconUrl = icons.normal;
|
|
472
|
+
let iconName = "normal.png";
|
|
473
|
+
let color = { r: 0.3, g: 0.5, b: 1.0 }; // default soft royal blue
|
|
474
|
+
for (const device of tag.iot_tag.linked_devices) {
|
|
475
|
+
if (!device)
|
|
476
|
+
continue;
|
|
477
|
+
const { quality, status } = device;
|
|
478
|
+
// If any device is offline, override color to gray and stop checking further
|
|
479
|
+
if (status === "offline") {
|
|
480
|
+
iconUrl = icons.normal;
|
|
481
|
+
iconName = "normal.png";
|
|
482
|
+
color = useHexToRgb("667c89"); // gray
|
|
483
|
+
break;
|
|
484
|
+
}
|
|
485
|
+
// If any device is alert (highest priority), set red and stop
|
|
486
|
+
if (quality === 2) {
|
|
487
|
+
iconUrl = icons.alert;
|
|
488
|
+
iconName = "alert.png";
|
|
489
|
+
color = { r: 1, g: 0, b: 0 }; // red
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
// If any device is attention, set orange but keep checking in case of alert
|
|
493
|
+
if (quality === 3) {
|
|
494
|
+
iconUrl = icons.alert;
|
|
495
|
+
iconName = "normal.png";
|
|
496
|
+
color = useHexToRgb("ffae42"); // orange
|
|
497
|
+
// continue loop to see if alert is present
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
tag.tag_icon_url = iconUrl;
|
|
501
|
+
tag.tag_icon_name = iconName;
|
|
502
|
+
tag.json_data.color = color;
|
|
503
|
+
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 });
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
}
|
|
387
508
|
function createOptionElement(item, dropdownType) {
|
|
388
509
|
console.log("createOptionElement");
|
|
389
510
|
const option = document.createElement('div');
|
|
@@ -51,7 +51,7 @@ export function renderTagIOTFormPane() {
|
|
|
51
51
|
</div>
|
|
52
52
|
</div>
|
|
53
53
|
|
|
54
|
-
<label for="">${i18n.t('
|
|
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('
|
|
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>
|
|
@@ -277,7 +277,7 @@ export function renderTags(tags, showOwnTagsOnly = false) {
|
|
|
277
277
|
const payload = { tag: targetTag };
|
|
278
278
|
dispatchSpaceEvent(SPACE_EVENTS.TAG_DISPOSED, payload);
|
|
279
279
|
toggleModal(false);
|
|
280
|
-
notify.success(i18n.t('
|
|
280
|
+
notify.success(i18n.t('SuccessDeleteTag'));
|
|
281
281
|
}
|
|
282
282
|
else {
|
|
283
283
|
toggleModal(false);
|
|
@@ -489,7 +489,7 @@ export function addClickEventToTagRow(tag) {
|
|
|
489
489
|
yield disposeTag({ tagId: tagId });
|
|
490
490
|
const tagRow = document.getElementById(`at-tag-row-${tagId}`);
|
|
491
491
|
tagRow.remove();
|
|
492
|
-
notify.success(i18n.t('
|
|
492
|
+
notify.success(i18n.t('SuccessDeleteTag'));
|
|
493
493
|
}
|
|
494
494
|
else {
|
|
495
495
|
notify.error("Tag id not found!");
|
|
@@ -851,7 +851,7 @@ export function setIotCategoryFilterOptions() {
|
|
|
851
851
|
log.info('setIotCategoryOptions()');
|
|
852
852
|
if (_tagIotCategoryTypes) {
|
|
853
853
|
renderIotCategoryDropdownFilterOptions('at-iot-category-filter-options', _tagIotCategoryTypes);
|
|
854
|
-
batchAddEventListenerByClassName('at_iot_cat_filter_option', (event) => {
|
|
854
|
+
batchAddEventListenerByClassName('at_iot_cat_filter_option', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
855
855
|
log.info("category filter clicked");
|
|
856
856
|
//@ts-ignore
|
|
857
857
|
const selectedCat = event.target;
|
|
@@ -861,6 +861,7 @@ export function setIotCategoryFilterOptions() {
|
|
|
861
861
|
// no selection selected
|
|
862
862
|
selectedIoTCategoryFilter = { uuid: '', name: 'NoSelection' };
|
|
863
863
|
setSelectedIoTCategoryFilter(selectedIoTCategoryFilter);
|
|
864
|
+
yield renderTagsInSpace(iotTags, true);
|
|
864
865
|
renderTags(iotTags);
|
|
865
866
|
}
|
|
866
867
|
const getCatName = _tagIotCategoryTypes.find(cat => cat.uuid === catUUID);
|
|
@@ -871,13 +872,18 @@ export function setIotCategoryFilterOptions() {
|
|
|
871
872
|
filterIotTagByCategory(iotTags);
|
|
872
873
|
}
|
|
873
874
|
toggleDropdown('at-iot-category-filter-options');
|
|
874
|
-
});
|
|
875
|
+
}));
|
|
875
876
|
}
|
|
876
877
|
}
|
|
877
878
|
export function filterIotTagByCategory(tags) {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
879
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
880
|
+
log.info("selectedIoTCategoryFilter", selectedIoTCategoryFilter, _tags);
|
|
881
|
+
const filteredTags = tags.filter(tag => tag.iot_tag.iot_category == selectedIoTCategoryFilter.name);
|
|
882
|
+
const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.IOT);
|
|
883
|
+
yield hideTagsFromSpace(removeTags);
|
|
884
|
+
yield renderTagsInSpace(filteredTags, true);
|
|
885
|
+
renderTags(filteredTags);
|
|
886
|
+
});
|
|
881
887
|
}
|
|
882
888
|
// displays selected Category in the dropdown
|
|
883
889
|
export function setSelectedIoTCategoryFilter(payload) {
|
package/lib/atwinui/events.js
CHANGED
|
@@ -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 { clearSelectedTag, initFormData, setSelectedTag, setTagFormMode } from "./components/toolbar/tagFormPane";
|
|
17
|
+
import { clearSelectedTag, initFormData, setSelectedTag, 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";
|
|
@@ -347,7 +347,8 @@ function renderTagPaneContent() {
|
|
|
347
347
|
setTagPaneActive(true);
|
|
348
348
|
setCurrentTagPaneMode(TAG_TYPE.MP);
|
|
349
349
|
resetSelectedTagSortOption();
|
|
350
|
-
const
|
|
350
|
+
const mpTags = tags.filter(tag => !tag.tag_type || tag.tag_type === TAG_TYPE.MP);
|
|
351
|
+
const sortedTagsToDisplay = sortTags(mpTags, selectedTagSortOption);
|
|
351
352
|
renderTags(sortedTagsToDisplay, true);
|
|
352
353
|
}
|
|
353
354
|
else if (!isTagPaneActive) {
|
|
@@ -846,7 +847,9 @@ function handlePlaceTag() {
|
|
|
846
847
|
const row = renderTagRow(iTag, '');
|
|
847
848
|
tagContainer.appendChild(row);
|
|
848
849
|
addClickEventToTagRow(iTag);
|
|
849
|
-
|
|
850
|
+
if (iTag.attachments && iTag.attachments.length > 0) {
|
|
851
|
+
yield attachTagMedia({ sdk: _atwin, tag: iTag, attachments: iTag.attachments });
|
|
852
|
+
}
|
|
850
853
|
// toggleDisplayPane('at-cancel-tag-form-btn')
|
|
851
854
|
notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
|
|
852
855
|
const tags = getMpTags();
|
|
@@ -1074,6 +1077,7 @@ function handleSaveTag() {
|
|
|
1074
1077
|
currentTag.media_url = tagFormPayload.tagEmbed;
|
|
1075
1078
|
currentTag.json_data.label = tagFormPayload.tagName;
|
|
1076
1079
|
currentTag.json_data.description = tagFormPayload.tagDescription;
|
|
1080
|
+
currentTag.tag_type = TAG_TYPE.MP;
|
|
1077
1081
|
// Add tag icon data
|
|
1078
1082
|
const targetCategory = _tagCategories.find(cat => cat.uuid === tagFormPayload.tagCategoryId);
|
|
1079
1083
|
if (targetCategory) {
|
|
@@ -3326,37 +3330,35 @@ function handleClearSearchTagName() {
|
|
|
3326
3330
|
log.info('handleClearSearchTagName()');
|
|
3327
3331
|
const searchTagName = document.getElementById('at-clear-search-tag-name');
|
|
3328
3332
|
if (searchTagName) {
|
|
3329
|
-
searchTagName.addEventListener('click', () => {
|
|
3333
|
+
searchTagName.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
|
|
3330
3334
|
searchClearfield();
|
|
3331
3335
|
// commented out due to iot Dummy Data
|
|
3332
3336
|
// const tags = getMpTags()
|
|
3333
3337
|
const tags = [..._tags];
|
|
3334
|
-
const filteredTags = filterTagList(tags);
|
|
3335
3338
|
if (selectedCategoryFilterId || selectedSubCategoryFilterId && isTagPaneActive) {
|
|
3336
|
-
const filteredTags = filterTagList(tags);
|
|
3339
|
+
const filteredTags = filterTagList(tags).filter(tag => tag.tag_type === TAG_TYPE.MP);
|
|
3340
|
+
// show filtered tags only
|
|
3341
|
+
yield renderTagsInSpace(filteredTags, true);
|
|
3337
3342
|
renderTags(filteredTags);
|
|
3338
3343
|
}
|
|
3339
3344
|
else if (tags.length > 0 && isTagPaneActive) {
|
|
3340
|
-
|
|
3345
|
+
const filteredMPTags = tags.filter(tag => tag.tag_type === TAG_TYPE.MP);
|
|
3346
|
+
yield renderTagsInSpace(filteredMPTags, true);
|
|
3347
|
+
renderTags(filteredMPTags, true);
|
|
3341
3348
|
}
|
|
3342
3349
|
else if (!isTagPaneActive) {
|
|
3343
3350
|
const filteredIotTags = filterIotTagList(tags);
|
|
3351
|
+
yield renderTagsInSpace(filteredIotTags, true);
|
|
3344
3352
|
renderTags(filteredIotTags);
|
|
3345
|
-
// if (selectedCategoryFilterId || selectedSubCategoryFilterId) {
|
|
3346
|
-
// const sortedTags = sortTags(filteredTags, {by: 'label', order: 'asc'})
|
|
3347
|
-
// renderTags(sortedTags)
|
|
3348
|
-
// } else if (tags.length > 0) {
|
|
3349
|
-
// const sortedTags = sortTags(tags, {by: 'label', order: 'asc'})
|
|
3350
|
-
// renderTags(sortedTags,true)
|
|
3351
3353
|
}
|
|
3352
|
-
});
|
|
3354
|
+
}));
|
|
3353
3355
|
}
|
|
3354
3356
|
}
|
|
3355
3357
|
function handleSearchFromTagListButton() {
|
|
3356
3358
|
log.info('handleSearchFromTagListButton()');
|
|
3357
3359
|
const searchTagNameButton = document.getElementById('at-search-tag-button');
|
|
3358
3360
|
if (searchTagNameButton) {
|
|
3359
|
-
searchTagNameButton.addEventListener('click', () => {
|
|
3361
|
+
searchTagNameButton.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
|
|
3360
3362
|
const tags = getMpTags();
|
|
3361
3363
|
const tagSearch = getSearchTagTerm();
|
|
3362
3364
|
if (tagSearch) {
|
|
@@ -3366,18 +3368,36 @@ function handleSearchFromTagListButton() {
|
|
|
3366
3368
|
if (foundTag) {
|
|
3367
3369
|
if (selectedCategoryFilterId || selectedSubCategoryFilterId && isTagPaneActive) {
|
|
3368
3370
|
const filteredTags = filterTagList(foundTag);
|
|
3371
|
+
const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
|
|
3372
|
+
log.info("removeTags", removeTags);
|
|
3373
|
+
// remove tags that is not part in the sorted Tags
|
|
3374
|
+
yield hideTagsFromSpace(removeTags);
|
|
3375
|
+
// show filtered tags only
|
|
3376
|
+
yield renderTagsInSpace(filteredTags, true);
|
|
3369
3377
|
renderTags(filteredTags);
|
|
3370
3378
|
}
|
|
3371
3379
|
else if (foundTag.length > 0 && isTagPaneActive) {
|
|
3380
|
+
const removeTags = tags.filter(tag => !foundTag.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
|
|
3381
|
+
log.info("removeTags", removeTags);
|
|
3382
|
+
// remove tags that is not part in the sorted Tags
|
|
3383
|
+
yield hideTagsFromSpace(removeTags);
|
|
3384
|
+
// show filtered tags only
|
|
3385
|
+
yield renderTagsInSpace(foundTag, true);
|
|
3372
3386
|
renderTags(foundTag, true);
|
|
3373
3387
|
}
|
|
3374
3388
|
else if (!isTagPaneActive) {
|
|
3375
3389
|
const filteredIotTags = filterIotTagList(foundTag);
|
|
3390
|
+
const removeTags = tags.filter(tag => !filteredIotTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.IOT);
|
|
3391
|
+
log.info("removeTags", removeTags);
|
|
3392
|
+
// remove tags that is not part in the sorted Tags
|
|
3393
|
+
yield hideTagsFromSpace(removeTags);
|
|
3394
|
+
// show filtered tags only
|
|
3395
|
+
yield renderTagsInSpace(filteredIotTags, true);
|
|
3376
3396
|
renderTags(filteredIotTags);
|
|
3377
3397
|
}
|
|
3378
3398
|
}
|
|
3379
3399
|
}
|
|
3380
|
-
});
|
|
3400
|
+
}));
|
|
3381
3401
|
}
|
|
3382
3402
|
}
|
|
3383
3403
|
function handleCustomMapFloorImageUploaded(payload) {
|
package/lib/tag.js
CHANGED
|
@@ -138,13 +138,14 @@ function attachTagMedia(payload) {
|
|
|
138
138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
139
139
|
log.info('__@ attachTagContent()', payload);
|
|
140
140
|
// log.info('attachTagContent()', payload)
|
|
141
|
-
|
|
141
|
+
const validAttachments = (payload.attachments || []).filter(url => !!url);
|
|
142
|
+
if (validAttachments.length === 0) {
|
|
142
143
|
log.error('__@ No Attachments');
|
|
143
144
|
return;
|
|
144
145
|
}
|
|
145
146
|
payload.tag.attachments = [];
|
|
146
|
-
for (let i in
|
|
147
|
-
const [attachmentId] = yield payload.sdk.Tag.registerAttachment(
|
|
147
|
+
for (let i in validAttachments) {
|
|
148
|
+
const [attachmentId] = yield payload.sdk.Tag.registerAttachment(validAttachments[i]);
|
|
148
149
|
log.info("media attachmentId ", attachmentId);
|
|
149
150
|
payload.tag.attachments.push(attachmentId);
|
|
150
151
|
}
|
|
@@ -445,7 +446,8 @@ function toggleTagVisibility(payload) {
|
|
|
445
446
|
payload.sdk.Tag.editOpacity(payload.tagId, payload.visibility ? 1 : 0);
|
|
446
447
|
payload.sdk.Tag.allowAction(payload.tagId, {
|
|
447
448
|
opening: payload.visibility,
|
|
448
|
-
navigating: true
|
|
449
|
+
navigating: true,
|
|
450
|
+
docking: payload.visibility,
|
|
449
451
|
});
|
|
450
452
|
}
|
|
451
453
|
export { renderTag, disposeTag, moveTag, attachTagMediaById, attachTagMedia, detachTagMedia, setTagIcon, editBillboard, editStem, editColor, saveTagDb, deleteTag, getTagColorCodeID, getEmbedlyData, cancelMoveTag, handleTagPlacerCreated, attachSandbox, registerSandbox, toggleTagVisibility };
|