chuijs 3.6.2 → 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 -568
- 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 +7129 -6974
- 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,108 +1,114 @@
|
|
|
1
|
-
chui_combobox {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
height: max-content;
|
|
5
|
-
margin: var(--margin);
|
|
6
|
-
width:
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
combobox {
|
|
10
|
-
position: relative;
|
|
11
|
-
display:flex;
|
|
12
|
-
height: max-content;
|
|
13
|
-
width: -webkit-fill-available;
|
|
14
|
-
border-radius: var(--border_radius);
|
|
15
|
-
padding: 0;
|
|
16
|
-
font-size: var(--font_default_size);
|
|
17
|
-
background: var(--element_background);
|
|
18
|
-
border: 1px solid var(--border_color);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.combobox_input {
|
|
22
|
-
width: 100%;
|
|
23
|
-
margin: 0;
|
|
24
|
-
padding: var(--test_padding) 0 var(--test_padding) 10px;
|
|
25
|
-
background: transparent;
|
|
26
|
-
color: var(--text_color);
|
|
27
|
-
border: none;
|
|
28
|
-
font-size: var(--font_default_size);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
combobox_dropdown {
|
|
32
|
-
background: var(--
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
.
|
|
89
|
-
cursor: not-allowed;
|
|
90
|
-
background:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
1
|
+
chui_combobox {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
height: max-content;
|
|
5
|
+
margin: var(--margin);
|
|
6
|
+
width: var(--control_width)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
combobox {
|
|
10
|
+
position: relative;
|
|
11
|
+
display:flex;
|
|
12
|
+
height: max-content;
|
|
13
|
+
width: -webkit-fill-available;
|
|
14
|
+
border-radius: var(--border_radius);
|
|
15
|
+
padding: 0;
|
|
16
|
+
font-size: var(--font_default_size);
|
|
17
|
+
background: var(--element_background);
|
|
18
|
+
border: 1px solid var(--border_color);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.combobox_input {
|
|
22
|
+
width: 100%;
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: var(--test_padding) 0 var(--test_padding) 10px;
|
|
25
|
+
background: transparent;
|
|
26
|
+
color: var(--text_color);
|
|
27
|
+
border: none;
|
|
28
|
+
font-size: var(--font_default_size);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
combobox_dropdown {
|
|
32
|
+
background: var(--header_background);
|
|
33
|
+
backdrop-filter: var(--global_blur);
|
|
34
|
+
-webkit-backdrop-filter: var(--global_blur);
|
|
35
|
+
position:absolute;
|
|
36
|
+
display:none;
|
|
37
|
+
height: max-content;
|
|
38
|
+
border-radius: var(--border_radius);
|
|
39
|
+
margin-top: 36px;
|
|
40
|
+
padding: var(--test_padding);
|
|
41
|
+
font-size: var(--font_default_size);
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
z-index: 1;
|
|
44
|
+
width: -webkit-fill-available;
|
|
45
|
+
overflow: hidden hidden;
|
|
46
|
+
box-shadow: var(--box_shadow_main);
|
|
47
|
+
border: 1px solid var(--border_color);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
combobox_dropdown:hover {
|
|
51
|
+
overflow: hidden overlay
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.combobox_label {
|
|
55
|
+
height: max-content;
|
|
56
|
+
width: max-content;
|
|
57
|
+
margin: var(--margin);
|
|
58
|
+
font-size: var(--font_labels_size);
|
|
59
|
+
font-weight:500;
|
|
60
|
+
color: var(--text_color)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
combo_button_open {
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
padding: var(--main_padding);
|
|
66
|
+
color: var(--blue_prime_background)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
combobox_option {
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
text-align: start;
|
|
72
|
+
padding: var(--test_padding);
|
|
73
|
+
border-radius: var(--border_radius);
|
|
74
|
+
color: var(--text_color)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
combobox_option:hover {
|
|
78
|
+
background: var(--blue_prime_background);
|
|
79
|
+
color: var(--text_color_hover);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
combobox_option:active {
|
|
83
|
+
background: var(--element_background_prime);
|
|
84
|
+
color: var(--text_color_hover);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* DISABLED STYLES */
|
|
88
|
+
.combobox_disabled {
|
|
89
|
+
cursor: not-allowed;
|
|
90
|
+
background: var(--element_background_disabled);
|
|
91
|
+
border: 1px solid var(--border_color);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.combobox_input_disabled {
|
|
95
|
+
cursor: not-allowed;
|
|
96
|
+
background: transparent;
|
|
97
|
+
color: var(--text_color_disabled);
|
|
98
|
+
text-align: start;
|
|
99
|
+
width: 100%;
|
|
100
|
+
margin: 0;
|
|
101
|
+
padding: var(--test_padding) 0 var(--test_padding) 10px;
|
|
102
|
+
border: none;
|
|
103
|
+
font-size: var(--font_default_size);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.combobox_label_disabled {
|
|
107
|
+
cursor: not-allowed;
|
|
108
|
+
height: max-content;
|
|
109
|
+
width: max-content;
|
|
110
|
+
margin: var(--margin);
|
|
111
|
+
font-size: var(--font_labels_size);
|
|
112
|
+
font-weight:500;
|
|
113
|
+
color: var(--text_color_disabled)
|
|
108
114
|
}
|
|
@@ -1,174 +1,177 @@
|
|
|
1
|
-
const {Animation} = require('../../../modules/chui_animations/animations');
|
|
2
|
-
const {Calendar} = require('../../chui_calendar/calendar');
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.#
|
|
26
|
-
this.#
|
|
27
|
-
this.#
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.#
|
|
36
|
-
this.#label.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this.#
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
this.#date_main_block.classList.
|
|
159
|
-
this.#input.className = "
|
|
160
|
-
this.#label.className = "
|
|
161
|
-
this.#
|
|
162
|
-
this.#date_main_block.appendChild(this.#
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
1
|
+
const {Animation} = require('../../../modules/chui_animations/animations');
|
|
2
|
+
const {Calendar} = require('../../chui_calendar/calendar');
|
|
3
|
+
const {Icon, Icons} = require('../../chui_icons/icons');
|
|
4
|
+
|
|
5
|
+
const MONTHS_IN_YEAR = 12;
|
|
6
|
+
const isDayNumber = (cell) => /^\d+$/.test(String(cell).trim());
|
|
7
|
+
|
|
8
|
+
class DateInput {
|
|
9
|
+
#id = require("randomstring").generate();
|
|
10
|
+
#chui_date_input = document.createElement('chui_date_input');
|
|
11
|
+
#date_main_block = document.createElement('date_main_block');
|
|
12
|
+
#input = document.createElement('input');
|
|
13
|
+
#label = document.createElement('label');
|
|
14
|
+
#date_dropdown_open = document.createElement('date_dropdown_open');
|
|
15
|
+
#date_dropdown_open_disabled = document.createElement('date_dropdown_open');
|
|
16
|
+
#dropdown = document.createElement('date_select_dropdown');
|
|
17
|
+
#dropdown_id = require("randomstring").generate();
|
|
18
|
+
#date_now = new Date();
|
|
19
|
+
#date_month_list = document.createElement('date_month_list');
|
|
20
|
+
#date_calendar_title = document.createElement('date_calendar_title');
|
|
21
|
+
#calendar_year = this.#date_now.getFullYear();
|
|
22
|
+
#calendar_month = this.#date_now.getMonth();
|
|
23
|
+
constructor(options = { name: String(), title: String(), required: Boolean() }) {
|
|
24
|
+
require('../../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_DateInput');
|
|
25
|
+
this.#date_main_block.style.display = 'flex';
|
|
26
|
+
this.#input.type = 'date';
|
|
27
|
+
this.#input.className = "date_input";
|
|
28
|
+
this.#input.id = this.#id;
|
|
29
|
+
if (options.name !== undefined) this.#input.name = options.name;
|
|
30
|
+
if (options.required !== undefined) this.#input.required = options.required;
|
|
31
|
+
this.#date_dropdown_open.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_DOWN, undefined, "var(--blue_prime_background)").getHTML();
|
|
32
|
+
this.#date_dropdown_open_disabled.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_DOWN, undefined, "var(--text_color_disabled)").getHTML();
|
|
33
|
+
this.#date_dropdown_open_disabled.style.cursor = "not-allowed";
|
|
34
|
+
if (options.title !== undefined) {
|
|
35
|
+
this.#label.classList.add('date_input_label')
|
|
36
|
+
this.#label.innerText = options.title;
|
|
37
|
+
this.#label.setAttribute('for', this.#id);
|
|
38
|
+
this.#chui_date_input.appendChild(this.#label);
|
|
39
|
+
}
|
|
40
|
+
this.#input.addEventListener('focus', () => {
|
|
41
|
+
this.#date_main_block.style.border = '1px solid var(--blue_prime_background)';
|
|
42
|
+
this.#label.style.color = 'var(--blue_prime_background)';
|
|
43
|
+
})
|
|
44
|
+
this.#input.addEventListener('blur', () => {
|
|
45
|
+
this.#date_main_block.removeAttribute("style");
|
|
46
|
+
this.#label.removeAttribute("style");
|
|
47
|
+
});
|
|
48
|
+
this.#dropdown.setAttribute('id', this.#dropdown_id);
|
|
49
|
+
this.#dropdown.appendChild(this.#buildCalendarHeader());
|
|
50
|
+
this.#dropdown.appendChild(this.#date_month_list);
|
|
51
|
+
this.#buildYear(this.#calendar_year);
|
|
52
|
+
this.#showMonth(this.#calendar_month);
|
|
53
|
+
//LISTENERS
|
|
54
|
+
this.#chui_date_input.addEventListener('click', (event) => {
|
|
55
|
+
if (!this.#input.disabled) {
|
|
56
|
+
if (event.target.parentNode === this.#date_main_block) {
|
|
57
|
+
this.#input.focus()
|
|
58
|
+
new Animation(this.#dropdown).fadeIn();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
window.addEventListener('click', (event) => {
|
|
63
|
+
if (!this.#date_main_block.contains(event.target)) {
|
|
64
|
+
new Animation(this.#dropdown).fadeOut();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
this.#date_main_block.appendChild(this.#input);
|
|
68
|
+
this.#date_main_block.appendChild(this.#date_dropdown_open);
|
|
69
|
+
this.#date_main_block.appendChild(this.#dropdown);
|
|
70
|
+
this.#chui_date_input.appendChild(this.#date_main_block);
|
|
71
|
+
}
|
|
72
|
+
#buildCalendarHeader() {
|
|
73
|
+
const header = document.createElement('date_calendar_header');
|
|
74
|
+
const previous = document.createElement('date_calendar_nav');
|
|
75
|
+
previous.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_LEFT, undefined, "var(--text_color)").getHTML();
|
|
76
|
+
previous.addEventListener('click', (event) => {
|
|
77
|
+
event.stopPropagation();
|
|
78
|
+
this.#goToMonth(-1);
|
|
79
|
+
});
|
|
80
|
+
const next = document.createElement('date_calendar_nav');
|
|
81
|
+
next.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_RIGHT, undefined, "var(--text_color)").getHTML();
|
|
82
|
+
next.addEventListener('click', (event) => {
|
|
83
|
+
event.stopPropagation();
|
|
84
|
+
this.#goToMonth(1);
|
|
85
|
+
});
|
|
86
|
+
header.appendChild(previous);
|
|
87
|
+
header.appendChild(this.#date_calendar_title);
|
|
88
|
+
header.appendChild(next);
|
|
89
|
+
return header;
|
|
90
|
+
}
|
|
91
|
+
#buildYear(year) {
|
|
92
|
+
this.#date_month_list.innerHTML = '';
|
|
93
|
+
for (let i = 0; i < MONTHS_IN_YEAR; i++) {
|
|
94
|
+
const cal = new Calendar(year, i + 1);
|
|
95
|
+
const date_month_main = document.createElement('date_month_main');
|
|
96
|
+
date_month_main.setAttribute('month-name', cal.getMonthName());
|
|
97
|
+
date_month_main.setAttribute('month-index', String(cal.getMonth()));
|
|
98
|
+
date_month_main.style.width = 'fit-content';
|
|
99
|
+
for (let row of cal.getCalendar()) {
|
|
100
|
+
const date_week = document.createElement('date_week');
|
|
101
|
+
let index = 0;
|
|
102
|
+
for (let cell of row) {
|
|
103
|
+
const date_day = document.createElement('date_day');
|
|
104
|
+
if (cell !== undefined) {
|
|
105
|
+
date_day.innerText = cell;
|
|
106
|
+
if (isDayNumber(cell)) {
|
|
107
|
+
date_day.classList = 'date_day';
|
|
108
|
+
date_day.addEventListener("click", () => {
|
|
109
|
+
const selected = new Date(cal.getYear(), cal.getMonth(), Number(cell));
|
|
110
|
+
this.#input.value = formatLocalDate(selected);
|
|
111
|
+
new Animation(this.#dropdown).fadeOut();
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
index++;
|
|
116
|
+
}
|
|
117
|
+
date_week.appendChild(date_day);
|
|
118
|
+
}
|
|
119
|
+
if (index !== 7) {
|
|
120
|
+
date_month_main.appendChild(date_week);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
this.#date_month_list.appendChild(date_month_main);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
#showMonth(index) {
|
|
127
|
+
this.#calendar_month = index;
|
|
128
|
+
const months = this.#date_month_list.querySelectorAll('date_month_main');
|
|
129
|
+
for (let month of months) {
|
|
130
|
+
month.style.display = Number(month.getAttribute('month-index')) === index ? 'block' : 'none';
|
|
131
|
+
}
|
|
132
|
+
this.#date_calendar_title.innerText = new Date(this.#calendar_year, index)
|
|
133
|
+
.toLocaleString('default', {month: 'long'}).toUpperCase() + ' ' + this.#calendar_year;
|
|
134
|
+
}
|
|
135
|
+
#goToMonth(delta) {
|
|
136
|
+
let month = this.#calendar_month + delta;
|
|
137
|
+
let year = this.#calendar_year;
|
|
138
|
+
if (month < 0) {
|
|
139
|
+
month = MONTHS_IN_YEAR - 1;
|
|
140
|
+
year--;
|
|
141
|
+
} else if (month >= MONTHS_IN_YEAR) {
|
|
142
|
+
month = 0;
|
|
143
|
+
year++;
|
|
144
|
+
}
|
|
145
|
+
if (year !== this.#calendar_year) {
|
|
146
|
+
this.#calendar_year = year;
|
|
147
|
+
this.#buildYear(year);
|
|
148
|
+
}
|
|
149
|
+
this.#showMonth(month);
|
|
150
|
+
}
|
|
151
|
+
getName() { return this.#input.name; }
|
|
152
|
+
getTitle() { return this.#label.innerText; }
|
|
153
|
+
getValue() { return this.#input.value; }
|
|
154
|
+
setValue(date = String()) { this.#input.value = date; }
|
|
155
|
+
setDisabled(boolean = Boolean()) {
|
|
156
|
+
this.#input.disabled = boolean
|
|
157
|
+
if (boolean) {
|
|
158
|
+
this.#date_main_block.classList.add("date_main_block_disabled")
|
|
159
|
+
this.#input.className = "date_input_disabled"
|
|
160
|
+
this.#label.className = "date_input_label_disabled"
|
|
161
|
+
this.#date_dropdown_open.remove();
|
|
162
|
+
this.#date_main_block.appendChild(this.#date_dropdown_open_disabled);
|
|
163
|
+
} else {
|
|
164
|
+
this.#date_main_block.classList.remove("date_main_block_disabled")
|
|
165
|
+
this.#input.className = "date_input"
|
|
166
|
+
this.#label.className = "date_input_label"
|
|
167
|
+
this.#date_dropdown_open_disabled.remove();
|
|
168
|
+
this.#date_main_block.appendChild(this.#date_dropdown_open);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
set() { return this.#chui_date_input; }
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const formatLocalDate = (date) =>
|
|
175
|
+
date.getFullYear() + "-" + String(date.getMonth() + 1).padStart(2, "0") + "-" + String(date.getDate()).padStart(2, "0");
|
|
176
|
+
|
|
177
|
+
exports.DateInput = DateInput
|