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,236 +1,213 @@
1
- chui_multicombobox {
2
- position: relative;
3
- display: flex;
4
- flex-direction: column;
5
- height: max-content;
6
- margin: var(--margin);
7
- width: 200px
8
- }
9
-
10
- multicombobox {
11
- position: relative;
12
- display: flex;
13
- height: max-content;
14
- width: -webkit-fill-available;
15
- border-radius: var(--border_radius);
16
- padding: 0;
17
- font-size: var(--font_default_size);
18
- background: var(--element_background);
19
- border: 1px solid var(--border_color);
20
- }
21
-
22
- multicombobox_options {
23
- display: flex;
24
- flex-direction: column;
25
- }
26
-
27
- .multicombobox_input {
28
- width: 100%;
29
- margin: 0;
30
- padding: var(--test_padding) 0 var(--test_padding) 10px;
31
- background: transparent;
32
- color: var(--text_color);
33
- border: none;
34
- font-size: var(--font_default_size);
35
- }
36
-
37
- multicombobox_dropdown {
38
- background: var(--element_background);
39
- position: absolute;
40
- display: none;
41
- height: max-content;
42
- border-radius: var(--border_radius);
43
- margin-top: 36px;
44
- padding: var(--test_padding);
45
- font-size: var(--font_default_size);
46
- flex-direction: column;
47
- z-index: 1;
48
- width: -webkit-fill-available;
49
- overflow: hidden hidden;
50
- box-shadow: var(--box_shadow_main);
51
- border: 1px solid var(--border_color);
52
- }
53
-
54
- multicombobox_dropdown:hover {
55
- overflow: hidden overlay
56
- }
57
-
58
- .multicombobox_label {
59
- height: max-content;
60
- width: max-content;
61
- margin: var(--margin);
62
- font-size: var(--font_labels_size);
63
- font-weight:500;
64
- color: var(--text_color)
65
- }
66
-
67
- multicombo_button_open {
68
- cursor: pointer;
69
- padding: var(--main_padding);
70
- color: var(--blue_prime_background);
71
- justify-content: center;
72
- align-items: center;
73
- display: flex;
74
- }
75
-
76
- .option_input_label {
77
- padding: var(--test_padding);
78
- width: -webkit-fill-available;
79
- text-align: start;
80
- }
81
-
82
- .multi_combobox_option {
83
- display: flex;
84
- flex-direction: row;
85
- border-radius: var(--border_radius);
86
- color: var(--text_color);
87
- justify-content: center;
88
- align-items: center;
89
- width: -webkit-fill-available;
90
- }
91
-
92
- .multi_combobox_option:hover {
93
- background: var(--blue_prime_background);
94
- color: var(--text_color_hover);
95
- }
96
-
97
- /* DISABLED STYLES */
98
- .multicombobox_disabled {
99
- cursor: not-allowed;
100
- background: var(--element_background_disabled);
101
- border: 1px solid var(--border_color);
102
- }
103
-
104
- .multicombobox_input_disabled {
105
- cursor: not-allowed;
106
- background: transparent;
107
- color: var(--text_color_disabled);
108
- text-align: start;
109
- width: 100%;
110
- margin: 0;
111
- padding: var(--test_padding) 0 var(--test_padding) 10px;
112
- border: none;
113
- font-size: var(--font_default_size);
114
- }
115
-
116
- .multicombobox_label_disabled {
117
- cursor: not-allowed;
118
- height: max-content;
119
- width: max-content;
120
- margin: var(--margin);
121
- font-size: var(--font_labels_size);
122
- font-weight:500;
123
- color: var(--text_color_disabled)
124
- }
125
-
126
- multicombobox_option_added_main {
127
- color: var(--text_color);
128
- display: flex;
129
- flex-direction: row;
130
- height: max-content;
131
- margin: 3px;
132
- width: max-content;
133
- background: var(--ap_slider_background);
134
- border-radius: var(--border_radius);
135
- font-weight: 500;
136
- justify-content: center;
137
- align-items: center;
138
- }
139
-
140
- multicombobox_option_added_body {
141
- padding: 5px 8px;
142
- width: max-content;
143
- height: max-content;
144
- }
145
-
146
- multicombobox_option_added_remove {
147
- width: max-content;
148
- height: max-content;
149
- font-weight: 600;
150
- padding: 5px 8px 5px 0px;
151
- }
152
-
153
- label input {
154
- position: absolute;
155
- opacity: 0;
156
- cursor: pointer;
157
- height: 0;
158
- width: 0;
159
- }
160
-
161
- .checkmark {
162
- margin: 8px 0px 8px 8px;
163
- font-size: var(--font_default_size);
164
- content: '';
165
- display: flex;
166
- width: 1.2em;
167
- height: 1.2em;
168
- flex-shrink: 0;
169
- flex-grow: 0;
170
- border-radius: 25%;
171
- align-items: center;
172
- justify-content: center;
173
- color: var(--ap_slider_background);
174
- font-family: 'chui_I';
175
- background: var(--ap_slider_background);
176
- border: none;
177
- box-shadow: 0 0 1px 0 var(--ap_slider_background);
178
- background-repeat: no-repeat;
179
- background-position: center center;
180
- background-size: 50% 50%;
181
- }
182
-
183
- /* On mouse-over, add a grey background color */
184
- label:hover input ~ .checkmark {
185
- background-color: var(--ap_slider_background);
186
- }
187
-
188
- /* When the checkbox is checked, add a blue background */
189
- label input:checked ~ .checkmark {
190
- background-color: var(--blue_prime_background);
191
- color:var(--text_color_hover);
192
- border: none;
193
- box-shadow: 0 0 1px 0 var(--blue_prime_background);
194
- background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3e%3c/svg%3e");
195
- }
196
-
197
- /* Create the checkmark/indicator (hidden when not checked) */
198
- .checkmark:after {
199
- content: "";
200
- position: absolute;
201
- display: none;
202
- }
203
-
204
- /* Show the checkmark when checked */
205
- .container input:checked ~ .checkmark:after {
206
- display: block;
207
- }
208
-
209
- /* Style the checkmark/indicator */
210
- .container .checkmark:after {
211
- left: 9px;
212
- top: 5px;
213
- width: 5px;
214
- height: 10px;
215
- border: solid white;
216
- border-width: 0 3px 3px 0;
217
- -webkit-transform: rotate(45deg);
218
- -ms-transform: rotate(45deg);
219
- transform: rotate(45deg);
220
- }
221
-
222
- .multi_combobox_section {
223
- display: flex;
224
- align-items: flex-start;
225
- justify-content: center;
226
- flex-direction: column;
227
- width: -webkit-fill-available;
228
- height: max-content;
229
- }
230
-
231
- .multi_combobox_section_title {
232
- color: var(--text_color);
233
- font-weight: 500;
234
- font-size: 11pt;
235
- padding: 6px;
1
+ chui_multicombobox {
2
+ position: relative;
3
+ display: flex;
4
+ flex-direction: column;
5
+ height: max-content;
6
+ margin: var(--margin);
7
+ width: var(--control_width)
8
+ }
9
+
10
+ multicombobox {
11
+ position: relative;
12
+ display: flex;
13
+ height: max-content;
14
+ width: -webkit-fill-available;
15
+ border-radius: var(--border_radius);
16
+ padding: 0;
17
+ font-size: var(--font_default_size);
18
+ background: var(--element_background);
19
+ border: 1px solid var(--border_color);
20
+ }
21
+
22
+ multicombobox_options {
23
+ display: flex;
24
+ flex-direction: column;
25
+ }
26
+
27
+ .multicombobox_input {
28
+ width: 100%;
29
+ margin: 0;
30
+ padding: var(--test_padding) 0 var(--test_padding) 10px;
31
+ background: transparent;
32
+ color: var(--text_color);
33
+ border: none;
34
+ font-size: var(--font_default_size);
35
+ }
36
+
37
+ multicombobox_dropdown {
38
+ background: var(--header_background);
39
+ backdrop-filter: var(--global_blur);
40
+ -webkit-backdrop-filter: var(--global_blur);
41
+ position: absolute;
42
+ display: none;
43
+ height: max-content;
44
+ border-radius: var(--border_radius);
45
+ margin-top: 36px;
46
+ padding: var(--test_padding);
47
+ font-size: var(--font_default_size);
48
+ flex-direction: column;
49
+ z-index: 1;
50
+ width: -webkit-fill-available;
51
+ overflow: hidden hidden;
52
+ box-shadow: var(--box_shadow_main);
53
+ border: 1px solid var(--border_color);
54
+ }
55
+
56
+ multicombobox_dropdown:hover {
57
+ overflow: hidden overlay
58
+ }
59
+
60
+ .multicombobox_label {
61
+ height: max-content;
62
+ width: max-content;
63
+ margin: var(--margin);
64
+ font-size: var(--font_labels_size);
65
+ font-weight:500;
66
+ color: var(--text_color)
67
+ }
68
+
69
+ multicombo_button_open {
70
+ cursor: pointer;
71
+ padding: var(--main_padding);
72
+ color: var(--blue_prime_background);
73
+ justify-content: center;
74
+ align-items: center;
75
+ display: flex;
76
+ }
77
+
78
+ .option_input_label {
79
+ padding: var(--test_padding);
80
+ width: -webkit-fill-available;
81
+ text-align: start;
82
+ }
83
+
84
+ .multi_combobox_option {
85
+ display: flex;
86
+ flex-direction: row;
87
+ border-radius: var(--border_radius);
88
+ color: var(--text_color);
89
+ justify-content: center;
90
+ align-items: center;
91
+ width: -webkit-fill-available;
92
+ }
93
+
94
+ .multi_combobox_option:hover {
95
+ background: var(--blue_prime_background);
96
+ color: var(--text_color_hover);
97
+ }
98
+
99
+ /* DISABLED STYLES */
100
+ .multicombobox_disabled {
101
+ cursor: not-allowed;
102
+ background: var(--element_background_disabled);
103
+ border: 1px solid var(--border_color);
104
+ }
105
+
106
+ .multicombobox_input_disabled {
107
+ cursor: not-allowed;
108
+ background: transparent;
109
+ color: var(--text_color_disabled);
110
+ text-align: start;
111
+ width: 100%;
112
+ margin: 0;
113
+ padding: var(--test_padding) 0 var(--test_padding) 10px;
114
+ border: none;
115
+ font-size: var(--font_default_size);
116
+ }
117
+
118
+ .multicombobox_label_disabled {
119
+ cursor: not-allowed;
120
+ height: max-content;
121
+ width: max-content;
122
+ margin: var(--margin);
123
+ font-size: var(--font_labels_size);
124
+ font-weight:500;
125
+ color: var(--text_color_disabled)
126
+ }
127
+
128
+ multicombobox_option_added_main {
129
+ color: var(--text_color);
130
+ display: flex;
131
+ flex-direction: row;
132
+ height: max-content;
133
+ margin: 3px;
134
+ width: max-content;
135
+ background: var(--element_background_2);
136
+ border-radius: var(--border_radius);
137
+ font-weight: 500;
138
+ justify-content: center;
139
+ align-items: center;
140
+ }
141
+
142
+ multicombobox_option_added_body {
143
+ padding: 5px 8px;
144
+ width: max-content;
145
+ height: max-content;
146
+ }
147
+
148
+ multicombobox_option_added_remove {
149
+ width: max-content;
150
+ height: max-content;
151
+ font-weight: 600;
152
+ padding: 5px 8px 5px 0px;
153
+ }
154
+
155
+ label input {
156
+ position: absolute;
157
+ opacity: 0;
158
+ cursor: pointer;
159
+ height: 0;
160
+ width: 0;
161
+ }
162
+
163
+ .checkmark {
164
+ margin: 8px 0 8px 8px;
165
+ display: flex;
166
+ width: 1.2em;
167
+ height: 1.2em;
168
+ flex-shrink: 0;
169
+ flex-grow: 0;
170
+ border-radius: var(--radius_sm);
171
+ align-items: center;
172
+ justify-content: center;
173
+ color: transparent;
174
+ background: var(--element_background);
175
+ border: none;
176
+ box-shadow: 0 0 1px 0 var(--border_color);
177
+ background-repeat: no-repeat;
178
+ background-position: center center;
179
+ background-size: 50% 50%;
180
+ }
181
+
182
+ .multi_combobox_option:hover .checkmark {
183
+ background-color: var(--element_background_hover);
184
+ }
185
+
186
+ .multi_combobox_option input:checked ~ .checkmark {
187
+ background-color: var(--blue_prime_background);
188
+ color: var(--text_color_hover);
189
+ border: none;
190
+ box-shadow: 0 0 1px 0 var(--blue_prime_background);
191
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3e%3c/svg%3e");
192
+ }
193
+
194
+ .multi_combobox_option input:focus-visible ~ .checkmark {
195
+ outline: var(--focus_outline);
196
+ outline-offset: var(--focus_outline_offset);
197
+ }
198
+
199
+ .multi_combobox_section {
200
+ display: flex;
201
+ align-items: flex-start;
202
+ justify-content: center;
203
+ flex-direction: column;
204
+ width: -webkit-fill-available;
205
+ height: max-content;
206
+ }
207
+
208
+ .multi_combobox_section_title {
209
+ color: var(--text_color);
210
+ font-weight: 500;
211
+ font-size: 11pt;
212
+ padding: 6px;
236
213
  }
@@ -1,108 +1,108 @@
1
- const { Icon, Icons } = require('../../chui_icons/icons');
2
-
3
- class NumberInput {
4
- #chui_number_input = document.createElement('chui_number_input');
5
- #number_main = document.createElement("number_main");
6
- #number_button_minus = document.createElement("number_button_minus");
7
- #number_button_plus = document.createElement("number_button_plus");
8
- #number_button_minus_disabled = document.createElement("number_button_minus");
9
- #number_button_plus_disabled = document.createElement("number_button_plus");
10
- #title = undefined;
11
- #id = require("randomstring").generate();
12
- #input = document.createElement('input');
13
- #label = document.createElement('label');
14
- constructor(options = { name: String(), title: String(), required: Boolean(), width: String() }) {
15
- require('../../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_NumberInput');
16
- this.#title = options.title;
17
-
18
- this.#number_button_plus.style.right = '0';
19
- this.#number_button_plus.className = 'number_buttons';
20
- this.#number_button_plus.innerHTML = new Icon(Icons.CONTENT.ADD, undefined, "var(--blue_prime_background)").getHTML();
21
- this.#number_button_minus.style.left = '0';
22
- this.#number_button_minus.className = 'number_buttons';
23
- this.#number_button_minus.innerHTML = new Icon(Icons.CONTENT.REMOVE, undefined, "var(--blue_prime_background)").getHTML();
24
-
25
- // Выключенные кнопки
26
- this.#number_button_plus_disabled.style.right = '0';
27
- this.#number_button_plus_disabled.className = 'number_buttons';
28
- this.#number_button_plus_disabled.innerHTML = new Icon(Icons.CONTENT.ADD, undefined, "var(--text_color_disabled)").getHTML();
29
- this.#number_button_plus_disabled.style.cursor = "not-allowed";
30
- this.#number_button_minus_disabled.style.left = '0';
31
- this.#number_button_minus_disabled.className = 'number_buttons';
32
- this.#number_button_minus_disabled.innerHTML = new Icon(Icons.CONTENT.REMOVE, undefined, "var(--text_color_disabled)").getHTML();
33
- this.#number_button_minus_disabled.style.cursor = "not-allowed";
34
- //
35
-
36
- this.#input.type = 'number';
37
- this.#input.className = 'number_input';
38
- this.#input.value = '0';
39
- this.#input.id = this.#id;
40
- if (options.name !== undefined) this.#input.name = options.name;
41
- if (options.required !== undefined) this.#input.required = options.required;
42
- if (options.title !== undefined) {
43
- this.#label.innerText = options.title;
44
- this.#label.classList.add('number_label')
45
- this.#label.setAttribute('for', this.#id);
46
- this.#chui_number_input.appendChild(this.#label);
47
- }
48
- if (options.width !== undefined) this.#chui_number_input.style.width = options.width;
49
- this.#input.addEventListener('focus', () => {
50
- this.#number_main.style.border = '1px solid var(--blue_prime_background)';
51
- this.#label.style.color = 'var(--blue_prime_background)';
52
- })
53
- this.#input.addEventListener('blur', () => {
54
- this.#number_main.removeAttribute("style");
55
- this.#label.removeAttribute("style");
56
- })
57
-
58
- this.#number_main.appendChild(this.#number_button_minus);
59
- this.#number_main.appendChild(this.#input);
60
- this.#number_main.appendChild(this.#number_button_plus);
61
- this.#chui_number_input.appendChild(this.#number_main);
62
-
63
- this.#number_button_plus.addEventListener('mousedown', (event) => {
64
- event.preventDefault();
65
- return false;
66
- });
67
- this.#number_button_minus.addEventListener('mousedown', (event) => {
68
- event.preventDefault();
69
- return false;
70
- });
71
-
72
- this.#number_button_plus.addEventListener('click', () => {
73
- this.#input.focus();
74
- this.#input.value++
75
- });
76
- this.#number_button_minus.addEventListener('click', () => {
77
- this.#input.focus();
78
- this.#input.value--;
79
- });
80
- }
81
- getName() { return this.#input.name; }
82
- getTitle() { return this.#title; }
83
- getValue() { return this.#input.value; }
84
- setValue(num = Number()) { this.#input.value = num; }
85
- setDisabled(boolean = Boolean()) {
86
- this.#input.disabled = boolean
87
- if (boolean) {
88
- this.#number_main.classList.add("number_main_disabled")
89
- this.#input.className = "number_input_disabled"
90
- this.#label.className = "number_label_disabled"
91
- this.#number_button_minus.remove();
92
- this.#number_button_plus.remove();
93
- this.#number_main.appendChild(this.#number_button_minus_disabled);
94
- this.#number_main.appendChild(this.#number_button_plus_disabled);
95
- } else {
96
- this.#number_main.classList.remove("number_main_disabled")
97
- this.#input.className = "number_input"
98
- this.#label.className = "number_label"
99
- this.#number_button_minus_disabled.remove();
100
- this.#number_button_plus_disabled.remove();
101
- this.#number_main.appendChild(this.#number_button_minus);
102
- this.#number_main.appendChild(this.#number_button_plus);
103
- }
104
- }
105
- set() { return this.#chui_number_input; }
106
- }
107
-
108
- exports.NumberInput = NumberInput
1
+ const { Icon, Icons } = require('../../chui_icons/icons');
2
+
3
+ class NumberInput {
4
+ #chui_number_input = document.createElement('chui_number_input');
5
+ #number_main = document.createElement("number_main");
6
+ #number_button_minus = document.createElement("number_button_minus");
7
+ #number_button_plus = document.createElement("number_button_plus");
8
+ #number_button_minus_disabled = document.createElement("number_button_minus");
9
+ #number_button_plus_disabled = document.createElement("number_button_plus");
10
+ #title = undefined;
11
+ #id = require("randomstring").generate();
12
+ #input = document.createElement('input');
13
+ #label = document.createElement('label');
14
+ constructor(options = { name: String(), title: String(), required: Boolean(), width: String() }) {
15
+ require('../../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_NumberInput');
16
+ this.#title = options.title;
17
+
18
+ this.#number_button_plus.style.right = '0';
19
+ this.#number_button_plus.className = 'number_buttons';
20
+ this.#number_button_plus.innerHTML = new Icon(Icons.CONTENT.ADD, undefined, "var(--blue_prime_background)").getHTML();
21
+ this.#number_button_minus.style.left = '0';
22
+ this.#number_button_minus.className = 'number_buttons';
23
+ this.#number_button_minus.innerHTML = new Icon(Icons.CONTENT.REMOVE, undefined, "var(--blue_prime_background)").getHTML();
24
+
25
+ // Выключенные кнопки
26
+ this.#number_button_plus_disabled.style.right = '0';
27
+ this.#number_button_plus_disabled.className = 'number_buttons';
28
+ this.#number_button_plus_disabled.innerHTML = new Icon(Icons.CONTENT.ADD, undefined, "var(--text_color_disabled)").getHTML();
29
+ this.#number_button_plus_disabled.style.cursor = "not-allowed";
30
+ this.#number_button_minus_disabled.style.left = '0';
31
+ this.#number_button_minus_disabled.className = 'number_buttons';
32
+ this.#number_button_minus_disabled.innerHTML = new Icon(Icons.CONTENT.REMOVE, undefined, "var(--text_color_disabled)").getHTML();
33
+ this.#number_button_minus_disabled.style.cursor = "not-allowed";
34
+ //
35
+
36
+ this.#input.type = 'number';
37
+ this.#input.className = 'number_input';
38
+ this.#input.value = '0';
39
+ this.#input.id = this.#id;
40
+ if (options.name !== undefined) this.#input.name = options.name;
41
+ if (options.required !== undefined) this.#input.required = options.required;
42
+ if (options.title !== undefined) {
43
+ this.#label.innerText = options.title;
44
+ this.#label.classList.add('number_label')
45
+ this.#label.setAttribute('for', this.#id);
46
+ this.#chui_number_input.appendChild(this.#label);
47
+ }
48
+ if (options.width !== undefined) this.#chui_number_input.style.width = options.width;
49
+ this.#input.addEventListener('focus', () => {
50
+ this.#number_main.style.border = '1px solid var(--blue_prime_background)';
51
+ this.#label.style.color = 'var(--blue_prime_background)';
52
+ })
53
+ this.#input.addEventListener('blur', () => {
54
+ this.#number_main.removeAttribute("style");
55
+ this.#label.removeAttribute("style");
56
+ })
57
+
58
+ this.#number_main.appendChild(this.#number_button_minus);
59
+ this.#number_main.appendChild(this.#input);
60
+ this.#number_main.appendChild(this.#number_button_plus);
61
+ this.#chui_number_input.appendChild(this.#number_main);
62
+
63
+ this.#number_button_plus.addEventListener('mousedown', (event) => {
64
+ event.preventDefault();
65
+ return false;
66
+ });
67
+ this.#number_button_minus.addEventListener('mousedown', (event) => {
68
+ event.preventDefault();
69
+ return false;
70
+ });
71
+
72
+ this.#number_button_plus.addEventListener('click', () => {
73
+ this.#input.focus();
74
+ this.#input.value++
75
+ });
76
+ this.#number_button_minus.addEventListener('click', () => {
77
+ this.#input.focus();
78
+ this.#input.value--;
79
+ });
80
+ }
81
+ getName() { return this.#input.name; }
82
+ getTitle() { return this.#title; }
83
+ getValue() { return this.#input.value; }
84
+ setValue(num = Number()) { this.#input.value = num; }
85
+ setDisabled(boolean = Boolean()) {
86
+ this.#input.disabled = boolean
87
+ if (boolean) {
88
+ this.#number_main.classList.add("number_main_disabled")
89
+ this.#input.className = "number_input_disabled"
90
+ this.#label.className = "number_label_disabled"
91
+ this.#number_button_minus.remove();
92
+ this.#number_button_plus.remove();
93
+ this.#number_main.appendChild(this.#number_button_minus_disabled);
94
+ this.#number_main.appendChild(this.#number_button_plus_disabled);
95
+ } else {
96
+ this.#number_main.classList.remove("number_main_disabled")
97
+ this.#input.className = "number_input"
98
+ this.#label.className = "number_label"
99
+ this.#number_button_minus_disabled.remove();
100
+ this.#number_button_plus_disabled.remove();
101
+ this.#number_main.appendChild(this.#number_button_minus);
102
+ this.#number_main.appendChild(this.#number_button_plus);
103
+ }
104
+ }
105
+ set() { return this.#chui_number_input; }
106
+ }
107
+
108
+ exports.NumberInput = NumberInput