chuijs 3.6.3 → 3.6.4

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 (119) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +1203 -162
  3. package/framework/appLayout/default/chui_app_layout.js +747 -747
  4. package/framework/appLayout/default/global_style.css +592 -570
  5. package/framework/appLayout/default/main_theme_style.css +118 -101
  6. package/framework/components/chui_accordion/accordion.js +63 -63
  7. package/framework/components/chui_accordion/styles.css +79 -75
  8. package/framework/components/chui_badge/badge.js +55 -55
  9. package/framework/components/chui_badge/styles.css +29 -29
  10. package/framework/components/chui_button/button.js +48 -48
  11. package/framework/components/chui_button/styles.css +75 -70
  12. package/framework/components/chui_calendar/calendar.js +97 -97
  13. package/framework/components/chui_card/card.js +87 -0
  14. package/framework/components/chui_card/styles.css +72 -0
  15. package/framework/components/chui_code/code.js +18 -18
  16. package/framework/components/chui_code/styles.css +9 -9
  17. package/framework/components/chui_console/console.js +27 -27
  18. package/framework/components/chui_console/styles.css +31 -31
  19. package/framework/components/chui_content_block/content_block.js +51 -51
  20. package/framework/components/chui_content_block/styles.css +2 -2
  21. package/framework/components/chui_context_menu/context_menu.js +230 -0
  22. package/framework/components/chui_context_menu/styles.css +136 -0
  23. package/framework/components/chui_custom_element/custom_element.js +24 -24
  24. package/framework/components/chui_details/details.js +85 -85
  25. package/framework/components/chui_details/styles.css +70 -66
  26. package/framework/components/chui_fieldset/fieldset.js +40 -40
  27. package/framework/components/chui_fieldset/styles.css +24 -24
  28. package/framework/components/chui_form/form.js +40 -40
  29. package/framework/components/chui_form/styles.css +21 -21
  30. package/framework/components/chui_graphs/graphs.js +234 -190
  31. package/framework/components/chui_graphs/styles.css +37 -32
  32. package/framework/components/chui_hero/hero.js +98 -0
  33. package/framework/components/chui_hero/styles.css +91 -0
  34. package/framework/components/chui_html_block/html_block.js +16 -16
  35. package/framework/components/chui_html_block/styles.css +5 -5
  36. package/framework/components/chui_hx/hx.js +15 -15
  37. package/framework/components/chui_hx/styles.css +38 -38
  38. package/framework/components/chui_icons/icons.js +2144 -2144
  39. package/framework/components/chui_icons/styles.css +13 -13
  40. package/framework/components/chui_inputs/chui_check_box/check_box.js +32 -32
  41. package/framework/components/chui_inputs/chui_check_box/styles.css +91 -86
  42. package/framework/components/chui_inputs/chui_combo_box/combo_box.js +166 -150
  43. package/framework/components/chui_inputs/chui_combo_box/styles.css +113 -107
  44. package/framework/components/chui_inputs/chui_date/date.js +177 -174
  45. package/framework/components/chui_inputs/chui_date/styles.css +163 -128
  46. package/framework/components/chui_inputs/chui_email/email.js +61 -61
  47. package/framework/components/chui_inputs/chui_email/styles.css +69 -71
  48. package/framework/components/chui_inputs/chui_file/file.js +76 -76
  49. package/framework/components/chui_inputs/chui_file/styles.css +99 -99
  50. package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +295 -295
  51. package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +212 -235
  52. package/framework/components/chui_inputs/chui_number/number.js +108 -108
  53. package/framework/components/chui_inputs/chui_number/styles.css +84 -84
  54. package/framework/components/chui_inputs/chui_password/password.js +99 -99
  55. package/framework/components/chui_inputs/chui_password/styles.css +97 -97
  56. package/framework/components/chui_inputs/chui_radio_button/radio_button.js +45 -45
  57. package/framework/components/chui_inputs/chui_radio_button/styles.css +76 -73
  58. package/framework/components/chui_inputs/chui_select_box/select_box.js +187 -170
  59. package/framework/components/chui_inputs/chui_select_box/styles.css +123 -117
  60. package/framework/components/chui_inputs/chui_text/styles.css +83 -84
  61. package/framework/components/chui_inputs/chui_text/text.js +91 -91
  62. package/framework/components/chui_inputs/chui_text_area/styles.css +57 -57
  63. package/framework/components/chui_inputs/chui_text_area/text_area.js +61 -61
  64. package/framework/components/chui_inputs/chui_toggle/styles.css +66 -61
  65. package/framework/components/chui_inputs/chui_toggle/toggle.js +36 -36
  66. package/framework/components/chui_label/label.js +54 -54
  67. package/framework/components/chui_label/styles.css +11 -11
  68. package/framework/components/chui_media/audio.js +908 -908
  69. package/framework/components/chui_media/audio_styles.css +458 -458
  70. package/framework/components/chui_media/image.js +105 -105
  71. package/framework/components/chui_media/image_styles.css +61 -61
  72. package/framework/components/chui_media/video.js +248 -248
  73. package/framework/components/chui_media/video_styles.css +160 -160
  74. package/framework/components/chui_menu_bar/menu_bar.js +66 -74
  75. package/framework/components/chui_menu_bar/styles.css +114 -76
  76. package/framework/components/chui_modal/modal.js +142 -135
  77. package/framework/components/chui_modal/styles.css +36 -36
  78. package/framework/components/chui_notification/notification.js +72 -72
  79. package/framework/components/chui_notification/notification_download.js +78 -78
  80. package/framework/components/chui_notification/notification_download_progress.css +119 -123
  81. package/framework/components/chui_notification/notification_download_progress.js +105 -105
  82. package/framework/components/chui_notification/notification_update.js +54 -54
  83. package/framework/components/chui_notification/styles.css +91 -91
  84. package/framework/components/chui_notification/styles_download.css +85 -85
  85. package/framework/components/chui_notification/styles_update.css +73 -73
  86. package/framework/components/chui_paragraph/paragraph.js +14 -14
  87. package/framework/components/chui_paragraph/styles.css +6 -6
  88. package/framework/components/chui_popups/popups.js +250 -250
  89. package/framework/components/chui_popups/styles.css +129 -115
  90. package/framework/components/chui_progress_bar/progress_bar.js +28 -28
  91. package/framework/components/chui_progress_bar/styles.css +28 -28
  92. package/framework/components/chui_radio_group/radio_group.js +57 -57
  93. package/framework/components/chui_radio_group/styles.css +3 -3
  94. package/framework/components/chui_slideshow/slideshow.js +75 -75
  95. package/framework/components/chui_slideshow/styles.css +94 -85
  96. package/framework/components/chui_spinner/spinner.js +45 -45
  97. package/framework/components/chui_spinner/styles.css +23 -23
  98. package/framework/components/chui_table/styles.css +42 -42
  99. package/framework/components/chui_table/table.js +234 -234
  100. package/framework/components/chui_tabs/chui_tabs.js +77 -77
  101. package/framework/components/chui_tabs/styles.css +54 -48
  102. package/framework/components/chui_text_editor/styles.css +217 -217
  103. package/framework/components/chui_text_editor/text_editor.js +144 -144
  104. package/framework/components/chui_text_editor/text_editor_panel.js +568 -568
  105. package/framework/components/chui_tree_view/styles.css +81 -75
  106. package/framework/components/chui_tree_view/tree_view.js +90 -90
  107. package/framework/components/chui_webview/styles.css +27 -27
  108. package/framework/components/chui_webview/webview.js +103 -103
  109. package/framework/components/telegram_bot/chui_telegram_bot.js +183 -183
  110. package/framework/modules/chui_animations/animations.js +121 -121
  111. package/framework/modules/chui_animations/styles.css +79 -79
  112. package/framework/modules/chui_fonts.js +7128 -7128
  113. package/framework/modules/chui_functions.js +106 -78
  114. package/framework/modules/chui_logger/chui_logger.js +53 -53
  115. package/framework/modules/chui_page/page.js +86 -86
  116. package/framework/modules/chui_page/styles.css +9 -9
  117. package/framework/tray_bar/chui_menu_items.js +48 -48
  118. package/index.js +570 -555
  119. package/package.json +51 -46
