underpost 2.8.878 → 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 (61) hide show
  1. package/.env.development +35 -3
  2. package/.env.production +40 -3
  3. package/.env.test +35 -3
  4. package/.github/workflows/release.cd.yml +3 -3
  5. package/README.md +20 -2
  6. package/bin/deploy.js +40 -0
  7. package/cli.md +3 -1
  8. package/conf.js +29 -3
  9. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  10. package/manifests/deployment/dd-test-development/deployment.yaml +6 -6
  11. package/package.json +1 -2
  12. package/src/api/document/document.controller.js +66 -0
  13. package/src/api/document/document.model.js +51 -0
  14. package/src/api/document/document.router.js +24 -0
  15. package/src/api/document/document.service.js +133 -0
  16. package/src/cli/deploy.js +1 -1
  17. package/src/cli/index.js +2 -0
  18. package/src/cli/repository.js +2 -0
  19. package/src/cli/run.js +27 -1
  20. package/src/client/Default.index.js +46 -1
  21. package/src/client/components/core/Account.js +8 -1
  22. package/src/client/components/core/AgGrid.js +18 -9
  23. package/src/client/components/core/Auth.js +258 -89
  24. package/src/client/components/core/BtnIcon.js +13 -3
  25. package/src/client/components/core/Content.js +2 -1
  26. package/src/client/components/core/CssCore.js +40 -27
  27. package/src/client/components/core/Docs.js +189 -88
  28. package/src/client/components/core/Input.js +34 -19
  29. package/src/client/components/core/LoadingAnimation.js +5 -10
  30. package/src/client/components/core/Modal.js +280 -123
  31. package/src/client/components/core/ObjectLayerEngine.js +470 -104
  32. package/src/client/components/core/ObjectLayerEngineModal.js +1 -0
  33. package/src/client/components/core/Panel.js +9 -2
  34. package/src/client/components/core/PanelForm.js +234 -76
  35. package/src/client/components/core/Router.js +15 -15
  36. package/src/client/components/core/ToolTip.js +83 -19
  37. package/src/client/components/core/Translate.js +1 -1
  38. package/src/client/components/core/VanillaJs.js +7 -3
  39. package/src/client/components/core/windowGetDimensions.js +202 -0
  40. package/src/client/components/default/MenuDefault.js +105 -41
  41. package/src/client/components/default/RoutesDefault.js +2 -0
  42. package/src/client/services/default/default.management.js +1 -0
  43. package/src/client/services/document/document.service.js +97 -0
  44. package/src/client/services/file/file.service.js +2 -0
  45. package/src/client/ssr/Render.js +1 -1
  46. package/src/client/ssr/head/DefaultScripts.js +2 -0
  47. package/src/client/ssr/head/Seo.js +1 -0
  48. package/src/index.js +1 -1
  49. package/src/mailer/EmailRender.js +1 -1
  50. package/src/server/auth.js +68 -17
  51. package/src/server/client-build.js +2 -3
  52. package/src/server/client-formatted.js +40 -12
  53. package/src/server/conf.js +5 -1
  54. package/src/server/crypto.js +195 -76
  55. package/src/server/object-layer.js +196 -0
  56. package/src/server/peer.js +47 -5
  57. package/src/server/process.js +85 -1
  58. package/src/server/runtime.js +23 -23
  59. package/src/server/ssr.js +52 -10
  60. package/src/server/valkey.js +89 -1
  61. package/test/crypto.test.js +117 -0
@@ -1,4 +1,4 @@
1
- import { getId, newInstance } from './CommonJs.js';
1
+ import { getId, newInstance, s4 } from './CommonJs.js';
2
2
  import { Draggable } from '@neodrag/vanilla';
3
3
  import { append, s, prepend, htmls, sa, getAllChildNodes, isActiveElement } from './VanillaJs.js';
4
4
  import { BtnIcon } from './BtnIcon.js';
@@ -30,8 +30,10 @@ import { DropDown } from './DropDown.js';
30
30
  import { Keyboard } from './Keyboard.js';
31
31
  import { Badge } from './Badge.js';
