architwin 1.13.1 → 1.13.3

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.
@@ -192,7 +192,9 @@ i18n
192
192
  "ConfirmDeletePipeCategory": "Are you sure you want to delete this pipe category?",
193
193
  "DeletePipe": "Delete pipe",
194
194
  "ConfirmDeletePipe": "Are you sure you want to delete this pipe?",
195
- "AllCategory": "All Category"
195
+ "PipeCategoryName": "Enter pipe type",
196
+ "HideShowAllPipes": "Hide/Show All Pipes",
197
+ "PipePlaceHolder": "Ex: Gas Pipe",
196
198
  }
197
199
  },
198
200
  ja: {
@@ -364,7 +366,7 @@ i18n
364
366
  "SelectPipeType": "配管種別選択",
365
367
  "AddPipeType": "配管種別を追加",
366
368
  "EditPipeType": "配管種別を編集",
367
- "PipeTypeName": "改版種別名",
369
+ "PipeTypeName": "配管種別名",
368
370
  "CategoryColor": "配管色",
369
371
  "NoPipesToDisplay": "表示する快感がありません",
370
372
  "DrawPipe": "配管を描画",
@@ -384,7 +386,9 @@ i18n
384
386
  "ConfirmDeletePipeCategory": "この配管種別を削除してもよろしいですか?",
385
387
  "DeletePipe": "配管を削除",
386
388
  "ConfirmDeletePipe": "この快感を削除してもよろしいですか?",
387
- "AllCategory": "「すべてのカテゴリ」"
389
+ "PipeCategoryName": "配管種別を入力",
390
+ "HideShowAllPipes": "全ての配管を表示/非表示",
391
+ "PipePlaceHolder": "ガス配管"
388
392
  }
389
393
  }
390
394
  },
@@ -1,7 +1,6 @@
1
1
  import { IPipeCategory, IPipe } from "../../../types";
