underpost 2.6.3 → 2.7.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.
Files changed (216) hide show
  1. package/.dockerignore +13 -13
  2. package/.env.development +7 -7
  3. package/.env.production +7 -7
  4. package/.env.test +7 -7
  5. package/.github/workflows/publish.yml +26 -0
  6. package/.nycrc +9 -9
  7. package/.prettierignore +12 -12
  8. package/.prettierrc +9 -9
  9. package/.vscode/extensions.json +72 -72
  10. package/.vscode/settings.json +100 -99
  11. package/AUTHORS.md +10 -0
  12. package/CHANGELOG.md +91 -0
  13. package/Dockerfile +89 -89
  14. package/LICENSE +21 -21
  15. package/README.md +96 -96
  16. package/bin/db.js +172 -119
  17. package/bin/deploy.js +582 -626
  18. package/bin/dns.js +1 -1
  19. package/bin/file.js +92 -92
  20. package/bin/index.js +53 -34
  21. package/bin/install.js +398 -357
  22. package/bin/shortcut.js +44 -44
  23. package/bin/ssl.js +65 -61
  24. package/bin/util.js +182 -182
  25. package/bin/vs.js +35 -35
  26. package/conf.js +251 -249
  27. package/docker-compose.yml +67 -67
  28. package/jsconfig.json +7 -7
  29. package/jsdoc.json +32 -32
  30. package/nodemon.json +6 -6
  31. package/package.json +137 -128
  32. package/prometheus.yml +36 -36
  33. package/setup.sh +24 -24
  34. package/src/api/core/core.controller.js +69 -69
  35. package/src/api/core/core.model.js +11 -11
  36. package/src/api/core/core.router.js +23 -23
  37. package/src/api/core/core.service.js +29 -29
  38. package/src/api/crypto/crypto.controller.js +51 -51
  39. package/src/api/crypto/crypto.model.js +23 -23
  40. package/src/api/crypto/crypto.router.js +20 -20
  41. package/src/api/crypto/crypto.service.js +64 -64
  42. package/src/api/default/default.controller.js +69 -69
  43. package/src/api/default/default.model.js +20 -20
  44. package/src/api/default/default.router.js +23 -23
  45. package/src/api/default/default.service.js +31 -31
  46. package/src/api/file/file.controller.js +53 -51
  47. package/src/api/file/file.model.js +19 -19
  48. package/src/api/file/file.router.js +21 -20
  49. package/src/api/file/file.service.js +76 -70
  50. package/src/api/instance/instance.controller.js +69 -69
  51. package/src/api/instance/instance.model.js +36 -36
  52. package/src/api/instance/instance.router.js +33 -33
  53. package/src/api/instance/instance.service.js +48 -48
  54. package/src/api/test/test.controller.js +59 -59
  55. package/src/api/test/test.model.js +14 -14
  56. package/src/api/test/test.router.js +21 -21
  57. package/src/api/test/test.service.js +35 -35
  58. package/src/api/user/user.build.js +16 -0
  59. package/src/api/user/user.controller.js +70 -70
  60. package/src/api/user/user.model.js +65 -65
  61. package/src/api/user/user.router.js +345 -345
  62. package/src/api/user/user.service.js +479 -479
  63. package/src/api.js +23 -23
  64. package/src/client/Default.index.js +40 -40
  65. package/src/client/components/core/Account.js +290 -290
  66. package/src/client/components/core/AgGrid.js +160 -160
  67. package/src/client/components/core/Auth.js +19 -19
  68. package/src/client/components/core/Badge.js +32 -32
  69. package/src/client/components/core/BlockChain.js +41 -41
  70. package/src/client/components/core/Blog.js +9 -9
  71. package/src/client/components/core/BtnIcon.js +101 -94
  72. package/src/client/components/core/CalendarCore.js +458 -319
  73. package/src/client/components/core/Chat.js +64 -64
  74. package/src/client/components/core/ColorPalette.js +5267 -5267
  75. package/src/client/components/core/CommonJs.js +735 -732
  76. package/src/client/components/core/Content.js +193 -49
  77. package/src/client/components/core/Css.js +1064 -1027
  78. package/src/client/components/core/CssCore.js +817 -796
  79. package/src/client/components/core/D3Chart.js +44 -44
  80. package/src/client/components/core/Docs.js +229 -229
  81. package/src/client/components/core/DropDown.js +164 -164
  82. package/src/client/components/core/EventsUI.js +46 -54
  83. package/src/client/components/core/FileExplorer.js +699 -624
  84. package/src/client/components/core/FullScreen.js +45 -45
  85. package/src/client/components/core/Input.js +346 -259
  86. package/src/client/components/core/JoyStick.js +77 -77
  87. package/src/client/components/core/Keyboard.js +73 -73
  88. package/src/client/components/core/LoadingAnimation.js +179 -157
  89. package/src/client/components/core/LogIn.js +187 -181
  90. package/src/client/components/core/LogOut.js +58 -52
  91. package/src/client/components/core/Logger.js +26 -26
  92. package/src/client/components/core/Modal.js +1612 -1596
  93. package/src/client/components/core/NotificationManager.js +84 -84
  94. package/src/client/components/core/Panel.js +613 -413
  95. package/src/client/components/core/PanelForm.js +468 -0
  96. package/src/client/components/core/Polyhedron.js +162 -162
  97. package/src/client/components/core/Recover.js +204 -204
  98. package/src/client/components/core/Responsive.js +53 -53
  99. package/src/client/components/core/RichText.js +51 -27
  100. package/src/client/components/core/Router.js +76 -77
  101. package/src/client/components/core/Scroll.js +34 -0
  102. package/src/client/components/core/SignUp.js +125 -125
  103. package/src/client/components/core/SocketIo.js +72 -72
  104. package/src/client/components/core/Stream.js +113 -113
  105. package/src/client/components/core/ToggleSwitch.js +87 -87
  106. package/src/client/components/core/ToolTip.js +26 -26
  107. package/src/client/components/core/Translate.js +437 -408
  108. package/src/client/components/core/Validator.js +100 -100
  109. package/src/client/components/core/VanillaJs.js +460 -457
  110. package/src/client/components/core/Wallet.js +106 -106
  111. package/src/client/components/core/Webhook.js +25 -25
  112. package/src/client/components/core/Worker.js +272 -272
  113. package/src/client/components/default/CommonDefault.js +29 -29
  114. package/src/client/components/default/CssDefault.js +13 -13
  115. package/src/client/components/default/ElementsDefault.js +38 -38
  116. package/src/client/components/default/LogInDefault.js +41 -41
  117. package/src/client/components/default/LogOutDefault.js +28 -28
  118. package/src/client/components/default/MenuDefault.js +389 -389
  119. package/src/client/components/default/RoutesDefault.js +48 -48
  120. package/src/client/components/default/SettingsDefault.js +16 -16
  121. package/src/client/components/default/SignUpDefault.js +9 -9
  122. package/src/client/components/default/SocketIoDefault.js +54 -54
  123. package/src/client/components/default/TranslateDefault.js +7 -7
  124. package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
  125. package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
  126. package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
  127. package/src/client/public/default/browserconfig.xml +11 -11
  128. package/src/client/public/default/manifest.webmanifest +68 -68
  129. package/src/client/public/default/plantuml/client-conf.svg +1 -0
  130. package/src/client/public/default/plantuml/client-schema.svg +1 -0
  131. package/src/client/public/default/plantuml/cron-conf.svg +1 -0
  132. package/src/client/public/default/plantuml/cron-schema.svg +1 -0
  133. package/src/client/public/default/plantuml/server-conf.svg +1 -0
  134. package/src/client/public/default/plantuml/server-schema.svg +1 -0
  135. package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
  136. package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
  137. package/src/client/public/default/sitemap +147 -147
  138. package/src/client/public/default/yandex-browser-manifest.json +8 -8
  139. package/src/client/public/doc/sitemap +147 -147
  140. package/src/client/public/test/sitemap +147 -147
  141. package/src/client/services/core/core.service.js +170 -152
  142. package/src/client/services/crypto/crypto.service.js +70 -70
  143. package/src/client/services/default/default.management.js +345 -345
  144. package/src/client/services/default/default.service.js +89 -89
  145. package/src/client/services/file/file.service.js +70 -70
  146. package/src/client/services/instance/instance.management.js +74 -74
  147. package/src/client/services/instance/instance.service.js +89 -89
  148. package/src/client/services/test/test.service.js +70 -70
  149. package/src/client/services/user/user.management.js +50 -50
  150. package/src/client/services/user/user.service.js +89 -89
  151. package/src/client/ssr/Render.js +16 -16
  152. package/src/client/ssr/body-components/CacheControl.js +114 -113
  153. package/src/client/ssr/body-components/DefaultSplashScreen.js +79 -79
  154. package/src/client/ssr/email-components/DefaultRecoverEmail.js +21 -21
  155. package/src/client/ssr/email-components/DefaultVerifyEmail.js +17 -17
  156. package/src/client/ssr/head-components/Css.js +241 -241
  157. package/src/client/ssr/head-components/DefaultScripts.js +3 -3
  158. package/src/client/ssr/head-components/Microdata.js +11 -11
  159. package/src/client/ssr/head-components/Production.js +1 -1
  160. package/src/client/ssr/head-components/PwaDefault.js +59 -59
  161. package/src/client/ssr/head-components/Seo.js +14 -14
  162. package/src/client/sw/default.sw.js +201 -201
  163. package/src/client/sw/template.sw.js +84 -84
  164. package/src/client.build.js +22 -22
  165. package/src/client.dev.js +21 -21
  166. package/src/cron.js +25 -25
  167. package/src/db/DataBaseProvider.js +34 -34
  168. package/src/db/mariadb/MariaDB.js +33 -33
  169. package/src/db/mongo/MongooseDB.js +46 -46
  170. package/src/dns.js +22 -22
  171. package/src/index.js +42 -0
  172. package/src/mailer/EmailRender.js +69 -69
  173. package/src/mailer/MailerProvider.js +96 -96
  174. package/src/proxy.js +22 -22
  175. package/src/runtime/lampp/Lampp.js +69 -44
  176. package/src/runtime/nginx/Nginx.js +3 -3
  177. package/src/runtime/xampp/Xampp.js +49 -49
  178. package/src/server/auth.js +235 -204
  179. package/src/server/backup.js +101 -84
  180. package/src/server/client-build-live.js +72 -72
  181. package/src/server/client-build.js +705 -699
  182. package/src/server/client-dev-server.js +60 -58
  183. package/src/server/client-formatted.js +48 -48
  184. package/src/server/client-icons.js +149 -150
  185. package/src/server/conf.js +860 -611
  186. package/src/server/dns.js +98 -87
  187. package/src/server/downloader.js +42 -42
  188. package/src/server/logger.js +180 -135
  189. package/src/server/network.js +122 -122
  190. package/src/server/peer.js +33 -33
  191. package/src/server/process.js +66 -66
  192. package/src/server/prompt-optimizer.js +28 -0
  193. package/src/server/proxy.js +118 -118
  194. package/src/server/runtime.js +444 -393
  195. package/src/server/ssl.js +109 -107
  196. package/src/server.js +25 -25
  197. package/src/ws/IoInterface.js +45 -45
  198. package/src/ws/IoServer.js +39 -39
  199. package/src/ws/core/channels/core.ws.chat.js +23 -23
  200. package/src/ws/core/channels/core.ws.mailer.js +35 -35
  201. package/src/ws/core/channels/core.ws.stream.js +31 -31
  202. package/src/ws/core/core.ws.connection.js +28 -28
  203. package/src/ws/core/core.ws.emit.js +14 -14
  204. package/src/ws/core/core.ws.server.js +24 -24
  205. package/src/ws/core/management/core.ws.chat.js +8 -8
  206. package/src/ws/core/management/core.ws.mailer.js +16 -16
  207. package/src/ws/core/management/core.ws.stream.js +8 -8
  208. package/src/ws/default/channels/default.ws.main.js +16 -16
  209. package/src/ws/default/default.ws.connection.js +22 -22
  210. package/src/ws/default/default.ws.emit.js +14 -14
  211. package/src/ws/default/default.ws.server.js +20 -20
  212. package/src/ws/default/management/default.ws.main.js +8 -8
  213. package/startup.js +11 -11
  214. package/supervisord-openssh-server.conf +4 -4
  215. package/test/api.test.js +60 -60
  216. package/bin/help.js +0 -110
