@underpostnet/underpost 2.7.9
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 +6 -0
- package/.env.production +6 -0
- package/.env.test +6 -0
- package/.github/workflows/ghpkg.yml +115 -0
- package/.github/workflows/publish.yml +84 -0
- package/.github/workflows/pwa-microservices-template.page.yml +54 -0
- package/.github/workflows/pwa-microservices-template.test.yml +30 -0
- package/.nycrc +9 -0
- package/.prettierignore +13 -0
- package/.prettierrc +9 -0
- package/.vscode/extensions.json +72 -0
- package/.vscode/settings.json +106 -0
- package/AUTHORS.md +10 -0
- package/CHANGELOG.md +85 -0
- package/Dockerfile +90 -0
- package/LICENSE +21 -0
- package/README.md +96 -0
- package/bin/cron.js +47 -0
- package/bin/db.js +180 -0
- package/bin/deploy.js +859 -0
- package/bin/file.js +109 -0
- package/bin/index.js +82 -0
- package/bin/ssl.js +55 -0
- package/bin/util.js +204 -0
- package/bin/vs.js +35 -0
- package/conf.js +265 -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 +134 -0
- package/prometheus.yml +36 -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 +31 -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 +53 -0
- package/src/api/file/file.model.js +19 -0
- package/src/api/file/file.router.js +21 -0
- package/src/api/file/file.service.js +80 -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.build.js +16 -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 +101 -0
- package/src/client/components/core/CalendarCore.js +458 -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 +742 -0
- package/src/client/components/core/Content.js +193 -0
- package/src/client/components/core/Css.js +846 -0
- package/src/client/components/core/CssCore.js +844 -0
- package/src/client/components/core/D3Chart.js +44 -0
- package/src/client/components/core/Docs.js +331 -0
- package/src/client/components/core/DropDown.js +164 -0
- package/src/client/components/core/EventsUI.js +46 -0
- package/src/client/components/core/FileExplorer.js +699 -0
- package/src/client/components/core/FullScreen.js +45 -0
- package/src/client/components/core/Input.js +346 -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 +178 -0
- package/src/client/components/core/LogIn.js +187 -0
- package/src/client/components/core/LogOut.js +58 -0
- package/src/client/components/core/Logger.js +26 -0
- package/src/client/components/core/Modal.js +1814 -0
- package/src/client/components/core/NotificationManager.js +84 -0
- package/src/client/components/core/Panel.js +613 -0
- package/src/client/components/core/PanelForm.js +469 -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 +68 -0
- package/src/client/components/core/RichText.js +53 -0
- package/src/client/components/core/Router.js +76 -0
- package/src/client/components/core/Scroll.js +34 -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 +446 -0
- package/src/client/components/core/Validator.js +100 -0
- package/src/client/components/core/VanillaJs.js +463 -0
- package/src/client/components/core/Wallet.js +106 -0
- package/src/client/components/core/WebComponent.js +44 -0
- package/src/client/components/core/Webhook.js +25 -0
- package/src/client/components/core/Worker.js +280 -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/assets/mailer/api-user-check.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-recover.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/plantuml/client-conf.svg +1 -0
- package/src/client/public/default/plantuml/client-schema.svg +1 -0
- package/src/client/public/default/plantuml/cron-conf.svg +1 -0
- package/src/client/public/default/plantuml/cron-schema.svg +1 -0
- package/src/client/public/default/plantuml/server-conf.svg +1 -0
- package/src/client/public/default/plantuml/server-schema.svg +1 -0
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
- package/src/client/public/default/site.webmanifest +69 -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 +170 -0
- package/src/client/services/crypto/crypto.service.js +70 -0
- package/src/client/services/default/default.management.js +343 -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 +237 -0
- package/src/client/ssr/common/Alert.js +75 -0
- package/src/client/ssr/common/SsrCore.js +91 -0
- package/src/client/ssr/common/Translate.js +26 -0
- package/src/client/ssr/common/Worker.js +28 -0
- package/src/client/ssr/components/body/CacheControl.js +114 -0
- package/src/client/ssr/components/body/DefaultSplashScreen.js +90 -0
- package/src/client/ssr/components/email/DefaultRecoverEmail.js +21 -0
- package/src/client/ssr/components/email/DefaultVerifyEmail.js +17 -0
- package/src/client/ssr/components/head/Css.js +241 -0
- package/src/client/ssr/components/head/DefaultScripts.js +3 -0
- 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/PwaDefault.js +60 -0
- package/src/client/ssr/components/head/Seo.js +14 -0
- package/src/client/ssr/pages/404.js +12 -0
- package/src/client/ssr/pages/500.js +12 -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 +205 -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/db/DataBaseProvider.js +45 -0
- package/src/db/mariadb/MariaDB.js +33 -0
- package/src/db/mongo/MongooseDB.js +124 -0
- package/src/dns.js +22 -0
- package/src/index.js +43 -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 +115 -0
- package/src/runtime/nginx/Nginx.js +3 -0
- package/src/runtime/xampp/Xampp.js +49 -0
- package/src/server/auth.js +235 -0
- package/src/server/backup.js +120 -0
- package/src/server/client-build-live.js +98 -0
- package/src/server/client-build.js +754 -0
- package/src/server/client-dev-server.js +60 -0
- package/src/server/client-formatted.js +58 -0
- package/src/server/client-icons.js +151 -0
- package/src/server/conf.js +929 -0
- package/src/server/crypto.js +91 -0
- package/src/server/dns.js +118 -0
- package/src/server/downloader.js +42 -0
- package/src/server/logger.js +190 -0
- package/src/server/network.js +209 -0
- package/src/server/peer.js +33 -0
- package/src/server/process.js +66 -0
- package/src/server/prompt-optimizer.js +28 -0
- package/src/server/proxy.js +118 -0
- package/src/server/runtime.js +463 -0
- package/src/server/ssl.js +120 -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,84 @@
|
|
|
1
|
+
import { getId, getIsoDate } from './CommonJs.js';
|
|
2
|
+
import { Css, Themes } from './Css.js';
|
|
3
|
+
import { Modal } from './Modal.js';
|
|
4
|
+
import { append, prepend, s } from './VanillaJs.js';
|
|
5
|
+
|
|
6
|
+
const NotificationManager = {
|
|
7
|
+
Types: ['success', 'error', 'warning', 'info'],
|
|
8
|
+
RenderBoard: async function (options) {
|
|
9
|
+
this.options = options;
|
|
10
|
+
append(
|
|
11
|
+
'body',
|
|
12
|
+
html`
|
|
13
|
+
<style>
|
|
14
|
+
.notification-board-container {
|
|
15
|
+
right: 5px !important;
|
|
16
|
+
width: 300px !important;
|
|
17
|
+
bottom: ${5 + (options?.heightBottomBar ? options.heightBottomBar : 0)}px !important;
|
|
18
|
+
z-index: 5 !important;
|
|
19
|
+
}
|
|
20
|
+
.notification-board-title {
|
|
21
|
+
padding: 5px !important;
|
|
22
|
+
}
|
|
23
|
+
.notification-manager-date {
|
|
24
|
+
font-size: 20px !important;
|
|
25
|
+
color: #7a7a7a !important;
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
28
|
+
<div class="fix notification-board-container"></div>
|
|
29
|
+
`,
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
Tokens: {},
|
|
33
|
+
Push: async function (options = { status: '', html: '' }) {
|
|
34
|
+
const { barConfig } = await Themes[Css.currentTheme](); // newInstance
|
|
35
|
+
barConfig.buttons.maximize.disabled = true;
|
|
36
|
+
barConfig.buttons.minimize.disabled = true;
|
|
37
|
+
barConfig.buttons.restore.disabled = true;
|
|
38
|
+
barConfig.buttons.menu.disabled = true;
|
|
39
|
+
const idNotification = getId(this.Tokens, 'board-notification-');
|
|
40
|
+
this.Tokens[idNotification] = {};
|
|
41
|
+
await Modal.Render({
|
|
42
|
+
title: html`<div class="in notification-manager-date">${getIsoDate(new Date())}</div>
|
|
43
|
+
${options.html}`,
|
|
44
|
+
html: '',
|
|
45
|
+
id: idNotification,
|
|
46
|
+
selector: `.notification-board-container`,
|
|
47
|
+
class: 'in',
|
|
48
|
+
titleClass: 'notification-board-title',
|
|
49
|
+
renderType: 'prepend',
|
|
50
|
+
barConfig,
|
|
51
|
+
style: {
|
|
52
|
+
width: '300px',
|
|
53
|
+
},
|
|
54
|
+
mode: 'dropNotification',
|
|
55
|
+
status: options.status,
|
|
56
|
+
});
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
if (s(`.btn-close-${idNotification}`)) s(`.btn-close-${idNotification}`).click();
|
|
59
|
+
}, 2000);
|
|
60
|
+
},
|
|
61
|
+
NotificationScheme: {
|
|
62
|
+
// Visual Options
|
|
63
|
+
body: '<String>',
|
|
64
|
+
icon: '<URL String>',
|
|
65
|
+
image: '<URL String>',
|
|
66
|
+
badge: '<URL String>',
|
|
67
|
+
dir: "<String of 'auto' | 'ltr' | 'rtl'>",
|
|
68
|
+
timestamp: '<Long>',
|
|
69
|
+
|
|
70
|
+
// Both visual & behavioral options
|
|
71
|
+
actions: '<Array of Strings>',
|
|
72
|
+
data: '<Anything>',
|
|
73
|
+
|
|
74
|
+
// Behavioral Options
|
|
75
|
+
tag: '<String>',
|
|
76
|
+
requireInteraction: '<boolean>',
|
|
77
|
+
renotify: '<Boolean>',
|
|
78
|
+
vibrate: '<Array of Integers>',
|
|
79
|
+
sound: '<URL String>',
|
|
80
|
+
silent: '<Boolean>',
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { NotificationManager };
|
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
import { getId } from './CommonJs.js';
|
|
2
|
+
import { LoadingAnimation } from '../core/LoadingAnimation.js';
|
|
3
|
+
import { Validator } from '../core/Validator.js';
|
|
4
|
+
import { Input } from '../core/Input.js';
|
|
5
|
+
import { Responsive } from '../core/Responsive.js';
|
|
6
|
+
import { append, getDataFromInputFile, getQueryParams, htmls, prepend, s } from './VanillaJs.js';
|
|
7
|
+
import { BtnIcon } from './BtnIcon.js';
|
|
8
|
+
import { Translate } from './Translate.js';
|
|
9
|
+
import { DropDown } from './DropDown.js';
|
|
10
|
+
import { dynamicCol, renderCssAttr } from './Css.js';
|
|
11
|
+
import { EventsUI } from './EventsUI.js';
|
|
12
|
+
import { ToggleSwitch } from './ToggleSwitch.js';
|
|
13
|
+
import { Modal } from './Modal.js';
|
|
14
|
+
import { RouterEvents } from './Router.js';
|
|
15
|
+
import { RichText } from './RichText.js';
|
|
16
|
+
import { loggerFactory } from './Logger.js';
|
|
17
|
+
import { Badge } from './Badge.js';
|
|
18
|
+
import { Content } from './Content.js';
|
|
19
|
+
|
|
20
|
+
const logger = loggerFactory(import.meta);
|
|
21
|
+
|
|
22
|
+
const Panel = {
|
|
23
|
+
Tokens: {},
|
|
24
|
+
Render: async function (
|
|
25
|
+
options = {
|
|
26
|
+
idPanel: '',
|
|
27
|
+
parentIdModal: '',
|
|
28
|
+
scrollClassContainer: '',
|
|
29
|
+
formData: [],
|
|
30
|
+
data: [],
|
|
31
|
+
originData: () => [],
|
|
32
|
+
filesData: () => [],
|
|
33
|
+
onClick: () => {},
|
|
34
|
+
},
|
|
35
|
+
) {
|
|
36
|
+
const idPanel = options?.idPanel ? options.idPanel : getId(this.Tokens, `${idPanel}-`);
|
|
37
|
+
if (options.formData)
|
|
38
|
+
options.formData = options.formData.map((formObj) => {
|
|
39
|
+
formObj.id = `${idPanel}-${formObj.id}`;
|
|
40
|
+
return formObj;
|
|
41
|
+
});
|
|
42
|
+
const { scrollClassContainer, formData, data, heightTopBar, heightBottomBar } = options;
|
|
43
|
+
|
|
44
|
+
const titleObj = formData.find((f) => f.panel && f.panel.type === 'title');
|
|
45
|
+
const titleKey = titleObj ? titleObj.model : '';
|
|
46
|
+
|
|
47
|
+
const subTitleObj = formData.find((f) => f.panel && f.panel.type === 'subtitle');
|
|
48
|
+
const subTitleKey = subTitleObj ? subTitleObj.model : '';
|
|
49
|
+
|
|
50
|
+
const fileNameInputExtDefaultContent = html` <div class="abs center">
|
|
51
|
+
<i style="font-size: 25px" class="fa-solid fa-cloud"></i>
|
|
52
|
+
</div>`;
|
|
53
|
+
|
|
54
|
+
let editId;
|
|
55
|
+
|
|
56
|
+
const openPanelForm = () => {
|
|
57
|
+
s(`.${idPanel}-form-body`).classList.remove('hide');
|
|
58
|
+
s(`.btn-${idPanel}-add`).classList.add('hide');
|
|
59
|
+
s(`.${scrollClassContainer}`).style.overflow = 'hidden';
|
|
60
|
+
if (options.customButtons) {
|
|
61
|
+
let customBtnIndex = -1;
|
|
62
|
+
for (const dataBtn of options.customButtons) {
|
|
63
|
+
customBtnIndex++;
|
|
64
|
+
const customBtnIndexFn = customBtnIndex;
|
|
65
|
+
const btnSelector = `btn-${idPanel}-custom${customBtnIndexFn}`;
|
|
66
|
+
s(`.${btnSelector}`).classList.add('hide');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
s(`.${idPanel}-form-body`).style.opacity = 1;
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const renderPanel = async (payload) => {
|
|
75
|
+
const obj = payload;
|
|
76
|
+
if ('_id' in obj) obj.id = obj._id;
|
|
77
|
+
const { id } = obj;
|
|
78
|
+
|
|
79
|
+
setTimeout(async () => {
|
|
80
|
+
LoadingAnimation.spinner.play(`.${idPanel}-img-spinner-${id}`, 'dual-ring');
|
|
81
|
+
if (options && options.callBackPanelRender)
|
|
82
|
+
await options.callBackPanelRender({
|
|
83
|
+
data: obj,
|
|
84
|
+
fileRender: async (options = { file: '', style: {}, class: '' }) => {
|
|
85
|
+
await Content.RenderFile({ container: `.${idPanel}-cell-col-a-${id}`, ...options });
|
|
86
|
+
s(`.${idPanel}-img-spinner-${id}`).classList.add('hide');
|
|
87
|
+
},
|
|
88
|
+
htmlRender: async ({ render }) => {
|
|
89
|
+
htmls(`.${idPanel}-cell-col-a-${id}`, render);
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
EventsUI.onClick(`.${idPanel}-btn-delete-${id}`, async (e) => {
|
|
93
|
+
logger.warn('delete', obj);
|
|
94
|
+
const { status } = await options.on.remove({ e, data: obj });
|
|
95
|
+
if (status === 'error') return;
|
|
96
|
+
if (s(`.${idPanel}-${id}`)) s(`.${idPanel}-${id}`).remove();
|
|
97
|
+
});
|
|
98
|
+
EventsUI.onClick(`.${idPanel}-btn-edit-${id}`, async () => {
|
|
99
|
+
logger.warn('edit', obj);
|
|
100
|
+
if (obj._id) editId = obj._id;
|
|
101
|
+
else if (obj.id) editId = obj.id;
|
|
102
|
+
|
|
103
|
+
s(`.btn-${idPanel}-label-edit`).classList.remove('hide');
|
|
104
|
+
s(`.btn-${idPanel}-label-add`).classList.add('hide');
|
|
105
|
+
|
|
106
|
+
openPanelForm();
|
|
107
|
+
// s(`.btn-${idPanel}-add`).click();
|
|
108
|
+
s(`.${scrollClassContainer}`).scrollTop = 0;
|
|
109
|
+
Input.setValues(
|
|
110
|
+
formData,
|
|
111
|
+
obj,
|
|
112
|
+
options.originData().find((d) => d._id === obj._id || d.id === obj.id),
|
|
113
|
+
options.filesData().find((d) => d._id === obj._id || d.id === obj.id),
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
s(`.a-${payload._id}`).onclick = async (e) => {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
};
|
|
119
|
+
s(`.container-${idPanel}-${id}`).onclick = async (e) => {
|
|
120
|
+
e.preventDefault();
|
|
121
|
+
if (options.onClick) await options.onClick({ payload });
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
return html` <div class="in box-shadow ${idPanel} ${idPanel}-${id}">
|
|
126
|
+
<div class="fl ${idPanel}-tools session-fl-log-in ${obj.tools ? '' : 'hide'}">
|
|
127
|
+
${await BtnIcon.Render({
|
|
128
|
+
class: `in flr main-btn-menu action-bar-box ${idPanel}-btn-tool ${idPanel}-btn-edit-${id}`,
|
|
129
|
+
label: html`<div class="abs center"><i class="fas fa-edit"></i></div>`,
|
|
130
|
+
tooltipHtml: await Badge.Render({
|
|
131
|
+
id: `tooltip-${idPanel}-${id}`,
|
|
132
|
+
text: `${Translate.Render(`edit`)}`,
|
|
133
|
+
classList: '',
|
|
134
|
+
style: { top: `-22px`, left: '-5px' },
|
|
135
|
+
}),
|
|
136
|
+
})}
|
|
137
|
+
${await BtnIcon.Render({
|
|
138
|
+
class: `in flr main-btn-menu action-bar-box ${idPanel}-btn-tool ${idPanel}-btn-delete-${id}`,
|
|
139
|
+
label: html`<div class="abs center"><i class="fas fa-trash"></i></div>`,
|
|
140
|
+
tooltipHtml: await Badge.Render({
|
|
141
|
+
id: `tooltip-${idPanel}-${id}`,
|
|
142
|
+
text: `${Translate.Render(`delete`)}`,
|
|
143
|
+
classList: '',
|
|
144
|
+
style: { top: `-22px`, left: '-13px' },
|
|
145
|
+
}),
|
|
146
|
+
})}
|
|
147
|
+
</div>
|
|
148
|
+
<div class="in container-${idPanel}-${id}">
|
|
149
|
+
<div class="in ${idPanel}-head">
|
|
150
|
+
<div class="in ${idPanel}-title">
|
|
151
|
+
${options.titleIcon}
|
|
152
|
+
<a href="?cid=${payload._id}" class="a-title-${idPanel} a-${payload._id}">
|
|
153
|
+
${titleKey ? obj[titleKey] : ''}</a
|
|
154
|
+
>
|
|
155
|
+
</div>
|
|
156
|
+
<div class="in ${idPanel}-subtitle">
|
|
157
|
+
${subTitleKey ? obj[subTitleKey] : ''} <span class="tag-render-${id}"></span>
|
|
158
|
+
</div>
|
|
159
|
+
<!-- <div class="in ${idPanel}-tags"></div> -->
|
|
160
|
+
</div>
|
|
161
|
+
<div class="fl">
|
|
162
|
+
<div class="in fll ${idPanel}-cell ${idPanel}-cell-col-a ${idPanel}-cell-col-a-${id}">
|
|
163
|
+
<div class="abs center ${idPanel}-img-spinner-${id}"></div>
|
|
164
|
+
</div>
|
|
165
|
+
<div class="in fll ${idPanel}-cell ${idPanel}-cell-col-b">
|
|
166
|
+
${Object.keys(obj)
|
|
167
|
+
.map((infoKey) => {
|
|
168
|
+
if (infoKey === 'id') return html``;
|
|
169
|
+
const formObjData = formData.find((f) => f.model === infoKey);
|
|
170
|
+
const valueIcon = formObjData?.panel?.icon?.value ? formObjData.panel.icon.value : '';
|
|
171
|
+
const keyIcon = formObjData?.panel?.icon?.key ? formObjData.panel.icon.key : '';
|
|
172
|
+
|
|
173
|
+
if (formData.find((f) => f.model === infoKey && f.panel && f.panel.type === 'tags')) {
|
|
174
|
+
setTimeout(async () => {
|
|
175
|
+
let tagRender = html``;
|
|
176
|
+
for (const tag of obj[infoKey]) {
|
|
177
|
+
tagRender += await Badge.Render({
|
|
178
|
+
text: tag,
|
|
179
|
+
style: { color: 'white' },
|
|
180
|
+
classList: 'inl',
|
|
181
|
+
style: { margin: '3px', background: `#a2a2a2` },
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
if (s(`.tag-render-${id}`)) htmls(`.tag-render-${id}`, tagRender);
|
|
185
|
+
});
|
|
186
|
+
return html``;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (formData.find((f) => f.model === infoKey && f.panel && f.panel.type === 'info-row-pin'))
|
|
190
|
+
return html`<div class="in ${idPanel}-row">
|
|
191
|
+
<span class="${idPanel}-row-pin-key capitalize ${formObjData.label?.disabled ? 'hide' : ''}">
|
|
192
|
+
${keyIcon} ${infoKey}:</span
|
|
193
|
+
>
|
|
194
|
+
<span class="${idPanel}-row-pin-value">${valueIcon} ${obj[infoKey]}</span>
|
|
195
|
+
</div> `;
|
|
196
|
+
|
|
197
|
+
if (formData.find((f) => f.model === infoKey && f.panel && f.panel.type === 'info-row'))
|
|
198
|
+
return html`<div class="in ${idPanel}-row">
|
|
199
|
+
<span class="${idPanel}-row-key capitalize ${formObjData.label?.disabled ? 'hide' : ''}">
|
|
200
|
+
${keyIcon} ${infoKey}:</span
|
|
201
|
+
>
|
|
202
|
+
<span class="${idPanel}-row-value"> ${valueIcon} ${obj[infoKey]}</span>
|
|
203
|
+
</div> `;
|
|
204
|
+
|
|
205
|
+
return html``;
|
|
206
|
+
})
|
|
207
|
+
.join('')}
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
</div>`;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
let render = '';
|
|
215
|
+
let renderForm = html` <div class="in modal stq" style="top: 0px; z-index: 1; padding-bottom: 5px">
|
|
216
|
+
${await BtnIcon.Render({
|
|
217
|
+
class: `section-mp btn-custom btn-${idPanel}-close`,
|
|
218
|
+
label: html`<i class="fa-solid fa-xmark"></i> ${Translate.Render('close')}`,
|
|
219
|
+
type: 'button',
|
|
220
|
+
})}
|
|
221
|
+
</div>`;
|
|
222
|
+
|
|
223
|
+
for (const modelData of formData) {
|
|
224
|
+
if (modelData.disableRender) continue;
|
|
225
|
+
switch (modelData.inputType) {
|
|
226
|
+
case 'dropdown':
|
|
227
|
+
renderForm += html` <div class="in section-mp">
|
|
228
|
+
${await DropDown.Render({
|
|
229
|
+
id: `${modelData.id}`,
|
|
230
|
+
label: html`${Translate.Render(modelData.model)}`,
|
|
231
|
+
containerClass: `${idPanel}-dropdown`,
|
|
232
|
+
// type: 'checkbox',
|
|
233
|
+
value: modelData.dropdown.options[0].replaceAll(' ', '-').toLowerCase(),
|
|
234
|
+
data: modelData.dropdown.options.map((dKey) => {
|
|
235
|
+
const key = dKey.replaceAll(' ', '-').toLowerCase();
|
|
236
|
+
return {
|
|
237
|
+
value: key,
|
|
238
|
+
data: dKey,
|
|
239
|
+
// checked: true,
|
|
240
|
+
display: html`${Translate.Render(dKey)}`,
|
|
241
|
+
onClick: function () {},
|
|
242
|
+
};
|
|
243
|
+
}),
|
|
244
|
+
})}
|
|
245
|
+
</div>`;
|
|
246
|
+
break;
|
|
247
|
+
case 'md': {
|
|
248
|
+
renderForm += html`<div class="in section-mp">
|
|
249
|
+
${await RichText.Render({ id: modelData.id, parentIdModal: options.parentIdModal })}
|
|
250
|
+
</div>`;
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
case 'checkbox-on-off':
|
|
255
|
+
{
|
|
256
|
+
setTimeout(() => {
|
|
257
|
+
s(`.toggle-form-container-${modelData.id}`).onclick = () => {
|
|
258
|
+
ToggleSwitch.Tokens[`${modelData.id}`].click();
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
renderForm += html`<div
|
|
262
|
+
class="in section-mp toggle-form-container toggle-form-container-${modelData.id} hover"
|
|
263
|
+
style="height: 82px;"
|
|
264
|
+
>
|
|
265
|
+
<div class="fl">
|
|
266
|
+
<div class="in fll" style="width: 70%">
|
|
267
|
+
<div class="in">
|
|
268
|
+
${modelData.panel && modelData.panel.icon ? modelData.panel.icon : ''}
|
|
269
|
+
${Translate.Render(modelData.model)}
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
<div class="in fll" style="width: 30%">
|
|
273
|
+
${await ToggleSwitch.Render({
|
|
274
|
+
id: `${modelData.id}`,
|
|
275
|
+
containerClass: 'inl',
|
|
276
|
+
disabledOnClick: true,
|
|
277
|
+
checked: false,
|
|
278
|
+
on: {
|
|
279
|
+
unchecked: () => {},
|
|
280
|
+
checked: () => {},
|
|
281
|
+
},
|
|
282
|
+
})}
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
</div>`;
|
|
286
|
+
}
|
|
287
|
+
break;
|
|
288
|
+
case 'file':
|
|
289
|
+
setTimeout(() => {
|
|
290
|
+
s(`.${modelData.id}`).fileNameInputExtDefaultContent = fileNameInputExtDefaultContent;
|
|
291
|
+
s(`.${modelData.id}`).onchange = async (e) => {
|
|
292
|
+
if (!Object.keys(e.target.files).length) return;
|
|
293
|
+
s(`.${modelData.id}`).inputFiles = e.target.files;
|
|
294
|
+
let htmlFileRender = '';
|
|
295
|
+
for (const fileKey of Object.keys(e.target.files)) {
|
|
296
|
+
const file = e.target.files[fileKey];
|
|
297
|
+
htmlFileRender += html`${await Content.RenderFile({
|
|
298
|
+
url: URL.createObjectURL(file),
|
|
299
|
+
file: {
|
|
300
|
+
mimetype: file.type,
|
|
301
|
+
name: file.name,
|
|
302
|
+
data: {
|
|
303
|
+
data: await getDataFromInputFile(file),
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
aHrefOptions: {
|
|
307
|
+
disable: true,
|
|
308
|
+
},
|
|
309
|
+
raw: true,
|
|
310
|
+
})}
|
|
311
|
+
<div class="in" style="overflow: hidden">${file.name}</div>`;
|
|
312
|
+
}
|
|
313
|
+
htmls(`.file-name-render-${modelData.id}`, htmlFileRender);
|
|
314
|
+
};
|
|
315
|
+
});
|
|
316
|
+
renderForm += `${await Input.Render({
|
|
317
|
+
inputClass: 'hide',
|
|
318
|
+
id: `${modelData.id}`,
|
|
319
|
+
type: modelData.inputType,
|
|
320
|
+
multiple: true,
|
|
321
|
+
// autocomplete: 'new-password',
|
|
322
|
+
label: html`<i class="fa-solid fa-file-arrow-up"></i> ${Translate.Render('select')}
|
|
323
|
+
${Translate.Render('file')}`,
|
|
324
|
+
containerClass: 'in section-mp width-mini-box input-container',
|
|
325
|
+
placeholder: true,
|
|
326
|
+
extension: () =>
|
|
327
|
+
html`<div class="file-name-render-${modelData.id}" style="min-height: 50px">
|
|
328
|
+
${fileNameInputExtDefaultContent}
|
|
329
|
+
</div>`,
|
|
330
|
+
// disabled: true,
|
|
331
|
+
// disabledEye: true,
|
|
332
|
+
})}`;
|
|
333
|
+
break;
|
|
334
|
+
default:
|
|
335
|
+
renderForm += `${await Input.Render({
|
|
336
|
+
id: `${modelData.id}`,
|
|
337
|
+
type: modelData.inputType,
|
|
338
|
+
// autocomplete: 'new-password',
|
|
339
|
+
label: html`<i class="fa-solid fa-pen-to-square"></i> ${Translate.Render(modelData.model)}`,
|
|
340
|
+
containerClass: 'in section-mp width-mini-box input-container',
|
|
341
|
+
placeholder: true,
|
|
342
|
+
// disabled: true,
|
|
343
|
+
// disabledEye: true,
|
|
344
|
+
})}`;
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
let renderFormBtn = html`
|
|
349
|
+
${await BtnIcon.Render({
|
|
350
|
+
class: `section-mp btn-custom btn-${idPanel}-submit`,
|
|
351
|
+
label: html`<span class="btn-${idPanel}-label-add"><i class="fas fa-plus"></i> ${Translate.Render('add')}</span
|
|
352
|
+
><span class="btn-${idPanel}-label-edit hide"><i class="fas fa-edit"></i> ${Translate.Render('edit')}</span>`,
|
|
353
|
+
type: 'submit',
|
|
354
|
+
})}
|
|
355
|
+
${await BtnIcon.Render({
|
|
356
|
+
class: `section-mp btn-custom btn-${idPanel}-clean`,
|
|
357
|
+
label: html`<i class="fa-solid fa-broom"></i> ${Translate.Render('clear')}`,
|
|
358
|
+
type: 'button',
|
|
359
|
+
})}
|
|
360
|
+
`;
|
|
361
|
+
|
|
362
|
+
setTimeout(async () => {
|
|
363
|
+
const resizeParentModal = () => {
|
|
364
|
+
if (options.parentIdModal) {
|
|
365
|
+
Modal.Data[options.parentIdModal].onObserverListener[`form-panel-${options.parentIdModal}`] = () => {
|
|
366
|
+
if (s(`.${idPanel}-form-container`))
|
|
367
|
+
s(`.${idPanel}-form-container`).style.maxHeight = `${
|
|
368
|
+
s(`.${options.parentIdModal}`).offsetHeight - Modal.headerTitleHeight
|
|
369
|
+
}px`;
|
|
370
|
+
};
|
|
371
|
+
Modal.Data[options.parentIdModal].onObserverListener[`form-panel-${options.parentIdModal}`]();
|
|
372
|
+
} else {
|
|
373
|
+
Responsive.Event[`${idPanel}-responsive`] = () => {
|
|
374
|
+
if (s(`.${idPanel}-form-container`))
|
|
375
|
+
s(`.${idPanel}-form-container`).style.maxHeight = `${
|
|
376
|
+
window.innerHeight - heightTopBar - heightBottomBar
|
|
377
|
+
}px`;
|
|
378
|
+
};
|
|
379
|
+
Responsive.Event[`${idPanel}-responsive`]();
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
setTimeout(resizeParentModal);
|
|
383
|
+
if (options.route) {
|
|
384
|
+
RouterEvents[options.parentIdModal] = ({ route }) => {
|
|
385
|
+
if (route === options.route) {
|
|
386
|
+
setTimeout(() => {
|
|
387
|
+
resizeParentModal();
|
|
388
|
+
}, 350);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const validators = await Validator.instance(formData);
|
|
394
|
+
|
|
395
|
+
s(`.${idPanel}-form`).onsubmit = (e) => {
|
|
396
|
+
e.preventDefault();
|
|
397
|
+
s(`.btn-${idPanel}-submit`).click();
|
|
398
|
+
};
|
|
399
|
+
EventsUI.onClick(`.btn-${idPanel}-submit`, async (e) => {
|
|
400
|
+
e.preventDefault();
|
|
401
|
+
const { errorMessage } = await validators();
|
|
402
|
+
if (errorMessage) return;
|
|
403
|
+
const obj = Input.getValues(formData);
|
|
404
|
+
obj.id = `${data.length}`;
|
|
405
|
+
let documents;
|
|
406
|
+
if (options && options.on && options.on.add) {
|
|
407
|
+
const { status, data } = await options.on.add({ data: obj, editId });
|
|
408
|
+
if (status === 'error') return;
|
|
409
|
+
documents = data;
|
|
410
|
+
}
|
|
411
|
+
s(`.btn-${idPanel}-clean`).click();
|
|
412
|
+
if (editId && s(`.${idPanel}-${editId}`)) s(`.${idPanel}-${editId}`).remove();
|
|
413
|
+
if (Array.isArray(documents)) {
|
|
414
|
+
htmls(`.${idPanel}-render`, '');
|
|
415
|
+
for (const doc of documents) {
|
|
416
|
+
append(`.${idPanel}-render`, await renderPanel(doc));
|
|
417
|
+
}
|
|
418
|
+
} else htmls(`.${idPanel}-render`, await renderPanel(obj));
|
|
419
|
+
Input.cleanValues(formData);
|
|
420
|
+
s(`.btn-${idPanel}-close`).click();
|
|
421
|
+
s(`.${scrollClassContainer}`).scrollTop = 0;
|
|
422
|
+
});
|
|
423
|
+
s(`.btn-${idPanel}-clean`).onclick = () => {
|
|
424
|
+
Input.cleanValues(formData);
|
|
425
|
+
};
|
|
426
|
+
s(`.btn-${idPanel}-close`).onclick = (e) => {
|
|
427
|
+
e.preventDefault();
|
|
428
|
+
s(`.${idPanel}-form-body`).style.opacity = 0;
|
|
429
|
+
s(`.btn-${idPanel}-add`).classList.remove('hide');
|
|
430
|
+
s(`.${scrollClassContainer}`).style.overflow = 'auto';
|
|
431
|
+
if (options.customButtons) {
|
|
432
|
+
let customBtnIndex = -1;
|
|
433
|
+
for (const dataBtn of options.customButtons) {
|
|
434
|
+
customBtnIndex++;
|
|
435
|
+
const customBtnIndexFn = customBtnIndex;
|
|
436
|
+
const btnSelector = `btn-${idPanel}-custom${customBtnIndexFn}`;
|
|
437
|
+
s(`.${btnSelector}`).classList.remove('hide');
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
setTimeout(() => {
|
|
441
|
+
s(`.${idPanel}-form-body`).classList.add('hide');
|
|
442
|
+
});
|
|
443
|
+
};
|
|
444
|
+
s(`.btn-${idPanel}-add`).onclick = (e) => {
|
|
445
|
+
e.preventDefault();
|
|
446
|
+
// s(`.btn-${idPanel}-clean`).click();
|
|
447
|
+
editId = undefined;
|
|
448
|
+
s(`.btn-${idPanel}-label-add`).classList.remove('hide');
|
|
449
|
+
s(`.btn-${idPanel}-label-edit`).classList.add('hide');
|
|
450
|
+
s(`.${scrollClassContainer}`).scrollTop = 0;
|
|
451
|
+
|
|
452
|
+
openPanelForm();
|
|
453
|
+
};
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
if (data.length > 0) for (const obj of data) render += await renderPanel(obj);
|
|
457
|
+
else
|
|
458
|
+
render += html`<div class="in" style="min-height: 200px">
|
|
459
|
+
<div class="abs center"><i class="fas fa-exclamation-circle"></i> ${Translate.Render(`no-result-found`)}</div>
|
|
460
|
+
</div>`;
|
|
461
|
+
|
|
462
|
+
this.Tokens[idPanel] = { idPanel, scrollClassContainer, formData, data, titleKey, subTitleKey, renderPanel };
|
|
463
|
+
|
|
464
|
+
let customButtonsRender = '';
|
|
465
|
+
if (options && options.customButtons) {
|
|
466
|
+
let customBtnIndex = -1;
|
|
467
|
+
for (const dataBtn of options.customButtons) {
|
|
468
|
+
customBtnIndex++;
|
|
469
|
+
const customBtnIndexFn = customBtnIndex;
|
|
470
|
+
const btnSelector = `btn-${idPanel}-custom${customBtnIndexFn}`;
|
|
471
|
+
if (dataBtn.onClick)
|
|
472
|
+
setTimeout(() => {
|
|
473
|
+
s(`.${btnSelector}`).onclick = () => dataBtn.onClick();
|
|
474
|
+
});
|
|
475
|
+
customButtonsRender += ` ${await BtnIcon.Render({
|
|
476
|
+
class: `section-mp btn-custom ${btnSelector}`,
|
|
477
|
+
label: dataBtn.label,
|
|
478
|
+
type: 'button',
|
|
479
|
+
})}`;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
return html`
|
|
484
|
+
<style>
|
|
485
|
+
.${scrollClassContainer} {
|
|
486
|
+
scroll-behavior: smooth;
|
|
487
|
+
}
|
|
488
|
+
.${idPanel}-form-container {
|
|
489
|
+
padding-bottom: 20px;
|
|
490
|
+
top: 0px;
|
|
491
|
+
z-index: 1;
|
|
492
|
+
overflow: auto;
|
|
493
|
+
}
|
|
494
|
+
.${idPanel}-form {
|
|
495
|
+
max-width: 900px;
|
|
496
|
+
}
|
|
497
|
+
.${idPanel}-cell {
|
|
498
|
+
min-height: 200px;
|
|
499
|
+
}
|
|
500
|
+
.${idPanel}-container {
|
|
501
|
+
}
|
|
502
|
+
.${idPanel} {
|
|
503
|
+
margin: 10px;
|
|
504
|
+
transition: 0.3s;
|
|
505
|
+
border-radius: 10px;
|
|
506
|
+
background: #f6f6f6;
|
|
507
|
+
color: black;
|
|
508
|
+
padding: 10px;
|
|
509
|
+
cursor: pointer;
|
|
510
|
+
min-height: 400px;
|
|
511
|
+
overflow: hidden;
|
|
512
|
+
}
|
|
513
|
+
.${idPanel}:hover {
|
|
514
|
+
background: #ffffff;
|
|
515
|
+
}
|
|
516
|
+
.${idPanel}-head {
|
|
517
|
+
/* background: white; */
|
|
518
|
+
margin-bottom: 10px;
|
|
519
|
+
}
|
|
520
|
+
.img-${idPanel} {
|
|
521
|
+
width: 100%;
|
|
522
|
+
}
|
|
523
|
+
.${idPanel}-title {
|
|
524
|
+
color: rgba(109, 104, 255, 1);
|
|
525
|
+
font-size: 24px;
|
|
526
|
+
padding: 5px;
|
|
527
|
+
}
|
|
528
|
+
.a-title-${idPanel} {
|
|
529
|
+
color: rgba(109, 104, 255, 1);
|
|
530
|
+
}
|
|
531
|
+
.a-title-${idPanel}:hover {
|
|
532
|
+
color: #e89f4c;
|
|
533
|
+
}
|
|
534
|
+
.${idPanel}-row {
|
|
535
|
+
padding: 5px;
|
|
536
|
+
margin: 5px;
|
|
537
|
+
font-size: 16px;
|
|
538
|
+
}
|
|
539
|
+
.${idPanel}-subtitle {
|
|
540
|
+
font-size: 17px;
|
|
541
|
+
margin-left: 20px;
|
|
542
|
+
top: -7px;
|
|
543
|
+
}
|
|
544
|
+
.${idPanel}-tags {
|
|
545
|
+
font-size: 17px;
|
|
546
|
+
margin-left: 10px;
|
|
547
|
+
top: -7px;
|
|
548
|
+
}
|
|
549
|
+
.${idPanel}-row-key {
|
|
550
|
+
}
|
|
551
|
+
.${idPanel}-row-value {
|
|
552
|
+
}
|
|
553
|
+
.${idPanel}-row-pin-key {
|
|
554
|
+
}
|
|
555
|
+
.${idPanel}-row-pin-value {
|
|
556
|
+
font-size: 20px;
|
|
557
|
+
color: rgb(19 190 84);
|
|
558
|
+
}
|
|
559
|
+
.${idPanel}-form-header {
|
|
560
|
+
}
|
|
561
|
+
.${idPanel}-form-body {
|
|
562
|
+
transition: 0.3s;
|
|
563
|
+
}
|
|
564
|
+
.btn-${idPanel}-add {
|
|
565
|
+
padding: 10px;
|
|
566
|
+
font-size: 20px;
|
|
567
|
+
}
|
|
568
|
+
.${idPanel}-dropdown {
|
|
569
|
+
min-height: 100px;
|
|
570
|
+
}
|
|
571
|
+
.${idPanel}-btn-tool {
|
|
572
|
+
background: none !important;
|
|
573
|
+
color: #c4c4c4 !important;
|
|
574
|
+
}
|
|
575
|
+
.${idPanel}-btn-tool:hover {
|
|
576
|
+
color: #000000 !important;
|
|
577
|
+
font-size: 17px !important;
|
|
578
|
+
}
|
|
579
|
+
</style>
|
|
580
|
+
<div class="${idPanel}-container">
|
|
581
|
+
<div
|
|
582
|
+
class="stq modal ${idPanel}-form-container ${options.formContainerClass ? options.formContainerClass : ''}"
|
|
583
|
+
>
|
|
584
|
+
<div class="in ${idPanel}-form-header">
|
|
585
|
+
${await BtnIcon.Render({
|
|
586
|
+
class: `section-mp btn-custom btn-${idPanel}-add`,
|
|
587
|
+
label: html`<i class="fas fa-plus"></i> ${Translate.Render('add')}`,
|
|
588
|
+
type: 'button',
|
|
589
|
+
})}
|
|
590
|
+
<!-- pagination component -->
|
|
591
|
+
${customButtonsRender}
|
|
592
|
+
</div>
|
|
593
|
+
<div class="in ${idPanel}-form-body hide" style="opacity: 0">
|
|
594
|
+
<form class="in ${idPanel}-form">
|
|
595
|
+
<div class="fl">${renderForm}</div>
|
|
596
|
+
<div class="in">${renderFormBtn}</div>
|
|
597
|
+
<br /><br />
|
|
598
|
+
</form>
|
|
599
|
+
</div>
|
|
600
|
+
</div>
|
|
601
|
+
${dynamicCol({
|
|
602
|
+
id: `${idPanel}-cell`,
|
|
603
|
+
containerSelector: `${idPanel}-render`,
|
|
604
|
+
limit: 500,
|
|
605
|
+
type: 'a-50-b-50',
|
|
606
|
+
})}
|
|
607
|
+
<div class="in ${idPanel}-render">${render}</div>
|
|
608
|
+
</div>
|
|
609
|
+
`;
|
|
610
|
+
},
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
export { Panel };
|