architwin 1.18.9 → 1.18.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/atwinui/components/toolbar/i18n.js +1 -3
- package/lib/atwinui/components/toolbar/tagFormPane.d.ts +1 -3
- package/lib/atwinui/components/toolbar/tagFormPane.js +91 -222
- 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 +7 -13
- package/lib/atwinui/events.js +14 -30
- package/package.json +1 -1
|
@@ -290,7 +290,6 @@ 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"
|
|
294
293
|
}
|
|
295
294
|
},
|
|
296
295
|
ja: {
|
|
@@ -575,8 +574,7 @@ i18n
|
|
|
575
574
|
"IotCategoryRequired": "IoTカテゴリは必須です",
|
|
576
575
|
"SuccessUpdatedFloorLevel": "区画のフロアオフセット値が更新されました",
|
|
577
576
|
"DuplicatePartitionName": "このパーティション名は既にこの部屋で使用されています。別の名前を選択してください。",
|
|
578
|
-
"PleaseOnPolygonVisibility": "操作を行う前に、部屋の表示をオンにしてください。"
|
|
579
|
-
"IoTType": "IoTタイプ"
|
|
577
|
+
"PleaseOnPolygonVisibility": "操作を行う前に、部屋の表示をオンにしてください。"
|
|
580
578
|
}
|
|
581
579
|
}
|
|
582
580
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FORM_MODE, ITagCategory
|
|
1
|
+
import { FORM_MODE, ITagCategory } 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,8 +13,6 @@ 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>;
|
|
18
16
|
export declare function renderCategoryDropdownOptions(elementId: string, items: Array<ITagCategory>, toggleId?: string): void;
|
|
19
17
|
export declare function renderSubcategoryDropdownOptions(elementId: string, items: Array<ITagCategory>): void;
|
|
20
18
|
export declare function clearTagFormDropdown(): void;
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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";
|
|
1
|
+
import { _tagCategories, _tags, getMpTags } from "../../../architwin";
|
|
2
|
+
import { convertToCssRgb, stringContains } from "../../../utils";
|
|
12
3
|
import { TAG_TYPE } from "../../../types";
|
|
13
4
|
import { renderTags, setSelectedCategoryFilter, setSelectedSubcategoryFilter, filterTagList, getAllSubcategories, selectedCategoryFilterId, sortTags, selectedTagSortOption } from './tagListPane';
|
|
14
5
|
import i18n from './i18n';
|
|
15
|
-
import log from "loglevel";
|
|
16
|
-
import ShortUniqueId from "short-unique-id";
|
|
17
|
-
import * as _tag from './../../../tag';
|
|
18
6
|
let mode = 'adding';
|
|
19
7
|
let tagNameInput, tagDescriptionInput, tagEmbedInput, tagCategoryDropdown, tagSubcategoryDropdown;
|
|
20
8
|
let selectedCategoryId = undefined;
|
|
@@ -273,228 +261,109 @@ export function clearInnerHTML(elementId) {
|
|
|
273
261
|
targetElement.innerHTML = ``;
|
|
274
262
|
}
|
|
275
263
|
function selectOption(option, elementId, skipToggle = false) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
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;
|
|
283
282
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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 = `
|
|
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);
|
|
306
|
+
}
|
|
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 = `
|
|
339
314
|
<span class="mdi mdi-circle-slice-1"></span> ${i18n.t('NoSelection')}
|
|
340
315
|
`;
|
|
341
|
-
|
|
316
|
+
subcatDropdownToggle.innerHTML = `
|
|
342
317
|
<span class="mdi mdi-circle-slice-1"></span> ${i18n.t('NoSelection')}
|
|
343
318
|
`;
|
|
344
|
-
}
|
|
345
319
|
}
|
|
346
320
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
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 = `
|
|
354
329
|
<span class="mdi mdi-circle-slice-1"></span> ${i18n.t('NoSelection')}
|
|
355
330
|
`;
|
|
356
|
-
|
|
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';
|
|
331
|
+
setSelectedCategoryFilter(undefined);
|
|
392
332
|
}
|
|
393
|
-
|
|
394
|
-
|
|
333
|
+
if (isFilterDropdown) {
|
|
334
|
+
setSelectedSubcategoryFilter(undefined); //reset selected subcategory
|
|
395
335
|
}
|
|
396
|
-
|
|
397
|
-
|
|
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
|
-
}));
|
|
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);
|
|
408
341
|
}
|
|
409
342
|
else {
|
|
410
|
-
|
|
343
|
+
const elementId = isFilterDropdown ? 'at-subcategory-filter-options' : 'at-subcategory-options';
|
|
344
|
+
clearInnerHTML(elementId);
|
|
411
345
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
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
|
-
});
|
|
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
|
+
}
|
|
498
367
|
}
|
|
499
368
|
function createOptionElement(item, dropdownType) {
|
|
500
369
|
console.log("createOptionElement");
|
|
@@ -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('Category')}</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[]):
|
|
35
|
+
export declare function filterIotTagByCategory(tags: ITag[]): 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 {
|
|
14
|
+
import { initFormData, 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('Category')}</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) => {
|
|
857
857
|
log.info("category filter clicked");
|
|
858
858
|
//@ts-ignore
|
|
859
859
|
const selectedCat = event.target;
|
|
@@ -863,7 +863,6 @@ export function setIotCategoryFilterOptions() {
|
|
|
863
863
|
// no selection selected
|
|
864
864
|
selectedIoTCategoryFilter = { uuid: '', name: 'NoSelection' };
|
|
865
865
|
setSelectedIoTCategoryFilter(selectedIoTCategoryFilter);
|
|
866
|
-
yield renderTagsInSpace(iotTags, true);
|
|
867
866
|
renderTags(iotTags);
|
|
868
867
|
}
|
|
869
868
|
const getCatName = _tagIotCategoryTypes.find(cat => cat.uuid === catUUID);
|
|
@@ -874,18 +873,13 @@ export function setIotCategoryFilterOptions() {
|
|
|
874
873
|
filterIotTagByCategory(iotTags);
|
|
875
874
|
}
|
|
876
875
|
toggleDropdown('at-iot-category-filter-options');
|
|
877
|
-
})
|
|
876
|
+
});
|
|
878
877
|
}
|
|
879
878
|
}
|
|
880
879
|
export function filterIotTagByCategory(tags) {
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
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
|
-
});
|
|
880
|
+
log.info("selectedIoTCategoryFilter", selectedIoTCategoryFilter, _tags);
|
|
881
|
+
const filteredTags = tags.filter(tag => tag.iot_tag.iot_category == selectedIoTCategoryFilter.name);
|
|
882
|
+
renderTags(filteredTags);
|
|
889
883
|
}
|
|
890
884
|
// displays selected Category in the dropdown
|
|
891
885
|
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 { initFormData,
|
|
17
|
+
import { initFormData, 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,35 +3281,37 @@ 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', () => {
|
|
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);
|
|
3289
3290
|
if (selectedCategoryFilterId || selectedSubCategoryFilterId && isTagPaneActive) {
|
|
3290
|
-
const filteredTags = filterTagList(tags)
|
|
3291
|
-
// show filtered tags only
|
|
3292
|
-
yield renderTagsInSpace(filteredTags, true);
|
|
3291
|
+
const filteredTags = filterTagList(tags);
|
|
3293
3292
|
renderTags(filteredTags);
|
|
3294
3293
|
}
|
|
3295
3294
|
else if (tags.length > 0 && isTagPaneActive) {
|
|
3296
|
-
|
|
3297
|
-
yield renderTagsInSpace(filteredMPTags, true);
|
|
3298
|
-
renderTags(filteredMPTags, true);
|
|
3295
|
+
renderTags(tags, true);
|
|
3299
3296
|
}
|
|
3300
3297
|
else if (!isTagPaneActive) {
|
|
3301
3298
|
const filteredIotTags = filterIotTagList(tags);
|
|
3302
|
-
yield renderTagsInSpace(filteredIotTags, true);
|
|
3303
3299
|
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)
|
|
3304
3306
|
}
|
|
3305
|
-
})
|
|
3307
|
+
});
|
|
3306
3308
|
}
|
|
3307
3309
|
}
|
|
3308
3310
|
function handleSearchFromTagListButton() {
|
|
3309
3311
|
log.info('handleSearchFromTagListButton()');
|
|
3310
3312
|
const searchTagNameButton = document.getElementById('at-search-tag-button');
|
|
3311
3313
|
if (searchTagNameButton) {
|
|
3312
|
-
searchTagNameButton.addEventListener('click', () =>
|
|
3314
|
+
searchTagNameButton.addEventListener('click', () => {
|
|
3313
3315
|
const tags = getMpTags();
|
|
3314
3316
|
const tagSearch = getSearchTagTerm();
|
|
3315
3317
|
if (tagSearch) {
|
|
@@ -3319,36 +3321,18 @@ function handleSearchFromTagListButton() {
|
|
|
3319
3321
|
if (foundTag) {
|
|
3320
3322
|
if (selectedCategoryFilterId || selectedSubCategoryFilterId && isTagPaneActive) {
|
|
3321
3323
|
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);
|
|
3328
3324
|
renderTags(filteredTags);
|
|
3329
3325
|
}
|
|
3330
3326
|
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);
|
|
3337
3327
|
renderTags(foundTag, true);
|
|
3338
3328
|
}
|
|
3339
3329
|
else if (!isTagPaneActive) {
|
|
3340
3330
|
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);
|
|
3347
3331
|
renderTags(filteredIotTags);
|
|
3348
3332
|
}
|
|
3349
3333
|
}
|
|
3350
3334
|
}
|
|
3351
|
-
})
|
|
3335
|
+
});
|
|
3352
3336
|
}
|
|
3353
3337
|
}
|
|
3354
3338
|
function handleCustomMapFloorImageUploaded(payload) {
|