underpost 2.8.881 → 2.8.882

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 (32) hide show
  1. package/.github/workflows/release.cd.yml +1 -2
  2. package/README.md +46 -36
  3. package/cli.md +86 -86
  4. package/conf.js +1 -0
  5. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  6. package/manifests/deployment/dd-test-development/deployment.yaml +6 -6
  7. package/package.json +1 -1
  8. package/src/api/document/document.service.js +9 -1
  9. package/src/cli/repository.js +2 -0
  10. package/src/client/components/core/Auth.js +258 -89
  11. package/src/client/components/core/BtnIcon.js +10 -1
  12. package/src/client/components/core/CssCore.js +36 -27
  13. package/src/client/components/core/Docs.js +189 -85
  14. package/src/client/components/core/LoadingAnimation.js +5 -10
  15. package/src/client/components/core/Modal.js +255 -120
  16. package/src/client/components/core/ObjectLayerEngine.js +154 -158
  17. package/src/client/components/core/Panel.js +2 -0
  18. package/src/client/components/core/PanelForm.js +94 -60
  19. package/src/client/components/core/Router.js +15 -15
  20. package/src/client/components/core/ToolTip.js +83 -19
  21. package/src/client/components/core/Translate.js +1 -1
  22. package/src/client/components/core/VanillaJs.js +4 -3
  23. package/src/client/components/core/windowGetDimensions.js +202 -0
  24. package/src/client/components/default/MenuDefault.js +11 -0
  25. package/src/client/ssr/Render.js +1 -1
  26. package/src/index.js +1 -1
  27. package/src/server/auth.js +68 -17
  28. package/src/server/crypto.js +195 -76
  29. package/src/server/peer.js +47 -5
  30. package/src/server/process.js +85 -1
  31. package/src/server/runtime.js +13 -10
  32. package/test/crypto.test.js +117 -0
@@ -31,6 +31,7 @@ import { Keyboard } from './Keyboard.js';
31
31
  import { Badge } from './Badge.js';
32
32
  import { Worker } from './Worker.js';
33
33
  import { Scroll } from './Scroll.js';
34
+ import { windowGetH, windowGetW } from './windowGetDimensions.js';
34
35
 
35
36
  const logger = loggerFactory(import.meta, { trace: true });
36
37
 
