architwin 1.14.16 → 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.
Files changed (35) hide show
  1. package/lib/architwin.d.ts +13 -2
  2. package/lib/architwin.js +1 -1
  3. package/lib/atwinui/components/toolbar/i18n.js +71 -3
  4. package/lib/atwinui/components/toolbar/index.js +5 -1
  5. package/lib/atwinui/components/toolbar/menuBar.d.ts +1 -0
  6. package/lib/atwinui/components/toolbar/menuBar.js +12 -0
  7. package/lib/atwinui/components/toolbar/spacePartition/roomFormPane.d.ts +2 -0
  8. package/lib/atwinui/components/toolbar/spacePartition/roomFormPane.js +41 -12
  9. package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.d.ts +21 -2
  10. package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.js +32 -12
  11. package/lib/atwinui/components/toolbar/tagFormPane.js +2 -1
  12. package/lib/atwinui/components/toolbar/tagListPane.d.ts +7 -2
  13. package/lib/atwinui/components/toolbar/tagListPane.js +126 -38
  14. package/lib/atwinui/events.d.ts +3 -1
  15. package/lib/atwinui/events.js +629 -107
  16. package/lib/atwinui/index.js +9 -1
  17. package/lib/color.js +12 -1
  18. package/lib/loaders/polydrawerLoader.js +3 -0
  19. package/lib/types.d.ts +75 -1
  20. package/lib/types.js +17 -0
  21. package/package.json +1 -1
  22. package/static/atwinui.css +55 -7
  23. package/static/colors/SOFT_ROYAL_BLUE.png +0 -0
  24. package/static/colors/YELLOW_ORANGE.png +0 -0
  25. package/static/utility.css +156 -537
  26. package/lib/atwinui/components/toolbar/roomCreation/roomFormPane.d.ts +0 -68
  27. package/lib/atwinui/components/toolbar/roomCreation/roomFormPane.js +0 -798
  28. package/lib/atwinui/components/toolbar/roomCreation/roomLayerListPane.d.ts +0 -33
  29. package/lib/atwinui/components/toolbar/roomCreation/roomLayerListPane.js +0 -447
  30. package/lib/atwinui/components/toolbar/tagIotForm.d.ts +0 -20
  31. package/lib/atwinui/components/toolbar/tagIotForm.js +0 -391
  32. package/lib/atwinui/components/toolbar/usersPane.d.ts +0 -14
  33. package/lib/atwinui/components/toolbar/usersPane.js +0 -273
  34. package/lib/convert.d.ts +0 -13
  35. package/lib/convert.js +0 -54
@@ -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
- // import { e } from "mathjs";
21
- let notify = new Notyf({ position: { x: 'left', y: 'bottom' } });
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 at_h-min-65 at_tag_list_pane">
41
- <div class="at_tags_filter_section">
42
- <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...')}>
43
- <span class="mdi mdi-close at_button_search_tag" id="at-clear-search-tag-name" style="display:none"></span>
44
- <button class="at_search_button" id="at-search-tag-button">
45
- <span class="mdi mdi-magnify"></span>
46
- </button>
47
- <div class="at_sort_btn_container">
48
- <div id="at-tag-sort-icon" class="mdi mdi-filter mdi-24px at_icon_hover">
49
- <span id="at-tag-sort-options-tooltip" class="at_custom_tooltip">
50
- <p class="at_tag_sort_option at_sort_option_selected" data-sort="Ascending">${i18n.t('Ascending')}</p>
51
- <p class="at_tag_sort_option" data-sort="Descending">${i18n.t('Descending')}</p>
52
- <p class="at_tag_sort_option" data-sort="Newest">${i18n.t('Newest')}</p>
53
- <p class="at_tag_sort_option" data-sort="Oldest">${i18n.t('Oldest')}</p>
54
- </span>
55
- </div>
56
- </div>
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
- const row = renderTagRow(tag.json_data, tag.tag_icon_url);
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
- initFormData(tagId);
166
- // setTagCategoriesOption()
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
- //@ts-ignore
234
- const tagRow = event.target.closest('.at_tag_row');
235
- if (tagRow) {
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:${convertToCssRgb(tag.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="at-tag-form-pane"></span>
281
- <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>
282
- <span class="mdi mdi-message at_message_tag_btn" id="at-message-tag-${tag.id}" data-cy="at-message-tag-${tag.id}" tag-id="${tag.id}" target-pane="at-tag-messaging-pane"></span>
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 [];
@@ -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;
@@ -43,6 +44,7 @@ declare function handleDeletePartition(targetId: string): void;
43
44
  * Handles the display logic for showing the custom minimap.
44
45
  */
45
46
  declare function handleShowCustomMinimap(): void;
47
+ declare function handleDisplayElements(id: string): void;
46
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 };