underpost 2.6.2
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/.dockerignore +14 -0
- package/.env.development +8 -0
- package/.env.production +8 -0
- package/.env.test +8 -0
- package/.nycrc +9 -0
- package/.prettierignore +13 -0
- package/.prettierrc +9 -0
- package/.vscode/extensions.json +72 -0
- package/.vscode/settings.json +99 -0
- package/Dockerfile +88 -0
- package/LICENSE +21 -0
- package/README.md +51 -0
- package/bin/db.js +119 -0
- package/bin/deploy.js +600 -0
- package/bin/dns.js +1 -0
- package/bin/file.js +92 -0
- package/bin/help.js +110 -0
- package/bin/index.js +29 -0
- package/bin/install.js +357 -0
- package/bin/shortcut.js +44 -0
- package/bin/ssl.js +61 -0
- package/bin/util.js +182 -0
- package/bin/vs.js +35 -0
- package/conf.js +244 -0
- package/docker-compose.yml +67 -0
- package/jsconfig.json +7 -0
- package/jsdoc.json +32 -0
- package/nodemon.json +6 -0
- package/package.json +128 -0
- package/prometheus.yml +36 -0
- package/setup.sh +25 -0
- package/src/api/core/core.controller.js +69 -0
- package/src/api/core/core.model.js +11 -0
- package/src/api/core/core.router.js +23 -0
- package/src/api/core/core.service.js +29 -0
- package/src/api/crypto/crypto.controller.js +51 -0
- package/src/api/crypto/crypto.model.js +23 -0
- package/src/api/crypto/crypto.router.js +20 -0
- package/src/api/crypto/crypto.service.js +64 -0
- package/src/api/default/default.controller.js +69 -0
- package/src/api/default/default.model.js +20 -0
- package/src/api/default/default.router.js +23 -0
- package/src/api/default/default.service.js +31 -0
- package/src/api/file/file.controller.js +51 -0
- package/src/api/file/file.model.js +19 -0
- package/src/api/file/file.router.js +20 -0
- package/src/api/file/file.service.js +70 -0
- package/src/api/instance/instance.controller.js +69 -0
- package/src/api/instance/instance.model.js +36 -0
- package/src/api/instance/instance.router.js +33 -0
- package/src/api/instance/instance.service.js +48 -0
- package/src/api/test/test.controller.js +59 -0
- package/src/api/test/test.model.js +14 -0
- package/src/api/test/test.router.js +21 -0
- package/src/api/test/test.service.js +35 -0
- package/src/api/user/user.controller.js +70 -0
- package/src/api/user/user.model.js +65 -0
- package/src/api/user/user.router.js +345 -0
- package/src/api/user/user.service.js +479 -0
- package/src/api.js +23 -0
- package/src/client/Default.index.js +40 -0
- package/src/client/components/core/Account.js +290 -0
- package/src/client/components/core/AgGrid.js +160 -0
- package/src/client/components/core/Auth.js +19 -0
- package/src/client/components/core/Badge.js +32 -0
- package/src/client/components/core/BlockChain.js +41 -0
- package/src/client/components/core/Blog.js +9 -0
- package/src/client/components/core/BtnIcon.js +91 -0
- package/src/client/components/core/CalendarCore.js +319 -0
- package/src/client/components/core/Chat.js +64 -0
- package/src/client/components/core/ColorPalette.js +5267 -0
- package/src/client/components/core/CommonJs.js +708 -0
- package/src/client/components/core/Content.js +49 -0
- package/src/client/components/core/Css.js +1027 -0
- package/src/client/components/core/CssCore.js +792 -0
- package/src/client/components/core/D3Chart.js +44 -0
- package/src/client/components/core/Docs.js +130 -0
- package/src/client/components/core/DropDown.js +164 -0
- package/src/client/components/core/EventsUI.js +54 -0
- package/src/client/components/core/FileExplorer.js +624 -0
- package/src/client/components/core/FullScreen.js +45 -0
- package/src/client/components/core/Input.js +259 -0
- package/src/client/components/core/JoyStick.js +77 -0
- package/src/client/components/core/Keyboard.js +73 -0
- package/src/client/components/core/LoadingAnimation.js +157 -0
- package/src/client/components/core/LogIn.js +181 -0
- package/src/client/components/core/LogOut.js +52 -0
- package/src/client/components/core/Logger.js +26 -0
- package/src/client/components/core/Modal.js +1596 -0
- package/src/client/components/core/NotificationManager.js +84 -0
- package/src/client/components/core/Panel.js +413 -0
- package/src/client/components/core/Polyhedron.js +162 -0
- package/src/client/components/core/Recover.js +204 -0
- package/src/client/components/core/Responsive.js +53 -0
- package/src/client/components/core/RichText.js +27 -0
- package/src/client/components/core/Router.js +77 -0
- package/src/client/components/core/SignUp.js +125 -0
- package/src/client/components/core/SocketIo.js +72 -0
- package/src/client/components/core/Stream.js +113 -0
- package/src/client/components/core/ToggleSwitch.js +87 -0
- package/src/client/components/core/ToolTip.js +26 -0
- package/src/client/components/core/Translate.js +408 -0
- package/src/client/components/core/Validator.js +100 -0
- package/src/client/components/core/VanillaJs.js +454 -0
- package/src/client/components/core/Wallet.js +106 -0
- package/src/client/components/core/Webhook.js +25 -0
- package/src/client/components/core/Worker.js +272 -0
- package/src/client/components/default/CommonDefault.js +29 -0
- package/src/client/components/default/CssDefault.js +13 -0
- package/src/client/components/default/ElementsDefault.js +38 -0
- package/src/client/components/default/LogInDefault.js +41 -0
- package/src/client/components/default/LogOutDefault.js +28 -0
- package/src/client/components/default/MenuDefault.js +389 -0
- package/src/client/components/default/RoutesDefault.js +48 -0
- package/src/client/components/default/SettingsDefault.js +16 -0
- package/src/client/components/default/SignUpDefault.js +9 -0
- package/src/client/components/default/SocketIoDefault.js +54 -0
- package/src/client/components/default/TranslateDefault.js +7 -0
- package/src/client/public/default/android-chrome-144x144.png +0 -0
- package/src/client/public/default/android-chrome-192x192.png +0 -0
- package/src/client/public/default/android-chrome-256x256.png +0 -0
- package/src/client/public/default/android-chrome-36x36.png +0 -0
- package/src/client/public/default/android-chrome-384x384.png +0 -0
- package/src/client/public/default/android-chrome-48x48.png +0 -0
- package/src/client/public/default/android-chrome-512x512.png +0 -0
- package/src/client/public/default/android-chrome-72x72.png +0 -0
- package/src/client/public/default/android-chrome-96x96.png +0 -0
- package/src/client/public/default/apple-touch-icon-1024x1024.png +0 -0
- package/src/client/public/default/apple-touch-icon-114x114.png +0 -0
- package/src/client/public/default/apple-touch-icon-120x120.png +0 -0
- package/src/client/public/default/apple-touch-icon-144x144.png +0 -0
- package/src/client/public/default/apple-touch-icon-152x152.png +0 -0
- package/src/client/public/default/apple-touch-icon-167x167.png +0 -0
- package/src/client/public/default/apple-touch-icon-180x180.png +0 -0
- package/src/client/public/default/apple-touch-icon-57x57.png +0 -0
- package/src/client/public/default/apple-touch-icon-60x60.png +0 -0
- package/src/client/public/default/apple-touch-icon-72x72.png +0 -0
- package/src/client/public/default/apple-touch-icon-76x76.png +0 -0
- package/src/client/public/default/apple-touch-icon-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1125x2436.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1136x640.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1170x2532.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1179x2556.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1242x2208.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1242x2688.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1284x2778.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1290x2796.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1334x750.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1488x2266.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1536x2048.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1620x2160.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1640x2160.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1668x2224.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1668x2388.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1792x828.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2048x1536.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2048x2732.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2160x1620.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2160x1640.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2208x1242.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2224x1668.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2266x1488.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2388x1668.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2436x1125.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2532x1170.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2556x1179.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2688x1242.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2732x2048.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2778x1284.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2796x1290.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-640x1136.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-750x1334.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-828x1792.png +0 -0
- package/src/client/public/default/assets/background/white.jpg +0 -0
- package/src/client/public/default/assets/background/white0-min.jpg +0 -0
- package/src/client/public/default/assets/background/white0.jpg +0 -0
- package/src/client/public/default/assets/logo/base-icon.png +0 -0
- package/src/client/public/default/browserconfig.xml +12 -0
- package/src/client/public/default/favicon-16x16.png +0 -0
- package/src/client/public/default/favicon-32x32.png +0 -0
- package/src/client/public/default/favicon-48x48.png +0 -0
- package/src/client/public/default/favicon.ico +0 -0
- package/src/client/public/default/manifest.webmanifest +69 -0
- package/src/client/public/default/mstile-144x144.png +0 -0
- package/src/client/public/default/mstile-150x150.png +0 -0
- package/src/client/public/default/mstile-310x150.png +0 -0
- package/src/client/public/default/mstile-310x310.png +0 -0
- package/src/client/public/default/mstile-70x70.png +0 -0
- package/src/client/public/default/sitemap +148 -0
- package/src/client/public/default/yandex-browser-50x50.png +0 -0
- package/src/client/public/default/yandex-browser-manifest.json +9 -0
- package/src/client/public/doc/favicon.ico +0 -0
- package/src/client/public/doc/sitemap +148 -0
- package/src/client/public/test/favicon.ico +0 -0
- package/src/client/public/test/sitemap +148 -0
- package/src/client/services/core/core.service.js +152 -0
- package/src/client/services/crypto/crypto.service.js +70 -0
- package/src/client/services/default/default.management.js +345 -0
- package/src/client/services/default/default.service.js +89 -0
- package/src/client/services/file/file.service.js +70 -0
- package/src/client/services/instance/instance.management.js +74 -0
- package/src/client/services/instance/instance.service.js +89 -0
- package/src/client/services/test/test.service.js +70 -0
- package/src/client/services/user/user.management.js +50 -0
- package/src/client/services/user/user.service.js +89 -0
- package/src/client/ssr/Render.js +16 -0
- package/src/client/ssr/body-components/CacheControl.js +113 -0
- package/src/client/ssr/body-components/DefaultSplashScreen.js +79 -0
- package/src/client/ssr/email-components/DefaultRecoverEmail.js +21 -0
- package/src/client/ssr/email-components/DefaultVerifyEmail.js +17 -0
- package/src/client/ssr/head-components/Css.js +241 -0
- package/src/client/ssr/head-components/DefaultScripts.js +3 -0
- package/src/client/ssr/head-components/Microdata.js +11 -0
- package/src/client/ssr/head-components/Production.js +1 -0
- package/src/client/ssr/head-components/PwaDefault.js +60 -0
- package/src/client/ssr/head-components/Seo.js +14 -0
- package/src/client/sw/default.sw.js +201 -0
- package/src/client/sw/template.sw.js +84 -0
- package/src/client.build.js +22 -0
- package/src/client.dev.js +21 -0
- package/src/cron.js +25 -0
- package/src/db/DataBaseProvider.js +34 -0
- package/src/db/mariadb/MariaDB.js +33 -0
- package/src/db/mongo/MongooseDB.js +46 -0
- package/src/dns.js +22 -0
- package/src/mailer/EmailRender.js +69 -0
- package/src/mailer/MailerProvider.js +96 -0
- package/src/proxy.js +22 -0
- package/src/runtime/lampp/Lampp.js +44 -0
- package/src/runtime/nginx/Nginx.js +3 -0
- package/src/runtime/xampp/Xampp.js +49 -0
- package/src/server/auth.js +204 -0
- package/src/server/backup.js +83 -0
- package/src/server/client-build-live.js +72 -0
- package/src/server/client-build.js +688 -0
- package/src/server/client-dev-server.js +58 -0
- package/src/server/client-formatted.js +48 -0
- package/src/server/client-icons.js +150 -0
- package/src/server/conf.js +611 -0
- package/src/server/dns.js +87 -0
- package/src/server/downloader.js +42 -0
- package/src/server/logger.js +135 -0
- package/src/server/network.js +122 -0
- package/src/server/peer.js +33 -0
- package/src/server/process.js +66 -0
- package/src/server/proxy.js +118 -0
- package/src/server/runtime.js +393 -0
- package/src/server/ssl.js +107 -0
- package/src/server.js +25 -0
- package/src/ws/IoInterface.js +45 -0
- package/src/ws/IoServer.js +39 -0
- package/src/ws/core/channels/core.ws.chat.js +23 -0
- package/src/ws/core/channels/core.ws.mailer.js +35 -0
- package/src/ws/core/channels/core.ws.stream.js +31 -0
- package/src/ws/core/core.ws.connection.js +28 -0
- package/src/ws/core/core.ws.emit.js +14 -0
- package/src/ws/core/core.ws.server.js +24 -0
- package/src/ws/core/management/core.ws.chat.js +8 -0
- package/src/ws/core/management/core.ws.mailer.js +16 -0
- package/src/ws/core/management/core.ws.stream.js +8 -0
- package/src/ws/default/channels/default.ws.main.js +16 -0
- package/src/ws/default/default.ws.connection.js +22 -0
- package/src/ws/default/default.ws.emit.js +14 -0
- package/src/ws/default/default.ws.server.js +20 -0
- package/src/ws/default/management/default.ws.main.js +8 -0
- package/startup.js +11 -0
- package/supervisord-openssh-server.conf +5 -0
- package/test/api.test.js +60 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { AgGrid } from './AgGrid.js';
|
|
2
|
+
import { BtnIcon } from './BtnIcon.js';
|
|
3
|
+
import { darkTheme } from './Css.js';
|
|
4
|
+
import { loggerFactory } from './Logger.js';
|
|
5
|
+
import { ToggleSwitch } from './ToggleSwitch.js';
|
|
6
|
+
import { Translate } from './Translate.js';
|
|
7
|
+
import { htmls, s } from './VanillaJs.js';
|
|
8
|
+
const logger = loggerFactory(import.meta);
|
|
9
|
+
|
|
10
|
+
const fileFormDataFactory = (e, extensions) => {
|
|
11
|
+
const form = new FormData();
|
|
12
|
+
for (const keyFile of Object.keys(e.target.files)) {
|
|
13
|
+
if (extensions && !extensions.includes(e.target.files[keyFile].type)) {
|
|
14
|
+
logger.error('Invalid file extension', e.target.files[keyFile]);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
form.append(e.target.files[keyFile].name, e.target.files[keyFile]);
|
|
18
|
+
}
|
|
19
|
+
return form;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const Input = {
|
|
23
|
+
Render: async function (options) {
|
|
24
|
+
const { id } = options;
|
|
25
|
+
options?.placeholder
|
|
26
|
+
? options.placeholder === true
|
|
27
|
+
? (options.placeholder = ' . . .')
|
|
28
|
+
: options.placeholder
|
|
29
|
+
: null;
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
s(`.input-container-${id}`).onclick = () => {
|
|
32
|
+
['color'].includes(options.type) ? s(`.${id}`).click() : s(`.${id}`).focus();
|
|
33
|
+
['datetime-local'].includes(options.type) ? s(`.${id}`).showPicker() : s(`.${id}`).focus();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
if (s(`.btn-eye-${id}`))
|
|
37
|
+
s(`.btn-eye-${id}`).onclick = () => {
|
|
38
|
+
if (s(`.fa-eye-slash-${id}`).style.display === 'none') {
|
|
39
|
+
s(`.fa-eye-${id}`).style.display = 'none';
|
|
40
|
+
s(`.fa-eye-slash-${id}`).style.display = null;
|
|
41
|
+
s(`.${id}`).type = 'text';
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
s(`.fa-eye-slash-${id}`).style.display = 'none';
|
|
45
|
+
s(`.fa-eye-${id}`).style.display = null;
|
|
46
|
+
s(`.${id}`).type = 'password';
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const inputElement = html` <input
|
|
51
|
+
type="${options?.type ? options.type : 'text'}"
|
|
52
|
+
class="${options.inputClass ? options.inputClass : 'in wfa'} ${id}"
|
|
53
|
+
${options?.min !== undefined ? `min="${options.min}"` : ''}
|
|
54
|
+
placeholder${options?.placeholder ? `="${options.placeholder}"` : ''}
|
|
55
|
+
${options?.value !== undefined ? `value="${options.value}"` : ''}
|
|
56
|
+
${options?.autocomplete ? `autocomplete="${options.autocomplete}"` : ''}
|
|
57
|
+
${options?.disabled ? `disabled` : ''}
|
|
58
|
+
${options?.name !== undefined ? `name="${options.name}"` : ''}
|
|
59
|
+
${options?.pattern !== undefined ? `pattern="${options.pattern}"` : ''}
|
|
60
|
+
${options?.pattern === undefined && options.type === 'tel' ? `pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}"` : ''}
|
|
61
|
+
${options?.required ? ` required ` : ''}
|
|
62
|
+
${options?.accept ? `accept="${options.accept}"` : ''}
|
|
63
|
+
/>
|
|
64
|
+
<div class="${id}-input-extension input-info input-extension ${options?.extension ? '' : 'hide'}">
|
|
65
|
+
${options?.extension ? await options.extension() : ''}
|
|
66
|
+
</div>`;
|
|
67
|
+
|
|
68
|
+
return html` <div class="${options?.containerClass ? options.containerClass + ' ' : ''} input-container-${id}">
|
|
69
|
+
<div class="in">
|
|
70
|
+
${options?.label ? html`<div class="in input-label input-label-${id}">${options.label}</div>` : ''}
|
|
71
|
+
${options.type === 'password' && !options.disabledEye
|
|
72
|
+
? html`
|
|
73
|
+
<div class="fl input-row-${id}">
|
|
74
|
+
<div class="in fll" style="width: 80%;">${inputElement}</div>
|
|
75
|
+
<div class="in fll btn-eye-password btn-eye-${id}" style="width: 20%;">
|
|
76
|
+
<i class="fas fa-eye fa-eye-${id} eye-password"></i>
|
|
77
|
+
<i class="fas fa-eye-slash fa-eye-slash-${id} eye-password" style="display: none"></i>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
`
|
|
81
|
+
: options?.placeholderIcon
|
|
82
|
+
? html` <div class="fl input-row-${id}">${options.placeholderIcon} ${inputElement}</div> `
|
|
83
|
+
: inputElement}
|
|
84
|
+
<div class="in input-info input-info-${id}"> </div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>`;
|
|
87
|
+
},
|
|
88
|
+
parseJsonEval: (selector) => {
|
|
89
|
+
try {
|
|
90
|
+
return JSON.parse(s(selector).value);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
return s(selector).value;
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
getValues: function (formData) {
|
|
96
|
+
const obj = {};
|
|
97
|
+
for (const inputData of formData) {
|
|
98
|
+
switch (inputData.inputType) {
|
|
99
|
+
case 'checkbox':
|
|
100
|
+
case 'checkbox-on-off':
|
|
101
|
+
obj[inputData.model] = s(`.${inputData.id}-checkbox`).checked;
|
|
102
|
+
continue;
|
|
103
|
+
break;
|
|
104
|
+
|
|
105
|
+
default:
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (!s(`.${inputData.id}`) || !s(`.${inputData.id}`).value || s(`.${inputData.id}`).value === 'undefined')
|
|
110
|
+
continue;
|
|
111
|
+
if ('model' in inputData) {
|
|
112
|
+
obj[inputData.model] = s(`.${inputData.id}`).value;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return obj;
|
|
116
|
+
},
|
|
117
|
+
cleanValues: function (formData) {
|
|
118
|
+
const obj = {};
|
|
119
|
+
for (const inputData of formData) {
|
|
120
|
+
if (!s(`.${inputData.id}`)) continue;
|
|
121
|
+
|
|
122
|
+
switch (inputData.inputType) {
|
|
123
|
+
case 'checkbox':
|
|
124
|
+
case 'checkbox-on-off':
|
|
125
|
+
if (s(`.${inputData.id}-checkbox`).checked) ToggleSwitch.Tokens[inputData.id].click();
|
|
126
|
+
continue;
|
|
127
|
+
break;
|
|
128
|
+
|
|
129
|
+
default:
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if ('model' in inputData) {
|
|
134
|
+
if (!['dropdown'].includes(inputData.inputType)) s(`.${inputData.id}`).value = '';
|
|
135
|
+
}
|
|
136
|
+
if (s(`.input-info-${inputData.id}`)) htmls(`.input-info-${inputData.id}`, html` `);
|
|
137
|
+
}
|
|
138
|
+
return obj;
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const InputFile = {
|
|
143
|
+
Render: async function ({ id, multiple }, on = { change: () => {}, clear: () => {} }) {
|
|
144
|
+
// drag drop multi file
|
|
145
|
+
const gridId = `ag-grid-input-file-${id}`;
|
|
146
|
+
setTimeout(() => {
|
|
147
|
+
s(`.btn-clear-input-file-${id}`).onclick = (e) => {
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
s(`.${id}`).value = null;
|
|
150
|
+
AgGrid.grids[gridId].setGridOption('rowData', []);
|
|
151
|
+
if (on && typeof on.clear === 'function') on.clear();
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
['drag', 'dragstart', 'dragend', 'dragover', 'dragenter', 'dragleave', 'drop'].forEach(function (event) {
|
|
155
|
+
s(`.drop-zone-${id}`).addEventListener(event, function (e) {
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
e.stopPropagation();
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
s(`.drop-zone-${id}`).addEventListener(
|
|
161
|
+
'dragover',
|
|
162
|
+
function (e) {
|
|
163
|
+
this.classList.add('drop-hover-container');
|
|
164
|
+
},
|
|
165
|
+
false,
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
s(`.drop-zone-${id}`).addEventListener(
|
|
169
|
+
'dragleave',
|
|
170
|
+
function (e) {
|
|
171
|
+
this.classList.remove('drop-hover-container');
|
|
172
|
+
},
|
|
173
|
+
false,
|
|
174
|
+
);
|
|
175
|
+
s(`.drop-zone-${id}`).addEventListener(
|
|
176
|
+
'drop',
|
|
177
|
+
function (e) {
|
|
178
|
+
this.classList.remove('drop-hover-container');
|
|
179
|
+
const files = e.dataTransfer.files;
|
|
180
|
+
const dataTransfer = new DataTransfer();
|
|
181
|
+
|
|
182
|
+
let countFiles = 0;
|
|
183
|
+
Array.prototype.forEach.call(files, (file) => {
|
|
184
|
+
// logger.info(file);
|
|
185
|
+
if (!multiple && countFiles == 1) return;
|
|
186
|
+
dataTransfer.items.add(file);
|
|
187
|
+
countFiles++;
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
s(`.${id}`).files = dataTransfer.files;
|
|
191
|
+
s(`.${id}`).onchange({ target: s(`.${id}`) });
|
|
192
|
+
},
|
|
193
|
+
false,
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
s(`.drop-zone-${id}`).addEventListener('click', function (e) {
|
|
197
|
+
s(`.${id}`).click();
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
s(`.${id}`).onchange = (e) => {
|
|
201
|
+
// logger.info('e', e);
|
|
202
|
+
const fileGridData = [];
|
|
203
|
+
Object.keys(e.target.files).forEach((fileKey, index) => {
|
|
204
|
+
const file = e.target.files[fileKey];
|
|
205
|
+
logger.info('Load file', file);
|
|
206
|
+
// Get raw:
|
|
207
|
+
// const read = new FileReader();
|
|
208
|
+
// read.readAsBinaryString(file);
|
|
209
|
+
// read.onloadend = () => {
|
|
210
|
+
// console.log('Load File', e.target.files[fileKey], { fileKey, index }, read.result);
|
|
211
|
+
// };
|
|
212
|
+
fileGridData.push(file);
|
|
213
|
+
});
|
|
214
|
+
AgGrid.grids[gridId].setGridOption('rowData', fileGridData);
|
|
215
|
+
if (on && typeof on.change === 'function') on.change(e);
|
|
216
|
+
};
|
|
217
|
+
});
|
|
218
|
+
return html` <div class="fl">
|
|
219
|
+
<div class="in fll input-file-col">
|
|
220
|
+
<div class="in section-mp input-file-sub-col">
|
|
221
|
+
<input class="wfa ${id}" type="file" ${multiple ? `multiple="multiple"` : ''} />
|
|
222
|
+
<div class="in">
|
|
223
|
+
${await BtnIcon.Render({
|
|
224
|
+
class: `wfa btn-clear-input-file-${id}`,
|
|
225
|
+
label: `<i class="fa-solid fa-broom"></i> ${Translate.Render('clear')}`,
|
|
226
|
+
})}
|
|
227
|
+
</div>
|
|
228
|
+
<div class="in">
|
|
229
|
+
${await AgGrid.Render({
|
|
230
|
+
id: gridId,
|
|
231
|
+
darkTheme,
|
|
232
|
+
style: {
|
|
233
|
+
height: '200px',
|
|
234
|
+
},
|
|
235
|
+
gridOptions: {
|
|
236
|
+
rowData: [],
|
|
237
|
+
columnDefs: [
|
|
238
|
+
// { field: '_id', headerName: 'ID' },
|
|
239
|
+
{ field: 'name', headerName: 'Name' },
|
|
240
|
+
{ field: 'type', headerName: 'Type' },
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
})}
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
<div class="in fll input-file-col">
|
|
248
|
+
<div class="in section-mp input-file-sub-col drop-zone-${id}">
|
|
249
|
+
<div class="abs center">
|
|
250
|
+
<i class="fas fa-cloud" style="font-size: 30px"></i><br />
|
|
251
|
+
${Translate.Render('drop-file')}
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
</div>`;
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export { Input, InputFile, fileFormDataFactory };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import JoystickController from 'joystick-controller';
|
|
2
|
+
import { getDirection, getId } from './CommonJs.js';
|
|
3
|
+
import { loggerFactory } from './Logger.js';
|
|
4
|
+
import { append, getProxyPath, s } from './VanillaJs.js';
|
|
5
|
+
|
|
6
|
+
const logger = loggerFactory(import.meta);
|
|
7
|
+
|
|
8
|
+
const JoyStick = {
|
|
9
|
+
Tokens: {},
|
|
10
|
+
Render: async function (options = { id: '', callback: ({ joyDataSet }) => {}, callBackTime: 50 }) {
|
|
11
|
+
const { callback, callBackTime } = options;
|
|
12
|
+
const id = options.id ? options.id : getId(this.Tokens, 'joystick-');
|
|
13
|
+
this.Tokens[id] = { callback };
|
|
14
|
+
append(
|
|
15
|
+
'body',
|
|
16
|
+
html`
|
|
17
|
+
<style>
|
|
18
|
+
.dynamic-joystick-container-${id} {
|
|
19
|
+
/* border: 2px solid red; */
|
|
20
|
+
left: 5px;
|
|
21
|
+
bottom: 5px;
|
|
22
|
+
height: 200px;
|
|
23
|
+
width: 200px;
|
|
24
|
+
z-index: 3;
|
|
25
|
+
}
|
|
26
|
+
.joy-img-background-${id} {
|
|
27
|
+
width: 93%;
|
|
28
|
+
height: 93%;
|
|
29
|
+
opacity: 0.8;
|
|
30
|
+
}
|
|
31
|
+
.dynamic-joystick-container-${id}:hover .joy-img-background-${id} {
|
|
32
|
+
width: 97%;
|
|
33
|
+
height: 97%;
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
<div class="abs dynamic-joystick-container-${id}">
|
|
38
|
+
<img class="abs center joy-img-background-${id}" src="${getProxyPath()}assets/joy/joy_alpha.png" />
|
|
39
|
+
</div>
|
|
40
|
+
`,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
this.Tokens[id].instance = new JoystickController(
|
|
44
|
+
{
|
|
45
|
+
maxRange: 70,
|
|
46
|
+
level: 10,
|
|
47
|
+
radius: 70,
|
|
48
|
+
joystickRadius: 50,
|
|
49
|
+
opacity: 0.5,
|
|
50
|
+
// containerClass: 'joystick-container',
|
|
51
|
+
// controllerClass: 'joystick-controller',
|
|
52
|
+
// joystickClass: 'joystick',
|
|
53
|
+
distortion: true,
|
|
54
|
+
dynamicPosition: true,
|
|
55
|
+
dynamicPositionTarget: s(`.dynamic-joystick-container-${id}`),
|
|
56
|
+
mouseClickButton: 'ALL',
|
|
57
|
+
hideContextMenu: true,
|
|
58
|
+
// x: '120px',
|
|
59
|
+
// y: '120px',
|
|
60
|
+
},
|
|
61
|
+
(args = { x, y, leveledX, leveledY, distance, angle }) => {
|
|
62
|
+
const { angle } = args;
|
|
63
|
+
if (angle === 0) return (this.Tokens[id].joyDataSet = undefined);
|
|
64
|
+
const radians = parseFloat(angle);
|
|
65
|
+
const direction = getDirection({ radians });
|
|
66
|
+
this.Tokens[id].joyDataSet = { ...args, radians, direction };
|
|
67
|
+
// logger.info(this.Tokens[id].joyDataSet, id);
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
setInterval(() => {
|
|
71
|
+
if (!this.Tokens[id].joyDataSet || !this.Tokens[id].joyDataSet.direction) return;
|
|
72
|
+
this.Tokens[id].callback({ joyDataSet: this.Tokens[id].joyDataSet });
|
|
73
|
+
}, callBackTime);
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export { JoyStick };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { cap, getId } from './CommonJs.js';
|
|
2
|
+
|
|
3
|
+
const Keyboard = {
|
|
4
|
+
ActiveKey: {},
|
|
5
|
+
Event: {},
|
|
6
|
+
Init: async function (options = { callBackTime: 50 }) {
|
|
7
|
+
const { callBackTime } = options;
|
|
8
|
+
window.onkeydown = (e = new KeyboardEvent()) => {
|
|
9
|
+
this.ActiveKey[e.key] = true;
|
|
10
|
+
// e.composedPath()
|
|
11
|
+
// if (['Tab'].includes(e.key)) {
|
|
12
|
+
// e.preventDefault();
|
|
13
|
+
// e.stopPropagation();
|
|
14
|
+
// e.stopImmediatePropagation();
|
|
15
|
+
// }
|
|
16
|
+
};
|
|
17
|
+
window.onkeyup = (e = new KeyboardEvent()) => {
|
|
18
|
+
delete this.ActiveKey[e.key];
|
|
19
|
+
};
|
|
20
|
+
setInterval(() => {
|
|
21
|
+
Object.keys(this.Event).map((key) => {
|
|
22
|
+
Object.keys(this.ActiveKey).map((activeKey) => {
|
|
23
|
+
if (activeKey in this.Event[key]) this.Event[key][activeKey]();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}, callBackTime);
|
|
27
|
+
},
|
|
28
|
+
instanceMultiPressKeyTokens: {},
|
|
29
|
+
instanceMultiPressKey: (options = { keys: [], id, timePressDelay, eventCallBack: () => {} }) => {
|
|
30
|
+
if (typeof options.keys[0] === 'string') options.keys[0] = [options.keys[0]];
|
|
31
|
+
if (!options.id) options.id = getId(Keyboard.instanceMultiPressKeyTokens, 'key-press-');
|
|
32
|
+
if (!options.timePressDelay) options.timePressDelay = 500;
|
|
33
|
+
const { id, timePressDelay, keys, eventCallBack } = options;
|
|
34
|
+
Keyboard.instanceMultiPressKeyTokens[id] = { ...options };
|
|
35
|
+
|
|
36
|
+
let indexCombined = -1;
|
|
37
|
+
for (const combinedKeys of keys) {
|
|
38
|
+
indexCombined++;
|
|
39
|
+
const privateIndexCombined = indexCombined;
|
|
40
|
+
const multiPressKey = {};
|
|
41
|
+
const triggerMultiPressKey = () => {
|
|
42
|
+
for (const key of Object.keys(multiPressKey)) {
|
|
43
|
+
if (!multiPressKey[key].press) return;
|
|
44
|
+
}
|
|
45
|
+
eventCallBack();
|
|
46
|
+
};
|
|
47
|
+
Keyboard.Event[`instanceMultiPressKey-${id}-${privateIndexCombined}`] = {};
|
|
48
|
+
for (const key of combinedKeys) {
|
|
49
|
+
multiPressKey[key] = {
|
|
50
|
+
press: false,
|
|
51
|
+
trigger: function () {
|
|
52
|
+
if (!multiPressKey[key].press) {
|
|
53
|
+
multiPressKey[key].press = true;
|
|
54
|
+
triggerMultiPressKey();
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
multiPressKey[key].press = false;
|
|
57
|
+
}, timePressDelay);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
Keyboard.Event[`instanceMultiPressKey-${id}-${privateIndexCombined}`][key] = multiPressKey[key].trigger;
|
|
63
|
+
Keyboard.Event[`instanceMultiPressKey-${id}-${privateIndexCombined}`][key.toLowerCase()] =
|
|
64
|
+
multiPressKey[key].trigger;
|
|
65
|
+
Keyboard.Event[`instanceMultiPressKey-${id}-${privateIndexCombined}`][key.toUpperCase()] =
|
|
66
|
+
multiPressKey[key].trigger;
|
|
67
|
+
Keyboard.Event[`instanceMultiPressKey-${id}-${privateIndexCombined}`][cap(key)] = multiPressKey[key].trigger;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { Keyboard };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { CoreService } from '../../services/core/core.service.js';
|
|
2
|
+
import { s4 } from './CommonJs.js';
|
|
3
|
+
import { darkTheme } from './Css.js';
|
|
4
|
+
import { loggerFactory } from './Logger.js';
|
|
5
|
+
import { append, getProxyPath, htmls, s } from './VanillaJs.js';
|
|
6
|
+
|
|
7
|
+
const logger = loggerFactory(import.meta);
|
|
8
|
+
|
|
9
|
+
const LoadingAnimation = {
|
|
10
|
+
bar: {
|
|
11
|
+
tokens: {},
|
|
12
|
+
getId: (id) => `bar-progress-${id.slice(1)}`,
|
|
13
|
+
play: async function (container) {
|
|
14
|
+
const id = this.getId(container);
|
|
15
|
+
const idEvent = s4() + s4() + s4();
|
|
16
|
+
this.tokens[container] = `${idEvent}`;
|
|
17
|
+
// diagonal-bar-background-animation
|
|
18
|
+
// #6d68ff #790079
|
|
19
|
+
append(
|
|
20
|
+
'body',
|
|
21
|
+
html`
|
|
22
|
+
<div
|
|
23
|
+
class="fix progress-bar box-shadow ${id}"
|
|
24
|
+
style="left: -100%; background: ${darkTheme
|
|
25
|
+
? LoadingAnimation.darkColor
|
|
26
|
+
? LoadingAnimation.darkColor
|
|
27
|
+
: `#c9c9c9`
|
|
28
|
+
: LoadingAnimation.lightColor
|
|
29
|
+
? LoadingAnimation.lightColor
|
|
30
|
+
: `#515151`};"
|
|
31
|
+
></div>
|
|
32
|
+
`,
|
|
33
|
+
);
|
|
34
|
+
for (const frame of [
|
|
35
|
+
{ time: 500, value: 35 },
|
|
36
|
+
{ time: 1250, value: 15 },
|
|
37
|
+
{ time: 3000, value: 5 },
|
|
38
|
+
{ time: 5000, value: 1 },
|
|
39
|
+
])
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
if (this.tokens[container] === idEvent && s(`.${id}`)) {
|
|
42
|
+
s(`.${id}`).style.left = `-${frame.value}%`;
|
|
43
|
+
// const percentageRender = html`${100 - frame.value}%`;
|
|
44
|
+
}
|
|
45
|
+
}, frame.time);
|
|
46
|
+
},
|
|
47
|
+
stop: function (container) {
|
|
48
|
+
const id = this.getId(container);
|
|
49
|
+
delete this.tokens[container];
|
|
50
|
+
if (!s(`.${id}`)) return;
|
|
51
|
+
s(`.${id}`).style.left = '0%';
|
|
52
|
+
s(`.${id}`).style.opacity = 1;
|
|
53
|
+
setTimeout(() => (s(`.${id}`).style.opacity = 0));
|
|
54
|
+
setTimeout(() => s(`.${id}`).remove(), 400);
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
spinner: {
|
|
58
|
+
spinners: {},
|
|
59
|
+
getId: (id) => `spinner-progress-${id.slice(1)}`,
|
|
60
|
+
spinnerSrcValidator: async function (spinner) {
|
|
61
|
+
if (!this.spinners[spinner]) {
|
|
62
|
+
const url = getProxyPath() + 'dist/loadingio/' + spinner + '/index.html';
|
|
63
|
+
this.spinners[spinner] = {
|
|
64
|
+
url,
|
|
65
|
+
html: await CoreService.getRaw({ url }),
|
|
66
|
+
};
|
|
67
|
+
append(
|
|
68
|
+
'head',
|
|
69
|
+
html`<link
|
|
70
|
+
rel="stylesheet"
|
|
71
|
+
type="text/css"
|
|
72
|
+
href="${getProxyPath()}dist/loadingio/${spinner}/index.min.css"
|
|
73
|
+
/>`,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
play: async function (container, spinner = 'dual-ring') {
|
|
78
|
+
await this.spinnerSrcValidator(spinner);
|
|
79
|
+
const id = this.getId(container);
|
|
80
|
+
if (s(container))
|
|
81
|
+
append(
|
|
82
|
+
container,
|
|
83
|
+
html` <div class="in ${id} loading-animation-container">${this.spinners[spinner].html}</div> `,
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
stop: function (container) {
|
|
87
|
+
const id = this.getId(container);
|
|
88
|
+
if (!s(`.${id}`)) return;
|
|
89
|
+
s(`.${id}`).remove();
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
img: {
|
|
93
|
+
tokens: {},
|
|
94
|
+
load: function ({ key, src, classes, style }) {
|
|
95
|
+
this.tokens[key] = { src, classes, style };
|
|
96
|
+
},
|
|
97
|
+
play: function (container, key) {
|
|
98
|
+
append(
|
|
99
|
+
container,
|
|
100
|
+
html`<img
|
|
101
|
+
${this.tokens[key].classes ? `class="${this.tokens[key].classes}"` : ''}
|
|
102
|
+
${this.tokens[key].style ? `style="${this.tokens[key].style}"` : ''}
|
|
103
|
+
src="${getProxyPath()}${this.tokens[key].src}"
|
|
104
|
+
/>`,
|
|
105
|
+
);
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
barLevel: {
|
|
109
|
+
append: () => {
|
|
110
|
+
s(`.ssr-blink-bar`).classList.remove('ssr-blink-bar');
|
|
111
|
+
append('.ssr-loading-bar', html`<div class="ssr-loading-bar-block ssr-blink-bar"></div>`);
|
|
112
|
+
},
|
|
113
|
+
clear: () => {
|
|
114
|
+
htmls('.ssr-loading-bar', html`<div class="ssr-loading-bar-block ssr-blink-bar"></div>`);
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
removeSplashScreen: function () {
|
|
118
|
+
if (s(`.clean-cache-container`)) s(`.clean-cache-container`).style.display = 'none';
|
|
119
|
+
if (s('.ssr-background'))
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
s('.ssr-background').style.opacity = 0;
|
|
122
|
+
setTimeout(async () => {
|
|
123
|
+
s('.ssr-background').style.display = 'none';
|
|
124
|
+
}, 300);
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
lightColor: null,
|
|
128
|
+
setLightColor: function (color) {
|
|
129
|
+
this.lightColor = color;
|
|
130
|
+
},
|
|
131
|
+
darkColor: null,
|
|
132
|
+
setDarkColor: function (color) {
|
|
133
|
+
this.darkColor = color;
|
|
134
|
+
},
|
|
135
|
+
RenderCurrentSrcLoad: function (event) {
|
|
136
|
+
if (s(`.ssr-loading-info`)) {
|
|
137
|
+
let nameSrcLoad = event.data.path;
|
|
138
|
+
if (nameSrcLoad) {
|
|
139
|
+
if (nameSrcLoad.match('assets'))
|
|
140
|
+
nameSrcLoad =
|
|
141
|
+
location.hostname +
|
|
142
|
+
location.pathname +
|
|
143
|
+
(location.pathname[location.pathname.length - 1] !== '/' ? '/' : '') +
|
|
144
|
+
'assets';
|
|
145
|
+
else if (!nameSrcLoad.match('api')) nameSrcLoad = undefined;
|
|
146
|
+
if (nameSrcLoad)
|
|
147
|
+
htmls(
|
|
148
|
+
`.ssr-loading-info`,
|
|
149
|
+
html`<span style="color: white">Download </span> <br />
|
|
150
|
+
<br />
|
|
151
|
+
...${nameSrcLoad.slice(-30)}`,
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
export { LoadingAnimation };
|