@@ -1,79 +1,79 @@
1
- const {Animation} = require('../../modules/chui_animations/animations');
2
- const {setStyles, getDate} = require('../../modules/chui_functions');
3
-
4
- class DownloadNotification {
5
- #id = require("randomstring").generate();
6
- #download_notification = document.createElement(`download_notification`);
7
- #download_notification_content = document.createElement("download_notification_content");
8
- #download_notification_header = document.createElement("download_notification_header");
9
- #download_notification_title = document.createElement("download_notification_title");
10
- #download_notification_date = document.createElement("download_notification_date");
11
- #download_notification_body = document.createElement("download_notification_body");
12
- #download_notification_text = document.createElement("download_notification_text");
13
- constructor(options = { title: String(), text: String(), type: String() }) {
14
- setStyles(__dirname + "/styles_download.css", 'chUiJS_downloadNotification');
15
- this.#download_notification.id = this.#id;
16
- if (options.title !== undefined) {
17
- this.#download_notification_title.innerText = options.title;
18
- } else {
19
- throw new Error("Должна быть установлена опция title");
20
- }
21
- this.#download_notification_body.style.width = "-webkit-fill-available"
22
- this.#download_notification_date.innerHTML = getDate();
23
- if (options.text !== undefined) {
24
- this.#download_notification_text.innerText = options.text;
25
- } else {
26
- throw new Error("Должна быть установлена опция text");
27
- }
28
- this.#download_notification_header.appendChild(this.#download_notification_title)
29
- this.#download_notification_header.appendChild(this.#download_notification_date)
30
- this.#download_notification_content.appendChild(this.#download_notification_header)
31
- this.#download_notification_body.appendChild(this.#download_notification_text)
32
- this.#download_notification_content.appendChild(this.#download_notification_body)
33
- this.#download_notification.appendChild(this.#download_notification_content)
34
- }
35
- update(title = String(), text = String()) {
36
- this.#download_notification_title.innerText = title;
37
- this.#download_notification_text.innerText = text;
38
- }
39
- show() {
40
- document.getElementsByTagName('notification_panel')[0].appendChild(this.#download_notification);
41
- let notification = document.getElementById(this.#id);
42
- new Animation(notification).slideRightIn();
43
- notification.addEventListener("click", () => this.#hideNotification(notification));
44
- }
45
- done() {
46
- this.#renderTest("download_notification_success");
47
- }
48
- error() {
49
- this.#renderTest("download_notification_error");
50
- }
51
- #renderTest(className) {
52
- let notification = document.getElementById(this.#id);
53
- let interval = setInterval(() => {
54
- try {
55
- notification.className = className;
56
- clearInterval(interval);
57
- } catch (e) { /* ... */ }
58
- }, 10)
59
- setTimeout(() => this.#hideNotification(notification), 2000);
60
- }
61
- #hideNotification(notification) {
62
- new Animation(notification).slideRightOutAndRemove();
63
- notification.addEventListener("animationend", () => {
64
- notification.removeAttribute("style");
65
- notification.style.display = 'flex';
66
- notification.style.width = '-webkit-fill-available';
67
- notification.style.opacity = "0"
68
- notification.style.transform = "translateX(100%)"
69
- let box = document.getElementById("chui_notification_box");
70
- box.appendChild(notification)
71
- setTimeout(() => {
72
- notification.style.opacity = "1"
73
- notification.style.transform = "translateX(0)"
74
- }, 500)
75
- })
76
- }
77
- }
78
-
1
+ const {Animation} = require('../../modules/chui_animations/animations');
2
+ const {setStyles, getDate} = require('../../modules/chui_functions');
3
+
4
+ class DownloadNotification {
5
+ #id = require("randomstring").generate();
6
+ #download_notification = document.createElement(`download_notification`);
7
+ #download_notification_content = document.createElement("download_notification_content");
8
+ #download_notification_header = document.createElement("download_notification_header");
9
+ #download_notification_title = document.createElement("download_notification_title");
10
+ #download_notification_date = document.createElement("download_notification_date");
11
+ #download_notification_body = document.createElement("download_notification_body");
12
+ #download_notification_text = document.createElement("download_notification_text");
13
+ constructor(options = { title: String(), text: String(), type: String() }) {
14
+ setStyles(__dirname + "/styles_download.css", 'chUiJS_downloadNotification');
15
+ this.#download_notification.id = this.#id;
16
+ if (options.title !== undefined) {
17
+ this.#download_notification_title.innerText = options.title;
18
+ } else {
19
+ throw new Error("Должна быть установлена опция title");
20
+ }
21
+ this.#download_notification_body.style.width = "-webkit-fill-available"
22
+ this.#download_notification_date.innerHTML = getDate();
23
+ if (options.text !== undefined) {
24
+ this.#download_notification_text.innerText = options.text;
25
+ } else {
26
+ throw new Error("Должна быть установлена опция text");
27
+ }
28
+ this.#download_notification_header.appendChild(this.#download_notification_title)
29
+ this.#download_notification_header.appendChild(this.#download_notification_date)
30
+ this.#download_notification_content.appendChild(this.#download_notification_header)
31
+ this.#download_notification_body.appendChild(this.#download_notification_text)
32
+ this.#download_notification_content.appendChild(this.#download_notification_body)
33
+ this.#download_notification.appendChild(this.#download_notification_content)
34
+ }
35
+ update(title = String(), text = String()) {
36
+ this.#download_notification_title.innerText = title;
37
+ this.#download_notification_text.innerText = text;
38
+ }
39
+ show() {
40
+ document.getElementsByTagName('notification_panel')[0].appendChild(this.#download_notification);
41
+ let notification = document.getElementById(this.#id);
42
+ new Animation(notification).slideRightIn();
43
+ notification.addEventListener("click", () => this.#hideNotification(notification));
44
+ }
45
+ done() {
46
+ this.#renderTest("download_notification_success");
47
+ }
48
+ error() {
49
+ this.#renderTest("download_notification_error");
50
+ }
51
+ #renderTest(className) {
52
+ let notification = document.getElementById(this.#id);
53
+ let interval = setInterval(() => {
54
+ try {
55
+ notification.className = className;
56
+ clearInterval(interval);
57
+ } catch (e) { /* ... */ }
58
+ }, 10)
59
+ setTimeout(() => this.#hideNotification(notification), 2000);
60
+ }
61
+ #hideNotification(notification) {
62
+ new Animation(notification).slideRightOutAndRemove();
63
+ notification.addEventListener("animationend", () => {
64
+ notification.removeAttribute("style");
65
+ notification.style.display = 'flex';
66
+ notification.style.width = '-webkit-fill-available';
67
+ notification.style.opacity = "0"
68
+ notification.style.transform = "translateX(100%)"
69
+ let box = document.getElementById("chui_notification_box");
70
+ box.appendChild(notification)
71
+ setTimeout(() => {
72
+ notification.style.opacity = "1"
73
+ notification.style.transform = "translateX(0)"
74
+ }, 500)
75
+ })
76
+ }
77
+ }
78
+
79
79
  exports.DownloadNotification = DownloadNotification
@@ -1,124 +1,120 @@
1
- /* download */
2
- notification_download_progress {
3
- display: none;
4
- height: max-content;
5
- width: max-content;
6
- min-width: 356px;
7
- max-width: 356px;
8
- border-radius: var(--border_radius);
9
- margin: var(--margin);
10
- font-size: var(--font_default_size);
11
- padding: 6px 10px;
12
- background: var(--header_background);
13
- backdrop-filter: var(--global_blur);
14
- z-index: 1002;
15
- box-shadow: var(--box_shadow_main);
16
- border: 1px solid var(--border_color);
17
- }
18
-
19
- .download_notification_error {
20
- background: var(--badge_error_back);
21
- box-shadow: var(--box_shadow_main);
22
- border: 1px solid var(--badge_error_back);
23
- }
24
-
25
- .download_notification_success {
26
- background: var(--badge_success_back);
27
- box-shadow: var(--box_shadow_main);
28
- border: 1px solid var(--badge_success_back);
29
- }
30
-
31
- download_notification_body {
32
- display: flex;
33
- flex-direction: row;
34
- flex: 1;
35
- justify-content: left;
36
- align-items: center;
37
- }
38
-
39
- download_notification_content {
40
- display: flex;
41
- flex-direction: column;
42
- flex: 1;
43
- justify-content: flex-start;
44
- align-items: flex-start;
45
- }
46
-
47
- download_notification_header {
48
- display: flex;
49
- flex-direction: row;
50
- flex: 1;
51
- justify-content: space-between;
52
- align-items: center;
53
- width: -webkit-fill-available;
54
- }
55
-
56
- download_notification_title {
57
- font-size: var(--font_default_size);
58
- font-weight: 500;
59
- margin: 3px;
60
- color: var(--text_color);
61
- word-break: break-all;
62
- }
63
-
64
- download_notification_title p {
65
- margin: 0;
66
- }
67
-
68
- download_notification_date {
69
- font-size: 8pt;
70
- font-weight: 400;
71
- margin: 3px 0 0 10px;
72
- color: var(--text_color);
73
- white-space: pre;
74
- text-align: end;
75
- }
76
-
77
- download_notification_text {
78
- font-size: 11pt;
79
- font-weight: 400;
80
- margin: 6px 3px;
81
- color: var(--text_color);
82
- word-break: break-word;
83
- }
84
-
85
- download_notification_text p {
86
- margin: 0;
87
- }
88
-
89
- download_progress {
90
-
91
- }
92
-
93
- download_progress_text_block {
94
- display: flex;
95
- justify-content: space-between;
96
- align-items: center;
97
- width: -webkit-fill-available;
98
- color: var(--text_color);
99
- margin: 3px;
100
- }
101
-
102
- download_progress_text, download_progress_count {
103
- font-size: 11px;
104
- }
105
-
106
- .download_progress_bar {
107
- border-radius: 50px;
108
- text-align: start;
109
- margin: 3px 0;
110
- width: -webkit-fill-available;
111
- height: 9px;
112
- border: none;
113
- }
114
-
115
- .download_progress_bar::-webkit-progress-bar {
116
- background: var(--ap_main_background);
117
- border-radius: 50px;
118
- border: none;
119
- }
120
-
121
- .download_progress_bar::-webkit-progress-value {
122
- background: var(--blue_prime_background);
123
- border-radius: 50px;
1
+ /* download */
2
+ notification_download_progress {
3
+ display: none;
4
+ height: max-content;
5
+ width: max-content;
6
+ min-width: 356px;
7
+ max-width: 356px;
8
+ border-radius: var(--border_radius);
9
+ margin: var(--margin);
10
+ font-size: var(--font_default_size);
11
+ padding: 6px 10px;
12
+ background: var(--header_background);
13
+ backdrop-filter: var(--global_blur);
14
+ z-index: 1002;
15
+ box-shadow: var(--box_shadow_main);
16
+ border: 1px solid var(--border_color);
17
+ }
18
+
19
+ .download_notification_error {
20
+ background: var(--badge_error_back);
21
+ box-shadow: var(--box_shadow_main);
22
+ border: 1px solid var(--badge_error_back);
23
+ }
24
+
25
+ .download_notification_success {
26
+ background: var(--badge_success_back);
27
+ box-shadow: var(--box_shadow_main);
28
+ border: 1px solid var(--badge_success_back);
29
+ }
30
+
31
+ download_notification_body {
32
+ display: flex;
33
+ flex-direction: row;
34
+ flex: 1;
35
+ justify-content: left;
36
+ align-items: center;
37
+ }
38
+
39
+ download_notification_content {
40
+ display: flex;
41
+ flex-direction: column;
42
+ flex: 1;
43
+ justify-content: flex-start;
44
+ align-items: flex-start;
45
+ }
46
+
47
+ download_notification_header {
48
+ display: flex;
49
+ flex-direction: row;
50
+ flex: 1;
51
+ justify-content: space-between;
52
+ align-items: center;
53
+ width: -webkit-fill-available;
54
+ }
55
+
56
+ download_notification_title {
57
+ font-size: var(--font_default_size);
58
+ font-weight: 500;
59
+ margin: 3px;
60
+ color: var(--text_color);
61
+ word-break: break-all;
62
+ }
63
+
64
+ download_notification_title p {
65
+ margin: 0;
66
+ }
67
+
68
+ download_notification_date {
69
+ font-size: 8pt;
70
+ font-weight: 400;
71
+ margin: 3px 0 0 10px;
72
+ color: var(--text_color);
73
+ white-space: pre;
74
+ text-align: end;
75
+ }
76
+
77
+ download_notification_text {
78
+ font-size: 11pt;
79
+ font-weight: 400;
80
+ margin: 6px 3px;
81
+ color: var(--text_color);
82
+ word-break: break-word;
83
+ }
84
+
85
+ download_notification_text p {
86
+ margin: 0;
87
+ }
88
+
89
+ download_progress_text_block {
90
+ display: flex;
91
+ justify-content: space-between;
92
+ align-items: center;
93
+ width: -webkit-fill-available;
94
+ color: var(--text_color);
95
+ margin: 3px;
96
+ }
97
+
98
+ download_progress_text, download_progress_count {
99
+ font-size: 11px;
100
+ }
101
+
102
+ .download_progress_bar {
103
+ border-radius: var(--radius_pill);
104
+ text-align: start;
105
+ margin: 3px 0;
106
+ width: -webkit-fill-available;
107
+ height: 9px;
108
+ border: none;
109
+ }
110
+
111
+ .download_progress_bar::-webkit-progress-bar {
112
+ background: var(--ap_main_background);
113
+ border-radius: var(--radius_pill);
114
+ border: none;
115
+ }
116
+
117
+ .download_progress_bar::-webkit-progress-value {
118
+ background: var(--blue_prime_background);
119
+ border-radius: var(--radius_pill);
124
120
  }
@@ -1,106 +1,106 @@
1
- const {Animation} = require('../../modules/chui_animations/animations');
2
- const {setStyles, getDate} = require('../../modules/chui_functions');
3
-
4
- class DownloadProgressNotification {
5
- #id = require("randomstring").generate();
6
- #download_notification = document.createElement(`notification_download_progress`);
7
- #download_notification_content = document.createElement("download_notification_content");
8
- #download_notification_header = document.createElement("download_notification_header");
9
- #id_download_notification_title = require("randomstring").generate();
10
- #download_notification_title = document.createElement("download_notification_title");
11
- #download_notification_date = document.createElement("download_notification_date");
12
- #download_notification_body = document.createElement("download_notification_body");
13
- //
14
- #id_progress = require("randomstring").generate();
15
- #ProgressBar = document.createElement(`progress`);
16
- #main = document.createElement("download_progress_block");
17
- #progress_text_block = document.createElement('download_progress_text_block');
18
- #id_progress_count = require("randomstring").generate();
19
- #progress_count = document.createElement('download_progress_count');
20
- #id_progress_text = require("randomstring").generate();
21
- #progress_text = document.createElement('download_progress_text');
22
- constructor(options = { title: String(), text: String(), type: String() }) {
23
- setStyles(__dirname + "/notification_download_progress.css", 'chUiJS_downloadNotification');
24
- this.#download_notification.id = this.#id;
25
- this.#download_notification_title.id = this.#id_download_notification_title
26
- if (options.title !== undefined) {
27
- this.#download_notification_title.innerText = options.title;
28
- } else {
29
- throw new Error("Должна быть установлена опция title");
30
- }
31
- this.#download_notification_body.style.width = "-webkit-fill-available"
32
- this.#download_notification_date.innerHTML = getDate();
33
- this.#download_notification_header.appendChild(this.#download_notification_title)
34
- this.#download_notification_header.appendChild(this.#download_notification_date)
35
- this.#download_notification_content.appendChild(this.#download_notification_header)
36
- this.#download_notification_content.appendChild(this.#download_notification_body)
37
- this.#download_notification.appendChild(this.#download_notification_content)
38
-
39
- //
40
- if (options.max !== undefined) this.#ProgressBar.max = options.max;
41
- this.#ProgressBar.id = this.#id_progress;
42
- this.#ProgressBar.className = "download_progress_bar"
43
- this.#progress_count.id = this.#id_progress_count
44
- this.#progress_count.setAttribute('for', this.#id_progress);
45
- this.#progress_text.id = this.#id_progress_text
46
- this.#progress_text.setAttribute('for', this.#id_progress);
47
- this.#progress_text_block.appendChild(this.#progress_text)
48
- this.#progress_text_block.appendChild(this.#progress_count)
49
-
50
- this.#main.appendChild(this.#progress_text_block)
51
- this.#main.appendChild(this.#ProgressBar)
52
- //
53
- this.#main.style.width = "-webkit-fill-available";
54
- this.#progress_text.innerText = "...";
55
- this.#progress_count.innerText = "0 из 0"
56
- this.#ProgressBar.value = 0;
57
- this.#download_notification_body.appendChild(this.#main)
58
- }
59
- update(title = String(), text = String(), value = Number(), max = Number()) {
60
- document.getElementById(this.#id_download_notification_title).innerText = title;
61
- document.getElementById(this.#id_progress_text).innerText = text;
62
- document.getElementById(this.#id_progress_count).innerText = `${value} из ${max}`
63
- document.getElementById(this.#id_progress).value = value;
64
- document.getElementById(this.#id_progress).max = max;
65
- }
66
- show() {
67
- document.getElementsByTagName('notification_panel')[0].appendChild(this.#download_notification);
68
- let notification = document.getElementById(this.#id);
69
- new Animation(notification).slideRightIn();
70
- notification.addEventListener("click", () => this.#hideNotification(notification));
71
- }
72
- done() {
73
- this.#renderTest("download_notification_success");
74
- }
75
- error() {
76
- this.#renderTest("download_notification_error");
77
- }
78
- #renderTest(className) {
79
- let notification = document.getElementById(this.#id);
80
- let interval = setInterval(() => {
81
- try {
82
- notification.className = className;
83
- clearInterval(interval);
84
- } catch (e) { /* ... */ }
85
- }, 10)
86
- setTimeout(() => this.#hideNotification(notification), 2000);
87
- }
88
- #hideNotification(notification) {
89
- new Animation(notification).slideRightOutAndRemove();
90
- notification.addEventListener("animationend", () => {
91
- notification.removeAttribute("style");
92
- notification.style.display = 'flex';
93
- notification.style.width = '-webkit-fill-available';
94
- notification.style.opacity = "0"
95
- notification.style.transform = "translateX(100%)"
96
- let box = document.getElementById("chui_notification_box");
97
- box.appendChild(notification)
98
- setTimeout(() => {
99
- notification.style.opacity = "1"
100
- notification.style.transform = "translateX(0)"
101
- }, 500)
102
- })
103
- }
104
- }
105
-
1
+ const {Animation} = require('../../modules/chui_animations/animations');
2
+ const {setStyles, getDate} = require('../../modules/chui_functions');
3
+
4
+ class DownloadProgressNotification {
5
+ #id = require("randomstring").generate();
6
+ #download_notification = document.createElement(`notification_download_progress`);
7
+ #download_notification_content = document.createElement("download_notification_content");
8
+ #download_notification_header = document.createElement("download_notification_header");
9
+ #id_download_notification_title = require("randomstring").generate();
10
+ #download_notification_title = document.createElement("download_notification_title");
11
+ #download_notification_date = document.createElement("download_notification_date");
12
+ #download_notification_body = document.createElement("download_notification_body");
13
+ //
14
+ #id_progress = require("randomstring").generate();
15
+ #ProgressBar = document.createElement(`progress`);
16
+ #main = document.createElement("download_progress_block");
17
+ #progress_text_block = document.createElement('download_progress_text_block');
18
+ #id_progress_count = require("randomstring").generate();
19
+ #progress_count = document.createElement('download_progress_count');
20
+ #id_progress_text = require("randomstring").generate();
21
+ #progress_text = document.createElement('download_progress_text');
22
+ constructor(options = { title: String(), text: String(), type: String() }) {
23
+ setStyles(__dirname + "/notification_download_progress.css", 'chUiJS_downloadProgressNotification');
24
+ this.#download_notification.id = this.#id;
25
+ this.#download_notification_title.id = this.#id_download_notification_title
26
+ if (options.title !== undefined) {
27
+ this.#download_notification_title.innerText = options.title;
28
+ } else {
29
+ throw new Error("Должна быть установлена опция title");
30
+ }
31
+ this.#download_notification_body.style.width = "-webkit-fill-available"
32
+ this.#download_notification_date.innerHTML = getDate();
33
+ this.#download_notification_header.appendChild(this.#download_notification_title)
34
+ this.#download_notification_header.appendChild(this.#download_notification_date)
35
+ this.#download_notification_content.appendChild(this.#download_notification_header)
36
+ this.#download_notification_content.appendChild(this.#download_notification_body)
37
+ this.#download_notification.appendChild(this.#download_notification_content)
38
+
39
+ //
40
+ if (options.max !== undefined) this.#ProgressBar.max = options.max;
41
+ this.#ProgressBar.id = this.#id_progress;
42
+ this.#ProgressBar.className = "download_progress_bar"
43
+ this.#progress_count.id = this.#id_progress_count
44
+ this.#progress_count.setAttribute('for', this.#id_progress);
45
+ this.#progress_text.id = this.#id_progress_text
46
+ this.#progress_text.setAttribute('for', this.#id_progress);
47
+ this.#progress_text_block.appendChild(this.#progress_text)
48
+ this.#progress_text_block.appendChild(this.#progress_count)
49
+
50
+ this.#main.appendChild(this.#progress_text_block)
51
+ this.#main.appendChild(this.#ProgressBar)
52
+ //
53
+ this.#main.style.width = "-webkit-fill-available";
54
+ this.#progress_text.innerText = "...";
55
+ this.#progress_count.innerText = "0 из 0"
56
+ this.#ProgressBar.value = 0;
57
+ this.#download_notification_body.appendChild(this.#main)
58
+ }
59
+ update(title = String(), text = String(), value = Number(), max = Number()) {
60
+ document.getElementById(this.#id_download_notification_title).innerText = title;
61
+ document.getElementById(this.#id_progress_text).innerText = text;
62
+ document.getElementById(this.#id_progress_count).innerText = `${value} из ${max}`
63
+ document.getElementById(this.#id_progress).value = value;
64
+ document.getElementById(this.#id_progress).max = max;
65
+ }
66
+ show() {
67
+ document.getElementsByTagName('notification_panel')[0].appendChild(this.#download_notification);
68
+ let notification = document.getElementById(this.#id);
69
+ new Animation(notification).slideRightIn();
70
+ notification.addEventListener("click", () => this.#hideNotification(notification));
71
+ }
72
+ done() {
73
+ this.#renderTest("download_notification_success");
74
+ }
75
+ error() {
76
+ this.#renderTest("download_notification_error");
77
+ }
78
+ #renderTest(className) {
79
+ let notification = document.getElementById(this.#id);
80
+ let interval = setInterval(() => {
81
+ try {
82
+ notification.className = className;
83
+ clearInterval(interval);
84
+ } catch (e) { /* ... */ }
85
+ }, 10)
86
+ setTimeout(() => this.#hideNotification(notification), 2000);
87
+ }
88
+ #hideNotification(notification) {
89
+ new Animation(notification).slideRightOutAndRemove();
90
+ notification.addEventListener("animationend", () => {
91
+ notification.removeAttribute("style");
92
+ notification.style.display = 'flex';
93
+ notification.style.width = '-webkit-fill-available';
94
+ notification.style.opacity = "0"
95
+ notification.style.transform = "translateX(100%)"
96
+ let box = document.getElementById("chui_notification_box");
97
+ box.appendChild(notification)
98
+ setTimeout(() => {
99
+ notification.style.opacity = "1"
100
+ notification.style.transform = "translateX(0)"
101
+ }, 500)
102
+ })
103
+ }
104
+ }
105
+
106
106
  exports.DownloadProgressNotification = DownloadProgressNotification