underpost 2.7.83 → 2.7.91
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.
- package/.github/workflows/ghpkg.yml +41 -1
- package/.github/workflows/pwa-microservices-template.page.yml +54 -0
- package/.vscode/settings.json +7 -0
- package/CHANGELOG.md +64 -16
- package/bin/cron.js +47 -0
- package/bin/db.js +60 -7
- package/bin/deploy.js +345 -15
- package/bin/file.js +17 -1
- package/bin/index.js +1 -1
- package/bin/util.js +31 -1
- package/conf.js +18 -4
- package/docker-compose.yml +1 -1
- package/package.json +3 -3
- package/src/api/core/core.router.js +9 -9
- package/src/api/core/core.service.js +12 -4
- package/src/api/default/default.service.js +4 -4
- package/src/api/file/file.service.js +3 -3
- package/src/api/user/user.service.js +10 -8
- package/src/client/components/core/CommonJs.js +3 -0
- package/src/client/components/core/CssCore.js +30 -3
- package/src/client/components/core/Docs.js +110 -10
- package/src/client/components/core/LoadingAnimation.js +4 -2
- package/src/client/components/core/Modal.js +224 -22
- package/src/client/components/core/Panel.js +1 -1
- package/src/client/components/core/PanelForm.js +2 -1
- package/src/client/components/core/Responsive.js +34 -5
- package/src/client/components/core/RichText.js +4 -2
- package/src/client/components/core/WebComponent.js +44 -0
- package/src/client/components/core/Worker.js +13 -15
- package/src/client/public/default/plantuml/client-conf.svg +1 -1
- package/src/client/public/default/plantuml/client-schema.svg +1 -1
- package/src/client/public/default/plantuml/cron-conf.svg +1 -1
- package/src/client/public/default/plantuml/cron-schema.svg +1 -1
- package/src/client/public/default/plantuml/server-conf.svg +1 -1
- package/src/client/public/default/plantuml/server-schema.svg +1 -1
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -1
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -1
- package/src/client/public/default/site.webmanifest +69 -0
- package/src/client/ssr/components/body/CacheControl.js +1 -1
- package/src/client/ssr/components/head/Production.js +1 -0
- package/src/client/ssr/components/head/Pwa.js +146 -0
- package/src/client/ssr/components/head/Seo.js +14 -0
- package/src/client/ssr/pages/maintenance.js +14 -0
- package/src/client/ssr/pages/offline.js +21 -0
- package/src/client/sw/default.sw.js +4 -2
- package/src/db/DataBaseProvider.js +12 -1
- package/src/db/mongo/MongooseDB.js +0 -1
- package/src/runtime/lampp/Lampp.js +9 -9
- package/src/server/backup.js +82 -70
- package/src/server/client-build.js +46 -94
- package/src/server/conf.js +82 -18
- package/src/server/crypto.js +91 -0
- package/src/server/dns.js +48 -16
- package/src/server/network.js +94 -7
- package/src/server/proxy.js +27 -27
- package/src/server/runtime.js +4 -2
- package/src/server/ssl.js +2 -2
- package/src/client/ssr/offline/default.index.js +0 -31
- package/src/cron.js +0 -30
- package/src/server/cron.js +0 -35
|
@@ -86,6 +86,7 @@ const Modal = {
|
|
|
86
86
|
onDragEndListener: {},
|
|
87
87
|
onObserverListener: {},
|
|
88
88
|
onClickListener: {},
|
|
89
|
+
onExpandUiListener: {},
|
|
89
90
|
query: options.query ? `${window.location.search}` : undefined,
|
|
90
91
|
};
|
|
91
92
|
if (options && 'mode' in options) {
|
|
@@ -191,11 +192,20 @@ const Modal = {
|
|
|
191
192
|
s(`.${idModal}`).style.width = `${this.Data[idModal][options.mode].width}px`;
|
|
192
193
|
s(`.html-${idModal}`).style.display = 'block';
|
|
193
194
|
// s(`.title-modal-${idModal}`).style.display = 'block';
|
|
194
|
-
|
|
195
|
-
s(`.btn-
|
|
196
|
-
s(`.
|
|
197
|
-
|
|
195
|
+
setTimeout(() => {
|
|
196
|
+
s(`.main-body-btn-ui-menu-menu`).classList.add('hide');
|
|
197
|
+
s(`.main-body-btn-ui-menu-close`).classList.remove('hide');
|
|
198
|
+
if (s(`.btn-bar-center-icon-menu`)) {
|
|
199
|
+
s(`.btn-bar-center-icon-close`).classList.remove('hide');
|
|
200
|
+
s(`.btn-bar-center-icon-menu`).classList.add('hide');
|
|
201
|
+
}
|
|
202
|
+
});
|
|
198
203
|
|
|
204
|
+
setTimeout(() => {
|
|
205
|
+
s(`.main-body-btn-container`).style[
|
|
206
|
+
true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
|
|
207
|
+
] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px';
|
|
208
|
+
});
|
|
199
209
|
Responsive.Event[`slide-menu-${idModal}`]();
|
|
200
210
|
};
|
|
201
211
|
barConfig.buttons.close.onClick = () => {
|
|
@@ -204,15 +214,106 @@ const Modal = {
|
|
|
204
214
|
s(`.btn-menu-${idModal}`).classList.remove('hide');
|
|
205
215
|
s(`.${idModal}`).style.width = `${this.Data[idModal][options.mode].width}px`;
|
|
206
216
|
s(`.html-${idModal}`).style.display = 'none';
|
|
207
|
-
|
|
208
|
-
s(`.
|
|
209
|
-
s(`.btn-
|
|
210
|
-
|
|
217
|
+
setTimeout(() => {
|
|
218
|
+
s(`.main-body-btn-ui-menu-close`).classList.add('hide');
|
|
219
|
+
s(`.main-body-btn-ui-menu-menu`).classList.remove('hide');
|
|
220
|
+
if (s(`.btn-bar-center-icon-menu`)) {
|
|
221
|
+
s(`.btn-bar-center-icon-menu`).classList.remove('hide');
|
|
222
|
+
s(`.btn-bar-center-icon-close`).classList.add('hide');
|
|
223
|
+
}
|
|
224
|
+
});
|
|
211
225
|
// s(`.title-modal-${idModal}`).style.display = 'none';
|
|
226
|
+
setTimeout(() => {
|
|
227
|
+
s(`.main-body-btn-container`).style[
|
|
228
|
+
true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
|
|
229
|
+
] = `${0}px`;
|
|
230
|
+
});
|
|
212
231
|
Responsive.Event[`slide-menu-${idModal}`]();
|
|
213
232
|
};
|
|
214
233
|
transition += `, width 0.3s`;
|
|
215
234
|
|
|
235
|
+
setTimeout(() => {
|
|
236
|
+
append(
|
|
237
|
+
'body',
|
|
238
|
+
html`
|
|
239
|
+
<div
|
|
240
|
+
class="abs main-body-btn-container"
|
|
241
|
+
style="top: ${options.heightTopBar + 50}px; z-index: 9; ${true ||
|
|
242
|
+
(options.mode && options.mode.match('right'))
|
|
243
|
+
? 'right'
|
|
244
|
+
: 'left'}: 50px; width: 50px; height: 100px; transition: .3s"
|
|
245
|
+
>
|
|
246
|
+
<div
|
|
247
|
+
class="abs main-body-btn main-body-btn-menu"
|
|
248
|
+
style="top: 50px; ${true || (options.mode && options.mode.match('right'))
|
|
249
|
+
? 'right'
|
|
250
|
+
: 'left'}: 0px"
|
|
251
|
+
>
|
|
252
|
+
<div class="abs center">
|
|
253
|
+
<i class="fa-solid fa-xmark hide main-body-btn-ui-menu-close"></i>
|
|
254
|
+
<i class="fa-solid fa-bars main-body-btn-ui-menu-menu"></i>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
<div
|
|
258
|
+
class="abs main-body-btn main-body-btn-ui"
|
|
259
|
+
style="top: 0px; ${true || (options.mode && options.mode.match('right')) ? 'right' : 'left'}: 0px"
|
|
260
|
+
>
|
|
261
|
+
<div class="abs center">
|
|
262
|
+
<i class="fas fa-caret-down main-body-btn-ui-open hide"></i>
|
|
263
|
+
<i class="fas fa-caret-up main-body-btn-ui-close"></i>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
`,
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
s(`.main-body-btn-menu`).onclick = () => {
|
|
271
|
+
Modal.actionBtnCenter();
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
let _heightTopBar, _heightBottomBar, _topMenu;
|
|
275
|
+
s(`.main-body-btn-ui`).onclick = () => {
|
|
276
|
+
if (s(`.main-body-btn-ui-open`).classList.contains('hide')) {
|
|
277
|
+
s(`.main-body-btn-ui-open`).classList.remove('hide');
|
|
278
|
+
s(`.main-body-btn-ui-close`).classList.add('hide');
|
|
279
|
+
_heightTopBar = newInstance(options.heightTopBar);
|
|
280
|
+
_heightBottomBar = newInstance(options.heightBottomBar);
|
|
281
|
+
_topMenu = newInstance(s(`.modal-menu`).style.top);
|
|
282
|
+
options.heightTopBar = 0;
|
|
283
|
+
options.heightBottomBar = 0;
|
|
284
|
+
s(`.slide-menu-top-bar`).classList.add('hide');
|
|
285
|
+
s(`.bottom-bar`).classList.add('hide');
|
|
286
|
+
s(`.modal-menu`).style.top = '0px';
|
|
287
|
+
s(`.main-body-btn-container`).style.top = '50px';
|
|
288
|
+
s(`.main-body`).style.top = '0px';
|
|
289
|
+
} else {
|
|
290
|
+
s(`.main-body-btn-ui-close`).classList.remove('hide');
|
|
291
|
+
s(`.main-body-btn-ui-open`).classList.add('hide');
|
|
292
|
+
options.heightTopBar = _heightTopBar;
|
|
293
|
+
options.heightBottomBar = _heightBottomBar;
|
|
294
|
+
s(`.modal-menu`).style.top = _topMenu;
|
|
295
|
+
s(`.main-body-btn-container`).style.top = `${options.heightTopBar + 50}px`;
|
|
296
|
+
s(`.slide-menu-top-bar`).classList.remove('hide');
|
|
297
|
+
s(`.bottom-bar`).classList.remove('hide');
|
|
298
|
+
s(`.main-body`).style.top = `${options.heightTopBar}px`;
|
|
299
|
+
}
|
|
300
|
+
Responsive.Event[`slide-menu-modal-menu`]();
|
|
301
|
+
Object.keys(this.Data).map((_idModal) => {
|
|
302
|
+
if (this.Data[_idModal].slideMenu) {
|
|
303
|
+
if (s(`.btn-maximize-${_idModal}`)) s(`.btn-maximize-${_idModal}`).click();
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
Responsive.Event[`view-${'main-body'}`]();
|
|
307
|
+
if (Responsive.Event[`view-${'bottom-bar'}`]) Responsive.Event[`view-${'bottom-bar'}`]();
|
|
308
|
+
if (Responsive.Event[`view-${'main-body-top'}`]) Responsive.Event[`view-${'main-body-top'}`]();
|
|
309
|
+
for (const keyEvent of Object.keys(this.Data[idModal].onExpandUiListener)) {
|
|
310
|
+
this.Data[idModal].onExpandUiListener[keyEvent](
|
|
311
|
+
!s(`.main-body-btn-ui-open`).classList.contains('hide'),
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
});
|
|
316
|
+
|
|
216
317
|
const inputSearchBoxId = `top-bar-search-box`;
|
|
217
318
|
append(
|
|
218
319
|
'body',
|
|
@@ -970,11 +1071,24 @@ const Modal = {
|
|
|
970
1071
|
|
|
971
1072
|
Responsive.Event[`view-${id}`] = () => {
|
|
972
1073
|
if (!this.Data[id] || !s(`.${id}`)) return delete Responsive.Event[`view-${id}`];
|
|
973
|
-
s(`.${id}`).style.height =
|
|
974
|
-
|
|
975
|
-
(
|
|
976
|
-
|
|
977
|
-
|
|
1074
|
+
s(`.${id}`).style.height =
|
|
1075
|
+
s(`.main-body-btn-ui-close`).classList.contains('hide') &&
|
|
1076
|
+
s(`.btn-restore-${id}`).style.display !== 'none'
|
|
1077
|
+
? `${window.innerHeight}px`
|
|
1078
|
+
: `${
|
|
1079
|
+
window.innerHeight -
|
|
1080
|
+
(options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
|
|
1081
|
+
(options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
|
|
1082
|
+
}px`;
|
|
1083
|
+
|
|
1084
|
+
if (
|
|
1085
|
+
s(`.main-body-btn-ui-close`).classList.contains('hide') &&
|
|
1086
|
+
s(`.btn-restore-${id}`).style.display !== 'none'
|
|
1087
|
+
) {
|
|
1088
|
+
s(`.${id}`).style.top = '0px';
|
|
1089
|
+
} else {
|
|
1090
|
+
s(`.${id}`).style.top = `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
|
|
1091
|
+
}
|
|
978
1092
|
};
|
|
979
1093
|
Responsive.Event[`view-${id}`]();
|
|
980
1094
|
|
|
@@ -1049,6 +1163,28 @@ const Modal = {
|
|
|
1049
1163
|
top: 5%;
|
|
1050
1164
|
left: 5%;
|
|
1051
1165
|
}
|
|
1166
|
+
.sub-menu-title-container-${idModal},
|
|
1167
|
+
.nav-path-container-${idModal} {
|
|
1168
|
+
top: 0px;
|
|
1169
|
+
left: 0px;
|
|
1170
|
+
width: 200px;
|
|
1171
|
+
height: 50px;
|
|
1172
|
+
overflow: hidden;
|
|
1173
|
+
font-size: 20px;
|
|
1174
|
+
cursor: default;
|
|
1175
|
+
}
|
|
1176
|
+
.nav-path-display-${idModal} {
|
|
1177
|
+
font-size: 11px;
|
|
1178
|
+
width: 100%;
|
|
1179
|
+
top: 35px;
|
|
1180
|
+
left: 37px;
|
|
1181
|
+
}
|
|
1182
|
+
.nav-title-display-${idModal} {
|
|
1183
|
+
font-size: 19px;
|
|
1184
|
+
width: 100%;
|
|
1185
|
+
top: 13px;
|
|
1186
|
+
left: 13px;
|
|
1187
|
+
}
|
|
1052
1188
|
</style>
|
|
1053
1189
|
${renderStyleTag(`style-${idModal}`, `.${idModal}`, options)}
|
|
1054
1190
|
<div class="fix ${options && options.class ? options.class : ''} modal box-shadow ${idModal}">
|
|
@@ -1117,7 +1253,10 @@ const Modal = {
|
|
|
1117
1253
|
|
|
1118
1254
|
<div class="in html-${idModal}">
|
|
1119
1255
|
${options.mode && options.mode.match('slide-menu')
|
|
1120
|
-
? html`<div
|
|
1256
|
+
? html`<div
|
|
1257
|
+
class="stq modal"
|
|
1258
|
+
style="${renderCssAttr({ style: { height: '50px', 'z-index': 1, top: '0px' } })}"
|
|
1259
|
+
>
|
|
1121
1260
|
${await BtnIcon.Render({
|
|
1122
1261
|
style: renderCssAttr({ style: { height: '100%', color: '#5f5f5f' } }),
|
|
1123
1262
|
class: `in flr main-btn-menu action-bar-box btn-icon-menu-mode`,
|
|
@@ -1134,6 +1273,19 @@ const Modal = {
|
|
|
1134
1273
|
></i>
|
|
1135
1274
|
</div>`,
|
|
1136
1275
|
})}
|
|
1276
|
+
${await BtnIcon.Render({
|
|
1277
|
+
style: renderCssAttr({ style: { height: '100%', color: '#5f5f5f' } }),
|
|
1278
|
+
class: `in flr main-btn-menu action-bar-box btn-icon-menu-back hide`,
|
|
1279
|
+
label: html`<div class="abs center"><i class="fas fa-undo-alt"></i></div>`,
|
|
1280
|
+
})}
|
|
1281
|
+
<div class="abs sub-menu-title-container-${idModal} ac">
|
|
1282
|
+
<div class="abs nav-title-display-${idModal}">
|
|
1283
|
+
<!-- <i class="fas fa-home"></i> ${Translate.Render('home')} -->
|
|
1284
|
+
</div>
|
|
1285
|
+
</div>
|
|
1286
|
+
<div class="abs nav-path-container-${idModal} ahc bold">
|
|
1287
|
+
<div class="abs nav-path-display-${idModal}"><!-- ${location.pathname} --></div>
|
|
1288
|
+
</div>
|
|
1137
1289
|
</div>`
|
|
1138
1290
|
: ''}
|
|
1139
1291
|
${options && options.html ? (typeof options.html === 'function' ? await options.html() : options.html) : ''}
|
|
@@ -1167,6 +1319,15 @@ const Modal = {
|
|
|
1167
1319
|
case 'slide-menu':
|
|
1168
1320
|
case 'slide-menu-right':
|
|
1169
1321
|
case 'slide-menu-left':
|
|
1322
|
+
const backMenuButtonEvent = async () => {
|
|
1323
|
+
if (location.pathname !== getProxyPath()) setPath(getProxyPath());
|
|
1324
|
+
if (s(`.menu-btn-container-children`)) htmls(`.menu-btn-container-children`, '');
|
|
1325
|
+
// htmls(`.nav-title-display-${'modal-menu'}`, html`<i class="fas fa-home"></i> ${Translate.Render('home')}`);
|
|
1326
|
+
htmls(`.nav-title-display-${'modal-menu'}`, html``);
|
|
1327
|
+
htmls(`.nav-path-display-${idModal}`, '');
|
|
1328
|
+
s(`.btn-icon-menu-back`).classList.add('hide');
|
|
1329
|
+
if (s(`.menu-btn-container-main`)) s(`.menu-btn-container-main`).classList.remove('hide');
|
|
1330
|
+
};
|
|
1170
1331
|
s(`.main-btn-home`).onclick = () => {
|
|
1171
1332
|
for (const keyModal of Object.keys(this.Data)) {
|
|
1172
1333
|
if (
|
|
@@ -1175,9 +1336,11 @@ const Modal = {
|
|
|
1175
1336
|
.includes(keyModal)
|
|
1176
1337
|
)
|
|
1177
1338
|
s(`.btn-close-${keyModal}`).click();
|
|
1339
|
+
backMenuButtonEvent();
|
|
1178
1340
|
}
|
|
1179
1341
|
s(`.btn-close-modal-menu`).click();
|
|
1180
1342
|
};
|
|
1343
|
+
EventsUI.onClick(`.btn-icon-menu-back`, backMenuButtonEvent);
|
|
1181
1344
|
EventsUI.onClick(`.btn-icon-menu-mode`, () => {
|
|
1182
1345
|
if (s(`.btn-icon-menu-mode-right`).classList.contains('hide')) {
|
|
1183
1346
|
s(`.btn-icon-menu-mode-right`).classList.remove('hide');
|
|
@@ -1188,6 +1351,12 @@ const Modal = {
|
|
|
1188
1351
|
}
|
|
1189
1352
|
if (slideMenuWidth === originSlideMenuWidth) {
|
|
1190
1353
|
slideMenuWidth = collapseSlideMenuWidth;
|
|
1354
|
+
setTimeout(() => {
|
|
1355
|
+
s(`.main-body-btn-container`).style[
|
|
1356
|
+
true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
|
|
1357
|
+
] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px';
|
|
1358
|
+
}, 1);
|
|
1359
|
+
|
|
1191
1360
|
if (!s(`.btn-bar-center-icon-close`).classList.contains('hide')) {
|
|
1192
1361
|
sa(`.handle-btn-container`).forEach((el) => el.classList.add('hide'));
|
|
1193
1362
|
sa(`.menu-label-text`).forEach((el) => el.classList.add('hide'));
|
|
@@ -1195,18 +1364,32 @@ const Modal = {
|
|
|
1195
1364
|
sa(`.tooltip-menu`).forEach((el) => el.classList.remove('hide'));
|
|
1196
1365
|
s(`.${idModal}`).style.overflow = 'visible';
|
|
1197
1366
|
}
|
|
1367
|
+
if (s(`.menu-btn-container-main`) && s(`.menu-btn-container-main`).classList.contains('hide'))
|
|
1368
|
+
s(`.btn-icon-menu-back`).classList.add('hide');
|
|
1198
1369
|
}
|
|
1199
1370
|
if (options.onCollapseMenu) options.onCollapseMenu();
|
|
1371
|
+
s(`.sub-menu-title-container-${'modal-menu'}`).classList.add('hide');
|
|
1372
|
+
s(`.nav-path-container-${'modal-menu'}`).classList.add('hide');
|
|
1200
1373
|
} else {
|
|
1201
1374
|
slideMenuWidth = originSlideMenuWidth;
|
|
1375
|
+
setTimeout(() => {
|
|
1376
|
+
s(`.main-body-btn-container`).style[
|
|
1377
|
+
true || (options.mode && options.mode.match('right')) ? 'right' : 'left'
|
|
1378
|
+
] = options.mode && options.mode.match('right') ? `${slideMenuWidth}px` : '0px';
|
|
1379
|
+
}, 1);
|
|
1380
|
+
|
|
1202
1381
|
sa(`.handle-btn-container`).forEach((el) => el.classList.remove('hide'));
|
|
1203
1382
|
sa(`.menu-label-text`).forEach((el) => el.classList.remove('hide'));
|
|
1204
1383
|
if (!Modal.mobileModal()) {
|
|
1205
1384
|
sa(`.tooltip-menu`).forEach((el) => el.classList.add('hide'));
|
|
1206
1385
|
s(`.${idModal}`).style.overflow = null;
|
|
1207
1386
|
}
|
|
1387
|
+
if (s(`.menu-btn-container-main`) && s(`.menu-btn-container-main`).classList.contains('hide'))
|
|
1388
|
+
s(`.btn-icon-menu-back`).classList.remove('hide');
|
|
1208
1389
|
|
|
1209
1390
|
if (options.onExtendMenu) options.onExtendMenu();
|
|
1391
|
+
s(`.sub-menu-title-container-${'modal-menu'}`).classList.remove('hide');
|
|
1392
|
+
s(`.nav-path-container-${'modal-menu'}`).classList.remove('hide');
|
|
1210
1393
|
}
|
|
1211
1394
|
// btn-bar-center-icon-menu
|
|
1212
1395
|
this.actionBtnCenter();
|
|
@@ -1345,13 +1528,28 @@ const Modal = {
|
|
|
1345
1528
|
callBack,
|
|
1346
1529
|
id: options.slideMenu,
|
|
1347
1530
|
};
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1531
|
+
Responsive.Event['h-ui-hide-' + idModal] = () => {
|
|
1532
|
+
setTimeout(() => {
|
|
1533
|
+
if (!s(`.${idModal}`) || !s(`.main-body-btn-ui-close`)) return;
|
|
1534
|
+
s(`.${idModal}`).style.height =
|
|
1535
|
+
s(`.main-body-btn-ui-close`).classList.contains('hide') &&
|
|
1536
|
+
s(`.btn-restore-${idModal}`).style.display !== 'none'
|
|
1537
|
+
? `${window.innerHeight}px`
|
|
1538
|
+
: `${
|
|
1539
|
+
window.innerHeight -
|
|
1540
|
+
(options.heightTopBar ? options.heightTopBar : heightDefaultTopBar) -
|
|
1541
|
+
(options.heightBottomBar ? options.heightBottomBar : heightDefaultBottomBar)
|
|
1542
|
+
}px`;
|
|
1543
|
+
s(`.${idModal}`).style.top =
|
|
1544
|
+
s(`.main-body-btn-ui-close`).classList.contains('hide') &&
|
|
1545
|
+
s(`.btn-restore-${idModal}`).style.display !== 'none'
|
|
1546
|
+
? `0px`
|
|
1547
|
+
: `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
|
|
1548
|
+
});
|
|
1549
|
+
};
|
|
1550
|
+
Responsive.Event['h-ui-hide-' + idModal]();
|
|
1354
1551
|
} else {
|
|
1552
|
+
delete Responsive.Event['h-ui-hide-' + idModal];
|
|
1355
1553
|
s(`.${idModal}`).style.width = '100%';
|
|
1356
1554
|
s(`.${idModal}`).style.height = '100%';
|
|
1357
1555
|
s(`.${idModal}`).style.top = `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
|
|
@@ -1547,8 +1745,12 @@ const Modal = {
|
|
|
1547
1745
|
headerTitleHeight: 40,
|
|
1548
1746
|
actionBtnCenter: function () {
|
|
1549
1747
|
// if (!s(`.btn-close-modal-menu`).classList.contains('hide')) return s(`.main-btn-home`).click();
|
|
1550
|
-
if (!s(`.btn-close-modal-menu`).classList.contains('hide'))
|
|
1551
|
-
|
|
1748
|
+
if (!s(`.btn-close-modal-menu`).classList.contains('hide')) {
|
|
1749
|
+
return s(`.btn-close-modal-menu`).click();
|
|
1750
|
+
}
|
|
1751
|
+
if (!s(`.btn-menu-modal-menu`).classList.contains('hide')) {
|
|
1752
|
+
return s(`.btn-menu-modal-menu`).click();
|
|
1753
|
+
}
|
|
1552
1754
|
},
|
|
1553
1755
|
cleanUI: function () {
|
|
1554
1756
|
s(`.top-bar`).classList.add('hide');
|
|
@@ -454,7 +454,8 @@ const PanelForm = {
|
|
|
454
454
|
},
|
|
455
455
|
});
|
|
456
456
|
|
|
457
|
-
if (options.route === 'home') setTimeout(this.Data[idPanel].updatePanel);
|
|
457
|
+
// if (options.route === 'home') setTimeout(this.Data[idPanel].updatePanel);
|
|
458
|
+
if (!Auth.getToken()) setTimeout(this.Data[idPanel].updatePanel);
|
|
458
459
|
|
|
459
460
|
if (options.parentIdModal) {
|
|
460
461
|
htmls(`.html-${options.parentIdModal}`, await renderSrrPanelData());
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { newInstance } from './CommonJs.js';
|
|
2
|
+
import { loggerFactory } from './Logger.js';
|
|
2
3
|
import { getResponsiveData } from './VanillaJs.js';
|
|
3
4
|
|
|
5
|
+
const logger = loggerFactory(import.meta);
|
|
6
|
+
|
|
4
7
|
const Responsive = {
|
|
5
8
|
Data: {},
|
|
6
9
|
Event: {},
|
|
@@ -18,9 +21,9 @@ const Responsive = {
|
|
|
18
21
|
ResponsiveDataAmplitude.height = ResponsiveDataAmplitude.height * dimAmplitude;
|
|
19
22
|
return ResponsiveDataAmplitude;
|
|
20
23
|
},
|
|
21
|
-
resizeCallback: function () {
|
|
24
|
+
resizeCallback: function (force) {
|
|
22
25
|
const Data = getResponsiveData();
|
|
23
|
-
if (Data.minValue !== Responsive.Data.minValue || Data.maxValue !== Responsive.Data.maxValue) {
|
|
26
|
+
if (force === true || Data.minValue !== Responsive.Data.minValue || Data.maxValue !== Responsive.Data.maxValue) {
|
|
24
27
|
Responsive.Data = Data;
|
|
25
28
|
Responsive.triggerEvents();
|
|
26
29
|
}
|
|
@@ -28,13 +31,13 @@ const Responsive = {
|
|
|
28
31
|
resize: 0,
|
|
29
32
|
Init: async function () {
|
|
30
33
|
Responsive.resizeCallback();
|
|
31
|
-
window.onresize = () => {
|
|
34
|
+
window.onresize = (e, force) => {
|
|
32
35
|
Responsive.resize++;
|
|
33
36
|
const resize = Responsive.resize;
|
|
34
|
-
Responsive.resizeCallback();
|
|
37
|
+
Responsive.resizeCallback(force);
|
|
35
38
|
setTimeout(() => {
|
|
36
39
|
if (resize === Responsive.resize) {
|
|
37
|
-
Responsive.resizeCallback();
|
|
40
|
+
Responsive.resizeCallback(force);
|
|
38
41
|
Responsive.resize = 0;
|
|
39
42
|
for (const event of Object.keys(Responsive.DelayEvent)) Responsive.DelayEvent[event]();
|
|
40
43
|
}
|
|
@@ -43,11 +46,37 @@ const Responsive = {
|
|
|
43
46
|
// alternative option
|
|
44
47
|
// this.Observer = new ResizeObserver(this.resizeCallback);
|
|
45
48
|
// this.Observer.observe(document.documentElement);
|
|
49
|
+
screen.orientation.addEventListener('change', (event) => {
|
|
50
|
+
const type = event.target.type; // landscape-primary | portrait-primary
|
|
51
|
+
const angle = event.target.angle; // 90 degrees.
|
|
52
|
+
logger.info(`ScreenOrientation change: ${type}, ${angle} degrees.`);
|
|
53
|
+
setTimeout(() => window.onresize({}, true));
|
|
54
|
+
Responsive.triggerEventsOrientation();
|
|
55
|
+
});
|
|
56
|
+
Responsive.matchMediaOrientationInstance = matchMedia('screen and (orientation:portrait)');
|
|
57
|
+
|
|
58
|
+
Responsive.matchMediaOrientationInstance.onchange = (e) => {
|
|
59
|
+
console.log('orientation change', Responsive.matchMediaOrientationInstance.matches ? 'portrait' : 'landscape');
|
|
60
|
+
// though beware square will be marked as landscape here,
|
|
61
|
+
// if you want to handle this special case
|
|
62
|
+
// create an other mediaquery (orientation:landscape)
|
|
63
|
+
setTimeout(() => window.onresize({}, true));
|
|
64
|
+
Responsive.triggerEventsOrientation();
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
triggerEventsOrientation: function () {
|
|
68
|
+
for (const event of Object.keys(this.orientationEvent)) this.orientationEvent[event]();
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
window.onresize();
|
|
71
|
+
for (const event of Object.keys(this.orientationDelayEvent)) this.orientationDelayEvent[event]();
|
|
72
|
+
}, 1500);
|
|
46
73
|
},
|
|
47
74
|
triggerEvents: function (keyEvent) {
|
|
48
75
|
if (keyEvent) return this.Event[keyEvent]();
|
|
49
76
|
return Object.keys(this.Event).map((key) => this.Event[key]());
|
|
50
77
|
},
|
|
78
|
+
orientationEvent: {},
|
|
79
|
+
orientationDelayEvent: {},
|
|
51
80
|
};
|
|
52
81
|
|
|
53
82
|
export { Responsive };
|
|
@@ -20,14 +20,16 @@ const RichText = {
|
|
|
20
20
|
s(`.${options.parentIdModal}`).style.top = '0px';
|
|
21
21
|
s(`.${options.parentIdModal}`).style.height = `${window.innerHeight}px`;
|
|
22
22
|
}
|
|
23
|
-
Modal.cleanUI();
|
|
23
|
+
// Modal.cleanUI();
|
|
24
|
+
if (s(`.slide-menu-top-bar`)) s(`.slide-menu-top-bar`).classList.add('hide');
|
|
24
25
|
} else {
|
|
25
26
|
if (options.parentIdModal) {
|
|
26
27
|
s(`.btn-bar-modal-container-${options.parentIdModal}`).classList.remove('hide');
|
|
27
28
|
s(`.${options.parentIdModal}`).style.top = top;
|
|
28
29
|
s(`.${options.parentIdModal}`).style.height = height;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
if (s(`.slide-menu-top-bar`)) s(`.slide-menu-top-bar`).classList.add('remove');
|
|
32
|
+
// Modal.restoreUI();
|
|
31
33
|
}
|
|
32
34
|
},
|
|
33
35
|
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// https://javascript.info/
|
|
2
|
+
// https://javascript.info/web-components
|
|
3
|
+
|
|
4
|
+
class MyElement extends HTMLElement {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
// element created
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
connectedCallback() {
|
|
11
|
+
// browser calls this method when the element is added to the document
|
|
12
|
+
// (can be called many times if an element is repeatedly added/removed)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
disconnectedCallback() {
|
|
16
|
+
// browser calls this method when the element is removed from the document
|
|
17
|
+
// (can be called many times if an element is repeatedly added/removed)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static get observedAttributes() {
|
|
21
|
+
return [
|
|
22
|
+
/* array of attribute names to monitor for changes */
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
27
|
+
// called when one of attributes listed above is modified
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
adoptedCallback() {
|
|
31
|
+
// called when the element is moved to a new document
|
|
32
|
+
// (happens in document.adoptNode, very rarely used)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// there can be other element methods and properties
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
customElements.define('my-element', MyElement);
|
|
39
|
+
|
|
40
|
+
// Now for any HTML elements with tag <my-element>,
|
|
41
|
+
// an instance of MyElement is created, and the aforementioned
|
|
42
|
+
// methods are called.
|
|
43
|
+
|
|
44
|
+
export { MyElement };
|
|
@@ -51,6 +51,7 @@ const Worker = {
|
|
|
51
51
|
const isInstall = await this.status();
|
|
52
52
|
if (!isInstall) await this.install();
|
|
53
53
|
else await this.update();
|
|
54
|
+
await this.updateOfflineSrc();
|
|
54
55
|
// else if (location.hostname === 'localhost') await this.update();
|
|
55
56
|
this.RouterInstance = router();
|
|
56
57
|
await render();
|
|
@@ -61,9 +62,9 @@ const Worker = {
|
|
|
61
62
|
// Dev mode
|
|
62
63
|
|
|
63
64
|
window.addEventListener('visibilitychange', (event) => {
|
|
64
|
-
if (document.visibilityState === 'visible') {
|
|
65
|
-
|
|
66
|
-
}
|
|
65
|
+
// if (document.visibilityState === 'visible') {
|
|
66
|
+
// Worker.reload(delayLiveReload);
|
|
67
|
+
// }
|
|
67
68
|
});
|
|
68
69
|
window.addEventListener('focus', function () {
|
|
69
70
|
// Worker.reload(delayLiveReload);
|
|
@@ -90,21 +91,11 @@ const Worker = {
|
|
|
90
91
|
if (isInstall) {
|
|
91
92
|
const cacheNames = await caches.keys();
|
|
92
93
|
for (const cacheName of cacheNames) {
|
|
93
|
-
if (
|
|
94
|
-
cacheName.match('components/') ||
|
|
95
|
-
cacheName.match('services/') ||
|
|
96
|
-
cacheName.match('.index.js') ||
|
|
97
|
-
cacheName.match('offline.')
|
|
98
|
-
) {
|
|
94
|
+
if (cacheName.match('components/') || cacheName.match('services/') || cacheName.match('.index.js')) {
|
|
99
95
|
await caches.delete(cacheName);
|
|
100
96
|
}
|
|
101
97
|
}
|
|
102
98
|
await this.updateServiceWorker();
|
|
103
|
-
try {
|
|
104
|
-
await fetch('/offline.html');
|
|
105
|
-
} catch (error) {
|
|
106
|
-
logger.error('error');
|
|
107
|
-
}
|
|
108
99
|
}
|
|
109
100
|
},
|
|
110
101
|
updateServiceWorker: async function () {},
|
|
@@ -143,7 +134,7 @@ const Worker = {
|
|
|
143
134
|
return new Promise((resolve, reject) => {
|
|
144
135
|
if ('serviceWorker' in navigator) {
|
|
145
136
|
navigator.serviceWorker
|
|
146
|
-
.register(
|
|
137
|
+
.register(`${getProxyPath()}sw.js`, {
|
|
147
138
|
// scope: getProxyPath(),
|
|
148
139
|
// scope: '/',
|
|
149
140
|
type: 'module',
|
|
@@ -221,6 +212,13 @@ const Worker = {
|
|
|
221
212
|
}
|
|
222
213
|
});
|
|
223
214
|
},
|
|
215
|
+
updateOfflineSrc: async function () {
|
|
216
|
+
try {
|
|
217
|
+
await fetch(`${getProxyPath()}offline.html`);
|
|
218
|
+
} catch (error) {
|
|
219
|
+
logger.error('error');
|
|
220
|
+
}
|
|
221
|
+
},
|
|
224
222
|
// TODO: GPS management
|
|
225
223
|
RenderSetting: async function () {
|
|
226
224
|
setTimeout(() => {
|