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,74 +1,77 @@
1
- radiobutton {
2
- display: flex;
3
- align-items: center;
4
- justify-content: flex-start;
5
- font-size: var(--font_labels_size);
6
- margin: var(--margin);
7
- width: max-content
8
- }
9
-
10
- .radiobutton {
11
- position: absolute;
12
- z-index: -1;
13
- opacity: 0
14
- }
15
-
16
- .radiobutton+label {
17
- display: inline-flex;
18
- align-items: center;
19
- color:var(--text_color)
20
- }
21
-
22
- .radiobutton+label::before {
23
- font-size: var(--font_default_size);
24
- content: '';
25
- display: flex;
26
- width: 1.2em;
27
- height: 1.2em;
28
- flex-shrink: 0;
29
- flex-grow:0;
30
- border-radius:50%;
31
- margin-right:10px;
32
- align-items:center;
33
- justify-content:center;
34
- color: transparent;
35
- background: var(--element_background);
36
- border: none;
37
- box-shadow: 0 0 1px 0 var(--element_background_2);
38
- }
39
-
40
- .radiobutton:not(:disabled):active+label::before {
41
- background: radial-gradient(circle, var(--text_color_hover) 22%, var(--blue_prime_background) 22%);
42
- }
43
-
44
- .radiobutton:focus+label::before {}
45
-
46
- .radiobutton:checked+label::before {
47
- background: radial-gradient(circle, var(--text_color_hover) 22%, var(--blue_prime_background) 22%);
48
- border: none;
49
- box-shadow: 0 0 1px 0 var(--blue_prime_background);
50
- }
51
-
52
- .labelr {
53
- cursor: pointer;
54
- font-size: var(--font_default_size)
55
- }
56
-
57
- .radiobutton:disabled+label {
58
- cursor: not-allowed;
59
- color: var(--text_color_disabled);
60
- }
61
-
62
- .radiobutton:disabled:not(:checked)+label::before {
63
- cursor: not-allowed;
64
- background: var(--element_background_disabled);
65
- border: none;
66
- box-shadow: 0 0 1px 0 var(--element_background_disabled_2);
67
- }
68
-
69
- .radiobutton:disabled:checked+label::before {
70
- cursor: not-allowed;
71
- background: radial-gradient(circle, var(--text_color_disabled) 22%, var(--element_background_disabled) 22%);
72
- border: none;
73
- box-shadow: 0 0 1px 0 var(--element_background_disabled_2);
1
+ radiobutton {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: flex-start;
5
+ font-size: var(--font_labels_size);
6
+ margin: var(--margin);
7
+ width: max-content
8
+ }
9
+
10
+ .radiobutton {
11
+ position: absolute;
12
+ z-index: -1;
13
+ opacity: 0
14
+ }
15
+
16
+ .radiobutton+label {
17
+ display: inline-flex;
18
+ align-items: center;
19
+ color:var(--text_color)
20
+ }
21
+
22
+ .radiobutton+label::before {
23
+ font-size: var(--font_default_size);
24
+ content: '';
25
+ display: flex;
26
+ width: 1.2em;
27
+ height: 1.2em;
28
+ flex-shrink: 0;
29
+ flex-grow:0;
30
+ border-radius:50%;
31
+ margin-right:10px;
32
+ align-items:center;
33
+ justify-content:center;
34
+ color: transparent;
35
+ background: var(--element_background);
36
+ border: none;
37
+ box-shadow: 0 0 1px 0 var(--border_color);
38
+ }
39
+
40
+ .radiobutton:not(:disabled):active+label::before {
41
+ background: radial-gradient(circle, var(--text_color_hover) 22%, var(--blue_prime_background) 22%);
42
+ }
43
+
44
+ .radiobutton:focus-visible+label::before {
45
+ outline: var(--focus_outline);
46
+ outline-offset: var(--focus_outline_offset);
47
+ }
48
+
49
+ .radiobutton:checked+label::before {
50
+ background: radial-gradient(circle, var(--text_color_hover) 22%, var(--blue_prime_background) 22%);
51
+ border: none;
52
+ box-shadow: 0 0 1px 0 var(--blue_prime_background);
53
+ }
54
+
55
+ .labelr {
56
+ cursor: pointer;
57
+ font-size: var(--font_default_size)
58
+ }
59
+
60
+ .radiobutton:disabled+label {
61
+ cursor: not-allowed;
62
+ color: var(--text_color_disabled);
63
+ }
64
+
65
+ .radiobutton:disabled:not(:checked)+label::before {
66
+ cursor: not-allowed;
67
+ background: var(--element_background_disabled);
68
+ border: none;
69
+ box-shadow: 0 0 1px 0 var(--border_color);
70
+ }
71
+
72
+ .radiobutton:disabled:checked+label::before {
73
+ cursor: not-allowed;
74
+ background: radial-gradient(circle, var(--text_color_disabled) 22%, var(--element_background_disabled) 22%);
75
+ border: none;
76
+ box-shadow: 0 0 1px 0 var(--border_color);
74
77
  }
@@ -1,170 +1,187 @@
1
- const { Animation } = require('../../../modules/chui_animations/animations');
2
- const { Icon, Icons } = require('../../chui_icons/icons');
3
-
4
- class Select {
5
- #id = require("randomstring").generate();
6
- #id_sb = require("randomstring").generate();
7
- #Select_main = document.createElement('chui_selectbox');
8
- #Select_second = document.createElement('selectbox');
9
- #label = document.createElement('label');
10
- #input = document.createElement('input');
11
- #button_open = document.createElement('select_button_open');
12
- #button_open_disabled = document.createElement('select_button_open');
13
- #disabled_trigger = false;
14
- #dropdown = document.createElement('selectbox_dropdown');
15
- constructor(options = {
16
- name: String(), title: String(), placeholder: String(),
17
- width: String(), required: Boolean()
18
- }) {
19
- require('../../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_Select');
20
- if (options.width !== undefined) this.#Select_main.style.width = options.width;
21
- if (options.placeholder !== undefined) this.#input.placeholder = options.placeholder;
22
- if (options.title !== undefined) {
23
- this.#label.classList.add('select_label')
24
- this.#label.innerText = options.title;
25
- this.#label.setAttribute('for', this.#id_sb);
26
- this.#Select_main.appendChild(this.#label);
27
- }
28
- if (options.required !== undefined) this.#input.required = options.required;
29
- this.#input.setAttribute('id', this.#id_sb);
30
- this.#input.classList.add('selectbox_input');
31
- this.#input.type = 'text';
32
- if (options.name !== undefined) this.#input.name = options.name;
33
- this.#input.disabled = true
34
- this.#button_open.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_DOWN, undefined, "var(--blue_prime_background)").getHTML();
35
- this.#button_open_disabled.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_DOWN, undefined, "var(--text_color_disabled)").getHTML();
36
- this.#button_open_disabled.style.cursor = "not-allowed";
37
- this.#dropdown.setAttribute('id', this.#id);
38
- this.#Select_second.appendChild(this.#input)
39
- this.#Select_second.appendChild(this.#button_open)
40
- this.#Select_second.appendChild(this.#dropdown)
41
- //LISTENERS
42
- this.#input.addEventListener('focus', () => {
43
- this.#button_open.style.transform = 'rotate(180deg)'
44
- this.#Select_second.style.border = '1px solid var(--blue_prime_background)';
45
- })
46
- this.#input.addEventListener('blur', () => {
47
- this.#button_open.style.transform = 'rotate(0deg)'
48
- this.#Select_second.removeAttribute('style')
49
- })
50
- this.#Select_second.addEventListener('click', (event) => {
51
- if (!this.#disabled_trigger) {
52
- if (event.target.parentNode === this.#Select_second) {
53
- this.#input.focus()
54
- //this.#setWidthDropDown()
55
- new Animation(this.#dropdown).fadeIn();
56
- setOptionDisplay(document.getElementById(this.#id));
57
- }
58
- }
59
- });
60
- window.addEventListener('click', (event) => {
61
- if (event.target.parentNode !== this.#Select_second) {
62
- new Animation(this.#dropdown).fadeOut();
63
- }
64
- });
65
- this.#input.addEventListener('input', (event) => {
66
- let dropdown = document.getElementById(this.#id);
67
- for (let option of dropdown.childNodes) {
68
- if (!option.getAttribute('option_value').includes(event.target.value)) {
69
- option.style.display = 'none'
70
- } else {
71
- option.style.display = 'block'
72
- }
73
- }
74
- });
75
- this.#Select_main.appendChild(this.#Select_second)
76
- }
77
- setBottonOpenVisible(visible = Boolean()) {
78
- if (!visible) {
79
- this.#button_open.style.display = 'none';
80
- this.#input.style.padding = '5px 10px';
81
- this.#input.style.textAlign = 'left'
82
- }
83
- }
84
- addOption(title, value) {
85
- let option = document.createElement(`selectbox_option`);
86
- option.innerHTML = title;
87
- option.setAttribute('option_title', title);
88
- option.setAttribute('option_value', value);
89
- option.addEventListener('click', () => {
90
- const eventAwesome = new CustomEvent("chui_select_option_changed", {
91
- detail: {
92
- title: option.getAttribute('option_title'),
93
- value: option.getAttribute('option_value')
94
- },
95
- });
96
- this.#Select_main.dispatchEvent(eventAwesome)
97
- this.#input.setAttribute("value", option.getAttribute('option_title'));
98
- this.#Select_main.setAttribute("option_title", option.getAttribute('option_title'));
99
- this.#Select_main.setAttribute("option_value", option.getAttribute('option_value'));
100
- });
101
- this.#dropdown.appendChild(option);
102
- }
103
- addOptions(...options) {
104
- for (let opt of options) {
105
- let option = document.createElement(`selectbox_option`);
106
- option.innerHTML = opt.title;
107
- option.setAttribute('option_title', opt.title);
108
- option.setAttribute('option_value', opt.value);
109
- option.addEventListener('click', () => {
110
- const eventAwesome = new CustomEvent("chui_select_option_changed", {
111
- detail: {
112
- title: option.getAttribute('option_title'),
113
- value: option.getAttribute('option_value')
114
- },
115
- });
116
- this.#Select_main.dispatchEvent(eventAwesome)
117
- this.#input.setAttribute("value", option.getAttribute('option_title'));
118
- this.#Select_main.setAttribute("option_title", option.getAttribute('option_title'));
119
- this.#Select_main.setAttribute("option_value", option.getAttribute('option_value'));
120
- });
121
- this.#dropdown.appendChild(option);
122
- }
123
- }
124
- setDropdownHeight(height = String()) {
125
- this.#dropdown.style.height = height;
126
- }
127
- setDefaultOption(object = Object()) {
128
- let opt = this.#dropdown.getElementsByTagName('selectbox_option');
129
- for (let i = 0; i < opt.length; i++) {
130
- let test = opt.item(i);
131
- if (test.getAttribute('option_value') === object.toString()) test.click()
132
- }
133
- }
134
- addValueChangeListener(listener = () => {}) {
135
- this.#Select_main.addEventListener("chui_select_option_changed", listener)
136
- }
137
- getName() { return this.#input.name; }
138
- getValue() { return this.#input.value; }
139
- setDisabled(boolean = Boolean()) {
140
- this.#disabled_trigger = boolean
141
- if (boolean) {
142
- this.#Select_second.classList.add("selectbox_disabled")
143
- this.#input.className = "selectbox_input_disabled"
144
- this.#label.className = "select_label_disabled"
145
- this.#button_open.remove();
146
- this.#Select_second.appendChild(this.#button_open_disabled);
147
- } else {
148
- this.#Select_second.classList.remove("selectbox_disabled")
149
- this.#input.className = "selectbox_input"
150
- this.#label.className = "select_label"
151
- this.#button_open_disabled.remove();
152
- this.#Select_second.appendChild(this.#button_open);
153
- }
154
- }
155
- set() { return this.#Select_main; }
156
- #setWidthDropDown() {
157
- let dropdown_styles = window.getComputedStyle(this.#dropdown, null);
158
- let select_main_styles = window.getComputedStyle(this.#Select_main, null);
159
- let drop_padding = parseInt(dropdown_styles.padding) * 2;
160
- let drop_border = parseInt(dropdown_styles.border) * 2;
161
- let select_width = parseInt(select_main_styles.width);
162
- this.#dropdown.style.width = `${select_width - drop_border - drop_padding}px`;
163
- }
164
- }
165
-
166
- function setOptionDisplay(element = new HTMLElement()) {
167
- for (let option of element.childNodes) { option.style.display = 'block'; }
168
- }
169
-
170
- exports.Select = Select
1
+ const { Animation } = require('../../../modules/chui_animations/animations');
2
+ const { shouldOpenDropdownUp } = require('../../../modules/chui_functions');
3
+ const { Icon, Icons } = require('../../chui_icons/icons');
4
+
5
+ class Select {
6
+ #id = require("randomstring").generate();
7
+ #id_sb = require("randomstring").generate();
8
+ #Select_main = document.createElement('chui_selectbox');
9
+ #Select_second = document.createElement('selectbox');
10
+ #label = document.createElement('label');
11
+ #input = document.createElement('input');
12
+ #button_open = document.createElement('select_button_open');
13
+ #button_open_disabled = document.createElement('select_button_open');
14
+ #disabled_trigger = false;
15
+ #dropdown = document.createElement('selectbox_dropdown');
16
+ constructor(options = {
17
+ name: String(), title: String(), placeholder: String(),
18
+ width: String(), required: Boolean()
19
+ }) {
20
+ require('../../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_Select');
21
+ if (options.width !== undefined) this.#Select_main.style.width = options.width;
22
+ if (options.placeholder !== undefined) this.#input.placeholder = options.placeholder;
23
+ if (options.title !== undefined) {
24
+ this.#label.classList.add('select_label')
25
+ this.#label.innerText = options.title;
26
+ this.#label.setAttribute('for', this.#id_sb);
27
+ this.#Select_main.appendChild(this.#label);
28
+ }
29
+ if (options.required !== undefined) this.#input.required = options.required;
30
+ this.#input.setAttribute('id', this.#id_sb);
31
+ this.#input.classList.add('selectbox_input');
32
+ this.#input.type = 'text';
33
+ if (options.name !== undefined) this.#input.name = options.name;
34
+ this.#input.readOnly = true
35
+ this.#button_open.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_DOWN, undefined, "var(--blue_prime_background)").getHTML();
36
+ this.#button_open_disabled.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_DOWN, undefined, "var(--text_color_disabled)").getHTML();
37
+ this.#button_open_disabled.style.cursor = "not-allowed";
38
+ this.#dropdown.setAttribute('id', this.#id);
39
+ this.#Select_second.appendChild(this.#input)
40
+ this.#Select_second.appendChild(this.#button_open)
41
+ this.#Select_second.appendChild(this.#dropdown)
42
+ //LISTENERS
43
+ this.#input.addEventListener('focus', () => {
44
+ if (this.#disabled_trigger) return;
45
+ this.#setOpenState(true)
46
+ })
47
+ this.#input.addEventListener('blur', () => {
48
+ this.#setOpenState(false)
49
+ })
50
+ this.#Select_second.addEventListener('click', (event) => {
51
+ if (this.#disabled_trigger) return;
52
+ if (event.target.parentNode === this.#Select_second) {
53
+ this.#setOpenState(true)
54
+ this.#input.focus()
55
+ //this.#setWidthDropDown()
56
+ new Animation(this.#dropdown).fadeIn();
57
+ setOptionDisplay(document.getElementById(this.#id));
58
+ this.#setDropdownDirection();
59
+ }
60
+ });
61
+ window.addEventListener('click', (event) => {
62
+ if (event.target.parentNode !== this.#Select_second) {
63
+ this.#setOpenState(false)
64
+ new Animation(this.#dropdown).fadeOut();
65
+ }
66
+ });
67
+ this.#input.addEventListener('input', (event) => {
68
+ let dropdown = document.getElementById(this.#id);
69
+ for (let option of dropdown.childNodes) {
70
+ if (!option.getAttribute('option_value').includes(event.target.value)) {
71
+ option.style.display = 'none'
72
+ } else {
73
+ option.style.display = 'block'
74
+ }
75
+ }
76
+ });
77
+ this.#Select_main.appendChild(this.#Select_second)
78
+ }
79
+ setBottonOpenVisible(visible = Boolean()) {
80
+ if (!visible) {
81
+ this.#button_open.style.display = 'none';
82
+ this.#input.style.padding = '5px 10px';
83
+ this.#input.style.textAlign = 'left'
84
+ }
85
+ }
86
+ addOption(title, value) {
87
+ let option = document.createElement(`selectbox_option`);
88
+ option.innerHTML = title;
89
+ option.setAttribute('option_title', title);
90
+ option.setAttribute('option_value', value);
91
+ option.addEventListener('click', () => {
92
+ const eventAwesome = new CustomEvent("chui_select_option_changed", {
93
+ detail: {
94
+ title: option.getAttribute('option_title'),
95
+ value: option.getAttribute('option_value')
96
+ },
97
+ });
98
+ this.#Select_main.dispatchEvent(eventAwesome)
99
+ this.#input.setAttribute("value", option.getAttribute('option_title'));
100
+ this.#Select_main.setAttribute("option_title", option.getAttribute('option_title'));
101
+ this.#Select_main.setAttribute("option_value", option.getAttribute('option_value'));
102
+ });
103
+ this.#dropdown.appendChild(option);
104
+ }
105
+ addOptions(...options) {
106
+ for (let opt of options) {
107
+ let option = document.createElement(`selectbox_option`);
108
+ option.innerHTML = opt.title;
109
+ option.setAttribute('option_title', opt.title);
110
+ option.setAttribute('option_value', opt.value);
111
+ option.addEventListener('click', () => {
112
+ const eventAwesome = new CustomEvent("chui_select_option_changed", {
113
+ detail: {
114
+ title: option.getAttribute('option_title'),
115
+ value: option.getAttribute('option_value')
116
+ },
117
+ });
118
+ this.#Select_main.dispatchEvent(eventAwesome)
119
+ this.#input.setAttribute("value", option.getAttribute('option_title'));
120
+ this.#Select_main.setAttribute("option_title", option.getAttribute('option_title'));
121
+ this.#Select_main.setAttribute("option_value", option.getAttribute('option_value'));
122
+ });
123
+ this.#dropdown.appendChild(option);
124
+ }
125
+ }
126
+ setDropdownHeight(height = String()) {
127
+ this.#dropdown.style.height = height;
128
+ }
129
+ setDefaultOption(object = Object()) {
130
+ let opt = this.#dropdown.getElementsByTagName('selectbox_option');
131
+ for (let i = 0; i < opt.length; i++) {
132
+ let test = opt.item(i);
133
+ if (test.getAttribute('option_value') === object.toString()) test.click()
134
+ }
135
+ }
136
+ addValueChangeListener(listener = () => {}) {
137
+ this.#Select_main.addEventListener("chui_select_option_changed", listener)
138
+ }
139
+ getName() { return this.#input.name; }
140
+ getValue() { return this.#input.value; }
141
+ setDisabled(boolean = Boolean()) {
142
+ this.#disabled_trigger = boolean
143
+ if (boolean) {
144
+ this.#setOpenState(false)
145
+ this.#Select_second.classList.add("selectbox_disabled")
146
+ this.#input.className = "selectbox_input_disabled"
147
+ this.#label.className = "select_label_disabled"
148
+ this.#button_open.remove();
149
+ this.#Select_second.appendChild(this.#button_open_disabled);
150
+ } else {
151
+ this.#Select_second.classList.remove("selectbox_disabled")
152
+ this.#input.className = "selectbox_input"
153
+ this.#label.className = "select_label"
154
+ this.#button_open_disabled.remove();
155
+ this.#Select_second.appendChild(this.#button_open);
156
+ }
157
+ }
158
+ #setOpenState(opened = Boolean()) {
159
+ this.#button_open.style.transform = opened ? 'rotate(180deg)' : 'rotate(0deg)'
160
+ if (opened) {
161
+ this.#Select_second.style.border = '1px solid var(--blue_prime_background)';
162
+ } else {
163
+ this.#Select_second.removeAttribute('style')
164
+ }
165
+ }
166
+ #setDropdownDirection() {
167
+ const openUp = shouldOpenDropdownUp(this.#dropdown, this.#Select_second);
168
+ this.#dropdown.style.top = openUp ? 'auto' : '';
169
+ this.#dropdown.style.bottom = openUp ? '100%' : '';
170
+ this.#dropdown.style.marginTop = openUp ? '0' : '';
171
+ }
172
+ set() { return this.#Select_main; }
173
+ #setWidthDropDown() {
174
+ let dropdown_styles = window.getComputedStyle(this.#dropdown, null);
175
+ let select_main_styles = window.getComputedStyle(this.#Select_main, null);
176
+ let drop_padding = parseInt(dropdown_styles.padding) * 2;
177
+ let drop_border = parseInt(dropdown_styles.border) * 2;
178
+ let select_width = parseInt(select_main_styles.width);
179
+ this.#dropdown.style.width = `${select_width - drop_border - drop_padding}px`;
180
+ }
181
+ }
182
+
183
+ function setOptionDisplay(element = new HTMLElement()) {
184
+ for (let option of element.childNodes) { option.style.display = 'block'; }
185
+ }
186
+
187
+ exports.Select = Select