@@ -57,8 +58,8 @@ const Modal = {
57
58
  let originHeightTopBar = options.heightTopBar ? newInstance(options.heightTopBar) : 0;
58
59
  let width = 300;
59
60
  let height = 400;
60
- let top = 0;
61
- let left = 0;
61
+ let top = options.style?.top ? options.style.top : 0;
62
+ let left = options.style?.left ? options.style.left : 0;
62
63
  const topBottomBarEnable = options && options.barMode && options.barMode === 'top-bottom-bar';
63
64
  if (!topBottomBarEnable) {
64
65
  options.heightTopBar = options.heightTopBar + options.heightBottomBar;
@@ -69,7 +70,7 @@ const Modal = {
69
70
  const collapseSlideMenuWidth = 50;
70
71
  let slideMenuWidth = originSlideMenuWidth;
71
72
  const minWidth = width;
72
- const heightDefaultTopBar = 0;
73
+ const heightDefaultTopBar = 50;
73
74
  const heightDefaultBottomBar = 0;
74
75
  const idModal = options && 'id' in options ? options.id : getId(this.Data, 'modal-');
75
76
  this.Data[idModal] = {
@@ -87,40 +88,57 @@ const Modal = {
87
88
  onHome: {},
88
89
  homeModals: options.homeModals ? options.homeModals : [],
89
90
  query: options.query ? `${window.location.search}` : undefined,
90
- getTop: () => window.innerHeight - (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar),
91
+ getTop: () => {
92
+ const result = windowGetH() - (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar);
93
+ // TODO: mobile padding gap on init size top height, Iphone SE responsive case
94
+ // logger.warn('getTop', {
95
+ // top: result,
96
+ // height: Modal.Data[idModal].getHeight(),
97
+ // });
98
+ return result;
99
+ },
91
100
  getHeight: () => {
92
101
  return (
93
- window.innerHeight -
102
+ windowGetH() -
94
103
  (s(`.main-body-btn-ui-close`) && !s(`.main-body-btn-ui-close`).classList.contains('hide')
95
104
  ? (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) +
96
105
  (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
97
106
  : 0)
98
107
  );
99
108
  },
109
+ getMenuLeftStyle: (ops = { open: false }) =>
110
+ `${
111
+ options.mode === 'slide-menu-right'
112
+ ? `${
113
+ windowGetW() +
114
+ (ops?.open
115
+ ? -1 * originSlideMenuWidth +
116
+ (options.mode === 'slide-menu-right' && s(`.btn-icon-menu-mode-right`).classList.contains('hide')
117
+ ? originSlideMenuWidth - collapseSlideMenuWidth
118
+ : 0)
119
+ : originSlideMenuWidth)
120
+ }px`
121
+ : `-${ops?.open ? '0px' : originSlideMenuWidth}px`
122
+ }`,
100
123
  };
101
124
 
102
- if (idModal !== 'main-body' && options.mode !== 'view') {
103
- top = `${window.innerHeight / 2 - height / 2}px`;
104
- left = `${window.innerWidth / 2 - width / 2}px`;
105
- }
106
125
  if (options && 'mode' in options) {
107
- this.Data[idModal][options.mode] = {};
126
+ Modal.Data[idModal][options.mode] = {};
108
127
  switch (options.mode) {
109
128
  case 'view':
110
- if (options && options.slideMenu) s(`.btn-close-${options.slideMenu}`).click();
129
+ // if (options && options.slideMenu) s(`.btn-close-${options.slideMenu}`).click();
111
130
  options.zIndexSync = true;
112
131
 
113
- options.style = {
114
- ...options.style,
115
- 'min-width': `${minWidth}px`,
116
- width: '100%',
117
- };
132
+ options.style = { width: '100%', ...options.style, 'min-width': `${minWidth}px` };
118
133
 
119
- if (this.mobileModal()) {
134
+ if (Modal.mobileModal()) {
120
135
  options.barConfig.buttons.restore.disabled = true;
121
136
  options.barConfig.buttons.minimize.disabled = true;
122
137
  options.dragDisabled = true;
123
138
  options.style.resize = 'none';
139
+ setTimeout(() => {
140
+ s(`.btn-close-modal-menu`).click();
141
+ });
124
142
  }
125
143
 
126
144
  Responsive.Event[`view-${idModal}`] = () => {
@@ -207,8 +225,7 @@ const Modal = {
207
225
  }
208
226
  const { barConfig } = options;
209
227
  options.style = {
210
- position: 'absolute',
211
- height: `${Modal.Data[idModal].getHeight()}px`,
228
+ height: `${windowGetH() - options.heightTopBar - options.heightBottomBar}px`,
212
229
  width: `${slideMenuWidth}px`,
213
230
  // 'overflow-x': 'hidden',
214
231
  // overflow: 'visible', // required for tooltip
@@ -216,15 +233,14 @@ const Modal = {
216
233
  resize: 'none',
217
234
  top: `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`,
218
235
  };
219
- options.mode === 'slide-menu-right' ? (options.style.right = '0px') : (options.style.left = '0px');
220
236
  const contentIconClass = 'abs center';
221
- if (options.class) options.class += ' hide';
222
- else options.class = 'hide';
237
+ top = 'auto';
238
+ left = Modal.Data[idModal].getMenuLeftStyle();
239
+ transition = '.3s';
223
240
  options.dragDisabled = true;
224
241
  options.titleClass = 'hide';
225
- top = '0px';
226
- left = 'auto';
227
- width = 'auto';
242
+ options.disableCenter = true;
243
+
228
244
  // barConfig.buttons.maximize.disabled = true;
229
245
  // barConfig.buttons.minimize.disabled = true;
230
246
  // barConfig.buttons.restore.disabled = true;
@@ -237,6 +253,9 @@ const Modal = {
237
253
  this.Data[_idModal].slideMenu.callBack();
238
254
  }
239
255
  s(`.${idModal}`).style.height = `${Modal.Data[idModal].getHeight()}px`;
256
+ s(`.${idModal}`).style.left = Modal.Data[idModal].getMenuLeftStyle({
257
+ open: s(`.btn-bar-center-icon-menu`).classList.contains('hide') ? true : false,
258
+ });
240
259
  if (s(`.main-body-top`)) {
241
260
  if (Modal.mobileModal()) {
242
261
  if (s(`.btn-menu-${idModal}`).classList.contains('hide') && collapseSlideMenuWidth !== slideMenuWidth)
@@ -246,51 +265,56 @@ const Modal = {
246
265
  }
247
266
  };
248
267
  barConfig.buttons.menu.onClick = () => {
249
- this.Data[idModal][options.mode].width = slideMenuWidth;
268
+ Modal.Data[idModal][options.mode].width = slideMenuWidth;
250
269
  s(`.btn-menu-${idModal}`).classList.add('hide');
251
270
  s(`.btn-close-${idModal}`).classList.remove('hide');
252
- s(`.${idModal}`).style.width = `${this.Data[idModal][options.mode].width}px`;
271
+ // s(`.${idModal}`).style.width = `${this.Data[idModal][options.mode].width}px`;
253
272
  s(`.html-${idModal}`).style.display = 'block';
254
273
  // s(`.title-modal-${idModal}`).style.display = 'block';
255
- setTimeout(() => {
256
- s(`.main-body-btn-ui-menu-menu`).classList.add('hide');
257
- s(`.main-body-btn-ui-menu-close`).classList.remove('hide');
258
- if (s(`.btn-bar-center-icon-menu`)) {
259
- s(`.btn-bar-center-icon-close`).classList.remove('hide');
260
- s(`.btn-bar-center-icon-menu`).classList.add('hide');
261
- }
262
- });
274
+ s(`.main-body-btn-ui-menu-menu`).classList.add('hide');
275
+ s(`.main-body-btn-ui-menu-close`).classList.remove('hide');
276
+ if (s(`.btn-bar-center-icon-menu`)) {
277
+ s(`.btn-bar-center-icon-close`).classList.remove('hide');
278
+ s(`.btn-bar-center-icon-menu`).classList.add('hide');
279
+ }
263
280
 
264
- setTimeout(() => {
265
- s(`.main-body-btn-container`).style[
266
- true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
267
- ] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px';
268
- });
281
+ s(`.main-body-btn-container`).style[
282
+ true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
283
+ ] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px';
284
+ if (options.mode === 'slide-menu-right') {
285
+ s(`.${idModal}`).style.left = `${windowGetW() - originSlideMenuWidth}px`;
286
+ } else {
287
+ s(`.${idModal}`).style.left = `0px`;
288
+ }
269
289
  Responsive.Event[`slide-menu-${idModal}`]();
270
290
  };
271
291
  barConfig.buttons.close.onClick = () => {
272
- this.Data[idModal][options.mode].width = 0;
292
+ Modal.Data[idModal][options.mode].width = 0;
273
293
  s(`.btn-close-${idModal}`).classList.add('hide');
274
294
  s(`.btn-menu-${idModal}`).classList.remove('hide');
275
- s(`.${idModal}`).style.width = `${this.Data[idModal][options.mode].width}px`;
276
- s(`.html-${idModal}`).style.display = 'none';
295
+ // s(`.${idModal}`).style.width = `${this.Data[idModal][options.mode].width}px`;
296
+ // s(`.html-${idModal}`).style.display = 'none';
277
297
  // s(`.title-modal-${idModal}`).style.display = 'none';
278
- setTimeout(() => {
279
- s(`.main-body-btn-ui-menu-close`).classList.add('hide');
280
- s(`.main-body-btn-ui-menu-menu`).classList.remove('hide');
281
- if (s(`.btn-bar-center-icon-menu`)) {
282
- s(`.btn-bar-center-icon-menu`).classList.remove('hide');
283
- s(`.btn-bar-center-icon-close`).classList.add('hide');
284
- }
285
- s(`.main-body-btn-container`).style[
286
- true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
287
- ] = `${0}px`;
288
- });
298
+ s(`.main-body-btn-ui-menu-close`).classList.add('hide');
299
+ s(`.main-body-btn-ui-menu-menu`).classList.remove('hide');
300
+ if (s(`.btn-bar-center-icon-menu`)) {
301
+ s(`.btn-bar-center-icon-menu`).classList.remove('hide');
302
+ s(`.btn-bar-center-icon-close`).classList.add('hide');
303
+ }
304
+ s(`.main-body-btn-container`).style[
305
+ true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
306
+ ] = `${0}px`;
307
+ if (options.mode === 'slide-menu-right') {
308
+ s(`.${idModal}`).style.left = `${windowGetW() + originSlideMenuWidth}px`;
309
+ } else {
310
+ s(`.${idModal}`).style.left = `-${originSlideMenuWidth}px`;
311
+ }
289
312
  Responsive.Event[`slide-menu-${idModal}`]();
290
313
  };
291
314
  transition += `, width 0.3s`;
292
315
 
293
316
  setTimeout(() => {
317
+ setTimeout(btnCloseEvent);
294
318
  append(
295
319
  'body',
296
320
  html`
@@ -299,7 +323,7 @@ const Modal = {
299
323
  style="top: ${options.heightTopBar + 50}px; z-index: 9; ${true ||
300
324
  (options.mode && options.mode.match('right'))
301
325
  ? 'right'
302
- : 'left'}: 50px; width: 50px; height: 150px; transition: .3s"
326
+ : 'left'}: 0px; width: 50px; height: 150px; transition: .3s"
303
327
  >
304
328
  <div
305
329
  class="abs main-body-btn main-body-btn-ui"
@@ -356,6 +380,9 @@ const Modal = {
356
380
  s(`.slide-menu-top-bar-fix`).style.top = '-100px';
357
381
  s(`.top-bar-search-box-container`).click();
358
382
  }
383
+ if (Modal.mobileModal()) {
384
+ btnCloseEvent();
385
+ }
359
386
  };
360
387
 
361
388
  let _heightTopBar, _heightBottomBar, _topMenu;
@@ -373,7 +400,7 @@ const Modal = {
373
400
  s(`.modal-menu`).style.top = '0px';
374
401
  s(`.main-body-btn-container`).style.top = '50px';
375
402
  s(`.main-body`).style.top = '0px';
376
- s(`.main-body`).style.height = `${window.innerHeight}px`;
403
+ s(`.main-body`).style.height = `${windowGetH()}px`;
377
404
  for (const event of Object.keys(Modal.Data[idModal].onBarUiClose))
378
405
  Modal.Data[idModal].onBarUiClose[event]();
379
406
  } else {
@@ -386,7 +413,7 @@ const Modal = {
386
413
  s(`.slide-menu-top-bar`).classList.remove('hide');
387
414
  s(`.bottom-bar`).classList.remove('hide');
388
415
  s(`.main-body`).style.top = `${options.heightTopBar}px`;
389
- s(`.main-body`).style.height = `${window.innerHeight - options.heightTopBar}px`;
416
+ s(`.main-body`).style.height = `${windowGetH() - options.heightTopBar}px`;
390
417
  for (const event of Object.keys(Modal.Data[idModal].onBarUiOpen))
391
418
  Modal.Data[idModal].onBarUiOpen[event]();
392
419
  }
@@ -503,9 +530,15 @@ const Modal = {
503
530
  </div>`,
504
531
  );
505
532
  EventsUI.onClick(`.action-btn-profile-log-in`, () => {
533
+ if (Modal.mobileModal() && s(`.btn-close-search-box-history`)) {
534
+ s(`.btn-close-search-box-history`).click();
535
+ }
506
536
  s(`.main-btn-account`).click();
507
537
  });
508
538
  EventsUI.onClick(`.action-btn-profile-log-out`, () => {
539
+ if (Modal.mobileModal() && s(`.btn-close-search-box-history`)) {
540
+ s(`.btn-close-search-box-history`).click();
541
+ }
509
542
  s(`.main-btn-sign-up`).click();
510
543
  });
511
544
  s(`.input-info-${inputSearchBoxId}`).style.textAlign = 'left';
@@ -749,6 +782,9 @@ const Modal = {
749
782
  let boxHistoryDelayRender = 0;
750
783
  const searchBoxHistoryOpen = async () => {
751
784
  if (boxHistoryDelayRender) return;
785
+ if (Modal.mobileModal()) {
786
+ btnCloseEvent();
787
+ }
752
788
  boxHistoryDelayRender = 1000;
753
789
  setTimeout(() => (boxHistoryDelayRender = 0));
754
790
  if (!s(`.${searchBoxHistoryId}`)) {
@@ -779,8 +815,8 @@ const Modal = {
779
815
  resize: 'none',
780
816
  'max-width': '450px',
781
817
  height:
782
- this.mobileModal() && window.innerWidth < 445
783
- ? `${window.innerHeight - originHeightTopBar}px !important`
818
+ this.mobileModal() && windowGetW() < 445
819
+ ? `${windowGetH() - originHeightTopBar}px !important`
784
820
  : '300px !important',
785
821
  'z-index': 7,
786
822
  },
@@ -967,7 +1003,7 @@ const Modal = {
967
1003
  Responsive.Event[`view-${id}`] = () => {
968
1004
  if (!this.Data[id] || !s(`.${id}`)) return delete Responsive.Event[`view-${id}`];
969
1005
  const widthInputSearchBox =
970
- window.innerWidth > maxWidthInputSearchBox ? maxWidthInputSearchBox : window.innerWidth;
1006
+ windowGetW() > maxWidthInputSearchBox ? maxWidthInputSearchBox : windowGetW();
971
1007
  s(`.top-bar-search-box-container`).style.width = `${
972
1008
  widthInputSearchBox - originHeightTopBar - paddingRightSearchBox - 1
973
1009
  }px`;
@@ -1101,18 +1137,23 @@ const Modal = {
1101
1137
  height: `${options.heightBottomBar}px`,
1102
1138
  'min-width': `${minWidth}px`,
1103
1139
  'z-index': 7,
1140
+ // bottom: '0px !important',
1141
+ width: `${windowGetW()}px`,
1142
+ top: `${Modal.Data['modal-menu'].getTop()}px`,
1104
1143
  },
1105
1144
  dragDisabled: true,
1106
- maximize: true,
1107
- barMode: options.barMode,
1145
+ disableCenter: true,
1146
+ // maximize: true,
1147
+ // barMode: options.barMode,
1108
1148
  });
1109
1149
  Responsive.Event[`view-${id}`] = () => {
1110
1150
  if (!this.Data[id] || !s(`.${id}`)) return delete Responsive.Event[`view-${id}`];
1111
1151
  // <div class="in fll right-offset-menu-bottom-bar" style="height: 100%"></div>
1112
- // s(`.right-offset-menu-bottom-bar`).style.width = `${window.innerWidth - slideMenuWidth}px`;
1113
- s(`.${id}`).style.top = `${Modal.Data[id].getTop()}px`;
1152
+ // s(`.right-offset-menu-bottom-bar`).style.width = `${windowGetW() - slideMenuWidth}px`;
1153
+ s(`.${id}`).style.top = `${Modal.Data['modal-menu'].getTop()}px`;
1154
+ s(`.${id}`).style.width = `${windowGetW()}px`;
1114
1155
  };
1115
- Responsive.Event[`view-${id}`]();
1156
+ // Responsive.Event[`view-${id}`]();
1116
1157
  }
1117
1158
  EventsUI.onClick(`.action-btn-left`, (e) => {
1118
1159
  e.preventDefault();
@@ -1120,7 +1161,7 @@ const Modal = {
1120
1161
  });
1121
1162
  EventsUI.onClick(`.action-btn-center`, (e) => {
1122
1163
  e.preventDefault();
1123
- this.actionBtnCenter();
1164
+ Modal.actionBtnCenter();
1124
1165
  });
1125
1166
  EventsUI.onClick(`.action-btn-right`, (e) => {
1126
1167
  e.preventDefault();
@@ -1281,7 +1322,7 @@ const Modal = {
1281
1322
  s(`.${id}`).style.height =
1282
1323
  s(`.main-body-btn-ui-close`).classList.contains('hide') &&
1283
1324
  s(`.btn-restore-${id}`).style.display !== 'none'
1284
- ? `${window.innerHeight}px`
1325
+ ? `${windowGetH()}px`
1285
1326
  : `${Modal.Data[id].getHeight()}px`;
1286
1327
 
1287
1328
  if (
@@ -1301,13 +1342,15 @@ const Modal = {
1301
1342
  await NotificationManager.RenderBoard(options);
1302
1343
 
1303
1344
  const { removeEvent } = Scroll.setEvent('.main-body', async (payload) => {
1304
- console.warn('scroll', payload);
1345
+ // console.warn('scroll', payload);
1305
1346
  if (payload.scrollTop > 100) {
1306
1347
  if (!s(`.main-body-btn-ui-close`).classList.contains('hide')) s(`.main-body-btn-ui-close`).click();
1307
1348
 
1308
1349
  removeEvent();
1309
1350
  }
1310
1351
  });
1352
+ // TODO: mobile padding gap on init size top height, Iphone SE responsive case
1353
+ setTimeout(window.onresize);
1311
1354
  });
1312
1355
  })();
1313
1356
  break;
@@ -1336,14 +1379,17 @@ const Modal = {
1336
1379
  break;
1337
1380
  }
1338
1381
  }
1382
+
1339
1383
  if (options.zIndexSync) this.zIndexSync({ idModal });
1384
+
1340
1385
  if (s(`.${idModal}`)) {
1341
1386
  s(`.btn-maximize-${idModal}`).click();
1342
1387
  return;
1343
1388
  }
1344
- if (options.slideMenu) {
1345
- if (options.titleClass) options.titleClass = ' title-view-modal ' + options.titleClass;
1346
- options.titleClass = ' title-view-modal ';
1389
+
1390
+ if (idModal !== 'main-body' && options.mode !== 'view' && !options.disableCenter) {
1391
+ top = `${windowGetH() / 2 - height / 2}px`;
1392
+ left = `${windowGetW() / 2 - width / 2}px`;
1347
1393
  }
1348
1394
 
1349
1395
  const render = html` <style class="style-${idModal}">
@@ -1461,7 +1507,9 @@ const Modal = {
1461
1507
  ? html` <div class="abs modal-icon-container">${renderStatus(options.status)}</div> `
1462
1508
  : ''}
1463
1509
  <div
1464
- class="inl title-modal-${idModal} ${options && options.titleClass ? options.titleClass : 'title-modal'}"
1510
+ class="inl title-modal-${idModal} ${options && options.titleClass
1511
+ ? options.titleClass
1512
+ : 'title-main-modal'}"
1465
1513
  >
1466
1514
  ${options && options.titleRender ? options.titleRender() : options.title ? options.title : ''}
1467
1515
  </div>
@@ -1536,12 +1584,13 @@ const Modal = {
1536
1584
  case 'slide-menu-right':
1537
1585
  case 'slide-menu-left':
1538
1586
  const backMenuButtonEvent = async () => {
1539
- if (s(`.menu-btn-container-children`)) htmls(`.menu-btn-container-children`, '');
1540
1587
  // htmls(`.nav-title-display-${'modal-menu'}`, html`<i class="fas fa-home"></i> ${Translate.Render('home')}`);
1541
1588
  htmls(`.nav-title-display-${'modal-menu'}`, html``);
1542
1589
  htmls(`.nav-path-display-${idModal}`, '');
1543
1590
  s(`.btn-icon-menu-back`).classList.add('hide');
1544
- if (s(`.menu-btn-container-main`)) s(`.menu-btn-container-main`).classList.remove('hide');
1591
+ // sa(`.main-btn-menu`).forEach((el) => {
1592
+ // el.classList.remove('hide');
1593
+ // });
1545
1594
  };
1546
1595
  s(`.main-btn-home`).onclick = async () => {
1547
1596
  // await this.onHomeRouterEvent();
@@ -1558,22 +1607,12 @@ const Modal = {
1558
1607
  }
1559
1608
  if (slideMenuWidth === originSlideMenuWidth) {
1560
1609
  slideMenuWidth = collapseSlideMenuWidth;
1561
- setTimeout(() => {
1562
- s(`.main-body-btn-container`).style[
1563
- true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
1564
- ] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px';
1565
- }, 1);
1566
-
1567
- if (!s(`.btn-bar-center-icon-close`).classList.contains('hide')) {
1568
- sa(`.handle-btn-container`).forEach((el) => el.classList.add('hide'));
1569
- sa(`.menu-label-text`).forEach((el) => el.classList.add('hide'));
1570
- if (!Modal.mobileModal()) {
1571
- sa(`.tooltip-menu`).forEach((el) => el.classList.remove('hide'));
1572
- s(`.${idModal}`).style.overflow = 'visible';
1573
- }
1574
- if (s(`.menu-btn-container-main`) && s(`.menu-btn-container-main`).classList.contains('hide'))
1575
- s(`.btn-icon-menu-back`).classList.add('hide');
1576
- }
1610
+ s(`.${idModal}`).style.width = `${slideMenuWidth}px`;
1611
+ sa(`.menu-label-text`).forEach((el) => el.classList.add('hide'));
1612
+ s(`.main-body-btn-container`).style[
1613
+ true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
1614
+ ] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px';
1615
+ sa(`.handle-btn-container`).forEach((el) => el.classList.add('hide'));
1577
1616
  if (options.onCollapseMenu) options.onCollapseMenu();
1578
1617
  s(`.sub-menu-title-container-${'modal-menu'}`).classList.add('hide');
1579
1618
  s(`.nav-path-container-${'modal-menu'}`).classList.add('hide');
@@ -1582,20 +1621,14 @@ const Modal = {
1582
1621
  );
1583
1622
  } else {
1584
1623
  slideMenuWidth = originSlideMenuWidth;
1585
- setTimeout(() => {
1586
- s(`.main-body-btn-container`).style[
1587
- true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
1588
- ] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px';
1589
- }, 1);
1590
-
1591
- sa(`.handle-btn-container`).forEach((el) => el.classList.remove('hide'));
1624
+ s(`.${idModal}`).style.width = `${slideMenuWidth}px`;
1592
1625
  sa(`.menu-label-text`).forEach((el) => el.classList.remove('hide'));
1593
- if (!Modal.mobileModal()) {
1594
- sa(`.tooltip-menu`).forEach((el) => el.classList.add('hide'));
1595
- s(`.${idModal}`).style.overflow = null;
1596
- }
1597
- if (s(`.menu-btn-container-main`) && s(`.menu-btn-container-main`).classList.contains('hide'))
1598
- s(`.btn-icon-menu-back`).classList.remove('hide');
1626
+ s(`.main-body-btn-container`).style[
1627
+ true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
1628
+ ] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px';
1629
+ sa(`.handle-btn-container`).forEach((el) => el.classList.remove('hide'));
1630
+
1631
+ Modal.menuTextLabelAnimation(idModal);
1599
1632
 
1600
1633
  if (options.onExtendMenu) options.onExtendMenu();
1601
1634
  s(`.sub-menu-title-container-${'modal-menu'}`).classList.remove('hide');
@@ -1604,9 +1637,8 @@ const Modal = {
1604
1637
  this.Data[idModal].onExtendMenuListener[keyListener](),
1605
1638
  );
1606
1639
  }
1607
- // btn-bar-center-icon-menu
1608
- this.actionBtnCenter();
1609
- this.actionBtnCenter();
1640
+ Modal.Data[idModal][options.mode].width = slideMenuWidth;
1641
+ Responsive.Event[`slide-menu-${idModal}`]();
1610
1642
  });
1611
1643
 
1612
1644
  break;
@@ -1882,7 +1914,7 @@ const Modal = {
1882
1914
  : 'slide-menu-left';
1883
1915
  const callBack = () => {
1884
1916
  s(`.${idModal}`).style.transition = '0.3s';
1885
- s(`.${idModal}`).style.width = `${window.innerWidth - this.Data[options.slideMenu][idSlide].width}px`;
1917
+ s(`.${idModal}`).style.width = `${windowGetW() - this.Data[options.slideMenu][idSlide].width}px`;
1886
1918
  s(`.${idModal}`).style.left =
1887
1919
  idSlide === 'slide-menu-right' ? `0px` : `${this.Data[options.slideMenu][idSlide].width}px`;
1888
1920
  setTimeout(() => (s(`.${idModal}`) ? (s(`.${idModal}`).style.transition = transition) : null), 300);
@@ -1898,7 +1930,7 @@ const Modal = {
1898
1930
  if (!s(`.${idModal}`) || !s(`.main-body-btn-ui-close`)) return;
1899
1931
  if (s(`.btn-restore-${idModal}`) && s(`.btn-restore-${idModal}`).style.display !== 'none') {
1900
1932
  s(`.${idModal}`).style.height = s(`.main-body-btn-ui-close`).classList.contains('hide')
1901
- ? `${window.innerHeight}px`
1933
+ ? `${windowGetH()}px`
1902
1934
  : `${Modal.Data[idModal].getHeight()}px`;
1903
1935
  }
1904
1936
  s(`.${idModal}`).style.top = s(`.main-body-btn-ui-close`).classList.contains('hide')
@@ -1918,11 +1950,12 @@ const Modal = {
1918
1950
  };
1919
1951
 
1920
1952
  const btnMenuEvent = () => {
1953
+ Modal.menuTextLabelAnimation(idModal);
1921
1954
  Object.keys(this.Data[idModal].onMenuListener).map((keyListener) =>
1922
1955
  this.Data[idModal].onMenuListener[keyListener](),
1923
1956
  );
1924
1957
  if (options && 'barConfig' in options && options.barConfig.buttons.menu.onClick)
1925
- return options.barConfig.buttons.menu.onClick();
1958
+ options.barConfig.buttons.menu.onClick();
1926
1959
  };
1927
1960
  s(`.btn-menu-${idModal}`).onclick = btnMenuEvent;
1928
1961
 
@@ -1958,6 +1991,8 @@ const Modal = {
1958
1991
  ...this.Data[idModal],
1959
1992
  };
1960
1993
  },
1994
+ subMenuBtnClass: {},
1995
+
1961
1996
  onHomeRouterEvent: async () => {
1962
1997
  // 1. Get list of modals to close.
1963
1998
  const modalsToClose = Object.keys(Modal.Data).filter((idModal) => {
@@ -1986,11 +2021,13 @@ const Modal = {
1986
2021
  }
1987
2022
 
1988
2023
  // 4. Finally, handle UI cleanup for the slide-menu.
1989
- if (s(`.menu-btn-container-children`)) htmls(`.menu-btn-container-children`, '');
2024
+
1990
2025
  if (s(`.nav-title-display-modal-menu`)) htmls(`.nav-title-display-modal-menu`, '');
1991
2026
  if (s(`.nav-path-display-modal-menu`)) htmls(`.nav-path-display-modal-menu`, '');
1992
2027
  if (s(`.btn-icon-menu-back`)) s(`.btn-icon-menu-back`).classList.add('hide');
1993
- if (s(`.menu-btn-container-main`)) s(`.menu-btn-container-main`).classList.remove('hide');
2028
+ // sa(`.main-btn-menu`).forEach((el) => {
2029
+ // el.classList.remove('hide');
2030
+ // });
1994
2031
 
1995
2032
  // And close the slide menu if it's open
1996
2033
  if (s(`.btn-close-modal-menu`) && !s(`.btn-close-modal-menu`).classList.contains('hide')) {
@@ -2026,7 +2063,7 @@ const Modal = {
2026
2063
  s(`.${idModal}`).style.zIndex = '4';
2027
2064
  this.currentTopModalId = `${idModal}`;
2028
2065
  },
2029
- mobileModal: () => window.innerWidth < 600 || window.innerHeight < 600,
2066
+ mobileModal: () => windowGetW() < 600 || windowGetH() < 600,
2030
2067
  writeHTML: ({ idModal, html }) => htmls(`.html-${idModal}`, html),
2031
2068
  viewModalOpen: function () {
2032
2069
  return Object.keys(this.Data).find((idModal) => s(`.${idModal}`) && this.Data[idModal].options.mode === 'view');
@@ -2136,6 +2173,51 @@ const Modal = {
2136
2173
  };
2137
2174
  });
2138
2175
  },
2176
+ menuTextLabelAnimation: (idModal, subMenuId) => {
2177
+ if (
2178
+ !s(
2179
+ `.btn-icon-menu-mode-${Modal.Data[idModal].options.mode === 'slide-menu-right' ? 'left' : 'right'}`,
2180
+ ).classList.contains('hide')
2181
+ ) {
2182
+ return;
2183
+ }
2184
+ const btnSelector = `.main-btn-menu`;
2185
+ const labelSelector = `.menu-label-text`;
2186
+
2187
+ const _data = subMenuId
2188
+ ? {
2189
+ [subMenuId]: Modal.subMenuBtnClass[subMenuId],
2190
+ }
2191
+ : { ...Modal.subMenuBtnClass, _: { btnSelector, labelSelector } };
2192
+
2193
+ for (const keyDataBtn of Object.keys(_data)) {
2194
+ const { btnSelector, labelSelector, open, top } = _data[keyDataBtn];
2195
+ if (top)
2196
+ setTimeout(() => {
2197
+ top();
2198
+ });
2199
+ if (open) continue;
2200
+ sa(labelSelector).forEach((el) => {
2201
+ el.classList.add('hide');
2202
+ el.style.transition = null;
2203
+ });
2204
+
2205
+ setTimeout(() => {
2206
+ sa(labelSelector).forEach((el) => {
2207
+ el.classList.remove('hide');
2208
+ el.style.transition = null;
2209
+ });
2210
+ sa(labelSelector).forEach((el) => {
2211
+ el.style.top = '-40px';
2212
+ });
2213
+ }, 300);
2214
+ setTimeout(() => {
2215
+ sa(labelSelector).forEach((el) => {
2216
+ el.style.top = '-3px';
2217
+ });
2218
+ }, 400);
2219
+ }
2220
+ },
2139
2221
  // Move modal title element into the bar's render container so it aligns with control buttons
2140
2222
  /**
2141
2223
  * Position a modal relative to an anchor element
@@ -2163,8 +2245,8 @@ const Modal = {
2163
2245
 
2164
2246
  // First, position the modal near its final position but off-screen
2165
2247
  const arect = anchor.getBoundingClientRect();
2166
- const vh = window.innerHeight;
2167
- const vw = window.innerWidth;
2248
+ const vh = windowGetH();
2249
+ const vw = windowGetW();
2168
2250
  const safeMargin = 6;
2169
2251
 
2170
2252
  // Determine vertical position
@@ -2271,7 +2353,7 @@ const Modal = {
2271
2353
  };
2272
2354
 
2273
2355
  const renderMenuLabel = ({ img, text, icon }) => {
2274
- if (!img) return html`<span class="menu-btn-icon">${icon}</span> ${text}`;
2356
+ if (!img) return html`<span class="inl menu-btn-icon">${icon}</span> ${text}`;
2275
2357
  return html`<img class="abs center img-btn-square-menu" src="${getProxyPath()}assets/ui-icons/${img}" />
2276
2358
  <div class="abs center main-btn-menu-text">${text}</div>`;
2277
2359
  };
@@ -2312,17 +2394,17 @@ const buildBadgeToolTipMenuOption = (id, sideKey = 'left') => {
2312
2394
  const option = {
2313
2395
  id: `tooltip-content-main-btn-${id}`,
2314
2396
  text: `${Translate.Render(`${id}`)}`,
2315
- classList: 'tooltip-menu hide',
2316
- style: { top: `0px` },
2397
+ classList: 'tooltip-menu',
2398
+ style: { top: `-40px` },
2317
2399
  };
2318
2400
  switch (sideKey) {
2319
2401
  case 'left':
2320
- option.style.left = '40px';
2402
+ option.style.left = '60px';
2321
2403
 
2322
2404
  break;
2323
2405
 
2324
2406
  case 'right':
2325
- option.style.right = '80px';
2407
+ option.style.right = '60px';
2326
2408
  break;
2327
2409
 
2328
2410
  default:
@@ -2331,4 +2413,57 @@ const buildBadgeToolTipMenuOption = (id, sideKey = 'left') => {
2331
2413
  return option;
2332
2414
  };
2333
2415
 
2334
- export { Modal, renderMenuLabel, renderViewTitle, buildBadgeToolTipMenuOption };
2416
+ const subMenuRender = async (subMenuId) => {
2417
+ const _hBtn = 51;
2418
+ const menuBtn = s(`.main-btn-${subMenuId}`);
2419
+ const menuContainer = s(`.menu-btn-container-children-${subMenuId}`);
2420
+ const arrow = s(`.down-arrow-submenu-${subMenuId}`);
2421
+
2422
+ if (!menuBtn || !menuContainer || !arrow) return;
2423
+
2424
+ const top = () => {
2425
+ menuContainer.style.top = menuBtn.offsetTop + Modal.Data['modal-menu'].options.heightTopBar + 'px';
2426
+ };
2427
+
2428
+ Modal.subMenuBtnClass[subMenuId] = {
2429
+ ...Modal.subMenuBtnClass[subMenuId],
2430
+ btnSelector: `.btn-${subMenuId}`,
2431
+ labelSelector: `.menu-label-text-${subMenuId}`,
2432
+ top,
2433
+ };
2434
+
2435
+ menuBtn.style.transition = '.3s';
2436
+ arrow.style.transition = '.3s';
2437
+
2438
+ if (Modal.subMenuBtnClass[subMenuId].open) {
2439
+ Modal.subMenuBtnClass[subMenuId].open = false;
2440
+ // Close animation
2441
+ menuContainer.style.overflow = 'hidden';
2442
+ menuContainer.style.height = '0px';
2443
+ arrow.style.rotate = '180deg';
2444
+ setTimeout(() => {
2445
+ menuBtn.style.marginBottom = '0px';
2446
+ arrow.style.rotate = '0deg';
2447
+ });
2448
+ } else {
2449
+ Modal.menuTextLabelAnimation('modal-menu', subMenuId);
2450
+ Modal.subMenuBtnClass[subMenuId].open = true;
2451
+ // Open animation
2452
+ setTimeout(top, 360);
2453
+ menuContainer.style.width = '320px';
2454
+ menuContainer.style.overflow = null;
2455
+ menuContainer.style.height = '0px';
2456
+ menuContainer.style.height = `${_hBtn * 6}px`;
2457
+ arrow.style.rotate = '0deg';
2458
+ setTimeout(() => {
2459
+ menuBtn.style.marginBottom = `${_hBtn * sa(`.menu-label-text-${subMenuId}`).length + 4}px`;
2460
+ arrow.style.rotate = '180deg';
2461
+ });
2462
+ }
2463
+
2464
+ setTimeout(() => {
2465
+ menuBtn.style.transition = null;
2466
+ }, 500);
2467
+ };
2468
+
2469
+ export { Modal, renderMenuLabel, renderViewTitle, buildBadgeToolTipMenuOption, subMenuRender };