architwin 1.14.15 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +62 -24
  9. package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.d.ts +21 -3
  10. package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.js +62 -25
  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 +5 -3
  15. package/lib/atwinui/events.js +633 -79
  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 +88 -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 +157 -538
  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
@@ -1,391 +0,0 @@
1
- import { IOT_LINKED_SYSTEMS, SPACE_EVENTS } from '../../../types';
2
- import log from 'loglevel';
3
- import i18n from './i18n';
4
- import { dispatchSpaceEvent, _tagIotCategoryTypes, _tagIotDevices } from '../../../architwin';
5
- import { stringContains } from "../../../utils";
6
- import { batchAddEventListenerByClassName } from '../../events';
7
- let selectedIoTCatOption;
8
- let selectedIoTDeviceOption;
9
- export let iotTagFormMode = "ADD" /* FORM_MODE.ADD */;
10
- let tagIotName, iotModelName, iotSerialName, iotMfrName, iotSystemLink;
11
- let selectedIoTCatId;
12
- let linkedDevicesArray = [];
13
- export function renderTagIOTForm() {
14
- const element = document.createElement('div');
15
- element.classList.add('at_container');
16
- element.classList.add('at_w-12');
17
- element.classList.add('at_h-full');
18
- element.setAttribute('id', 'at-tag-iot-form-pane');
19
- element.setAttribute('data-cy', 'at-tag-iot-form-pane');
20
- element.innerHTML = `
21
- <div class="at_panel_header">
22
- <span>${i18n.t('Add IOT Tag')}</span>
23
- </div>
24
-
25
- <div class="at_form_container at_scrollable_container at_h-min-70">
26
- <label for="">${i18n.t('Linked Systems')}</label>
27
- <div class="at_gap_2" style="display: inline-flex">
28
- <label class="at_flex at_align_center at_text_xs at_gap_1">
29
- <input type="radio" id="at-linked-radio-bemac" name="iot-link-system" checked value=${IOT_LINKED_SYSTEMS.BEMAC} selected />
30
- ${i18n.t("BEMAC")}
31
- </label>
32
- <label class="at_flex at_align_center at_text_xs at_gap_1">
33
- <input type="radio" id="at-linked-radio-hanasys" name="iot-link-system" value=${IOT_LINKED_SYSTEMS.HANASYS} />
34
- ${i18n.t("HANASYS")}
35
- </label>
36
- <label class="at_flex at_align_center at_text_xs at_gap_1">
37
- <input type="radio" id="at-linked-radio-link" name="iot-link-system" value=${IOT_LINKED_SYSTEMS.URL_LINK} />
38
- ${i18n.t("URL Link")}
39
- </label>
40
- </div>
41
-
42
- <div class="at_field at_flex_column">
43
- <label for="">${i18n.t('Category')}</label>
44
- <div id="at-iot-category-dropdown" data-cy="at-iot-category-dropdown">
45
- <div id="at-iot-cat-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
46
- <div class="at_dropdown_toggle" id="at-iot-selected-cat" data-cy="at-iot-selected-cat">${i18n.t(selectedIoTCatOption)}</div>
47
- <span class="mdi mdi-chevron-down at_chevron" id="at-iot-cat-filter-chevron" data-cy="at-iot-cat-filter-chevron"></span>
48
- </div>
49
-
50
- <div style="position:absolute;">
51
- <div class="at_dropdown_options" id="at-iot-category-options" data-cy="at-iot-category-options">
52
-
53
- </div>
54
- </div>
55
-
56
- </div>
57
- </div>
58
-
59
- <div class="at-field at_flex_row at_justify_between">
60
- <label for="">${i18n.t('TagName')}</label>
61
- <input class="at_field_input at_w-full" type="text" name="tag_name" id="at-iot-name-input" data-cy="at-iot-name-input" placeholder="Sample..." />
62
- </div>
63
-
64
- <div class="at-field at_flex_row at_justify_between">
65
- <label for="">${i18n.t('Model Name')}</label>
66
- <input class="at_field_input at_w-full" type="text" name="model_name" id="at-iot-model-input" data-cy="at-iot-model-input" placeholder="Sample..." />
67
- </div>
68
-
69
- <div class="at-field at_flex_row at_justify_between">
70
- <label for="">${i18n.t('Serial Number')}</label>
71
- <input class="at_field_input at_w-full" type="text" name="serial_name" id="at-iot-serial-input" data-cy="at-iot-serial-input" placeholder="Sample..." />
72
- </div>
73
-
74
- <div class="at-field at_flex_row at_justify_between">
75
- <label for="">${i18n.t('Manufacturer Site')}</label>
76
- <input class="at_field_input at_w-full" type="text" name="manufacturer_site" id="at-iot-manufacturer-input" data-cy="at-iot-manufacturer-input" placeholder="Sample..." />
77
- </div>
78
-
79
- <div class="at-field at_flex_row at_justify_between" id="at-iot-system-link-container">
80
- <label for="">${i18n.t('System Link')}</label>
81
- <input class="at_field_input at_w-full" type="text" name="system_link" id="at-iot-system-link-input" data-cy="at-iot-system-link-input" placeholder="Sample..." />
82
- </div>
83
-
84
- <div class="at_button at_ghost" id="at-iot-move-btn" data-cy="at-iot-move-btn" style="top: 4px !important">
85
- <label for="" style="bottom: 10px !important" class="at_comment_unsend_container">${i18n.t('MoveTag')}</label>
86
- <span class="mdi mdi-map-marker at_icon" style="bottom: 9px !important"></span>
87
- </div>
88
-
89
- <div class="at_field at_flex_column" id="at-iot-device-main-container">
90
- <label for="">${i18n.t('IoT Devices')}</label>
91
- <div id="at-iot-devices-dropdown" data-cy="at-iot-devices-dropdown">
92
- <div id="at-setting-map-filter-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
93
- <div class="at_dropdown_toggle" id="at-iot-selected-device" data-cy="at-iot-selected-device">${i18n.t(selectedIoTDeviceOption)}</div>
94
- <span class="mdi mdi-chevron-down at_chevron" id="at-iot-cat-filter-chevron" data-cy="at-iot-cat-filter-chevron"></span>
95
- </div>
96
-
97
- <div style="position:absolute;">
98
- <div class="at_dropdown_options" id="at-iot-device-options" data-cy="at-iot-device-options">
99
-
100
- </div>
101
- </div>
102
- </div>
103
-
104
- <div class="at_partition_list_container at_h-min-40" id="at-iot-device-list-container" data-cy="at-iot-device-list-container">
105
-
106
- <div class="at_partition_item_container at_scrollable_container" id="at-linked-device-container" data-cy="at-linked-device-container">
107
-
108
- <div class="at_partition_title" id="at-iot-linked-devices">
109
- <div> </div>
110
- <label for="">${i18n.t('Linked to Devices')}</label>
111
- <div> </div>
112
- </div>
113
-
114
- </div>
115
-
116
- </div>
117
-
118
- </div>
119
- </div>
120
-
121
- <div class="at_button_row at_justify_between">
122
- <div class="at_button at_ghost" style="margin-top: auto;" id="at-cancel-iot-tag-form-btn" data-cy="at-cancel-iot-tag-form-btn" target-pane="at-tag-list-pane">
123
- <label for="" id="at-cancel-tag-form-btn">${i18n.t('Cancel')}</label>
124
- </div>
125
-
126
- <div class="at_button at_ghost" id="at-save-iot-btn" data-cy="at-save-iot-btn">
127
- <label for="">${i18n.t('Save')}</label>
128
- </div>
129
- </div>
130
- `;
131
- return element;
132
- }
133
- function setSelectedIoTCat(payload) {
134
- log.info('setSelectedIoTCat()', payload);
135
- const selectedOption = document.getElementById('at-iot-selected-cat');
136
- selectedOption.innerText = payload;
137
- }
138
- function setSelectedIoTDevice(payload) {
139
- log.info('setSelectedIoTDevice()', payload);
140
- const selectedDevice = document.getElementById('at-iot-selected-device');
141
- selectedDevice.innerText = payload;
142
- }
143
- function setInputFields() {
144
- log.info('setInputFields()');
145
- tagIotName = document.getElementById('at-iot-name-input');
146
- iotModelName = document.getElementById('at-iot-model-input');
147
- iotSerialName = document.getElementById('at-iot-serial-input');
148
- iotMfrName = document.getElementById('at-iot-manufacturer-input');
149
- iotSystemLink = document.getElementById('at-iot-system-link-input');
150
- }
151
- export function setIotCategoryOptions() {
152
- log.info('setIotCategoryOptions()');
153
- dispatchSpaceEvent(SPACE_EVENTS.GET_IOT_CATEGORIES, { payload: 'hello from library' });
154
- renderIotCategoryDropdownOptions('at-iot-category-options', _tagIotCategoryTypes);
155
- batchAddEventListenerByClassName('at_iot_cat_option', (event) => {
156
- //@ts-ignore
157
- const selectedCat = event.target;
158
- const dataCy = selectedCat.getAttribute('data-cy');
159
- const match = dataCy.match(/^at-iot-category-option-(.+)$/);
160
- const selectedId = match ? match[1] : null;
161
- selectedIoTCatId = selectedId.toString();
162
- setSelectedIoTCat(selectedCat.innerText);
163
- log.info('cat id: ', selectedIoTCatId);
164
- });
165
- }
166
- export function toggleIoTCategoryOptions() {
167
- log.info('toggleIoTCategoryOptions');
168
- const catDropdown = document.getElementById('at-iot-category-dropdown');
169
- const catOptions = document.getElementById('at-iot-category-options');
170
- catDropdown.addEventListener('click', () => {
171
- catOptions.classList.toggle('open');
172
- });
173
- }
174
- export function toggleIoTDevicesOptions() {
175
- log.info('toggleIoTDevicesOptions()');
176
- const devicesDropdown = document.getElementById('at-iot-devices-dropdown');
177
- const deviceOptions = document.getElementById('at-iot-device-options');
178
- devicesDropdown.addEventListener('click', () => {
179
- deviceOptions.classList.toggle('open');
180
- });
181
- }
182
- export function setSelectedIoTSystemRadio(payload) {
183
- log.info('setSelectedIoTSystemRadio()', payload);
184
- const linkedDeviceContainer = document.getElementById('at-iot-device-main-container');
185
- const systemLinkContainer = document.getElementById('at-iot-system-link-container');
186
- if (payload === IOT_LINKED_SYSTEMS.URL_LINK) {
187
- log.info('payload == IOT_LINKED_SYSTEMS.URL_LINK', payload, IOT_LINKED_SYSTEMS.URL_LINK);
188
- linkedDeviceContainer.style.display = 'none';
189
- systemLinkContainer.style.display = 'block';
190
- }
191
- else {
192
- linkedDeviceContainer.style.display = 'block';
193
- systemLinkContainer.style.display = 'none';
194
- }
195
- }
196
- export function clearIoTDropdowns() {
197
- log.info('clearIoTDropdowns()');
198
- const catDropdown = document.getElementById('at-iot-selected-cat');
199
- const devicesDropdown = document.getElementById('at-iot-selected-device');
200
- catDropdown.innerText = 'No Selection';
201
- devicesDropdown.innerText = 'Select Device';
202
- }
203
- // Initializes Form Data, but current this is only Add Mode
204
- export function initIoTFormData() {
205
- log.info('initIoTFormData()');
206
- // Add Mode
207
- iotTagFormMode = "ADD" /* FORM_MODE.ADD */;
208
- log.info('initIoTFormData() Mode: ', iotTagFormMode);
209
- if (tagIotName === null || tagIotName == undefined) {
210
- log.info('initIoTFormData() tagname check', tagIotName);
211
- setInputFields();
212
- }
213
- tagIotName.value = '';
214
- iotModelName.value = '';
215
- iotSerialName.value = '';
216
- iotMfrName.value = '';
217
- iotSystemLink.value = '';
218
- }
219
- export function renderIotCategoryDropdownOptions(elementId, items) {
220
- const element = document.getElementById(elementId);
221
- if (!element) {
222
- console.error("Parameter element is undefined");
223
- return;
224
- }
225
- if (!items) {
226
- console.error("Parameter items is undefined");
227
- return;
228
- }
229
- const isFilterDropdown = stringContains(elementId, 'filter');
230
- //Clear previosly appended children
231
- element.innerHTML = ``;
232
- const selectedIotCategoryOption = document.getElementById(isFilterDropdown ? 'at-iot-category-filter-dropdown-toggle' : 'at-iot-category-dropdown-toggle');
233
- if (selectedIotCategoryOption) {
234
- selectedIotCategoryOption.textContent = `${i18n.t('NoSelection')}`;
235
- selectedIoTCatOption = undefined;
236
- }
237
- //Add the no selection option
238
- const noSelection = document.createElement('div');
239
- noSelection.classList.add('at_option');
240
- noSelection.setAttribute('iot-category-uuid', '');
241
- noSelection.setAttribute('dropdown-type', 'iotcategory');
242
- noSelection.innerHTML = `
243
- <span class="mdi mdi-circle-slice-1"></span> ${i18n.t('NoSelection')}
244
- `;
245
- noSelection.onclick = () => {
246
- selectCatOption(noSelection, isFilterDropdown ? 'at-iot-category-filter-dropdown-toggle' : 'at-iot-category-filter-dropdown-toggle');
247
- };
248
- element.appendChild(noSelection);
249
- if (items.length <= 0) {
250
- console.log("No items to render");
251
- return;
252
- }
253
- items.forEach(item => {
254
- const option = createCatOptionElement(item, 'iotcategory');
255
- element.appendChild(option);
256
- });
257
- }
258
- function createCatOptionElement(item, dropdownType) {
259
- console.log("createCatOptionElement()");
260
- const option = document.createElement('div');
261
- option.style.display = 'flex';
262
- option.style.flexDirection = 'row';
263
- option.style.justifyContent = 'left';
264
- option.style.alignItems = 'center';
265
- option.style.gap = '2px';
266
- option.classList.add('at_option');
267
- option.classList.add('at_iot_cat_option');
268
- option.setAttribute('iot-category-uuid', item.uuid);
269
- option.setAttribute('dropdown-type', dropdownType);
270
- option.setAttribute('data-cy', `at-iot-category-option-${item.uuid}`);
271
- if (dropdownType == 'category') {
272
- option.innerHTML = `
273
- <span class="at_colored-indicator"></span>
274
- ${item.name}
275
- `;
276
- return option;
277
- }
278
- option.innerHTML = `
279
- ${item.json_data.iconURL === 'button.png' || item.json_data.iconURL === undefined ? `
280
- <img class="at_avatar_xs" style="display:inline-block" src="https://cdn.jsdelivr.net/npm/architwin@latest/static/images/button.png"/>
281
- ` : `
282
- <img class="at_avatar_xs" style="display:inline-block" src="${item.json_data.iconURL}"/>
283
- `}
284
- ${item.name}`;
285
- return option;
286
- }
287
- function selectCatOption(option, elementId) {
288
- log.info('selectCatOption()', option, elementId);
289
- }
290
- export function setIotDeviceOptions() {
291
- log.info('setIotDeviceOptions()');
292
- dispatchSpaceEvent(SPACE_EVENTS.GET_IOT_DEVICES, { payload: 'hello from library' });
293
- renderIotDeviceDropdownOptions('at-iot-device-options', _tagIotDevices);
294
- batchAddEventListenerByClassName('at_iot_dev_option', (event) => {
295
- //@ts-ignore
296
- const selectedDev = event.target;
297
- setSelectedIoTDevice(selectedDev.innerText);
298
- });
299
- }
300
- export function renderIotDeviceDropdownOptions(elementId, items) {
301
- const element = document.getElementById(elementId);
302
- if (!element) {
303
- console.error("Parameter element is undefined");
304
- return;
305
- }
306
- if (!items) {
307
- console.error("Parameter items is undefined");
308
- return;
309
- }
310
- const isFilterDropdown = stringContains(elementId, 'filter');
311
- //Clear previosly appended children
312
- element.innerHTML = ``;
313
- const selectedIotDeviceOption = document.getElementById(isFilterDropdown ? 'at-iot-device-filter-dropdown-toggle' : 'at-iot-device-dropdown-toggle');
314
- if (selectedIotDeviceOption) {
315
- selectedIotDeviceOption.textContent = `${i18n.t('SelectDevice')}`;
316
- selectedIoTDeviceOption = undefined;
317
- }
318
- //Add the no selection option
319
- const selectDevice = document.createElement('div');
320
- selectDevice.classList.add('at_iot_dev_option');
321
- selectDevice.setAttribute('iot-device-uuid', '');
322
- selectDevice.setAttribute('dropdown-type', 'iotdevice');
323
- selectDevice.innerHTML = `
324
- <span></span> ${i18n.t('SelectDevice')}
325
- `;
326
- selectDevice.onclick = () => {
327
- log.info('@caroline onClick');
328
- selectDeviceOption(selectDevice, isFilterDropdown ? 'at-iot-device-filter-dropdown-toggle' : 'at-iot-device-filter-dropdown-toggle');
329
- };
330
- element.appendChild(selectDevice);
331
- if (items.length <= 0) {
332
- console.log("No items to render");
333
- return;
334
- }
335
- items.forEach(item => {
336
- const option = createDeviceOptionElement(item, 'iotdevice');
337
- element.appendChild(option);
338
- });
339
- }
340
- function selectDeviceOption(option, elementId) {
341
- log.info('@caroline selectDeviceOption()', option, elementId);
342
- }
343
- function createDeviceOptionElement(item, dropdownType) {
344
- console.log("createDeviceOptionElement()", item, dropdownType);
345
- const option = document.createElement('div');
346
- option.style.display = 'flex';
347
- option.style.flexDirection = 'row';
348
- option.style.justifyContent = 'left';
349
- option.style.alignItems = 'center';
350
- option.style.gap = '2px';
351
- option.classList.add('at_option');
352
- option.classList.add('at_iot_dev_option');
353
- option.setAttribute('iot-category-uuid', item.uuid);
354
- option.setAttribute('dropdown-type', dropdownType);
355
- option.setAttribute('data-cy', `at-iot-category-option-${item.uuid}`);
356
- if (dropdownType == 'category') {
357
- option.innerHTML = `
358
- <span class="at_colored-indicator"></span>
359
- ${item.name}
360
- `;
361
- return option;
362
- }
363
- option.innerHTML = `
364
- <span>${item.name}</span>
365
- `;
366
- return option;
367
- }
368
- export function getIotTagFormData() {
369
- if (!tagIotName) {
370
- setInputFields();
371
- }
372
- const formData = {
373
- tagName: tagIotName.value,
374
- modelName: iotModelName.value,
375
- serialName: iotSerialName.value,
376
- tagMf: iotMfrName.value,
377
- tagCategoryId: selectedIoTCatId,
378
- systemLink: iotSystemLink.value
379
- };
380
- return formData;
381
- }
382
- // function renderLinkedDevices(payload) {
383
- // log.info('displayLinkedDevices()', payload)
384
- // return `
385
- // <li class="at_room_tree_child">
386
- // <div id="at-linked-device-${payload.uuid}" class="at_flex at_space_between">
387
- // <span id="at-linked-device-${payload.uuid}"> ${i18n.t(`${payload.name}`)} </span>
388
- // </div>
389
- // </li>
390
- // `
391
- // }
@@ -1,14 +0,0 @@
1
- import { ScreenShareRequest, ScreenShareSessionUser, ScreenShareUser } from '../../../types';
2
- export declare function renderUsersPane(): HTMLElement;
3
- export declare function renderUsersList(users: ScreenShareUser[]): void;
4
- export declare function renderOnlineUserRow(user: ScreenShareUser): HTMLTableRowElement;
5
- export declare function renderOfflineUserRow(user: ScreenShareUser): HTMLTableRowElement;
6
- export declare function sortUsersRowByOnlineState(onlineFirst?: boolean): void;
7
- export declare function handleClickEventUserRow(): void;
8
- export declare function renderSharingSpaceDetail(user: ScreenShareSessionUser): void;
9
- export declare function handleClickEventBackToUserListLink(): void;
10
- export declare function renderScreenShareRequestModal(request: ScreenShareRequest): void;
11
- export declare function handleInputEventSelectPointerSettings(): void;
12
- export declare function handleClickEventEndSessionBtn(): void;
13
- export declare function handleScreenShareUsersUpdated(users: ScreenShareUser[]): void;
14
- export declare function handleScreenShareEndSessionEvent(): void;
@@ -1,273 +0,0 @@
1
- import { _space, dispatchSpaceEvent } from '../../../architwin';
2
- import { SPACE_EVENTS } from '../../../types';
3
- import i18n from './i18n';
4
- let _currentUser;
5
- let _screenShareUsers = [];
6
- let _screenShareUser;
7
- let _screenShareSessionUsers;
8
- let _screenShareSessionUser;
9
- let _screenShareSession;
10
- let _screenShareUsersSortSettings = { onlineFirst: true };
11
- let _onDisplayComponent;
12
- export function renderUsersPane() {
13
- const element = document.createElement('div');
14
- element.setAttribute('id', 'at-users-pane');
15
- element.style.setProperty('width', '400px');
16
- element.classList.add('at_container');
17
- element.innerHTML = `
18
- <div id="at-users-pane" class="at_flex at_flex_column">
19
- <div id="at-users-pane-content" class="at_form_container">
20
- <div class="at_flex at_justify_start">
21
- <span class="at_bolder at_text_base">${i18n.t('Users')}</span>
22
- </div>
23
- <div class="at_disable_hover_users_list at_scrollable_container at_h-min-45">
24
- <table id="at-user-list-container">
25
- </table>
26
- </div>
27
- </div>
28
- </div>
29
- `;
30
- return element;
31
- }
32
- export function renderUsersList(users) {
33
- _onDisplayComponent = 'USER_LIST';
34
- _screenShareUsers = users;
35
- const usersContainer = document.getElementById("at-user-list-container");
36
- if (!usersContainer) {
37
- console.error("Tag container does not exist in DOM");
38
- return;
39
- }
40
- if (users.length <= 0) {
41
- console.log("No tags to load");
42
- usersContainer.innerHTML = ``;
43
- return;
44
- }
45
- usersContainer.innerHTML = '';
46
- users.forEach(user => {
47
- const row = user.onlineStatus !== 'offline' ? renderOnlineUserRow(user) : renderOfflineUserRow(user);
48
- usersContainer.appendChild(row);
49
- });
50
- handleClickEventUserRow();
51
- sortUsersRowByOnlineState(true);
52
- }
53
- export function renderOnlineUserRow(user) {
54
- const element = document.createElement("tr");
55
- element.setAttribute('id', `at-user-row-${user.id}`);
56
- element.dataset.id = user.id;
57
- element.classList.add(...['at_online_user_row', 'at_flex', 'at_items_center', 'at_justify_between']);
58
- const iconOrSharingText = user.onlineStatus === 'in_session'
59
- ? `
60
- <div class="at_flex at_items_center at_justify_center">
61
- <p>Now Sharing</p>
62
- </div>
63
- `
64
- : `
65
- <div class="at_user_screen_sharing_state at_flex at_items_center at_justify_center">
66
- <div class="mdi mdi-monitor-share"></div>
67
- </div>
68
- `;
69
- element.innerHTML = `
70
- <td id="at_user_row_${user.id}">
71
- <div class="at_flex at_flex_row at_items_center">
72
- <div class="at_users_online_indicator"></div>
73
- <span class="at_no_hover_text_online_user at_text_base">${user.name}</span>
74
- </div>
75
- </td>
76
- <td>
77
- ${iconOrSharingText}
78
- </td>
79
- `;
80
- return element;
81
- }
82
- export function renderOfflineUserRow(user) {
83
- const element = document.createElement("tr");
84
- element.setAttribute('id', `at-user-row-${user.id}`);
85
- element.dataset.id = user.id;
86
- element.classList.add(...['at_offline_user_row', 'at_flex', 'at_items_center', 'at_justify_between']);
87
- element.innerHTML = `
88
- <td id="at_user_row_${user.id}">
89
- <div class="at_flex at_flex_row at_items_center">
90
- <div class="at_users_ofline_indicator"></div>
91
- <span class="at_no_hover_text_offline_user at_text_base at_offline_user_name_text">${user.name}</span>
92
- </div>
93
- </td>
94
- `;
95
- return element;
96
- }
97
- export function sortUsersRowByOnlineState(onlineFirst = _screenShareUsersSortSettings.onlineFirst || true) {
98
- _screenShareUsersSortSettings = { onlineFirst };
99
- const table = document.getElementById('at-user-list-container');
100
- const rows = Array.from(table.querySelectorAll('tr'));
101
- if (onlineFirst) {
102
- rows.sort((a, b) => {
103
- const aClass = a.classList.contains('at_online_user_row');
104
- const bClass = b.classList.contains('at_online_user_row');
105
- return Number(bClass) - Number(aClass);
106
- });
107
- table.append(...rows);
108
- }
109
- }
110
- export function handleClickEventUserRow() {
111
- const table = document.getElementById('at-user-list-container');
112
- if (table) {
113
- table.addEventListener('click', (event) => {
114
- const target = event.target;
115
- const row = target.closest('tr');
116
- if (row && table.contains(row)) {
117
- const id = row.dataset.id;
118
- const user = _screenShareUsers.find(u => u.id === id);
119
- _screenShareUser = user;
120
- if (user.onlineStatus === 'offline')
121
- return;
122
- if (user.onlineStatus === 'in_session') {
123
- const usersPaneContent = document.getElementById('at-users-pane-content');
124
- usersPaneContent.innerHTML = '';
125
- const sessionUser = {
126
- id: user.id,
127
- name: user.name,
128
- role: 'guest',
129
- session: _screenShareSession
130
- };
131
- renderSharingSpaceDetail(sessionUser);
132
- }
133
- else {
134
- const nowEpochSeconds = Math.floor(Date.now() / 1000);
135
- const screenShareInvitation = {
136
- user: user,
137
- requestBy: _currentUser,
138
- requestedAt: nowEpochSeconds,
139
- status: 'pending'
140
- };
141
- dispatchSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_REQUEST, screenShareInvitation);
142
- // renderScreenShareRequestModal(screenShareInvitation) // moved it to front end
143
- }
144
- }
145
- });
146
- }
147
- }
148
- export function renderSharingSpaceDetail(user) {
149
- var _a;
150
- _onDisplayComponent = 'SPACE_SHARING_DETAILS';
151
- _screenShareSessionUser = user;
152
- const usersPaneContent = document.getElementById('at-users-pane-content');
153
- const element = document.createElement('div');
154
- element.setAttribute('id', 'at-sharing-space-details');
155
- element.classList.add('at_form_container');
156
- element.innerHTML = `
157
- <div class="at_flex at_justify_start">
158
- <span class="at_bolder at_text_base at_capitalize">${i18n.t('Sharing Space')}</span>
159
- </div>
160
- <div class="at_flex at_flex_column at_gap_half_rem">
161
- <div class="at_screen_share_guest_card at_flex at_flex_row at_justify_between at_items_center">
162
- <div class="at_flex at_flex_column at_justify_start">
163
- <p class="at_bolder at_text_base">${user.name}</p>
164
- <span class="at_subtitle_text">Your are sharing ${(_a = _space === null || _space === void 0 ? void 0 : _space.name) !== null && _a !== void 0 ? _a : 'test'} to this person</span>
165
- </div>
166
- <div class="at_users_online_indicator"></div>
167
- </div>
168
- <div class="at_bolder at_text_base">Pointer</div>
169
- <div class="at_flex at_flex_column at_justify_start">
170
- <div class="at_screen_share_pointer_choices">
171
- <select id="at_select_screen_share_pointer" name="at_screen_share_pointer">
172
- <option>${i18n.t('Off')}</option>
173
- <option>${i18n.t('On')}</option>
174
- </select>
175
- </div>
176
- </div>
177
- <div class="at_flex at_flex_column at_justify_center at_items_center">
178
- <div id="at-back-user-list-link" class="at_back_user_list_link">
179
- <span class="mdi mdi-arrow-left"></span>
180
- <p> ${i18n.t('Back to user list')}</p>
181
- </div>
182
- <button type="button" id="at-screen-share-end-session-btn" class="at_screen_share_end_session_btn">
183
- ${i18n.t('End Session')}
184
- </button>
185
- </div>
186
- </div>
187
- `;
188
- usersPaneContent.appendChild(element);
189
- handleClickEventBackToUserListLink();
190
- handleInputEventSelectPointerSettings();
191
- handleClickEventEndSessionBtn();
192
- }
193
- export function handleClickEventBackToUserListLink() {
194
- const link = document.getElementById('at-back-user-list-link');
195
- if (link) {
196
- link.addEventListener('click', () => {
197
- const usersPaneContent = document.getElementById('at-users-pane-content');
198
- usersPaneContent.innerHTML = '';
199
- usersPaneContent.classList.add('at_form_container');
200
- usersPaneContent.innerHTML = `
201
- <div class="at_flex at_justify_start">
202
- <span class="at_bolder at_text_base">${i18n.t('Users')}</span>
203
- </div>
204
- <div class="at_disable_hover_users_list at_scrollable_container at_h-min-45">
205
- <table id="at-user-list-container">
206
- </table>
207
- </div>
208
- `;
209
- renderUsersList(_screenShareUsers);
210
- });
211
- }
212
- }
213
- export function renderScreenShareRequestModal(request) {
214
- var _a;
215
- _onDisplayComponent = 'SCREEN_SHARE_REQUEST_MODAL';
216
- const element = document.createElement('dialog');
217
- element.setAttribute('id', 'at-screen-share-request-modal');
218
- element.classList.add('at_screen_share_request_modal');
219
- element.innerHTML = `
220
- <div class="at_screen_share_request_modal_content at_flex at_flex_column at_justify_center at_items_center">
221
- <div class="at_screen_share_icon mdi mdi-monitor-multiple"></div>
222
- <h1 class="at_screen_share_request_message">${i18n.t('Waiting for remote screen share confirmation')}</h1>
223
- <p class="at_screen_share_request_sub_message"> ${i18n.t('You are requesting to remotely share your space to')} <strong>${request.user.name}</strong></p>
224
- <button type="button" id="at-screen-share-request-btn" class="at_screen_share_cancel_request_btn">${i18n.t('Cancel Request')}</button>
225
- </div>
226
- `;
227
- // disabled modal dismiss via Esc key
228
- function blockEscapeKey(e) {
229
- if (e.key === 'Escape' && element.open) {
230
- e.preventDefault();
231
- e.stopPropagation();
232
- }
233
- }
234
- element.addEventListener('keydown', blockEscapeKey);
235
- element.addEventListener('cancel', (event) => {
236
- event.preventDefault();
237
- });
238
- (_a = element.querySelector('#at-screen-share-request-btn')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', () => {
239
- const cancelRequest = Object.assign(Object.assign({}, request), { status: 'canceled' });
240
- dispatchSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_CANCEL_REQUEST, cancelRequest);
241
- element.close();
242
- element.remove();
243
- _onDisplayComponent = 'USER_LIST';
244
- });
245
- document.body.appendChild(element);
246
- element.showModal();
247
- }
248
- export function handleInputEventSelectPointerSettings() {
249
- const select = document.getElementById('at_select_screen_share_pointer');
250
- if (select) {
251
- select.addEventListener('input', (event) => {
252
- const target = event.target;
253
- _screenShareSession = Object.assign(Object.assign({}, _screenShareSession), { isPointerEnabled: target.value === 'On' });
254
- dispatchSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_POINTER_UPDATE, _screenShareSession);
255
- });
256
- }
257
- }
258
- export function handleClickEventEndSessionBtn() {
259
- const button = document.getElementById('at-screen-share-end-session-btn');
260
- if (button) {
261
- button.addEventListener('click', () => {
262
- dispatchSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_END_SESSION, handleScreenShareEndSessionEvent);
263
- });
264
- }
265
- }
266
- export function handleScreenShareUsersUpdated(users) {
267
- renderUsersList(users);
268
- }
269
- export function handleScreenShareEndSessionEvent() {
270
- _screenShareSessionUsers = [];
271
- _screenShareSession = {};
272
- renderUsersList(_screenShareUsers);
273
- }