@@ -1,164 +1,164 @@
1
- import { getId, newInstance } from './CommonJs.js';
2
- import { Input } from './Input.js';
3
- import { ToggleSwitch } from './ToggleSwitch.js';
4
- import { Translate } from './Translate.js';
5
- import { s, htmls } from './VanillaJs.js';
6
-
7
- const DropDown = {
8
- Tokens: {},
9
- Render: async function (options) {
10
- const id = options.id ? options.id : getId(this.Tokens, 'dropdown-');
11
- this.Tokens[id] = { onClickEvents: {}, lastSelectValue: undefined };
12
-
13
- options.data.push({
14
- value: 'reset',
15
- display: html`<i class="fa-solid fa-broom"></i> ${Translate.Render('clear')}`,
16
- onClick: () => {
17
- console.log('DropDown onClick', this.value);
18
- if (options && options.resetOnClick) options.resetOnClick();
19
- this.Tokens[id].value = undefined;
20
- },
21
- });
22
-
23
- if (!(options && options.disableClose))
24
- options.data.push({
25
- value: 'close',
26
- display: html`<i class="fa-solid fa-xmark"></i> ${Translate.Render('close')}`,
27
- onClick: function () {
28
- console.log('DropDown onClick', this.value);
29
- },
30
- });
31
-
32
- const switchOptionsPanel = () => {
33
- if (Array.from(s(`.dropdown-option-${id}`).classList).includes('hide'))
34
- s(`.dropdown-option-${id}`).classList.remove('hide');
35
- else s(`.dropdown-option-${id}`).classList.add('hide');
36
- };
37
-
38
- setTimeout(() => {
39
- if (options.type === 'checkbox')
40
- options.data.map((optionData) => {
41
- const indexValue = options.data.findIndex((t) => optionData.checked && t.value === optionData.value);
42
- if (indexValue > -1) setTimeout(() => s(`.dropdown-option-${id}-${indexValue}`).click());
43
- });
44
- else {
45
- const indexValue = options.data.findIndex((t) => t.value === options.value);
46
- if (indexValue > -1) setTimeout(() => s(`.dropdown-option-${id}-${indexValue}`).click());
47
- }
48
-
49
- s(`.dropdown-label-${id}`).onclick = switchOptionsPanel;
50
- s(`.dropdown-current-${id}`).onclick = switchOptionsPanel;
51
- if (options && options.open) switchOptionsPanel();
52
- });
53
-
54
- let render = '';
55
- let index = -1;
56
- for (const optionData of options.data) {
57
- index++;
58
- const i = index;
59
- const valueDisplay = optionData.value.trim().replaceAll(' ', '-');
60
- setTimeout(() => {
61
- const onclick = (e) => {
62
- if (options && options.lastSelectClass && s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`)) {
63
- s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`).classList.remove(options.lastSelectClass);
64
- }
65
- this.Tokens[id].lastSelectValue = valueDisplay;
66
- if (options && options.lastSelectClass && s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`)) {
67
- s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`).classList.add(options.lastSelectClass);
68
- }
69
-
70
- if (
71
- !(options && options.disableClose) &&
72
- (options.type !== 'checkbox' || optionData.value === 'close' || optionData.value === 'reset')
73
- )
74
- s(`.dropdown-option-${id}`).classList.add('hide');
75
-
76
- if (options.type === 'checkbox' && ToggleSwitch.Tokens[`checkbox-role-${valueDisplay}`])
77
- ToggleSwitch.Tokens[`checkbox-role-${valueDisplay}`].click();
78
- if (optionData.value !== 'close') {
79
- if (optionData.value !== 'reset')
80
- htmls(
81
- `.dropdown-current-${id}`,
82
- options.type === 'checkbox'
83
- ? options.data
84
- .filter((d) => d.checked)
85
- .map((v, i, a) => `${v.display}${i < a.length - 1 ? ',' : ''}`)
86
- .join('')
87
- : optionData.display,
88
- );
89
- else htmls(`.dropdown-current-${id}`, '');
90
-
91
- this.Tokens[id].value =
92
- options.type === 'checkbox' ? options.data.filter((d) => d.checked).map((d) => d.data) : optionData.data;
93
-
94
- console.warn('current value dropdown id:' + id, this.Tokens[id].value);
95
-
96
- s(`.${id}`).value = this.Tokens[id].value;
97
-
98
- optionData.onClick(e);
99
- }
100
- };
101
-
102
- this.Tokens[id].onClickEvents[`dropdown-option-${id}-${i}`] = onclick;
103
- this.Tokens[id].onClickEvents[`dropdown-option-${id}-${valueDisplay}`] = onclick;
104
- this.Tokens[id].onClickEvents[`dropdown-option-${valueDisplay}`] = onclick;
105
-
106
- s(`.dropdown-option-${id}-${i}`).onclick = onclick;
107
- });
108
- render += html`
109
- <div
110
- class="in dropdown-option dropdown-option-${id}-${i} dropdown-option-${id}-${valueDisplay} dropdown-option-${valueDisplay} ${valueDisplay ===
111
- 'reset' &&
112
- options &&
113
- !(options.resetOption === true)
114
- ? 'hide'
115
- : ''}"
116
- >
117
- ${options.type === 'checkbox' && optionData.value !== 'close' && optionData.value !== 'reset'
118
- ? html`
119
- ${await ToggleSwitch.Render({
120
- id: `checkbox-role-${valueDisplay}`,
121
- type: 'checkbox',
122
- disabledOnClick: true,
123
- checked: optionData.checked,
124
- on: {
125
- unchecked: () => {
126
- optionData.checked = false;
127
- },
128
- checked: () => {
129
- optionData.checked = true;
130
- },
131
- },
132
- })}
133
- `
134
- : ''}${optionData.display}
135
- </div>
136
- `;
137
- }
138
- return html`
139
- <div class="inl dropdown-container ${id} ${options?.containerClass ? options.containerClass : ''}">
140
- <div class="in dropdown-option dropdown-label-${id} ${options && options.disableSelectLabel ? 'hide' : ''}">
141
- <i class="fa-solid fa-caret-down"> </i> ${options.label}
142
- </div>
143
- <div
144
- class="in dropdown-option dropdown-current-${id} ${options && options.disableSelectOptionsLabel
145
- ? 'hide'
146
- : ''}"
147
- ></div>
148
- <div class="in dropdown-option-${id} hide">
149
- <div class="in dropdown-option ${options && options.disableSearchBox ? 'hide' : ''}">
150
- ${await Input.Render({
151
- id: `search-box-${id}`,
152
- label: html`<i class="fa-solid fa-magnifying-glass"></i> ${Translate.Render('search')}`,
153
- containerClass: 'in',
154
- placeholder: true,
155
- })}
156
- </div>
157
- ${render}
158
- </div>
159
- </div>
160
- `;
161
- },
162
- };
163
-
164
- export { DropDown };
1
+ import { getId, newInstance } from './CommonJs.js';
2
+ import { Input } from './Input.js';
3
+ import { ToggleSwitch } from './ToggleSwitch.js';
4
+ import { Translate } from './Translate.js';
5
+ import { s, htmls } from './VanillaJs.js';
6
+
7
+ const DropDown = {
8
+ Tokens: {},
9
+ Render: async function (options) {
10
+ const id = options.id ? options.id : getId(this.Tokens, 'dropdown-');
11
+ this.Tokens[id] = { onClickEvents: {}, lastSelectValue: undefined };
12
+
13
+ options.data.push({
14
+ value: 'reset',
15
+ display: html`<i class="fa-solid fa-broom"></i> ${Translate.Render('clear')}`,
16
+ onClick: () => {
17
+ console.log('DropDown onClick', this.value);
18
+ if (options && options.resetOnClick) options.resetOnClick();
19
+ this.Tokens[id].value = undefined;
20
+ },
21
+ });
22
+
23
+ if (!(options && options.disableClose))
24
+ options.data.push({
25
+ value: 'close',
26
+ display: html`<i class="fa-solid fa-xmark"></i> ${Translate.Render('close')}`,
27
+ onClick: function () {
28
+ console.log('DropDown onClick', this.value);
29
+ },
30
+ });
31
+
32
+ const switchOptionsPanel = () => {
33
+ if (Array.from(s(`.dropdown-option-${id}`).classList).includes('hide'))
34
+ s(`.dropdown-option-${id}`).classList.remove('hide');
35
+ else s(`.dropdown-option-${id}`).classList.add('hide');
36
+ };
37
+
38
+ setTimeout(() => {
39
+ if (options.type === 'checkbox')
40
+ options.data.map((optionData) => {
41
+ const indexValue = options.data.findIndex((t) => optionData.checked && t.value === optionData.value);
42
+ if (indexValue > -1) setTimeout(() => s(`.dropdown-option-${id}-${indexValue}`).click());
43
+ });
44
+ else {
45
+ const indexValue = options.data.findIndex((t) => t.value === options.value);
46
+ if (indexValue > -1) setTimeout(() => s(`.dropdown-option-${id}-${indexValue}`).click());
47
+ }
48
+
49
+ s(`.dropdown-label-${id}`).onclick = switchOptionsPanel;
50
+ s(`.dropdown-current-${id}`).onclick = switchOptionsPanel;
51
+ if (options && options.open) switchOptionsPanel();
52
+ });
53
+
54
+ let render = '';
55
+ let index = -1;
56
+ for (const optionData of options.data) {
57
+ index++;
58
+ const i = index;
59
+ const valueDisplay = optionData.value.trim().replaceAll(' ', '-');
60
+ setTimeout(() => {
61
+ const onclick = (e) => {
62
+ if (options && options.lastSelectClass && s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`)) {
63
+ s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`).classList.remove(options.lastSelectClass);
64
+ }
65
+ this.Tokens[id].lastSelectValue = valueDisplay;
66
+ if (options && options.lastSelectClass && s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`)) {
67
+ s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`).classList.add(options.lastSelectClass);
68
+ }
69
+
70
+ if (
71
+ !(options && options.disableClose) &&
72
+ (options.type !== 'checkbox' || optionData.value === 'close' || optionData.value === 'reset')
73
+ )
74
+ s(`.dropdown-option-${id}`).classList.add('hide');
75
+
76
+ if (options.type === 'checkbox' && ToggleSwitch.Tokens[`checkbox-role-${valueDisplay}`])
77
+ ToggleSwitch.Tokens[`checkbox-role-${valueDisplay}`].click();
78
+ if (optionData.value !== 'close') {
79
+ if (optionData.value !== 'reset')
80
+ htmls(
81
+ `.dropdown-current-${id}`,
82
+ options.type === 'checkbox'
83
+ ? options.data
84
+ .filter((d) => d.checked)
85
+ .map((v, i, a) => `${v.display}${i < a.length - 1 ? ',' : ''}`)
86
+ .join('')
87
+ : optionData.display,
88
+ );
89
+ else htmls(`.dropdown-current-${id}`, '');
90
+
91
+ this.Tokens[id].value =
92
+ options.type === 'checkbox' ? options.data.filter((d) => d.checked).map((d) => d.data) : optionData.data;
93
+
94
+ console.warn('current value dropdown id:' + id, this.Tokens[id].value);
95
+
96
+ s(`.${id}`).value = this.Tokens[id].value;
97
+
98
+ optionData.onClick(e);
99
+ }
100
+ };
101
+
102
+ this.Tokens[id].onClickEvents[`dropdown-option-${id}-${i}`] = onclick;
103
+ this.Tokens[id].onClickEvents[`dropdown-option-${id}-${valueDisplay}`] = onclick;
104
+ this.Tokens[id].onClickEvents[`dropdown-option-${valueDisplay}`] = onclick;
105
+
106
+ s(`.dropdown-option-${id}-${i}`).onclick = onclick;
107
+ });
108
+ render += html`
109
+ <div
110
+ class="in dropdown-option dropdown-option-${id}-${i} dropdown-option-${id}-${valueDisplay} dropdown-option-${valueDisplay} ${valueDisplay ===
111
+ 'reset' &&
112
+ options &&
113
+ !(options.resetOption === true)
114
+ ? 'hide'
115
+ : ''}"
116
+ >
117
+ ${options.type === 'checkbox' && optionData.value !== 'close' && optionData.value !== 'reset'
118
+ ? html`
119
+ ${await ToggleSwitch.Render({
120
+ id: `checkbox-role-${valueDisplay}`,
121
+ type: 'checkbox',
122
+ disabledOnClick: true,
123
+ checked: optionData.checked,
124
+ on: {
125
+ unchecked: () => {
126
+ optionData.checked = false;
127
+ },
128
+ checked: () => {
129
+ optionData.checked = true;
130
+ },
131
+ },
132
+ })}
133
+ `
134
+ : ''}${optionData.display}
135
+ </div>
136
+ `;
137
+ }
138
+ return html`
139
+ <div class="inl dropdown-container ${id} ${options?.containerClass ? options.containerClass : ''}">
140
+ <div class="in dropdown-option dropdown-label-${id} ${options && options.disableSelectLabel ? 'hide' : ''}">
141
+ <i class="fa-solid fa-caret-down"> </i> ${options.label}
142
+ </div>
143
+ <div
144
+ class="in dropdown-option dropdown-current-${id} ${options && options.disableSelectOptionsLabel
145
+ ? 'hide'
146
+ : ''}"
147
+ ></div>
148
+ <div class="in dropdown-option-${id} hide">
149
+ <div class="in dropdown-option ${options && options.disableSearchBox ? 'hide' : ''}">
150
+ ${await Input.Render({
151
+ id: `search-box-${id}`,
152
+ label: html`<i class="fa-solid fa-magnifying-glass"></i> ${Translate.Render('search')}`,
153
+ containerClass: 'in',
154
+ placeholder: true,
155
+ })}
156
+ </div>
157
+ ${render}
158
+ </div>
159
+ </div>
160
+ `;
161
+ },
162
+ };
163
+
164
+ export { DropDown };
@@ -1,54 +1,46 @@
1
- import { LoadingAnimation } from '../core/LoadingAnimation.js';
2
- import { loggerFactory } from '../core/Logger.js';
3
- import { cssEffect } from './Css.js';
4
- import { NotificationManager } from './NotificationManager.js';
5
- import { s } from './VanillaJs.js';
6
-
7
- const logger = loggerFactory(import.meta);
8
-
9
- const EventsUI = {
10
- on: (id = '', logic = function (e) {}, type = 'onclick', options = {}) => {
11
- const { loadingContainer, disableSpinner } = options;
12
- if (!s(id)) return;
13
- let complete = true;
14
- s(id)[type] = async function (e) {
15
- cssEffect(id, e);
16
- if (complete) {
17
- complete = false;
18
- if (!disableSpinner) await LoadingAnimation.spinner.play(loadingContainer ? loadingContainer : id);
19
- await LoadingAnimation.bar.play(id);
20
- try {
21
- await logic(e);
22
- } catch (error) {
23
- logger.error(error);
24
- NotificationManager.Push({
25
- status: 'error',
26
- html: error?.message ? error.message : error ? error : 'Event error',
27
- });
28
- }
29
- LoadingAnimation.bar.stop(id);
30
- if (!disableSpinner) await LoadingAnimation.spinner.stop(loadingContainer ? loadingContainer : id);
31
- complete = true;
32
- return;
33
- }
34
- if (e && e.preventDefault) e.preventDefault();
35
- logger.warn('in process', id);
36
- };
37
- },
38
- onClick: async function (
39
- id = '',
40
- logic = async function (e) {},
41
- options = { disableSpinner: false, loadingContainer: '' },
42
- ) {
43
- return await this.on(id, logic, 'onclick', options);
44
- },
45
- onChange: async function (
46
- id = '',
47
- logic = async function (e) {},
48
- options = { disableSpinner: false, loadingContainer: '' },
49
- ) {
50
- return await this.on(id, logic, 'onchange', options);
51
- },
52
- };
53
-
54
- export { EventsUI };
1
+ import { LoadingAnimation } from '../core/LoadingAnimation.js';
2
+ import { loggerFactory } from '../core/Logger.js';
3
+ import { cssEffect } from './Css.js';
4
+ import { NotificationManager } from './NotificationManager.js';
5
+ import { s } from './VanillaJs.js';
6
+
7
+ const logger = loggerFactory(import.meta);
8
+
9
+ const EventsUI = {
10
+ on: (id = '', logic = function (e) {}, type = 'onclick', options = {}) => {
11
+ const { loadingContainer } = options;
12
+ if (!s(id)) return;
13
+ let complete = true;
14
+ s(id)[type] = async function (e) {
15
+ cssEffect(id, e);
16
+ if (complete) {
17
+ complete = false;
18
+ await LoadingAnimation.spinner.play(loadingContainer ? loadingContainer : id);
19
+ await LoadingAnimation.bar.play(id);
20
+ try {
21
+ await logic(e);
22
+ } catch (error) {
23
+ logger.error(error);
24
+ NotificationManager.Push({
25
+ status: 'error',
26
+ html: error?.message ? error.message : error ? error : 'Event error',
27
+ });
28
+ }
29
+ LoadingAnimation.bar.stop(id);
30
+ await LoadingAnimation.spinner.stop(loadingContainer ? loadingContainer : id);
31
+ complete = true;
32
+ return;
33
+ }
34
+ if (e && e.preventDefault) e.preventDefault();
35
+ logger.warn('in process', id);
36
+ };
37
+ },
38
+ onClick: async function (id = '', logic = async function (e) {}, options = { loadingContainer: '' }) {
39
+ return await this.on(id, logic, 'onclick', options);
40
+ },
41
+ onChange: async function (id = '', logic = async function (e) {}, options = { loadingContainer: '' }) {
42
+ return await this.on(id, logic, 'onchange', options);
43
+ },
44
+ };
45
+
46
+ export { EventsUI };