2
2
  export declare class PipeForm {
3
3
  private category;
4
- private mode;
5
4
  private collapse;
6
5
  private readonly colorCategory;
7
6
  constructor();
@@ -7,7 +7,7 @@ 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 { _3DXObjects, _pipeCategories, _pipes, _selectedPipe, _selectedPipeCategory, cancelDraw, dispatchSpaceEvent, disposeModel, enableVerticeControls, getCurrentCameraPose, moveToSweep, redoDrawAction, renderPath, setModelVisibility, setPathLineOptions, setPipeCategories, setPipeIsDrawingMode, setPipes, startDraw, undoDrawAction } from "../../../architwin";
10
+ import { _3DXObjects, _pipes, _selectedPipe, _selectedPipeCategory, _undoDrawActions, cancelDraw, dispatchSpaceEvent, disposeModel, enableVerticeControls, getCurrentCameraPose, moveToSweep, redoDrawAction, renderPath, setModelVisibility, setPathLineOptions, setPipeIsDrawingMode, setPipes, startDraw, undoDrawAction } from "../../../architwin";
11
11
  import i18n from './i18n';
12
12
  import { COLLAPSE, SPACE_EVENTS } from "../../../types";
13
13
  import { Collapse } from "./collapse";
@@ -36,10 +36,10 @@ export class PipeForm {
36
36
  <div id="at_pipe_title"></div>
37
37
  </div>
38
38
  <div class="">
39
- <input id="at_pipe_type_name_input" class="at_pipe_input" type="text" name="pipe-name" required>
40
- <label class="at_pipe_label" for="at_pipe_type_name_input">${i18n.t('PipeTypeName')}</label>
39
+ <span class="">${i18n.t('PipeTypeName')}</span>
40
+ <input id="at_pipe_type_name_input" class="at_pipe_input" type="text" name="pipe-name" placeholder="${i18n.t('PipePlaceHolder')}" required>
41
41
  </div>
42
- <div class="at_h-responsive-224">
42
+ <div class="at_h-responsive-264">
43
43
  <div class="at_py-3">
44
44
  <span class="">${i18n.t('CategoryColor')}</span>
45
45
  <div class="at_py-3 ">
@@ -81,11 +81,18 @@ export class PipeForm {
81
81
  const element = document.createElement('div');
82
82
  element.id = 'at-pipe-pane';
83
83
  element.setAttribute('data-cy', 'at-pipe-pane');
84
- element.innerHTML = pipes != undefined && (pipes === null || pipes === void 0 ? void 0 : pipes.filter(pipe => pipe.category_uuid === category.uuid).length)
84
+ element.innerHTML = pipes != undefined && (pipes === null || pipes === void 0 ? void 0 : pipes.filter(pipe => (pipe === null || pipe === void 0 ? void 0 : pipe.category_uuid) === category.uuid).length)
85
85
  ? `
86
86
  <div class="at_collapse-content at_flex at_flex_column at_field at_scrollable_container at_h-responsive-650 at_mb_3">
87
- ${pipes === null || pipes === void 0 ? void 0 : pipes.filter(pipe => pipe.category_uuid === category.uuid).sort((a, b) => new Date(a.created_on).getTime() - new Date(b.created_on).getTime()).map(pipe => {
88
- var _a, _b, _c;
87
+ ${pipes
88
+ .filter(pipe => pipe.category_uuid === category.uuid)
89
+ .sort((a, b) => {
90
+ const nameCompare = a.name.localeCompare(b.name);
91
+ if (nameCompare !== 0)
92
+ return nameCompare;
93
+ return new Date(a.created_on).getTime() - new Date(b.created_on).getTime();
94
+ }).map(pipe => {
95
+ var _a;
89
96
  return `
90
97
  <div id="at-collapsible-${COLLAPSE.HEADER}-${pipe.uuid}" class="at_accent_forest at_rounded">
91
98
  <div id="at-input-name-container-${pipe.uuid}" class="at_hidden">
@@ -100,6 +107,7 @@ export class PipeForm {
100
107
  <div class="at_px-2 at_flex at_justify_center at_items_center at_w-half at_mx-w-8 at_accent_forest at_rounded">
101
108
  <span id="at_pipe_name_label_${pipe.uuid}" class="at_px-2">${pipe.name}</span>
102
109
  <div id="${COLLAPSE.TOGGLE_ID}"></div>
110
+
103
111
  <span class="mdi mdi-pen" id="at-edit-btn-${COLLAPSE.HEADER}-${pipe.uuid}" data-uuid="${pipe.uuid}"></span>
104
112
  </div>
105
113
  <span class="mdi mdi-trash-can-outline at_text_xl" id="at-delete-btn-${COLLAPSE.HEADER}-${pipe.uuid}" data-uuid="${pipe.uuid}" data-type="${COLLAPSE.HEADER}"></span>
@@ -109,23 +117,40 @@ export class PipeForm {
109
117
 
110
118
  <div class="at_collapsible_content" id="${COLLAPSE.CONTENT_ID}">
111
119
  <div class="at_p-2">
112
- ${JSON.parse(pipe.json_data) != undefined && JSON.parse(pipe.json_data).vertices.length ?
113
- (_c = (_b = JSON.parse(pipe.json_data)) === null || _b === void 0 ? void 0 : _b.vertices) === null || _c === void 0 ? void 0 : _c.map((vertex, index) => {
120
+ ${(() => {
121
+ console.log("TEMPLERE ==>", pipe);
122
+ let parsed, vertices;
123
+ try {
124
+ parsed = JSON.parse(pipe === null || pipe === void 0 ? void 0 : pipe.json_data);
125
+ vertices = parsed === null || parsed === void 0 ? void 0 : parsed.vertices;
126
+ }
127
+ catch (e) {
128
+ return `
129
+ <div class="at_flex at_justify_center at_items_center at_flex_column">
130
+ <div><span class="mdi mdi-ray-start-vertex-end at_pipe_category-container"></span></div>
131
+ <div>${i18n.t('NoVertexToDisplay')}</div>
132
+ </div>`;
133
+ }
134
+ if (!Array.isArray(vertices) || vertices.length === 0) {
135
+ return `
136
+
137
+
138
+ <div class="at_flex at_justify_center at_items_center at_flex_column">
139
+ <div><span class="mdi mdi-ray-start-vertex-end at_pipe_category-container"></span></div>
140
+ <div>${i18n.t('NoVertexToDisplay')}</div>
141
+ </div>`;
142
+ }
143
+ return vertices.map((vertex, index) => {
114
144
  var _a;
115
145
  return `
116
-
117
- <div class="at_flex at_justify_between at_items_center at_accent_forest at_px-2 at_rounded at_mb_1" id="at-collapsible-${COLLAPSE.LIST}-${vertex.x}">
118
- <span id="at-vertex-color-indicator-${index}" class="mdi mdi-vector-line at_text_xl at_pipe-vertex-bg at_rounded" style="background-color:${(_a = JSON.parse(category.json_data)) === null || _a === void 0 ? void 0 : _a.color}"></span>
119
- <span class="at_mr_3"> ${i18n.t('Vertex')} ${index + 1}</span>
120
- <span class="mdi mdi-trash-can-outline at_text_xl" id="at-delete-btn-${COLLAPSE.LIST}-${vertex.x}" data-uuid="${vertex.x}" data-index="${index}" data-type="${COLLAPSE.LIST}"></span>
121
- </div>
122
- `;
123
- }).join('')
124
- :
125
- `<div class="at_flex at_justify_center at_items_center at_flex_column">
126
- <div><span class="mdi mdi-ray-start-vertex-end at_pipe_category-container"></span></div>
127
- <div>${i18n.t('NoVertexToDisplay')}</div>
128
- </div>`}
146
+ <div class="at_flex at_justify_between at_items_center at_accent_forest at_px-2 at_rounded at_mb_1" id="at-collapsible-${COLLAPSE.LIST}-${vertex.x}">
147
+ <span id="at-vertex-color-indicator-${index}" class="mdi mdi-vector-line at_text_xl at_pipe-vertex-bg at_rounded" style="background-color:${(_a = JSON.parse(category.json_data)) === null || _a === void 0 ? void 0 : _a.color}"></span>
148
+ <span class="at_mr_3">${i18n.t('Vertex')} ${index + 1}</span>
149
+ <span class="mdi mdi-trash-can-outline at_text_xl" id="at-delete-btn-${COLLAPSE.LIST}-${vertex.x}" data-uuid="${vertex.x}" data-index="${index}" data-type="${COLLAPSE.LIST}"></span>
150
+ </div>
151
+ `;
152
+ }).join('');
153
+ })()}
129
154
  </div>
130
155
  </div>
131
156
  </div>
@@ -146,7 +171,6 @@ export class PipeForm {
146
171
  var _a;
147
172
  return __awaiter(this, void 0, void 0, function* () {
148
173
  this.resetInteractionState();
149
- // this.category = category
150
174
  const pipeNameInput = document.getElementById('at_pipe_type_name_input');
151
175
  if (!pipeNameInput)
152
176
  return;
@@ -167,6 +191,7 @@ export class PipeForm {
167
191
  });
168
192
  }
169
193
  observeInput() {
194
+ //bug the value of pipes gone when pipe
170
195
  const categoryNameInput = document.getElementById('at_pipe_type_name_input');
171
196
  observeInputToUpdate(categoryNameInput, () => _selectedPipeCategory, 'name');
172
197
  }
@@ -180,7 +205,7 @@ export class PipeForm {
180
205
  const uuid = target.dataset.uuid;
181
206
  const selectedPipe = _pipes.find(pipe => pipe.uuid == uuid);
182
207
  const parsed = JSON.parse((_a = selectedPipe.json_data) !== null && _a !== void 0 ? _a : '{}');
183
- this.setEditMode(uuid);
208
+ this.setEditMode(selectedPipe);
184
209
  if (parsed.vertices) {
185
210
  moveToSweep(parsed.sweepId, parsed.rotation);
186
211
  _3DXObjects.filter(obj => obj.object.uuid != uuid).forEach(targetObj => {
@@ -194,13 +219,13 @@ export class PipeForm {
194
219
  });
195
220
  }
196
221
  // enables edit mode for a selected pipe
197
- setEditMode(uuid) {
222
+ setEditMode(pipe) {
198
223
  var _a;
199
224
  return __awaiter(this, void 0, void 0, function* () {
200
- yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_SELECTED, uuid);
201
- // this.renderPipePath(_selectedPipe.uuid)
225
+ const uuid = pipe.uuid;
226
+ yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_ON_CHANGE, pipe); //review
202
227
  this.collapse.setExpand(true);
203
- this.populateFormCollapse(_selectedPipeCategory, _selectedPipe);
228
+ this.populateFormCollapse(_selectedPipeCategory, pipe);
204
229
  this.savePipe();
205
230
  this.delete();
206
231
  const inputName = document.getElementById(`at-input-name-container-${uuid}`);
@@ -223,7 +248,7 @@ export class PipeForm {
223
248
  });
224
249
  });
225
250
  }
226
- //setup save edited pipe listener
251
+ //setup SAVE_PIPE edited pipe listener
227
252
  savePipe() {
228
253
  document.querySelectorAll(`[id^="at-save-edit-btn-${COLLAPSE.HEADER}"]`).forEach(btn => {
229
254
  btn.addEventListener('click', (e) => __awaiter(this, void 0, void 0, function* () {
@@ -236,14 +261,13 @@ export class PipeForm {
236
261
  }
237
262
  const input = document.getElementById(`at_pipe_name_input_${uuid}`);
238
263
  _selectedPipe.name = input.value;
239
- console.log("SAVE PIPE =>", _selectedPipe);
240
264
  yield this.savePiPeEventHandler();
241
265
  }));
242
266
  });
243
267
  }
244
268
  savePiPeEventHandler() {
245
269
  return __awaiter(this, void 0, void 0, function* () {
246
- yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_SAVED, Object.assign({}, _selectedPipe));
270
+ yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_ON_CHANGE, Object.assign({}, _selectedPipe));
247
271
  ~(_pipes.findIndex((c, i) => c.uuid === _selectedPipe.uuid && (setPipes((_pipes[i] = _selectedPipe, _pipes)), 1)));
248
272
  notyf.success(`${i18n.t('PipeSavedSuccessfully')}`);
249
273
  this.init(_selectedPipeCategory, _pipes);
@@ -253,10 +277,9 @@ export class PipeForm {
253
277
  return __awaiter(this, void 0, void 0, function* () {
254
278
  const updated = { vertices: payload, sweepId: getCurrentCameraPose().sweep, rotation: getCurrentCameraPose().rotation };
255
279
  _selectedPipe.json_data = JSON.stringify(updated);
256
- yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_SAVED, Object.assign({}, _selectedPipe));
257
- ~(_pipes.findIndex((c, i) => c.uuid === _selectedPipe.uuid && (setPipes((_pipes[i] = _selectedPipe, _pipes)), 1)));
280
+ yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_ON_CHANGE, Object.assign({}, _selectedPipe));
258
281
  this.populateFormCollapse(_selectedPipeCategory, _selectedPipe);
259
- this.setEditMode(_selectedPipe.uuid);
282
+ this.setEditMode(_selectedPipe);
260
283
  });
261
284
  }
262
285
  // save category listener
@@ -270,11 +293,13 @@ export class PipeForm {
270
293
  notyf.error(`${i18n.t('SaveTheCurrentPipeBeforeProceeding')}`);
271
294
  return;
272
295
  }
273
- // const payload = await this.extractCategoryPayload()
296
+ if (!_selectedPipeCategory.name) {
297
+ notyf.error(`${i18n.t('PipeCategoryName')}`);
298
+ return;
299
+ }
274
300
  this.getDrawButton(null, 'white').classList.remove('active');
275
301
  yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_CATEGORY_SAVED, Object.assign({}, _selectedPipeCategory));
276
- ~(_pipeCategories.findIndex((c, i) => c.uuid === _selectedPipeCategory.uuid && (setPipeCategories((_pipeCategories[i] = _selectedPipeCategory, _pipeCategories)), 1)));
277
- notyf.success(`${i18n.t('CategorySuccessfullySaved')}`);
302
+ yield waitForChange(() => _pipes, { interval: 500, timeout: 10000 });
278
303
  yield toggleDisplayPane(target.id);
279
304
  }));
280
305
  }
@@ -284,19 +309,17 @@ export class PipeForm {
284
309
  return;
285
310
  btn.addEventListener('click', (e) => __awaiter(this, void 0, void 0, function* () {
286
311
  const target = e.currentTarget;
287
- const titleElement = document.getElementById('at_pipe_title');
288
- const pipes = _pipes.filter(p => p.category_uuid === _selectedPipeCategory.uuid);
289
- console.log("delete _selectedPipeCategory", pipes.length);
290
- if (titleElement.textContent !== i18n.t('EditPipeType')) {
291
- dispatchSpaceEvent(SPACE_EVENTS.PIPE_CATEGORY_REMOVED, _selectedPipeCategory.uuid);
292
- ~(_pipeCategories.findIndex((c, i) => c.uuid === _selectedPipeCategory.uuid && (setPipeCategories((_pipeCategories.splice(i, 1), _pipeCategories)), 1)));
293
- }
294
- yield toggleDisplayPane(target.id);
312
+ toggleDisplayPane(target.id);
295
313
  }));
296
314
  }
297
315
  // delete pipe/vertex listener
298
316
  delete() {
299
317
  document.querySelectorAll('[id^="at-delete-btn"]').forEach(el => {
318
+ var _a;
319
+ if (this.getDrawButton((_a = JSON.parse(_selectedPipeCategory.json_data)) === null || _a === void 0 ? void 0 : _a.color, 'black').classList.contains('active')) {
320
+ el.classList.add("at_hide");
321
+ return;
322
+ }
300
323
  el.addEventListener('click', (e) => __awaiter(this, void 0, void 0, function* () {
301
324
  const target = e.currentTarget;
302
325
  const type = target.dataset.type;
@@ -321,11 +344,9 @@ export class PipeForm {
321
344
  else {
322
345
  dispatchSpaceEvent(SPACE_EVENTS.PIPE_VERTEX_REMOVED, uuid);
323
346
  const index = Number(target.dataset.index);
324
- console.log("INDEx =>", index);
325
347
  this.renderPipePath(_selectedPipe.uuid);
326
348
  if (this.getDrawButton((_a = JSON.parse(_selectedPipeCategory.json_data)) === null || _a === void 0 ? void 0 : _a.color, 'black').classList.contains('active')) {
327
349
  const targetObj = _3DXObjects.find(obj => obj.object.uuid == _selectedPipe.uuid);
328
- // deleteVertex(index)
329
350
  enableVerticeControls(targetObj.component);
330
351
  }
331
352
  notyf.success(`${i18n.t('VertexDeletedSuccessfully!')}`);
@@ -373,16 +394,17 @@ export class PipeForm {
373
394
  if (!targetObject)
374
395
  return;
375
396
  enableVerticeControls(targetObject.component);
376
- this.setEditMode(_selectedPipe.uuid);
397
+ this.setEditMode(_selectedPipe);
377
398
  }
378
399
  else {
379
- yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_SAVED, {});
380
- const newPipe = yield waitForChange(() => _selectedPipe);
381
- this.setEditMode(newPipe.uuid);
400
+ yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_ADD, {});
401
+ this.setEditMode(_selectedPipe);
382
402
  }
383
- console.log("selectedPipeCategory. ==>", _selectedPipeCategory);
384
403
  }
385
404
  else {
405
+ document.querySelectorAll(`[id^="at-delete-btn-${COLLAPSE.LIST}"]`).forEach(el => {
406
+ el.classList.remove('at_disabled');
407
+ });
386
408
  this.savePiPeEventHandler();
387
409
  cancelDraw();
388
410
  setPipeIsDrawingMode(false);
@@ -398,14 +420,14 @@ export class PipeForm {
398
420
  return __awaiter(this, void 0, void 0, function* () {
399
421
  yield dispatchSpaceEvent(SPACE_EVENTS.DRAW_PIPE_UNDO);
400
422
  this.populateFormCollapse(_selectedPipeCategory, _selectedPipe);
401
- this.setEditMode(_selectedPipe.uuid);
423
+ this.setEditMode(_selectedPipe);
402
424
  undoDrawAction();
403
425
  });
404
426
  }
405
427
  redoEventHandler() {
406
428
  dispatchSpaceEvent(SPACE_EVENTS.DRAW_PIPE_REDO, _selectedPipe);
407
429
  this.populateFormCollapse(_selectedPipeCategory, _selectedPipe);
408
- this.setEditMode(_selectedPipe.uuid);
430
+ this.setEditMode(_selectedPipe);
409
431
  // this.renderPipePath()
410
432
  redoDrawAction();
411
433
  }
@@ -419,6 +441,8 @@ export class PipeForm {
419
441
  notyf.error(`${i18n.t('DrawingModeIsCurrentlyInactive')}`);
420
442
  return;
421
443
  }
444
+ if (_undoDrawActions.length == 0)
445
+ return;
422
446
  this.undoEventHandler();
423
447
  }));
424
448
  }
@@ -433,6 +457,8 @@ export class PipeForm {
433
457
  notyf.error(`${i18n.t('DrawingModeIsCurrentlyInactive')}`);
434
458
  return;
435
459
  }
460
+ if (_undoDrawActions.length == 0)
461
+ return;
436
462
  this.redoEventHandler();
437
463
  }));
438
464
  }
@@ -462,8 +488,6 @@ export class PipeForm {
462
488
  document.querySelectorAll('[id*="at-vertex-color-indicator"]').forEach(el => {
463
489
  el.style.backgroundColor = bgColor;
464
490
  });
465
- yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_CATEGORY_SAVED, Object.assign({}, _selectedPipeCategory));
466
- ~(_pipeCategories.findIndex((c, i) => c.uuid === _selectedPipeCategory.uuid && (setPipeCategories((_pipeCategories[i] = _selectedPipeCategory, _pipeCategories)), 1)));
467
491
  if (!this.getDrawButton((_a = JSON.parse(_selectedPipeCategory.json_data)) === null || _a === void 0 ? void 0 : _a.color, 'black').classList.contains('active')) {
468
492
  const uuid = _selectedPipe ? _selectedPipe.uuid : null;
469
493
  this.renderPipePath(uuid);
@@ -1,8 +1,6 @@
1
1
  export declare class PipeList {
2
2
  private form;
3
3
  private collapse;
4
- private categories;
5
- private pipes;
6
4
  constructor();
7
5
  renderPane(): HTMLElement;
8
6
  private createCollapseElement;
@@ -19,8 +19,6 @@ import { setModalAction, toggleModal } from "./modal";
19
19
  export class PipeList {
20
20
  // Initialize collapse UI and pipe form
21
21
  constructor() {
22
- this.categories = [];
23
- this.pipes = [];
24
22
  this.collapse = new Collapse(undefined, { expand: false });
25
23
  this.form = new PipeForm();
26
24
  }
@@ -38,22 +36,20 @@ export class PipeList {
38
36
  <span>${i18n.t('Pipes')}</span>
39
37
  </div>
40
38
  <div class="at_form_container ">
41
- <div class="at_field at_flex_column" style="${_pipeCategories ? '' : 'display: none;'}">
42
- <div class="">
43
- <span>${i18n.t('SelectPipeType')}</span>
44
- </div>
45
- <div id="at-custom-pipe-category-dropdown" data-cy="at-custom-pipe-category-dropdown">
46
- <div id="at-pipe-category-dropdown" class=" at_dropdown at_flex at_flex_row at_space_between">
47
- <div class="at_dropdown_toggle" id="at-pipe-category-dropdown-toggle" data-cy="at-pipe-category-dropdown-toggle">${i18n.t('NoSelection')}</div>
48
- <span class="mdi mdi-triangle-down at_chevron" id="at-pipe-category-chevron" data-cy="at-pipe-category-chevron"></span>
49
- </div>
50
- <div style="position:absolute">
51
- <div class="at_dropdown_options" id="at-pipe-category-options" data-cy="at-pipe-category-options">
39
+ <div class="at_field at_flex_column" style="${_pipeCategories ? '' : 'display: none;'}">
40
+ <label for="">${i18n.t('SelectPipeType')}</label>
41
+ <div id="at-custom-pipe-category-dropdown" data-cy="at-custom-pipe-category-dropdown">
42
+ <div id="at-pipe-category-dropdown" class="at_dropdown at_flex at_flex_row at_space_between">
43
+ <div class="at_dropdown_toggle" id="at-pipe-category-dropdown-toggle" data-cy="at-pipe-category-dropdown-toggle">${i18n.t('NoSelection')}</div>
44
+ <span class="mdi mdi-triangle-down at_chevron" id="at-pipe-category-chevron" data-cy="at-pipe-category-chevron"></span>
45
+ </div>
46
+ <div style="position:absolute;">
47
+ <div class="at_dropdown_options" id="at-pipe-category-options" data-cy="at-category-options">
48
+
49
+ </div>
52
50
  </div>
53
51
  </div>
54
52
  </div>
55
-
56
- </div>
57
53
  </div>
58
54
  <div class="at_form_container at_field ">
59
55
  <div class="at_collapsible_container" id="at-dropdown_container">
@@ -92,9 +88,15 @@ export class PipeList {
92
88
  </div>
93
89
  <div class="at_collapsible_content at_secondary_azusa" id="${COLLAPSE.CONTENT_ID}">
94
90
  <div class="at_p-2">
95
-
96
91
  ${pipes != undefined && pipes.filter(pipe => pipe.category_uuid === category.uuid).length ?
97
- pipes.filter(pipe => pipe.category_uuid === category.uuid).sort((a, b) => new Date(a.created_on).getTime() - new Date(b.created_on).getTime()).map(pipe => `
92
+ pipes
93
+ .filter(pipe => pipe.category_uuid === category.uuid)
94
+ .sort((a, b) => {
95
+ const nameCompare = a.name.localeCompare(b.name);
96
+ if (nameCompare !== 0)
97
+ return nameCompare;
98
+ return new Date(a.created_on).getTime() - new Date(b.created_on).getTime();
99
+ }).map(pipe => `
98
100
  <div class="at_locate_area_container at_flex at_justify_end at_gap_2" id="at-collapsible-${COLLAPSE.LIST}-${pipe.uuid}" data-uuid="${pipe.uuid}" data-type="${COLLAPSE.LIST}">
99
101
  <div id="at-locate-area-${COLLAPSE.LIST}-${pipe.uuid}" data-uuid="${pipe.uuid}" data-type="${COLLAPSE.LIST}">
100
102
  <span>${pipe.name}</span>
@@ -128,10 +130,14 @@ export class PipeList {
128
130
  //initialize pane, data binding and some handlers
129
131
  init() {
130
132
  return __awaiter(this, void 0, void 0, function* () {
133
+ // re render data
134
+ yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_INIT);
135
+ const [categories, pipes] = yield waitForChange(() => _pipeCategories, () => _pipes, { interval: 300, timeout: 10000 });
136
+ const element = this.createCollapseElement(categories, pipes);
137
+ // setupDevtools(_pipes)
131
138
  const container = document.getElementById('at-pipe-type-collapse-html-element');
132
139
  if (!container)
133
140
  return;
134
- const element = this.createCollapseElement(_pipeCategories, _pipes);
135
141
  this.collapse.setElement(element);
136
142
  const rendered = this.collapse.render();
137
143
  container.replaceChildren(rendered);
@@ -191,12 +197,10 @@ export class PipeList {
191
197
  return;
192
198
  btn.addEventListener('click', (e) => __awaiter(this, void 0, void 0, function* () {
193
199
  const target = e.currentTarget;
194
- yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_CATEGORY_SAVED, {});
195
- //wait until the _selectedPipeCategory change state value
196
- const newCategory = yield waitForChange(() => _selectedPipeCategory);
197
- console.log("CLICKED ADD CATEGORY =>", newCategory);
200
+ yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_CATEGORY_ADD, {});
201
+ console.log("CLICKED ADD CATEGORY =>", _selectedPipeCategory);
198
202
  this.form.setPipeTitle("AddPipeType");
199
- yield this.form.init(newCategory);
203
+ yield this.form.init(_selectedPipeCategory);
200
204
  yield toggleDisplayPane(target.id);
201
205
  }));
202
206
  }
@@ -207,7 +211,8 @@ export class PipeList {
207
211
  const target = e.currentTarget;
208
212
  const uuid = target.dataset.uuid;
209
213
  this.form.setPipeTitle("EditPipeType");
210
- yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_CATEGORY_SELECTED, uuid);
214
+ const category = _pipeCategories.find(categories => categories.uuid === uuid);
215
+ yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_CATEGORY_SELECTED, category);
211
216
  yield this.form.init(_selectedPipeCategory, _pipes);
212
217
  yield toggleDisplayPane(target.id);
213
218
  }));
@@ -329,36 +334,32 @@ export class PipeList {
329
334
  });
330
335
  }
331
336
  initDropdown(options) {
332
- // Ensure unique options
333
337
  const uniqueOptions = [i18n.t("NoSelection"), ...[...new Set(options)]];
334
338
  const toggleBtn = document.getElementById('at-custom-pipe-category-dropdown');
335
339
  const optionsContainer = document.getElementById('at-pipe-category-options');
336
340
  const toggleLabel = toggleBtn.querySelector('#at-pipe-category-dropdown-toggle');
337
341
  toggleLabel.textContent = i18n.t("NoSelection");
338
- toggleBtn.onclick = () => {
339
- const isNowOpen = optionsContainer.classList.toggle('open');
340
- if (isNowOpen) {
342
+ // Toggle dropdown
343
+ toggleBtn.onclick = (e) => {
344
+ e.stopPropagation(); // prevent bubbling
345
+ const isOpen = optionsContainer.classList.contains('open');
346
+ if (!isOpen) {
347
+ optionsContainer.classList.add('open');
341
348
  optionsContainer.innerHTML = '';
342
349
  uniqueOptions.forEach(opt => {
343
350
  const div = document.createElement('div');
344
- div.style.width = '228px';
345
- div.style.cursor = "pointer";
346
351
  div.textContent = opt;
347
- div.classList.add('at_dropdown-option');
348
- // Mark the default selected (All Category)
349
- if (opt === toggleLabel.textContent) {
350
- div.classList.add('selected');
351
- }
352
- div.onclick = () => {
352
+ div.classList.add('at_option');
353
+ div.onclick = (event) => {
354
+ event.stopPropagation(); // prevent toggleBtn click again
355
+ // CLOSE the dropdown
356
+ optionsContainer.classList.remove('open');
357
+ optionsContainer.innerHTML = '';
358
+ // Set selected label
353
359
  toggleLabel.textContent = opt;
354
- // Remove .selected from all
355
- document.querySelectorAll('.at_dropdown-option.selected').forEach(el => el.classList.remove('selected'));
356
- div.classList.add('selected');
357
- console.log("OPT", opt);
358
360
  const filteredCategory = opt === i18n.t('NoSelection')
359
361
  ? _pipeCategories
360
362
  : _pipeCategories.filter(category => category.name === opt);
361
- // Get all selected category UUIDs (can be multiple if same name)
362
363
  const selectedCategoryUUIDs = filteredCategory.map(cat => cat.uuid);
363
364
  _pipes.forEach(pipe => {
364
365
  const isVisible = selectedCategoryUUIDs.includes(pipe.category_uuid);
@@ -375,14 +376,20 @@ export class PipeList {
375
376
  const rendered = this.collapse.render();
376
377
  container.replaceChildren(rendered);
377
378
  this.eventHandler();
378
- optionsContainer.classList.remove('open');
379
379
  };
380
380
  optionsContainer.appendChild(div);
381
381
  });
382
382
  }
383
383
  else {
384
+ optionsContainer.classList.remove('open');
384
385
  optionsContainer.innerHTML = '';
385
386
  }
386
387
  };
388
+ document.addEventListener('click', (event) => {
389
+ if (!toggleBtn.contains(event.target)) {
390
+ optionsContainer.classList.remove('open');
391
+ optionsContainer.innerHTML = '';
392
+ }
393
+ });
387
394
  }
388
395
  }
@@ -0,0 +1,18 @@
1
+ import { ScreenShareRequest, ScreenShareSessionUser, ScreenShareUser } from '../../../types';
2
+ export declare function renderScreenSharePane(): 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 handleClickEventUserRow(): void;
7
+ export declare function renderSharingSpaceDetail(user: ScreenShareSessionUser): void;
8
+ export declare function handleClickEventBackToUserListLink(): void;
9
+ export declare function renderScreenShareRequestModal(request: ScreenShareRequest): void;
10
+ export declare function handleInputEventSelectPointerSettings(): void;
11
+ export declare function handleClickEventEndSessionBtn(): void;
12
+ export declare function handleScreenShareUsersUpdated(payload: {
13
+ screen_share_users: ScreenShareUser[];
14
+ space_data: Record<string, any>;
15
+ }): void;
16
+ export declare function handleScreenShareEndSessionEvent(): void;
17
+ export declare function handleScreenShareBackUserListPane(): void;
18
+ export declare function handleScreenShareAcceptRequest(payload: ScreenShareRequest): void;