underpost 2.8.637 → 2.8.646

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.
@@ -40,18 +40,6 @@ const CalendarCore = {
40
40
 
41
41
  const titleIcon = html`<i class="fas fa-calendar-alt"></i>`;
42
42
 
43
- const getSrrData = () => {
44
- this.Data[options.idModal].data = range(0, 5).map((i) => {
45
- return {
46
- id: `event-${i}`,
47
- description: `Event ${s4()}${s4()}${s4()}`,
48
- start: new Date().toTimeString(),
49
- end: new Date().toTimeString(),
50
- };
51
- });
52
- };
53
- getSrrData();
54
-
55
43
  const getPanelData = async () => {
56
44
  const result = await EventSchedulerService.get({
57
45
  id: `${getQueryParams().cid ? getQueryParams().cid : Auth.getToken() ? 'creatorUser' : ''}`,
@@ -235,35 +223,9 @@ const CalendarCore = {
235
223
  ];
236
224
 
237
225
  setTimeout(() => {
238
- const resizeModal = () => {
239
- Modal.Data[options.idModal].onObserverListener[options.idModal] = () => {
240
- if (s(`.main-body-calendar-${options.idModal}`))
241
- s(`.main-body-calendar-${options.idModal}`).style.height = `${
242
- s(`.${options.idModal}`).offsetHeight - Modal.headerTitleHeight
243
- }px`;
244
- };
245
- Modal.Data[options.idModal].onObserverListener[options.idModal]();
246
- };
247
- setTimeout(resizeModal);
248
- RouterEvents[`${options.idModal}-main-body`] = ({ route }) => {
249
- if (route === 'calendar') {
250
- setTimeout(() => {
251
- resizeModal();
252
- }, 400);
253
- }
254
- };
255
-
256
226
  s(`.close-calendar-container`).onclick = () => {
257
227
  s(`.calendar-container`).classList.add('hide');
258
228
  s(`.main-body-calendar-${options.idModal}`).classList.remove('hide');
259
- htmls(
260
- `.style-calendar`,
261
- html`<style>
262
- .modal-calendar {
263
- overflow: hidden;
264
- }
265
- </style>`,
266
- );
267
229
  };
268
230
  });
269
231
 
@@ -305,14 +267,6 @@ const CalendarCore = {
305
267
  // renderCalendar();
306
268
  CalendarCore.Data[options.idModal].calendar.setOption('height', 700);
307
269
  Translate.Event['fullcalendar-lang']();
308
- htmls(
309
- `.style-calendar`,
310
- html`<style>
311
- .modal-calendar {
312
- overflow: auto;
313
- }
314
- </style>`,
315
- );
316
270
  },
317
271
  },
318
272
  ],
@@ -404,18 +358,11 @@ const CalendarCore = {
404
358
  <div class="in" style="margin-bottom: 100px"></div>`;
405
359
  };
406
360
 
407
- let delayBlock = false;
361
+ let lastCid;
408
362
  this.Data[options.idModal].updatePanel = async () => {
409
- if (delayBlock) return;
410
- else {
411
- delayBlock = true;
412
- const _currentPath = `${location.pathname}${location.search}`;
413
- setTimeout(() => {
414
- delayBlock = false;
415
- if (`${location.pathname}${location.search}` !== _currentPath) this.Data[options.idModal].updatePanel();
416
- }, 1000);
417
- }
418
363
  const cid = getQueryParams().cid ? getQueryParams().cid : '';
364
+ if (lastCid === cid) return;
365
+ lastCid = cid;
419
366
  if (options.route === 'home') Modal.homeCid = newInstance(cid);
420
367
  if (s(`.main-body-calendar-${options.idModal}`)) {
421
368
  // if (Auth.getToken())
@@ -425,39 +372,22 @@ const CalendarCore = {
425
372
  }
426
373
  };
427
374
 
428
- if (options.route)
375
+ if (options.route) {
429
376
  listenQueryPathInstance({
430
377
  id: options.parentIdModal ? 'html-' + options.parentIdModal : 'main-body',
431
378
  routeId: options.route,
432
379
  event: async (path) => {
433
- setTimeout(() => {
434
- CalendarCore.Data[options.idModal].updatePanel();
435
- });
380
+ CalendarCore.Data[options.idModal].updatePanel();
436
381
  },
437
382
  });
438
-
439
- // if (options.route === 'home')
440
- setTimeout(() => {
441
- CalendarCore.Data[options.idModal].updatePanel();
442
- });
443
-
383
+ if (!options.parentIdModal)
384
+ Modal.Data['modal-menu'].onHome[idPanel] = async () => {
385
+ lastCid = undefined;
386
+ setQueryPath({ path: options.route, queryPath: '' });
387
+ await this.Data[idPanel].updatePanel();
388
+ };
389
+ }
444
390
  return html`
445
- <style>
446
- .main-body-calendar-${options.idModal} {
447
- overflow: auto;
448
- }
449
- .${idPanel}-form {
450
- max-width: 750px !important;
451
- }
452
- </style>
453
- <div class="style-calendar">
454
- <style>
455
- .modal-calendar {
456
- overflow: hidden;
457
- }
458
- </style>
459
- </div>
460
-
461
391
  <div class="in main-body-calendar-${options.idModal}">${await panelRender()}</div>
462
392
  <style>
463
393
  .calendar-container {
@@ -515,13 +445,11 @@ const CalendarCore = {
515
445
 
516
446
  .calendar-buttons-container {
517
447
  padding-bottom: 15px;
518
- top: ${Modal.headerTitleHeight}px;
519
448
  height: 60px;
520
- z-index: 4;
521
449
  }
522
450
  </style>
523
451
  <div class="in calendar-container hide">
524
- <div class="stq modal calendar-buttons-container">
452
+ <div class="in modal calendar-buttons-container">
525
453
  ${await BtnIcon.Render({
526
454
  class: `inl section-mp btn-custom close-calendar-container flr`,
527
455
  label: html`<i class="fa-solid fa-xmark"></i> ${Translate.Render('close')}`,
@@ -577,7 +577,8 @@ const getCurrentTrace = () => {
577
577
  try {
578
578
  _stack;
579
579
  } catch (error) {
580
- return error.stack.split('is not defined')[1];
580
+ console.error(error);
581
+ return error;
581
582
  }
582
583
  };
583
584
 
@@ -16,7 +16,7 @@ const EventsUI = {
16
16
  if (complete) {
17
17
  complete = false;
18
18
  await LoadingAnimation.spinner.play(loadingContainer ? loadingContainer : id);
19
- await LoadingAnimation.bar.play(id);
19
+ if (options.context !== 'modal') await LoadingAnimation.bar.play(id);
20
20
  try {
21
21
  await logic(e);
22
22
  } catch (error) {
@@ -26,7 +26,7 @@ const EventsUI = {
26
26
  html: error?.message ? error.message : error ? error : 'Event error',
27
27
  });
28
28
  }
29
- LoadingAnimation.bar.stop(id);
29
+ if (options.context !== 'modal') LoadingAnimation.bar.stop(id);
30
30
  await LoadingAnimation.spinner.stop(loadingContainer ? loadingContainer : id);
31
31
  complete = true;
32
32
  return;
@@ -323,50 +323,54 @@ const FileExplorer = {
323
323
 
324
324
  downloadFile(new Blob([new Uint8Array(file.data.data)], { type: params.data.mimetype }), params.data.name);
325
325
  });
326
- EventsUI.onClick(`.btn-file-delete-${params.data._id}`, async (e) => {
327
- e.preventDefault();
328
- {
329
- const confirmResult = await Modal.RenderConfirm({
330
- html: async () => {
331
- return html`
332
- <div class="in section-mp" style="text-align: center">
333
- ${Translate.Render('confirm-delete-item')}
334
- <br />
335
- "${params.data.title}"
336
- </div>
337
- `;
338
- },
339
- id: `delete-${params.data._id}`,
340
- });
341
- if (confirmResult.status !== 'confirm') return;
326
+ EventsUI.onClick(
327
+ `.btn-file-delete-${params.data._id}`,
328
+ async (e) => {
329
+ e.preventDefault();
330
+ {
331
+ const confirmResult = await Modal.RenderConfirm({
332
+ html: async () => {
333
+ return html`
334
+ <div class="in section-mp" style="text-align: center">
335
+ ${Translate.Render('confirm-delete-item')}
336
+ <br />
337
+ "${params.data.title}"
338
+ </div>
339
+ `;
340
+ },
341
+ id: `delete-${params.data._id}`,
342
+ });
343
+ if (confirmResult.status !== 'confirm') return;
342
344
 
343
- const { data, status, message } = await FileService.delete({
344
- id: params.data.fileId,
345
+ const { data, status, message } = await FileService.delete({
346
+ id: params.data.fileId,
347
+ });
348
+ NotificationManager.Push({
349
+ html: status,
350
+ status,
351
+ });
352
+ if (status === 'error') return;
353
+ }
354
+ const { data, status, message } = await DocumentService.delete({
355
+ id: params.data._id,
345
356
  });
346
357
  NotificationManager.Push({
347
358
  html: status,
348
359
  status,
349
360
  });
350
361
  if (status === 'error') return;
351
- }
352
- const { data, status, message } = await DocumentService.delete({
353
- id: params.data._id,
354
- });
355
- NotificationManager.Push({
356
- html: status,
357
- status,
358
- });
359
- if (status === 'error') return;
360
-
361
- documentInstance = documentInstance.filter((f) => f._id !== params.data._id);
362
- const format = FileExplorer.documentDataFormat({ document: documentInstance, location });
363
- files = format.files;
364
- folders = format.folders;
365
- // AgGrid.grids[gridFileId].setGridOption('rowData', files);
366
- // const selectedData = gridApi.getSelectedRows();
367
- AgGrid.grids[gridFileId].applyTransaction({ remove: [params.data] });
368
- AgGrid.grids[gridFolderId].setGridOption('rowData', folders);
369
- });
362
+
363
+ documentInstance = documentInstance.filter((f) => f._id !== params.data._id);
364
+ const format = FileExplorer.documentDataFormat({ document: documentInstance, location });
365
+ files = format.files;
366
+ folders = format.folders;
367
+ // AgGrid.grids[gridFileId].setGridOption('rowData', files);
368
+ // const selectedData = gridApi.getSelectedRows();
369
+ AgGrid.grids[gridFileId].applyTransaction({ remove: [params.data] });
370
+ AgGrid.grids[gridFolderId].setGridOption('rowData', folders);
371
+ },
372
+ { context: 'modal' },
373
+ );
370
374
  });
371
375
  }
372
376
 
@@ -400,49 +404,53 @@ const FileExplorer = {
400
404
  `;
401
405
 
402
406
  setTimeout(() => {
403
- EventsUI.onClick(`.btn-folder-delete-${id}`, async (e) => {
404
- const confirmResult = await Modal.RenderConfirm({
405
- html: async () => {
406
- return html`
407
- <div class="in section-mp" style="text-align: center">
408
- ${Translate.Render('confirm-delete-item')}
409
- <br />
410
- "${params.data.location}"
411
- </div>
412
- `;
413
- },
414
- id: `delete-${id}`,
415
- });
416
- if (confirmResult.status !== 'confirm') return;
407
+ EventsUI.onClick(
408
+ `.btn-folder-delete-${id}`,
409
+ async (e) => {
410
+ const confirmResult = await Modal.RenderConfirm({
411
+ html: async () => {
412
+ return html`
413
+ <div class="in section-mp" style="text-align: center">
414
+ ${Translate.Render('confirm-delete-item')}
415
+ <br />
416
+ "${params.data.location}"
417
+ </div>
418
+ `;
419
+ },
420
+ id: `delete-${id}`,
421
+ });
422
+ if (confirmResult.status !== 'confirm') return;
417
423
 
418
- e.preventDefault();
419
- const idFilesDelete = [];
420
- for (const file of documentInstance.filter(
421
- (f) => FileExplorer.locationFormat({ f }) === params.data.location, // .startsWith(params.data.location),
422
- )) {
423
- {
424
- const { data, status, message } = await FileService.delete({
425
- id: file.fileId._id,
426
- });
424
+ e.preventDefault();
425
+ const idFilesDelete = [];
426
+ for (const file of documentInstance.filter(
427
+ (f) => FileExplorer.locationFormat({ f }) === params.data.location, // .startsWith(params.data.location),
428
+ )) {
429
+ {
430
+ const { data, status, message } = await FileService.delete({
431
+ id: file.fileId._id,
432
+ });
433
+ }
434
+ {
435
+ idFilesDelete.push(file._id);
436
+ const { data, status, message } = await DocumentService.delete({
437
+ id: file._id,
438
+ });
439
+ }
427
440
  }
428
- {
429
- idFilesDelete.push(file._id);
430
- const { data, status, message } = await DocumentService.delete({
431
- id: file._id,
432
- });
433
- }
434
- }
435
- NotificationManager.Push({
436
- html: Translate.Render('success-delete'),
437
- status: 'success',
438
- });
439
- documentInstance = documentInstance.filter((f) => !idFilesDelete.includes(f._id));
440
- const format = FileExplorer.documentDataFormat({ document: documentInstance, location });
441
- files = format.files;
442
- folders = format.folders;
443
- AgGrid.grids[gridFileId].setGridOption('rowData', files);
444
- AgGrid.grids[gridFolderId].setGridOption('rowData', folders);
445
- });
441
+ NotificationManager.Push({
442
+ html: Translate.Render('success-delete'),
443
+ status: 'success',
444
+ });
445
+ documentInstance = documentInstance.filter((f) => !idFilesDelete.includes(f._id));
446
+ const format = FileExplorer.documentDataFormat({ document: documentInstance, location });
447
+ files = format.files;
448
+ folders = format.folders;
449
+ AgGrid.grids[gridFileId].setGridOption('rowData', files);
450
+ AgGrid.grids[gridFolderId].setGridOption('rowData', folders);
451
+ },
452
+ { context: 'modal' },
453
+ );
446
454
  });
447
455
  }
448
456
 
@@ -85,6 +85,7 @@ const Modal = {
85
85
  onExpandUiListener: {},
86
86
  onBarUiOpen: {},
87
87
  onBarUiClose: {},
88
+ onHome: {},
88
89
  query: options.query ? `${window.location.search}` : undefined,
89
90
  };
90
91
  const setCenterRestore = () => {
@@ -1010,14 +1011,15 @@ const Modal = {
1010
1011
  e.preventDefault();
1011
1012
  window.history.forward();
1012
1013
  });
1013
- EventsUI.onClick(`.action-btn-home`, () => s(`.main-btn-home`).click());
1014
- EventsUI.onClick(`.action-btn-app-icon`, () => s(`.action-btn-home`).click());
1014
+ EventsUI.onClick(`.action-btn-home`, async () => {
1015
+ await Modal.onHomeRouterEvent();
1016
+ Object.keys(this.Data[idModal].onHome).map((keyListener) => this.Data[idModal].onHome[keyListener]());
1017
+ });
1018
+ EventsUI.onClick(`.action-btn-app-icon`, () => Modal.onHomeRouterEvent());
1015
1019
  Keyboard.instanceMultiPressKey({
1016
1020
  id: 'input-shortcut-global-escape',
1017
1021
  keys: ['Escape'],
1018
1022
  eventCallBack: () => {
1019
- // if (s(`.main-btn-home`)) s(`.main-btn-home`).click();
1020
-
1021
1023
  if (s(`.btn-close-${this.currentTopModalId}`)) s(`.btn-close-${this.currentTopModalId}`).click();
1022
1024
  },
1023
1025
  });
@@ -1343,7 +1345,7 @@ const Modal = {
1343
1345
  s(`.btn-icon-menu-back`).classList.add('hide');
1344
1346
  if (s(`.menu-btn-container-main`)) s(`.menu-btn-container-main`).classList.remove('hide');
1345
1347
  };
1346
- s(`.main-btn-home`).onclick = () => {
1348
+ this.onHomeRouterEvent = async () => {
1347
1349
  for (const keyModal of Object.keys(this.Data)) {
1348
1350
  if (
1349
1351
  ![idModal, 'main-body-top', 'main-body']
@@ -1357,6 +1359,9 @@ const Modal = {
1357
1359
  setPath(getProxyPath());
1358
1360
  setDocTitle({ ...options.RouterInstance, route: '' });
1359
1361
  };
1362
+ s(`.main-btn-home`).onclick = async () => {
1363
+ await this.onHomeRouterEvent();
1364
+ };
1360
1365
  EventsUI.onClick(`.btn-icon-menu-back`, backMenuButtonEvent);
1361
1366
  EventsUI.onClick(`.btn-icon-menu-mode`, () => {
1362
1367
  if (s(`.btn-icon-menu-mode-right`).classList.contains('hide')) {
@@ -1620,6 +1625,7 @@ const Modal = {
1620
1625
  ...this.Data[idModal],
1621
1626
  };
1622
1627
  },
1628
+ onHomeRouterEvent: () => {},
1623
1629
  currentTopModalId: '',
1624
1630
  zIndexSync: function ({ idModal }) {
1625
1631
  setTimeout(() => {
@@ -1731,7 +1737,7 @@ const Modal = {
1731
1737
  titleClass: 'hide',
1732
1738
  style: {
1733
1739
  width: '300px',
1734
- height: '350px',
1740
+ height: '400px',
1735
1741
  overflow: 'hidden',
1736
1742
  'z-index': '11',
1737
1743
  resize: 'none',
@@ -1765,7 +1771,6 @@ const Modal = {
1765
1771
  },
1766
1772
  headerTitleHeight: 40,
1767
1773
  actionBtnCenter: function () {
1768
- // if (!s(`.btn-close-modal-menu`).classList.contains('hide')) return s(`.main-btn-home`).click();
1769
1774
  if (!s(`.btn-close-modal-menu`).classList.contains('hide')) {
1770
1775
  return s(`.btn-close-modal-menu`).click();
1771
1776
  }
@@ -55,7 +55,7 @@ const Panel = {
55
55
  const openPanelForm = () => {
56
56
  s(`.${idPanel}-form-body`).classList.remove('hide');
57
57
  s(`.btn-${idPanel}-add`).classList.add('hide');
58
- s(`.${scrollClassContainer}`).style.overflow = 'hidden';
58
+ // s(`.${scrollClassContainer}`).style.overflow = 'hidden';
59
59
  if (options.customButtons) {
60
60
  let customBtnIndex = -1;
61
61
  for (const dataBtn of options.customButtons) {
@@ -89,12 +89,16 @@ const Panel = {
89
89
  htmls(`.${idPanel}-cell-col-a-${id}`, render);
90
90
  },
91
91
  });
92
- EventsUI.onClick(`.${idPanel}-btn-delete-${id}`, async (e) => {
93
- logger.warn('delete', obj);
94
- const { status } = await options.on.remove({ e, data: obj });
95
- if (status === 'error') return;
96
- if (s(`.${idPanel}-${id}`)) s(`.${idPanel}-${id}`).remove();
97
- });
92
+ EventsUI.onClick(
93
+ `.${idPanel}-btn-delete-${id}`,
94
+ async (e) => {
95
+ logger.warn('delete', obj);
96
+ const { status } = await options.on.remove({ e, data: obj });
97
+ if (status === 'error') return;
98
+ if (s(`.${idPanel}-${id}`)) s(`.${idPanel}-${id}`).remove();
99
+ },
100
+ { context: 'modal' },
101
+ );
98
102
  EventsUI.onClick(`.${idPanel}-btn-edit-${id}`, async () => {
99
103
  logger.warn('edit', obj);
100
104
  if (obj._id) Panel.Tokens[idPanel].editId = obj._id;
@@ -121,7 +125,7 @@ const Panel = {
121
125
  if (options.onClick) await options.onClick({ payload });
122
126
  };
123
127
  });
124
-
128
+ if (s(`.${idPanel}-${id}`)) s(`.${idPanel}-${id}`).remove();
125
129
  return html` <div class="in box-shadow ${idPanel} ${idPanel}-${id}">
126
130
  <div class="fl ${idPanel}-tools session-fl-log-in ${obj.tools ? '' : 'hide'}">
127
131
  ${await BtnIcon.Render({
@@ -244,7 +248,7 @@ const Panel = {
244
248
  };
245
249
 
246
250
  let render = '';
247
- let renderForm = html` <div class="in modal stq" style="top: 0px; z-index: 1; padding-bottom: 5px">
251
+ let renderForm = html` <div class="in modal" style="top: 0px; z-index: 1; padding-bottom: 5px">
248
252
  ${await BtnIcon.Render({
249
253
  class: `inl section-mp btn-custom btn-${idPanel}-close`,
250
254
  label: html`<i class="fa-solid fa-xmark"></i> ${Translate.Render('close')}`,
@@ -417,49 +421,6 @@ const Panel = {
417
421
  `;
418
422
 
419
423
  setTimeout(async () => {
420
- const resizeParentModal = () => {
421
- if (options.parentIdModal) {
422
- Modal.Data[options.parentIdModal].onObserverListener[`form-panel-${options.parentIdModal}`] = () => {
423
- if (s(`.${idPanel}-form-container`))
424
- s(`.${idPanel}-form-container`).style.maxHeight = `${
425
- s(`.${options.parentIdModal}`).offsetHeight - Modal.headerTitleHeight
426
- }px`;
427
- };
428
- Modal.Data[options.parentIdModal].onObserverListener[`form-panel-${options.parentIdModal}`]();
429
- } else {
430
- Responsive.Event[`${idPanel}-responsive`] = () => {
431
- if (s(`.${idPanel}-form-container`))
432
- s(`.${idPanel}-form-container`).style.maxHeight =
433
- options.route === 'home' &&
434
- s(`.${idPanel}-form-body`) &&
435
- !s(`.${idPanel}-form-body`).classList.contains('hide') &&
436
- !s(`.main-body-btn-ui-open`).classList.contains('hide')
437
- ? `${window.innerHeight}px`
438
- : `${window.innerHeight - heightTopBar - heightBottomBar}px`;
439
- };
440
- Responsive.Event[`${idPanel}-responsive`]();
441
- }
442
- };
443
- if (options.route === 'home') {
444
- Modal.Data['modal-menu'].onBarUiClose[`${idPanel}-responsive`] = () => {
445
- resizeParentModal();
446
- };
447
-
448
- Modal.Data['modal-menu'].onBarUiOpen[`${idPanel}-responsive`] = () => {
449
- resizeParentModal();
450
- };
451
- }
452
- setTimeout(resizeParentModal);
453
- if (options.route) {
454
- RouterEvents[options.parentIdModal] = ({ route }) => {
455
- if (route === options.route) {
456
- setTimeout(() => {
457
- resizeParentModal();
458
- }, 350);
459
- }
460
- };
461
- }
462
-
463
424
  const validators = await Validator.instance(formData);
464
425
 
465
426
  s(`.${idPanel}-form`).onsubmit = (e) => {
@@ -581,7 +542,6 @@ const Panel = {
581
542
  padding: 10px;
582
543
  cursor: pointer;
583
544
  min-height: 400px;
584
- overflow: hidden;
585
545
  }
586
546
  .${idPanel}:hover {
587
547
  background: #ffffff;
@@ -651,9 +611,7 @@ const Panel = {
651
611
  }
652
612
  </style>
653
613
  <div class="${idPanel}-container">
654
- <div
655
- class="stq modal ${idPanel}-form-container ${options.formContainerClass ? options.formContainerClass : ''}"
656
- >
614
+ <div class="in modal ${idPanel}-form-container ${options.formContainerClass ? options.formContainerClass : ''}">
657
615
  <div class="in ${idPanel}-form-header">
658
616
  ${await BtnIcon.Render({
659
617
  class: `inl section-mp btn-custom btn-${idPanel}-add ${
@@ -1,4 +1,4 @@
1
- import { getCapVariableName, getId, newInstance, random, range, timer, uniqueArray } from './CommonJs.js';
1
+ import { getCapVariableName, newInstance, random, range, uniqueArray } from './CommonJs.js';
2
2
  import { marked } from 'marked';
3
3
  import {
4
4
  getBlobFromUint8ArrayFile,
@@ -12,7 +12,6 @@ import { NotificationManager } from './NotificationManager.js';
12
12
  import { DocumentService } from '../../services/document/document.service.js';
13
13
  import { FileService } from '../../services/file/file.service.js';
14
14
  import { getSrcFromFileData } from './Input.js';
15
- import { Auth } from './Auth.js';
16
15
  import { imageShimmer, renderCssAttr } from './Css.js';
17
16
  import { Translate } from './Translate.js';
18
17
  import { Modal } from './Modal.js';
@@ -383,7 +382,7 @@ const PanelForm = {
383
382
  };
384
383
  const renderSrrPanelData = async () =>
385
384
  await panelRender({
386
- data: range(0, 5).map((i) => ({
385
+ data: range(0, 0).map((i) => ({
387
386
  id: i,
388
387
  title: html`<div class="fl">
389
388
  <div
@@ -424,19 +423,12 @@ const PanelForm = {
424
423
  ssr: true,
425
424
  })),
426
425
  });
427
- let delayBlock = false;
428
426
  let firsUpdateEvent = false;
427
+ let lastCid;
429
428
  this.Data[idPanel].updatePanel = async () => {
430
- if (delayBlock) return;
431
- else {
432
- delayBlock = true;
433
- const _currentPath = `${location.pathname}${location.search}`;
434
- setTimeout(() => {
435
- delayBlock = false;
436
- if (`${location.pathname}${location.search}` !== _currentPath) this.Data[idPanel].updatePanel();
437
- }, 1000);
438
- }
439
429
  const cid = getQueryParams().cid ? getQueryParams().cid : '';
430
+ if (lastCid === cid) return;
431
+ lastCid = cid;
440
432
  if (options.route === 'home') Modal.homeCid = newInstance(cid);
441
433
  htmls(`.${options.parentIdModal ? 'html-' + options.parentIdModal : 'main-body'}`, await renderSrrPanelData());
442
434
  await getPanelData();
@@ -449,24 +441,21 @@ const PanelForm = {
449
441
  await options.firsUpdateEvent();
450
442
  }
451
443
  };
452
- if (options.route)
444
+ if (options.route) {
453
445
  listenQueryPathInstance({
454
446
  id: options.parentIdModal ? 'html-' + options.parentIdModal : 'main-body',
455
447
  routeId: options.route,
456
448
  event: async (path) => {
457
- // if (!PanelForm.Data[idPanel].sessionIn)
458
449
  await this.Data[idPanel].updatePanel();
459
450
  },
460
451
  });
461
-
462
- // if (options.route === 'home') setTimeout(this.Data[idPanel].updatePanel);
463
- setTimeout(() => {
464
- // if (
465
- // options.route !== 'home' &&
466
- // (!PanelForm.Data[idPanel].originData || PanelForm.Data[idPanel].originData.length === 0)
467
- // )
468
- this.Data[idPanel].updatePanel();
469
- });
452
+ if (!options.parentIdModal)
453
+ Modal.Data['modal-menu'].onHome[idPanel] = async () => {
454
+ lastCid = undefined;
455
+ setQueryPath({ path: options.route, queryPath: '' });
456
+ await this.Data[idPanel].updatePanel();
457
+ };
458
+ }
470
459
 
471
460
  if (options.parentIdModal) {
472
461
  htmls(`.html-${options.parentIdModal}`, await renderSrrPanelData());
@@ -52,7 +52,9 @@ const LoadRouter = function (RouterInstance) {
52
52
 
53
53
  const setQueryPath = (options = { path: '', queryPath: '' }, queryKey = 'cid') => {
54
54
  const { queryPath, path } = options;
55
- const newUri = `${getProxyPath()}${path === 'home' ? '' : `${path}/`}${queryPath ? `?${queryKey}=${queryPath}` : ''}`;
55
+ const newUri = `${getProxyPath()}${path === 'home' ? '' : `${path}/`}${
56
+ typeof queryPath === 'string' ? `?${queryKey}=${queryPath}` : ''
57
+ }`;
56
58
  const currentUri = `${window.location.pathname}${location.search}`;
57
59
  if (currentUri !== newUri && currentUri !== `${newUri}/`) setPath(newUri);
58
60
  };