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.
- package/LICENSE +21 -21
- package/README.md +1203 -162
- package/framework/appLayout/default/chui_app_layout.js +747 -747
- package/framework/appLayout/default/global_style.css +592 -570
- package/framework/appLayout/default/main_theme_style.css +118 -101
- package/framework/components/chui_accordion/accordion.js +63 -63
- package/framework/components/chui_accordion/styles.css +79 -75
- package/framework/components/chui_badge/badge.js +55 -55
- package/framework/components/chui_badge/styles.css +29 -29
- package/framework/components/chui_button/button.js +48 -48
- package/framework/components/chui_button/styles.css +75 -70
- package/framework/components/chui_calendar/calendar.js +97 -97
- package/framework/components/chui_card/card.js +87 -0
- package/framework/components/chui_card/styles.css +72 -0
- package/framework/components/chui_code/code.js +18 -18
- package/framework/components/chui_code/styles.css +9 -9
- package/framework/components/chui_console/console.js +27 -27
- package/framework/components/chui_console/styles.css +31 -31
- package/framework/components/chui_content_block/content_block.js +51 -51
- package/framework/components/chui_content_block/styles.css +2 -2
- package/framework/components/chui_context_menu/context_menu.js +230 -0
- package/framework/components/chui_context_menu/styles.css +136 -0
- package/framework/components/chui_custom_element/custom_element.js +24 -24
- package/framework/components/chui_details/details.js +85 -85
- package/framework/components/chui_details/styles.css +70 -66
- package/framework/components/chui_fieldset/fieldset.js +40 -40
- package/framework/components/chui_fieldset/styles.css +24 -24
- package/framework/components/chui_form/form.js +40 -40
- package/framework/components/chui_form/styles.css +21 -21
- package/framework/components/chui_graphs/graphs.js +234 -190
- package/framework/components/chui_graphs/styles.css +37 -32
- package/framework/components/chui_hero/hero.js +98 -0
- package/framework/components/chui_hero/styles.css +91 -0
- package/framework/components/chui_html_block/html_block.js +16 -16
- package/framework/components/chui_html_block/styles.css +5 -5
- package/framework/components/chui_hx/hx.js +15 -15
- package/framework/components/chui_hx/styles.css +38 -38
- package/framework/components/chui_icons/icons.js +2144 -2144
- package/framework/components/chui_icons/styles.css +13 -13
- package/framework/components/chui_inputs/chui_check_box/check_box.js +32 -32
- package/framework/components/chui_inputs/chui_check_box/styles.css +91 -86
- package/framework/components/chui_inputs/chui_combo_box/combo_box.js +166 -150
- package/framework/components/chui_inputs/chui_combo_box/styles.css +113 -107
- package/framework/components/chui_inputs/chui_date/date.js +177 -174
- package/framework/components/chui_inputs/chui_date/styles.css +163 -128
- package/framework/components/chui_inputs/chui_email/email.js +61 -61
- package/framework/components/chui_inputs/chui_email/styles.css +69 -71
- package/framework/components/chui_inputs/chui_file/file.js +76 -76
- package/framework/components/chui_inputs/chui_file/styles.css +99 -99
- package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +295 -295
- package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +212 -235
- package/framework/components/chui_inputs/chui_number/number.js +108 -108
- package/framework/components/chui_inputs/chui_number/styles.css +84 -84
- package/framework/components/chui_inputs/chui_password/password.js +99 -99
- package/framework/components/chui_inputs/chui_password/styles.css +97 -97
- package/framework/components/chui_inputs/chui_radio_button/radio_button.js +45 -45
- package/framework/components/chui_inputs/chui_radio_button/styles.css +76 -73
- package/framework/components/chui_inputs/chui_select_box/select_box.js +187 -170
- package/framework/components/chui_inputs/chui_select_box/styles.css +123 -117
- package/framework/components/chui_inputs/chui_text/styles.css +83 -84
- package/framework/components/chui_inputs/chui_text/text.js +91 -91
- package/framework/components/chui_inputs/chui_text_area/styles.css +57 -57
- package/framework/components/chui_inputs/chui_text_area/text_area.js +61 -61
- package/framework/components/chui_inputs/chui_toggle/styles.css +66 -61
- package/framework/components/chui_inputs/chui_toggle/toggle.js +36 -36
- package/framework/components/chui_label/label.js +54 -54
- package/framework/components/chui_label/styles.css +11 -11
- package/framework/components/chui_media/audio.js +908 -908
- package/framework/components/chui_media/audio_styles.css +458 -458
- package/framework/components/chui_media/image.js +105 -105
- package/framework/components/chui_media/image_styles.css +61 -61
- package/framework/components/chui_media/video.js +248 -248
- package/framework/components/chui_media/video_styles.css +160 -160
- package/framework/components/chui_menu_bar/menu_bar.js +66 -74
- package/framework/components/chui_menu_bar/styles.css +114 -76
- package/framework/components/chui_modal/modal.js +142 -135
- package/framework/components/chui_modal/styles.css +36 -36
- package/framework/components/chui_notification/notification.js +72 -72
- package/framework/components/chui_notification/notification_download.js +78 -78
- package/framework/components/chui_notification/notification_download_progress.css +119 -123
- package/framework/components/chui_notification/notification_download_progress.js +105 -105
- package/framework/components/chui_notification/notification_update.js +54 -54
- package/framework/components/chui_notification/styles.css +91 -91
- package/framework/components/chui_notification/styles_download.css +85 -85
- package/framework/components/chui_notification/styles_update.css +73 -73
- package/framework/components/chui_paragraph/paragraph.js +14 -14
- package/framework/components/chui_paragraph/styles.css +6 -6
- package/framework/components/chui_popups/popups.js +250 -250
- package/framework/components/chui_popups/styles.css +129 -115
- package/framework/components/chui_progress_bar/progress_bar.js +28 -28
- package/framework/components/chui_progress_bar/styles.css +28 -28
- package/framework/components/chui_radio_group/radio_group.js +57 -57
- package/framework/components/chui_radio_group/styles.css +3 -3
- package/framework/components/chui_slideshow/slideshow.js +75 -75
- package/framework/components/chui_slideshow/styles.css +94 -85
- package/framework/components/chui_spinner/spinner.js +45 -45
- package/framework/components/chui_spinner/styles.css +23 -23
- package/framework/components/chui_table/styles.css +42 -42
- package/framework/components/chui_table/table.js +234 -234
- package/framework/components/chui_tabs/chui_tabs.js +77 -77
- package/framework/components/chui_tabs/styles.css +54 -48
- package/framework/components/chui_text_editor/styles.css +217 -217
- package/framework/components/chui_text_editor/text_editor.js +144 -144
- package/framework/components/chui_text_editor/text_editor_panel.js +568 -568
- package/framework/components/chui_tree_view/styles.css +81 -75
- package/framework/components/chui_tree_view/tree_view.js +90 -90
- package/framework/components/chui_webview/styles.css +27 -27
- package/framework/components/chui_webview/webview.js +103 -103
- package/framework/components/telegram_bot/chui_telegram_bot.js +183 -183
- package/framework/modules/chui_animations/animations.js +121 -121
- package/framework/modules/chui_animations/styles.css +79 -79
- package/framework/modules/chui_fonts.js +7128 -7128
- package/framework/modules/chui_functions.js +106 -78
- package/framework/modules/chui_logger/chui_logger.js +53 -53
- package/framework/modules/chui_page/page.js +86 -86
- package/framework/modules/chui_page/styles.css +9 -9
- package/framework/tray_bar/chui_menu_items.js +48 -48
- package/index.js +570 -555
- 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(--
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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 {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (options.
|
|
22
|
-
if (options.
|
|
23
|
-
|
|
24
|
-
this.#label.
|
|
25
|
-
this.#label.
|
|
26
|
-
this.#
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.#input.
|
|
30
|
-
this.#input.
|
|
31
|
-
this.#input.
|
|
32
|
-
|
|
33
|
-
this.#input.
|
|
34
|
-
this.#
|
|
35
|
-
this.#
|
|
36
|
-
this.#button_open_disabled.
|
|
37
|
-
this.#
|
|
38
|
-
this.#
|
|
39
|
-
this.#Select_second.appendChild(this.#
|
|
40
|
-
this.#Select_second.appendChild(this.#
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.#
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.#
|
|
49
|
-
})
|
|
50
|
-
this.#Select_second.addEventListener('click', (event) => {
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
option.style.display = '
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this.#
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
option.
|
|
88
|
-
option.
|
|
89
|
-
option.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
this.#Select_main.
|
|
99
|
-
this.#
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
option.
|
|
108
|
-
option.
|
|
109
|
-
option.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
this.#Select_main.
|
|
119
|
-
this.#
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
this.#
|
|
145
|
-
this.#
|
|
146
|
-
this.#
|
|
147
|
-
|
|
148
|
-
this.#
|
|
149
|
-
this.#
|
|
150
|
-
|
|
151
|
-
this.#
|
|
152
|
-
this.#
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|