32
32
  import { Worker } from './Worker.js';
33
+ import { Scroll } from './Scroll.js';
34
+ import { windowGetH, windowGetW } from './windowGetDimensions.js';
33
35
 
34
- const logger = loggerFactory(import.meta);
36
+ const logger = loggerFactory(import.meta, { trace: true });
35
37
 
36
38
  const Modal = {
37
39
  Data: {},
@@ -56,8 +58,8 @@ const Modal = {
56
58
  let originHeightTopBar = options.heightTopBar ? newInstance(options.heightTopBar) : 0;
57
59
  let width = 300;
58
60
  let height = 400;
59
- let top = 0;
60
- let left = 0;
61
+ let top = options.style?.top ? options.style.top : 0;
62
+ let left = options.style?.left ? options.style.left : 0;
61
63
  const topBottomBarEnable = options && options.barMode && options.barMode === 'top-bottom-bar';
62
64
  if (!topBottomBarEnable) {
63
65
  options.heightTopBar = options.heightTopBar + options.heightBottomBar;
@@ -68,7 +70,7 @@ const Modal = {
68
70
  const collapseSlideMenuWidth = 50;
69
71
  let slideMenuWidth = originSlideMenuWidth;
70
72
  const minWidth = width;
71
- const heightDefaultTopBar = 0;
73
+ const heightDefaultTopBar = 50;
72
74
  const heightDefaultBottomBar = 0;
73
75
  const idModal = options && 'id' in options ? options.id : getId(this.Data, 'modal-');
74
76
  this.Data[idModal] = {
@@ -86,35 +88,57 @@ const Modal = {
86
88
  onHome: {},
87
89
  homeModals: options.homeModals ? options.homeModals : [],
88
90
  query: options.query ? `${window.location.search}` : undefined,
89
- getTop: () => window.innerHeight - (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar),
90
- getHeight: () =>
91
- window.innerHeight -
92
- (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
93
- (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
+ },
100
+ getHeight: () => {
101
+ return (
102
+ windowGetH() -
103
+ (s(`.main-body-btn-ui-close`) && !s(`.main-body-btn-ui-close`).classList.contains('hide')
104
+ ? (options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) +
105
+ (options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
106
+ : 0)
107
+ );
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
+ }`,
94
123
  };
95
124
 
96
- if (idModal !== 'main-body' && options.mode !== 'view') {
97
- top = `${window.innerHeight / 2 - height / 2}px`;
98
- left = `${window.innerWidth / 2 - width / 2}px`;
99
- }
100
125
  if (options && 'mode' in options) {
101
- this.Data[idModal][options.mode] = {};
126
+ Modal.Data[idModal][options.mode] = {};
102
127
  switch (options.mode) {
103
128
  case 'view':
104
- if (options && options.slideMenu) s(`.btn-close-${options.slideMenu}`).click();
129
+ // if (options && options.slideMenu) s(`.btn-close-${options.slideMenu}`).click();
105
130
  options.zIndexSync = true;
106
131
 
107
- options.style = {
108
- ...options.style,
109
- 'min-width': `${minWidth}px`,
110
- width: '100%',
111
- };
132
+ options.style = { width: '100%', ...options.style, 'min-width': `${minWidth}px` };
112
133
 
113
- if (this.mobileModal()) {
134
+ if (Modal.mobileModal()) {
114
135
  options.barConfig.buttons.restore.disabled = true;
115
136
  options.barConfig.buttons.minimize.disabled = true;
116
137
  options.dragDisabled = true;
117
138
  options.style.resize = 'none';
139
+ setTimeout(() => {
140
+ s(`.btn-close-modal-menu`).click();
141
+ });
118
142
  }
119
143
 
120
144
  Responsive.Event[`view-${idModal}`] = () => {
@@ -201,8 +225,7 @@ const Modal = {
201
225
  }
202
226
  const { barConfig } = options;
203
227
  options.style = {
204
- position: 'absolute',
205
- height: `${Modal.Data[idModal].getHeight()}px`,
228
+ height: `${windowGetH() - options.heightTopBar - options.heightBottomBar}px`,
206
229
  width: `${slideMenuWidth}px`,
207
230
  // 'overflow-x': 'hidden',
208
231
  // overflow: 'visible', // required for tooltip
@@ -210,15 +233,14 @@ const Modal = {
210
233
  resize: 'none',
211
234
  top: `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`,
212
235
  };
213
- options.mode === 'slide-menu-right' ? (options.style.right = '0px') : (options.style.left = '0px');
214
236
  const contentIconClass = 'abs center';
215
- if (options.class) options.class += ' hide';
216
- else options.class = 'hide';
237
+ top = 'auto';
238
+ left = Modal.Data[idModal].getMenuLeftStyle();
239
+ transition = '.3s';
217
240
  options.dragDisabled = true;
218
241
  options.titleClass = 'hide';
219
- top = '0px';
220
- left = 'auto';
221
- width = 'auto';
242
+ options.disableCenter = true;
243
+
222
244
  // barConfig.buttons.maximize.disabled = true;
223
245
  // barConfig.buttons.minimize.disabled = true;
224
246
  // barConfig.buttons.restore.disabled = true;
@@ -231,6 +253,9 @@ const Modal = {
231
253
  this.Data[_idModal].slideMenu.callBack();
232
254
  }
233
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
+ });
234
259
  if (s(`.main-body-top`)) {
235
260
  if (Modal.mobileModal()) {
236
261
  if (s(`.btn-menu-${idModal}`).classList.contains('hide') && collapseSlideMenuWidth !== slideMenuWidth)
@@ -240,51 +265,56 @@ const Modal = {
240
265
  }
241
266
  };
242
267
  barConfig.buttons.menu.onClick = () => {
243
- this.Data[idModal][options.mode].width = slideMenuWidth;
268
+ Modal.Data[idModal][options.mode].width = slideMenuWidth;
244
269
  s(`.btn-menu-${idModal}`).classList.add('hide');
245
270
  s(`.btn-close-${idModal}`).classList.remove('hide');
246
- s(`.${idModal}`).style.width = `${this.Data[idModal][options.mode].width}px`;
271
+ // s(`.${idModal}`).style.width = `${this.Data[idModal][options.mode].width}px`;
247
272
  s(`.html-${idModal}`).style.display = 'block';
248
273
  // s(`.title-modal-${idModal}`).style.display = 'block';
249
- setTimeout(() => {
250
- s(`.main-body-btn-ui-menu-menu`).classList.add('hide');
251
- s(`.main-body-btn-ui-menu-close`).classList.remove('hide');
252
- if (s(`.btn-bar-center-icon-menu`)) {
253
- s(`.btn-bar-center-icon-close`).classList.remove('hide');
254
- s(`.btn-bar-center-icon-menu`).classList.add('hide');
255
- }
256
- });
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
+ }
257
280
 
258
- setTimeout(() => {
259
- s(`.main-body-btn-container`).style[
260
- true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
261
- ] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px';
262
- });
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
+ }
263
289
  Responsive.Event[`slide-menu-${idModal}`]();
264
290
  };
265
291
  barConfig.buttons.close.onClick = () => {
266
- this.Data[idModal][options.mode].width = 0;
292
+ Modal.Data[idModal][options.mode].width = 0;
267
293
  s(`.btn-close-${idModal}`).classList.add('hide');
268
294
  s(`.btn-menu-${idModal}`).classList.remove('hide');
269
- s(`.${idModal}`).style.width = `${this.Data[idModal][options.mode].width}px`;
270
- 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';
271
297
  // s(`.title-modal-${idModal}`).style.display = 'none';
272
- setTimeout(() => {
273
- s(`.main-body-btn-ui-menu-close`).classList.add('hide');
274
- s(`.main-body-btn-ui-menu-menu`).classList.remove('hide');
275
- if (s(`.btn-bar-center-icon-menu`)) {
276
- s(`.btn-bar-center-icon-menu`).classList.remove('hide');
277
- s(`.btn-bar-center-icon-close`).classList.add('hide');
278
- }
279
- s(`.main-body-btn-container`).style[
280
- true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
281
- ] = `${0}px`;
282
- });
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
+ }
283
312
  Responsive.Event[`slide-menu-${idModal}`]();
284
313
  };
285
314
  transition += `, width 0.3s`;
286
315
 
287
316
  setTimeout(() => {
317
+ setTimeout(btnCloseEvent);
288
318
  append(
289
319
  'body',
290
320
  html`
@@ -293,7 +323,7 @@ const Modal = {
293
323
  style="top: ${options.heightTopBar + 50}px; z-index: 9; ${true ||
294
324
  (options.mode && options.mode.match('right'))
295
325
  ? 'right'
296
- : 'left'}: 50px; width: 50px; height: 150px; transition: .3s"
326
+ : 'left'}: 0px; width: 50px; height: 150px; transition: .3s"
297
327
  >
298
328
  <div
299
329
  class="abs main-body-btn main-body-btn-ui"
@@ -350,6 +380,9 @@ const Modal = {
350
380
  s(`.slide-menu-top-bar-fix`).style.top = '-100px';
351
381
  s(`.top-bar-search-box-container`).click();
352
382
  }
383
+ if (Modal.mobileModal()) {
384
+ btnCloseEvent();
385
+ }
353
386
  };
354
387
 
355
388
  let _heightTopBar, _heightBottomBar, _topMenu;
@@ -367,6 +400,7 @@ const Modal = {
367
400
  s(`.modal-menu`).style.top = '0px';
368
401
  s(`.main-body-btn-container`).style.top = '50px';
369
402
  s(`.main-body`).style.top = '0px';
403
+ s(`.main-body`).style.height = `${windowGetH()}px`;
370
404
  for (const event of Object.keys(Modal.Data[idModal].onBarUiClose))
371
405
  Modal.Data[idModal].onBarUiClose[event]();
372
406
  } else {
@@ -379,6 +413,7 @@ const Modal = {
379
413
  s(`.slide-menu-top-bar`).classList.remove('hide');
380
414
  s(`.bottom-bar`).classList.remove('hide');
381
415
  s(`.main-body`).style.top = `${options.heightTopBar}px`;
416
+ s(`.main-body`).style.height = `${windowGetH() - options.heightTopBar}px`;
382
417
  for (const event of Object.keys(Modal.Data[idModal].onBarUiOpen))
383
418
  Modal.Data[idModal].onBarUiOpen[event]();
384
419
  }
@@ -495,9 +530,15 @@ const Modal = {
495
530
  </div>`,
496
531
  );
497
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
+ }
498
536
  s(`.main-btn-account`).click();
499
537
  });
500
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
+ }
501
542
  s(`.main-btn-sign-up`).click();
502
543
  });
503
544
  s(`.input-info-${inputSearchBoxId}`).style.textAlign = 'left';
@@ -741,6 +782,9 @@ const Modal = {
741
782
  let boxHistoryDelayRender = 0;
742
783
  const searchBoxHistoryOpen = async () => {
743
784
  if (boxHistoryDelayRender) return;
785
+ if (Modal.mobileModal()) {
786
+ btnCloseEvent();
787
+ }
744
788
  boxHistoryDelayRender = 1000;
745
789
  setTimeout(() => (boxHistoryDelayRender = 0));
746
790
  if (!s(`.${searchBoxHistoryId}`)) {
@@ -771,8 +815,8 @@ const Modal = {
771
815
  resize: 'none',
772
816
  'max-width': '450px',
773
817
  height:
774
- this.mobileModal() && window.innerWidth < 445
775
- ? `${window.innerHeight - originHeightTopBar}px !important`
818
+ this.mobileModal() && windowGetW() < 445
819
+ ? `${windowGetH() - originHeightTopBar}px !important`
776
820
  : '300px !important',
777
821
  'z-index': 7,
778
822
  },
@@ -959,7 +1003,7 @@ const Modal = {
959
1003
  Responsive.Event[`view-${id}`] = () => {
960
1004
  if (!this.Data[id] || !s(`.${id}`)) return delete Responsive.Event[`view-${id}`];
961
1005
  const widthInputSearchBox =
962
- window.innerWidth > maxWidthInputSearchBox ? maxWidthInputSearchBox : window.innerWidth;
1006
+ windowGetW() > maxWidthInputSearchBox ? maxWidthInputSearchBox : windowGetW();
963
1007
  s(`.top-bar-search-box-container`).style.width = `${
964
1008
  widthInputSearchBox - originHeightTopBar - paddingRightSearchBox - 1
965
1009
  }px`;
@@ -1093,18 +1137,23 @@ const Modal = {
1093
1137
  height: `${options.heightBottomBar}px`,
1094
1138
  'min-width': `${minWidth}px`,
1095
1139
  'z-index': 7,
1140
+ // bottom: '0px !important',
1141
+ width: `${windowGetW()}px`,
1142
+ top: `${Modal.Data['modal-menu'].getTop()}px`,
1096
1143
  },
1097
1144
  dragDisabled: true,
1098
- maximize: true,
1099
- barMode: options.barMode,
1145
+ disableCenter: true,
1146
+ // maximize: true,
1147
+ // barMode: options.barMode,
1100
1148
  });
1101
1149
  Responsive.Event[`view-${id}`] = () => {
1102
1150
  if (!this.Data[id] || !s(`.${id}`)) return delete Responsive.Event[`view-${id}`];
1103
1151
  // <div class="in fll right-offset-menu-bottom-bar" style="height: 100%"></div>
1104
- // s(`.right-offset-menu-bottom-bar`).style.width = `${window.innerWidth - slideMenuWidth}px`;
1105
- 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`;
1106
1155
  };
1107
- Responsive.Event[`view-${id}`]();
1156
+ // Responsive.Event[`view-${id}`]();
1108
1157
  }
1109
1158
  EventsUI.onClick(`.action-btn-left`, (e) => {
1110
1159
  e.preventDefault();
@@ -1112,7 +1161,7 @@ const Modal = {
1112
1161
  });
1113
1162
  EventsUI.onClick(`.action-btn-center`, (e) => {
1114
1163
  e.preventDefault();
1115
- this.actionBtnCenter();
1164
+ Modal.actionBtnCenter();
1116
1165
  });
1117
1166
  EventsUI.onClick(`.action-btn-right`, (e) => {
1118
1167
  e.preventDefault();
@@ -1273,7 +1322,7 @@ const Modal = {
1273
1322
  s(`.${id}`).style.height =
1274
1323
  s(`.main-body-btn-ui-close`).classList.contains('hide') &&
1275
1324
  s(`.btn-restore-${id}`).style.display !== 'none'
1276
- ? `${window.innerHeight}px`
1325
+ ? `${windowGetH()}px`
1277
1326
  : `${Modal.Data[id].getHeight()}px`;
1278
1327
 
1279
1328
  if (
@@ -1291,6 +1340,17 @@ const Modal = {
1291
1340
  }
1292
1341
 
1293
1342
  await NotificationManager.RenderBoard(options);
1343
+
1344
+ const { removeEvent } = Scroll.setEvent('.main-body', async (payload) => {
1345
+ // console.warn('scroll', payload);
1346
+ if (payload.scrollTop > 100) {
1347
+ if (!s(`.main-body-btn-ui-close`).classList.contains('hide')) s(`.main-body-btn-ui-close`).click();
1348
+
1349
+ removeEvent();
1350
+ }
1351
+ });
1352
+ // TODO: mobile padding gap on init size top height, Iphone SE responsive case
1353
+ setTimeout(window.onresize);
1294
1354
  });
1295
1355
  })();
1296
1356
  break;
@@ -1319,14 +1379,17 @@ const Modal = {
1319
1379
  break;
1320
1380
  }
1321
1381
  }
1382
+
1322
1383
  if (options.zIndexSync) this.zIndexSync({ idModal });
1384
+
1323
1385
  if (s(`.${idModal}`)) {
1324
1386
  s(`.btn-maximize-${idModal}`).click();
1325
1387
  return;
1326
1388
  }
1327
- if (options.slideMenu) {
1328
- if (options.titleClass) options.titleClass = ' title-view-modal ' + options.titleClass;
1329
- 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`;
1330
1393
  }
1331
1394
 
1332
1395
  const render = html` <style class="style-${idModal}">
@@ -1385,7 +1448,7 @@ const Modal = {
1385
1448
  <div
1386
1449
  class="fix ${options && options.class ? options.class : ''} modal ${options.disableBoxShadow
1387
1450
  ? ''
1388
- : 'box-shadow'} ${idModal}"
1451
+ : 'box-shadow'} ${idModal === 'main-body' ? `${idModal} modal-home` : idModal}"
1389
1452
  >
1390
1453
  <div class="abs modal-handle-${idModal}"></div>
1391
1454
  <div class="in modal-html-${idModal}">
@@ -1444,7 +1507,9 @@ const Modal = {
1444
1507
  ? html` <div class="abs modal-icon-container">${renderStatus(options.status)}</div> `
1445
1508
  : ''}
1446
1509
  <div
1447
- 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'}"
1448
1513
  >
1449
1514
  ${options && options.titleRender ? options.titleRender() : options.title ? options.title : ''}
1450
1515
  </div>
@@ -1519,12 +1584,13 @@ const Modal = {
1519
1584
  case 'slide-menu-right':
1520
1585
  case 'slide-menu-left':
1521
1586
  const backMenuButtonEvent = async () => {
1522
- if (s(`.menu-btn-container-children`)) htmls(`.menu-btn-container-children`, '');
1523
1587
  // htmls(`.nav-title-display-${'modal-menu'}`, html`<i class="fas fa-home"></i> ${Translate.Render('home')}`);
1524
1588
  htmls(`.nav-title-display-${'modal-menu'}`, html``);
1525
1589
  htmls(`.nav-path-display-${idModal}`, '');
1526
1590
  s(`.btn-icon-menu-back`).classList.add('hide');
1527
- 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
+ // });
1528
1594
  };
1529
1595
  s(`.main-btn-home`).onclick = async () => {
1530
1596
  // await this.onHomeRouterEvent();
@@ -1541,22 +1607,12 @@ const Modal = {
1541
1607
  }
1542
1608
  if (slideMenuWidth === originSlideMenuWidth) {
1543
1609
  slideMenuWidth = collapseSlideMenuWidth;
1544
- setTimeout(() => {
1545
- s(`.main-body-btn-container`).style[
1546
- true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
1547
- ] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px';
1548
- }, 1);
1549
-
1550
- if (!s(`.btn-bar-center-icon-close`).classList.contains('hide')) {
1551
- sa(`.handle-btn-container`).forEach((el) => el.classList.add('hide'));
1552
- sa(`.menu-label-text`).forEach((el) => el.classList.add('hide'));
1553
- if (!Modal.mobileModal()) {
1554
- sa(`.tooltip-menu`).forEach((el) => el.classList.remove('hide'));
1555
- s(`.${idModal}`).style.overflow = 'visible';
1556
- }
1557
- if (s(`.menu-btn-container-main`) && s(`.menu-btn-container-main`).classList.contains('hide'))
1558
- s(`.btn-icon-menu-back`).classList.add('hide');
1559
- }
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'));
1560
1616
  if (options.onCollapseMenu) options.onCollapseMenu();
1561
1617
  s(`.sub-menu-title-container-${'modal-menu'}`).classList.add('hide');
1562
1618
  s(`.nav-path-container-${'modal-menu'}`).classList.add('hide');
@@ -1565,20 +1621,14 @@ const Modal = {
1565
1621
  );
1566
1622
  } else {
1567
1623
  slideMenuWidth = originSlideMenuWidth;
1568
- setTimeout(() => {
1569
- s(`.main-body-btn-container`).style[
1570
- true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
1571
- ] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px';
1572
- }, 1);
1573
-
1574
- sa(`.handle-btn-container`).forEach((el) => el.classList.remove('hide'));
1624
+ s(`.${idModal}`).style.width = `${slideMenuWidth}px`;
1575
1625
  sa(`.menu-label-text`).forEach((el) => el.classList.remove('hide'));
1576
- if (!Modal.mobileModal()) {
1577
- sa(`.tooltip-menu`).forEach((el) => el.classList.add('hide'));
1578
- s(`.${idModal}`).style.overflow = null;
1579
- }
1580
- if (s(`.menu-btn-container-main`) && s(`.menu-btn-container-main`).classList.contains('hide'))
1581
- 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);
1582
1632
 
1583
1633
  if (options.onExtendMenu) options.onExtendMenu();
1584
1634
  s(`.sub-menu-title-container-${'modal-menu'}`).classList.remove('hide');
@@ -1587,9 +1637,8 @@ const Modal = {
1587
1637
  this.Data[idModal].onExtendMenuListener[keyListener](),
1588
1638
  );
1589
1639
  }
1590
- // btn-bar-center-icon-menu
1591
- this.actionBtnCenter();
1592
- this.actionBtnCenter();
1640
+ Modal.Data[idModal][options.mode].width = slideMenuWidth;
1641
+ Responsive.Event[`slide-menu-${idModal}`]();
1593
1642
  });
1594
1643
 
1595
1644
  break;
@@ -1865,7 +1914,7 @@ const Modal = {
1865
1914
  : 'slide-menu-left';
1866
1915
  const callBack = () => {
1867
1916
  s(`.${idModal}`).style.transition = '0.3s';
1868
- 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`;
1869
1918
  s(`.${idModal}`).style.left =
1870
1919
  idSlide === 'slide-menu-right' ? `0px` : `${this.Data[options.slideMenu][idSlide].width}px`;
1871
1920
  setTimeout(() => (s(`.${idModal}`) ? (s(`.${idModal}`).style.transition = transition) : null), 300);
@@ -1881,7 +1930,7 @@ const Modal = {
1881
1930
  if (!s(`.${idModal}`) || !s(`.main-body-btn-ui-close`)) return;
1882
1931
  if (s(`.btn-restore-${idModal}`) && s(`.btn-restore-${idModal}`).style.display !== 'none') {
1883
1932
  s(`.${idModal}`).style.height = s(`.main-body-btn-ui-close`).classList.contains('hide')
1884
- ? `${window.innerHeight}px`
1933
+ ? `${windowGetH()}px`
1885
1934
  : `${Modal.Data[idModal].getHeight()}px`;
1886
1935
  }
1887
1936
  s(`.${idModal}`).style.top = s(`.main-body-btn-ui-close`).classList.contains('hide')
@@ -1901,11 +1950,12 @@ const Modal = {
1901
1950
  };
1902
1951
 
1903
1952
  const btnMenuEvent = () => {
1953
+ Modal.menuTextLabelAnimation(idModal);
1904
1954
  Object.keys(this.Data[idModal].onMenuListener).map((keyListener) =>
1905
1955
  this.Data[idModal].onMenuListener[keyListener](),
1906
1956
  );
1907
1957
  if (options && 'barConfig' in options && options.barConfig.buttons.menu.onClick)
1908
- return options.barConfig.buttons.menu.onClick();
1958
+ options.barConfig.buttons.menu.onClick();
1909
1959
  };
1910
1960
  s(`.btn-menu-${idModal}`).onclick = btnMenuEvent;
1911
1961
 
@@ -1941,6 +1991,8 @@ const Modal = {
1941
1991
  ...this.Data[idModal],
1942
1992
  };
1943
1993
  },
1994
+ subMenuBtnClass: {},
1995
+
1944
1996
  onHomeRouterEvent: async () => {
1945
1997
  // 1. Get list of modals to close.
1946
1998
  const modalsToClose = Object.keys(Modal.Data).filter((idModal) => {
@@ -1969,11 +2021,13 @@ const Modal = {
1969
2021
  }
1970
2022
 
1971
2023
  // 4. Finally, handle UI cleanup for the slide-menu.
1972
- if (s(`.menu-btn-container-children`)) htmls(`.menu-btn-container-children`, '');
2024
+
1973
2025
  if (s(`.nav-title-display-modal-menu`)) htmls(`.nav-title-display-modal-menu`, '');
1974
2026
  if (s(`.nav-path-display-modal-menu`)) htmls(`.nav-path-display-modal-menu`, '');
1975
2027
  if (s(`.btn-icon-menu-back`)) s(`.btn-icon-menu-back`).classList.add('hide');
1976
- 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
+ // });
1977
2031
 
1978
2032
  // And close the slide menu if it's open
1979
2033
  if (s(`.btn-close-modal-menu`) && !s(`.btn-close-modal-menu`).classList.contains('hide')) {
@@ -2009,7 +2063,7 @@ const Modal = {
2009
2063
  s(`.${idModal}`).style.zIndex = '4';
2010
2064
  this.currentTopModalId = `${idModal}`;
2011
2065
  },
2012
- mobileModal: () => window.innerWidth < 600 || window.innerHeight < 600,
2066
+ mobileModal: () => windowGetW() < 600 || windowGetH() < 600,
2013
2067
  writeHTML: ({ idModal, html }) => htmls(`.html-${idModal}`, html),
2014
2068
  viewModalOpen: function () {
2015
2069
  return Object.keys(this.Data).find((idModal) => s(`.${idModal}`) && this.Data[idModal].options.mode === 'view');
@@ -2119,6 +2173,51 @@ const Modal = {
2119
2173
  };
2120
2174
  });
2121
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
+ },
2122
2221
  // Move modal title element into the bar's render container so it aligns with control buttons
2123
2222
  /**
2124
2223
  * Position a modal relative to an anchor element
@@ -2146,8 +2245,8 @@ const Modal = {
2146
2245
 
2147
2246
  // First, position the modal near its final position but off-screen
2148
2247
  const arect = anchor.getBoundingClientRect();
2149
- const vh = window.innerHeight;
2150
- const vw = window.innerWidth;
2248
+ const vh = windowGetH();
2249
+ const vw = windowGetW();
2151
2250
  const safeMargin = 6;
2152
2251
 
2153
2252
  // Determine vertical position
@@ -2246,10 +2345,15 @@ const Modal = {
2246
2345
  s(`.bottom-bar`).classList.remove('hide');
2247
2346
  s(`.modal-menu`).classList.remove('hide');
2248
2347
  },
2348
+ RenderSeoSanitizer: async () => {
2349
+ sa('img').forEach((img) => {
2350
+ if (!img.getAttribute('alt')) img.setAttribute('alt', 'image ' + Worker.title + ' ' + s4());
2351
+ });
2352
+ },
2249
2353
  };
2250
2354
 
2251
2355
  const renderMenuLabel = ({ img, text, icon }) => {
2252
- 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}`;
2253
2357
  return html`<img class="abs center img-btn-square-menu" src="${getProxyPath()}assets/ui-icons/${img}" />
2254
2358
  <div class="abs center main-btn-menu-text">${text}</div>`;
2255
2359
  };
@@ -2290,17 +2394,17 @@ const buildBadgeToolTipMenuOption = (id, sideKey = 'left') => {
2290
2394
  const option = {
2291
2395
  id: `tooltip-content-main-btn-${id}`,
2292
2396
  text: `${Translate.Render(`${id}`)}`,
2293
- classList: 'tooltip-menu hide',
2294
- style: { top: `0px` },
2397
+ classList: 'tooltip-menu',
2398
+ style: { top: `-40px` },
2295
2399
  };
2296
2400
  switch (sideKey) {
2297
2401
  case 'left':
2298
- option.style.left = '40px';
2402
+ option.style.left = '60px';
2299
2403
 
2300
2404
  break;
2301
2405
 
2302
2406
  case 'right':
2303
- option.style.right = '80px';
2407
+ option.style.right = '60px';
2304
2408
  break;
2305
2409
 
2306
2410
  default:
@@ -2309,4 +2413,57 @@ const buildBadgeToolTipMenuOption = (id, sideKey = 'left') => {
2309
2413
  return option;
2310
2414
  };
2311
2415
 
2312
- 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 };