chuijs 4.0.3 → 4.0.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/CHANGELOG.md +536 -0
- package/framework/appLayout/default/chui_app_layout.js +361 -303
- package/framework/appLayout/default/global_style.css +243 -89
- package/framework/appLayout/default/main_theme_style.css +188 -101
- package/framework/components/chui_accordion/accordion.js +17 -17
- package/framework/components/chui_accordion/styles.css +7 -7
- package/framework/components/chui_action_sheet/action_sheet.js +35 -32
- package/framework/components/chui_action_sheet/styles.css +10 -4
- package/framework/components/chui_actions_bar/actions_bar.js +338 -0
- package/framework/components/chui_actions_bar/styles.css +139 -0
- package/framework/components/chui_affix/affix.js +4 -4
- package/framework/components/chui_affix/styles.css +5 -0
- package/framework/components/chui_alert/alert.js +11 -5
- package/framework/components/chui_alert/styles.css +7 -0
- package/framework/components/chui_avatar/avatar.js +13 -13
- package/framework/components/chui_avatar/styles.css +1 -1
- package/framework/components/chui_avatar_group/avatar_group.js +4 -4
- package/framework/components/chui_avatar_group/styles.css +1 -1
- package/framework/components/chui_backtop/backtop.js +25 -2
- package/framework/components/chui_backtop/styles.css +21 -0
- package/framework/components/chui_badge/badge.js +15 -15
- package/framework/components/chui_badge/styles.css +6 -6
- package/framework/components/chui_banner/banner.js +222 -0
- package/framework/components/chui_banner/styles.css +170 -0
- package/framework/components/chui_breadcrumb/styles.css +1 -1
- package/framework/components/chui_button/button.js +24 -28
- package/framework/components/chui_button/styles.css +5 -5
- package/framework/components/chui_calendar/calendar.js +6 -6
- package/framework/components/chui_card/card.js +14 -14
- package/framework/components/chui_card_scroll/card_scroll.js +169 -0
- package/framework/components/chui_card_scroll/styles.css +86 -0
- package/framework/components/chui_chat/chat.js +73 -51
- package/framework/components/chui_chat/styles.css +18 -7
- package/framework/components/chui_clipboard_history/clipboard_history.js +25 -20
- package/framework/components/chui_clipboard_history/styles.css +10 -8
- package/framework/components/chui_code/code.js +8 -8
- package/framework/components/chui_code/styles.css +2 -2
- package/framework/components/chui_code_editor/code_editor.js +26 -26
- package/framework/components/chui_code_editor/styles.css +3 -3
- package/framework/components/chui_command_palette/command_palette.js +29 -29
- package/framework/components/chui_command_palette/styles.css +5 -5
- package/framework/components/chui_console/console.js +9 -9
- package/framework/components/chui_console/styles.css +5 -2
- package/framework/components/chui_content_block/content_block.js +2 -2
- package/framework/components/chui_context_menu/context_menu.js +162 -54
- package/framework/components/chui_context_menu/styles.css +82 -8
- package/framework/components/chui_custom_element/custom_element.js +11 -11
- package/framework/components/chui_data_grid/data_grid.js +268 -268
- package/framework/components/chui_data_grid/styles.css +14 -14
- package/framework/components/chui_descriptions/styles.css +1 -1
- package/framework/components/chui_details/details.js +12 -12
- package/framework/components/chui_details/styles.css +7 -7
- package/framework/components/chui_diff_viewer/diff_viewer.js +88 -88
- package/framework/components/chui_diff_viewer/styles.css +9 -9
- package/framework/components/chui_divider/divider.js +6 -6
- package/framework/components/chui_divider/styles.css +2 -2
- package/framework/components/chui_drawer/drawer.js +37 -14
- package/framework/components/chui_drawer/styles.css +18 -4
- package/framework/components/chui_drop_zone/drop_zone.js +6 -6
- package/framework/components/chui_drop_zone/styles.css +10 -6
- package/framework/components/chui_fieldset/fieldset.js +6 -6
- package/framework/components/chui_fieldset/styles.css +5 -5
- package/framework/components/chui_file_explorer/file_explorer.js +115 -115
- package/framework/components/chui_file_explorer/styles.css +6 -6
- package/framework/components/chui_form/form.js +11 -11
- package/framework/components/chui_gantt/gantt.js +41 -41
- package/framework/components/chui_gantt/styles.css +5 -5
- package/framework/components/chui_graphs/graphs.js +82 -46
- package/framework/components/chui_graphs/styles.css +26 -5
- package/framework/components/chui_hero/hero.js +63 -20
- package/framework/components/chui_hero/styles.css +176 -7
- package/framework/components/chui_html_block/html_block.js +5 -5
- package/framework/components/chui_html_block/styles.css +1 -1
- package/framework/components/chui_hx/styles.css +2 -2
- package/framework/components/chui_icons/icons.js +7 -7
- package/framework/components/chui_icons/styles.css +2 -1
- package/framework/components/chui_inputs/chui_check_box/styles.css +12 -3
- package/framework/components/chui_inputs/chui_chips/chips.js +92 -31
- package/framework/components/chui_inputs/chui_chips/styles.css +28 -5
- package/framework/components/chui_inputs/chui_color_picker/color_picker.js +20 -15
- package/framework/components/chui_inputs/chui_color_picker/styles.css +7 -7
- package/framework/components/chui_inputs/chui_combo_box/combo_box.js +58 -58
- package/framework/components/chui_inputs/chui_combo_box/styles.css +9 -9
- package/framework/components/chui_inputs/chui_date/date.js +93 -95
- package/framework/components/chui_inputs/chui_date/styles.css +8 -8
- package/framework/components/chui_inputs/chui_date_range/date_range.js +22 -22
- package/framework/components/chui_inputs/chui_date_range/styles.css +3 -3
- package/framework/components/chui_inputs/chui_datetime/datetime.js +12 -12
- package/framework/components/chui_inputs/chui_datetime/styles.css +3 -3
- package/framework/components/chui_inputs/chui_email/email.js +10 -10
- package/framework/components/chui_inputs/chui_email/styles.css +6 -6
- package/framework/components/chui_inputs/chui_file/file.js +8 -8
- package/framework/components/chui_inputs/chui_file/styles.css +12 -9
- package/framework/components/chui_inputs/chui_hotkey/hotkey.js +39 -39
- package/framework/components/chui_inputs/chui_hotkey/styles.css +6 -6
- package/framework/components/chui_inputs/chui_masked/masked.js +44 -44
- package/framework/components/chui_inputs/chui_masked/styles.css +5 -5
- package/framework/components/chui_inputs/chui_mention/mention.js +13 -13
- package/framework/components/chui_inputs/chui_mention/styles.css +14 -8
- package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +147 -137
- package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +14 -8
- package/framework/components/chui_inputs/chui_number/number.js +42 -45
- package/framework/components/chui_inputs/chui_number/styles.css +6 -6
- package/framework/components/chui_inputs/chui_otp/otp.js +32 -32
- package/framework/components/chui_inputs/chui_otp/styles.css +5 -5
- package/framework/components/chui_inputs/chui_password/password.js +30 -36
- package/framework/components/chui_inputs/chui_password/styles.css +7 -7
- package/framework/components/chui_inputs/chui_radio_button/styles.css +2 -2
- package/framework/components/chui_inputs/chui_rating/rating.js +28 -28
- package/framework/components/chui_inputs/chui_rating/styles.css +3 -3
- package/framework/components/chui_inputs/chui_select_box/select_box.js +54 -54
- package/framework/components/chui_inputs/chui_select_box/styles.css +10 -10
- package/framework/components/chui_inputs/chui_slider/slider.js +14 -14
- package/framework/components/chui_inputs/chui_slider/styles.css +5 -4
- package/framework/components/chui_inputs/chui_text/styles.css +7 -7
- package/framework/components/chui_inputs/chui_text/text.js +13 -17
- package/framework/components/chui_inputs/chui_text_area/styles.css +8 -8
- package/framework/components/chui_inputs/chui_text_area/text_area.js +23 -23
- package/framework/components/chui_inputs/chui_time/styles.css +13 -17
- package/framework/components/chui_inputs/chui_time/time.js +35 -24
- package/framework/components/chui_inputs/chui_toggle/styles.css +10 -3
- package/framework/components/chui_inputs/chui_toggle/toggle.js +16 -16
- package/framework/components/chui_json_editor/json_editor.js +87 -87
- package/framework/components/chui_json_editor/styles.css +5 -5
- package/framework/components/chui_json_viewer/json_viewer.js +80 -80
- package/framework/components/chui_json_viewer/styles.css +6 -6
- package/framework/components/chui_kanban/kanban.js +27 -27
- package/framework/components/chui_kanban/styles.css +8 -4
- package/framework/components/chui_kbd/styles.css +1 -1
- package/framework/components/chui_label/label.js +17 -17
- package/framework/components/chui_label/styles.css +1 -1
- package/framework/components/chui_link/link.js +9 -9
- package/framework/components/chui_link/styles.css +11 -4
- package/framework/components/chui_list/list.js +11 -11
- package/framework/components/chui_list/styles.css +2 -2
- package/framework/components/chui_markdown_editor/markdown_editor.js +66 -66
- package/framework/components/chui_markdown_editor/styles.css +5 -5
- package/framework/components/chui_media/audio.js +240 -246
- package/framework/components/chui_media/audio_styles.css +41 -23
- package/framework/components/chui_media/image.js +49 -46
- package/framework/components/chui_media/image_compare.js +35 -35
- package/framework/components/chui_media/image_compare_styles.css +5 -5
- package/framework/components/chui_media/image_styles.css +1 -1
- package/framework/components/chui_media/video.js +148 -148
- package/framework/components/chui_media/video_styles.css +27 -11
- package/framework/components/chui_menu_bar/menu_bar.js +54 -54
- package/framework/components/chui_menu_bar/styles.css +10 -10
- package/framework/components/chui_message_bar/message_bar.js +551 -0
- package/framework/components/chui_message_bar/styles.css +248 -0
- package/framework/components/chui_modal/modal.js +37 -13
- package/framework/components/chui_notification/notification.js +76 -54
- package/framework/components/chui_notification/notification_download.js +26 -81
- package/framework/components/chui_notification/notification_download_card.js +115 -0
- package/framework/components/chui_notification/notification_download_progress.css +2 -2
- package/framework/components/chui_notification/notification_download_progress.js +70 -108
- package/framework/components/chui_notification/notification_update.js +31 -31
- package/framework/components/chui_notification/status_plate.css +3 -3
- package/framework/components/chui_notification/styles.css +6 -1
- package/framework/components/chui_notification/styles_download.css +1 -1
- package/framework/components/chui_notification/styles_update.css +2 -2
- package/framework/components/chui_org_chart/org_chart.js +29 -29
- package/framework/components/chui_org_chart/styles.css +2 -2
- package/framework/components/chui_pagination/pagination.js +3 -3
- package/framework/components/chui_pagination/styles.css +1 -1
- package/framework/components/chui_paragraph/styles.css +2 -2
- package/framework/components/chui_popover/popover.js +29 -23
- package/framework/components/chui_popover/styles.css +1 -1
- package/framework/components/chui_popups/popups.js +124 -124
- package/framework/components/chui_popups/styles.css +5 -5
- package/framework/components/chui_print_button/print_button.js +15 -10
- package/framework/components/chui_progress_bar/progress_bar.js +34 -12
- package/framework/components/chui_progress_bar/styles.css +4 -4
- package/framework/components/chui_progress_ring/progress_ring.js +15 -15
- package/framework/components/chui_progress_ring/styles.css +1 -1
- package/framework/components/chui_qrcode/qrcode.js +12 -12
- package/framework/components/chui_query_builder/query_builder.js +46 -46
- package/framework/components/chui_query_builder/styles.css +4 -4
- package/framework/components/chui_radio_group/styles.css +1 -1
- package/framework/components/chui_result/result.js +15 -15
- package/framework/components/chui_result/styles.css +3 -3
- package/framework/components/chui_scheduler/scheduler.js +74 -74
- package/framework/components/chui_scheduler/styles.css +5 -5
- package/framework/components/chui_screen_spinner/screen_spinner.js +167 -0
- package/framework/components/chui_screen_spinner/styles.css +49 -0
- package/framework/components/chui_segmented_control/segmented_control.js +63 -6
- package/framework/components/chui_segmented_control/styles.css +32 -6
- package/framework/components/chui_settings/settings.js +45 -46
- package/framework/components/chui_settings/styles.css +4 -4
- package/framework/components/chui_shortcut_help/shortcut_help.js +32 -34
- package/framework/components/chui_sidebar_nav/sidebar_nav.js +98 -29
- package/framework/components/chui_sidebar_nav/styles.css +9 -3
- package/framework/components/chui_slideshow/slideshow.js +85 -85
- package/framework/components/chui_slideshow/styles.css +6 -6
- package/framework/components/chui_spinner/spinner.js +10 -10
- package/framework/components/chui_split_button/split_button.js +30 -12
- package/framework/components/chui_split_button/styles.css +21 -5
- package/framework/components/chui_splitter/splitter.js +11 -11
- package/framework/components/chui_splitter/styles.css +2 -2
- package/framework/components/chui_statistic/statistic.js +47 -47
- package/framework/components/chui_status_bar/styles.css +2 -2
- package/framework/components/chui_stepper/stepper.js +202 -31
- package/framework/components/chui_stepper/styles.css +79 -14
- package/framework/components/chui_sticky_bar/sticky_bar.js +44 -13
- package/framework/components/chui_sticky_bar/styles.css +10 -8
- package/framework/components/chui_tabs/chui_tabs.js +74 -26
- package/framework/components/chui_tabs/styles.css +40 -12
- package/framework/components/chui_text_editor/styles.css +7 -7
- package/framework/components/chui_text_editor/text_editor.js +56 -56
- package/framework/components/chui_text_editor/text_editor_panel.js +173 -174
- package/framework/components/chui_theme_toggle/theme_toggle.js +21 -5
- package/framework/components/chui_timeline/styles.css +3 -1
- package/framework/components/chui_toast_queue/styles.css +11 -11
- package/framework/components/chui_toast_queue/toast_queue.js +30 -27
- package/framework/components/chui_toolbar/styles.css +2 -2
- package/framework/components/chui_tooltip/styles.css +2 -2
- package/framework/components/chui_tooltip/tooltip.js +3 -3
- package/framework/components/chui_tour/styles.css +8 -8
- package/framework/components/chui_tour/tour.js +72 -72
- package/framework/components/chui_transfer/styles.css +6 -6
- package/framework/components/chui_transfer/transfer.js +93 -106
- package/framework/components/chui_tree_table/styles.css +4 -4
- package/framework/components/chui_tree_table/tree_table.js +45 -45
- package/framework/components/chui_tree_view/styles.css +10 -8
- package/framework/components/chui_tree_view/tree_view.js +185 -183
- package/framework/components/chui_user_bar/styles.css +145 -0
- package/framework/components/chui_user_bar/user_bar.js +402 -0
- package/framework/components/chui_user_list_bar/styles.css +173 -0
- package/framework/components/chui_user_list_bar/user_list_bar.js +485 -0
- package/framework/components/chui_watermark/watermark.js +17 -17
- package/framework/components/chui_webview/webview.js +9 -9
- package/framework/components/chui_write_bar/styles.css +172 -0
- package/framework/components/chui_write_bar/write_bar.js +320 -0
- package/framework/main_window.js +1234 -0
- package/framework/modules/chui_a11y/chui_a11y.js +78 -79
- package/framework/modules/chui_animations/animations.js +77 -15
- package/framework/modules/chui_animations/motion.js +120 -0
- package/framework/modules/chui_animations/styles.css +36 -3
- package/framework/modules/chui_functions.js +31 -27
- package/framework/modules/chui_highlight/styles.css +13 -10
- package/framework/modules/chui_i18n/chui_i18n.js +3 -3
- package/framework/modules/chui_i18n/locales/feedback.js +62 -0
- package/framework/modules/chui_i18n/locales/navigation.js +4 -0
- package/framework/modules/chui_json/chui_json.js +2 -2
- package/framework/modules/chui_logger/chui_logger.js +23 -8
- package/framework/modules/chui_page/page.js +10 -10
- package/framework/modules/chui_palette/palette.js +61 -0
- package/framework/modules/chui_qr/chui_qr.js +23 -23
- package/framework/modules/chui_scrollbar/chui_scrollbar.js +45 -45
- package/framework/modules/chui_scrollbar/styles.css +3 -3
- package/framework/modules/chui_services/chui_services.js +8 -8
- package/framework/modules/chui_services/desktop.js +77 -71
- package/framework/modules/chui_sortable/chui_sortable.js +17 -17
- package/framework/modules/chui_validate/chui_validate.js +3 -3
- package/framework/tray_bar/chui_menu_items.js +2 -2
- package/index.d.ts +266 -34
- package/index.js +20 -1168
- package/package.json +6 -4
- package/framework/components/telegram_bot/chui_telegram_bot.js +0 -191
|
@@ -43,13 +43,13 @@ class DateTimeInput {
|
|
|
43
43
|
#time = undefined;
|
|
44
44
|
#id = undefined;
|
|
45
45
|
#name = undefined;
|
|
46
|
-
#
|
|
47
|
-
#
|
|
46
|
+
#titleText = undefined;
|
|
47
|
+
#labelText = undefined;
|
|
48
48
|
#min = undefined;
|
|
49
49
|
#max = undefined;
|
|
50
50
|
#disabled = false;
|
|
51
51
|
#listeners = [];
|
|
52
|
-
#
|
|
52
|
+
#onChange = undefined;
|
|
53
53
|
|
|
54
54
|
constructor(
|
|
55
55
|
options = {
|
|
@@ -72,10 +72,10 @@ class DateTimeInput {
|
|
|
72
72
|
DateTimeInput.#counter += 1;
|
|
73
73
|
this.#id = options.id === undefined ? `chui_datetime_input_${DateTimeInput.#counter}` : options.id;
|
|
74
74
|
this.#name = options.name;
|
|
75
|
-
this.#
|
|
75
|
+
this.#labelText = options.label;
|
|
76
76
|
this.#min = DateTimeInput.#parseMoment(options.min);
|
|
77
77
|
this.#max = DateTimeInput.#parseMoment(options.max);
|
|
78
|
-
this.#
|
|
78
|
+
this.#onChange = options.onChange;
|
|
79
79
|
if (options.changeListener !== undefined) this.addChangeListener(options.changeListener);
|
|
80
80
|
this.#root.id = this.#id;
|
|
81
81
|
this.#label.className = "datetime_label";
|
|
@@ -109,9 +109,9 @@ class DateTimeInput {
|
|
|
109
109
|
delete rules.min;
|
|
110
110
|
delete rules.max;
|
|
111
111
|
if (rules.pattern === undefined) rules.pattern = MOMENT_PATTERN;
|
|
112
|
-
const
|
|
112
|
+
const ownValidate = options.validate;
|
|
113
113
|
rules.validate = (value) => {
|
|
114
|
-
const custom =
|
|
114
|
+
const custom = ownValidate === undefined ? undefined : ownValidate(value);
|
|
115
115
|
if (custom !== undefined && custom !== null && custom !== true) return custom;
|
|
116
116
|
const moment = String(value);
|
|
117
117
|
if (this.#min !== undefined && moment < this.#min) return I18n.t("dateTime.min", { min: this.#min });
|
|
@@ -133,12 +133,12 @@ class DateTimeInput {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
getTitle() {
|
|
136
|
-
return this.#
|
|
136
|
+
return this.#titleText;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
/** Доступное имя группы, заданное в `label` */
|
|
140
140
|
getLabel() {
|
|
141
|
-
return this.#
|
|
141
|
+
return this.#labelText;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/** Момент «ГГГГ-ММ-ДДTЧЧ:ММ»; пустая строка — заполнена не вся пара */
|
|
@@ -188,7 +188,7 @@ class DateTimeInput {
|
|
|
188
188
|
|
|
189
189
|
/** Подпись над парой полей; `undefined` её убирает */
|
|
190
190
|
setTitle(text = undefined) {
|
|
191
|
-
this.#
|
|
191
|
+
this.#titleText = text;
|
|
192
192
|
if (text === undefined || text === "") {
|
|
193
193
|
this.#label.hidden = true;
|
|
194
194
|
this.#label.innerText = "";
|
|
@@ -201,7 +201,7 @@ class DateTimeInput {
|
|
|
201
201
|
|
|
202
202
|
/** Доступное имя группы; `undefined` убирает его */
|
|
203
203
|
setLabel(text = undefined) {
|
|
204
|
-
this.#
|
|
204
|
+
this.#labelText = text;
|
|
205
205
|
if (text === undefined) this.#row.removeAttribute("aria-label");
|
|
206
206
|
else this.#row.setAttribute("aria-label", String(text));
|
|
207
207
|
return this;
|
|
@@ -280,7 +280,7 @@ class DateTimeInput {
|
|
|
280
280
|
#changed() {
|
|
281
281
|
const value = this.getValue();
|
|
282
282
|
for (const listener of [...this.#listeners]) listener(value, this);
|
|
283
|
-
if (this.#
|
|
283
|
+
if (this.#onChange !== undefined) this.#onChange(value, this);
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
static #parseMoment(value = undefined) {
|
|
@@ -5,18 +5,18 @@ chui_datetime_input {
|
|
|
5
5
|
карточку. Токены переопределены у корня поля, поэтому действуют только внутри него
|
|
6
6
|
(тот же приём у полосы меню-бара). */
|
|
7
7
|
--control_padding: var(--control_padding_sm);
|
|
8
|
-
--
|
|
8
|
+
--block_padding: var(--block_padding_sm);
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
width: max-content;
|
|
12
12
|
height: max-content;
|
|
13
|
-
margin: var(--
|
|
13
|
+
margin: var(--block_margin);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.datetime_label {
|
|
17
17
|
display: block;
|
|
18
18
|
width: max-content;
|
|
19
|
-
margin: 0 0 var(--
|
|
19
|
+
margin: 0 0 var(--block_margin);
|
|
20
20
|
color: var(--text_color);
|
|
21
21
|
font-size: var(--font_labels_size);
|
|
22
22
|
font-weight: 500;
|
|
@@ -2,8 +2,8 @@ const { Validate } = require("../../../modules/chui_validate/chui_validate");
|
|
|
2
2
|
|
|
3
3
|
class EmailInput {
|
|
4
4
|
#id = require("randomstring").generate();
|
|
5
|
-
#
|
|
6
|
-
#
|
|
5
|
+
#chuiEmailInput = document.createElement("chui_email_input");
|
|
6
|
+
#chuiEmailMain = document.createElement("chui_email_main");
|
|
7
7
|
#label = document.createElement("label");
|
|
8
8
|
#input = document.createElement("input");
|
|
9
9
|
#title = undefined;
|
|
@@ -25,20 +25,20 @@ class EmailInput {
|
|
|
25
25
|
this.#input.pattern = "^([a-zA-Z0-9_.+-])+@[a-zA-Z0-9-.]+\\.[a-zA-Z0-9-]{2,}$";
|
|
26
26
|
if (options.required !== undefined) this.#input.required = options.required;
|
|
27
27
|
// Валидация: email-формат проверяется правилом type: 'email'
|
|
28
|
-
Validate.installField(this, options, this.#
|
|
28
|
+
Validate.installField(this, options, this.#chuiEmailMain, undefined, () => this.#input.value);
|
|
29
29
|
if (options.title !== undefined) {
|
|
30
30
|
this.#label.innerText = options.title;
|
|
31
31
|
this.#label.classList.add("email_label");
|
|
32
32
|
this.#label.setAttribute("for", this.#id);
|
|
33
|
-
this.#
|
|
33
|
+
this.#chuiEmailInput.appendChild(this.#label);
|
|
34
34
|
}
|
|
35
35
|
if (options.placeholder !== undefined) this.#input.placeholder = options.placeholder;
|
|
36
|
-
if (options.width !== undefined) this.#
|
|
36
|
+
if (options.width !== undefined) this.#chuiEmailInput.style.width = options.width;
|
|
37
37
|
// Рамку с кольцом при фокусе рисует общее правило темы (`chui_email_main:hover`,
|
|
38
38
|
// `:focus-within`), а не компонент: прежде он ставил то же самое инлайном,
|
|
39
39
|
// а на `blur` снимал весь атрибут `style`
|
|
40
|
-
this.#
|
|
41
|
-
this.#
|
|
40
|
+
this.#chuiEmailMain.appendChild(this.#input);
|
|
41
|
+
this.#chuiEmailInput.appendChild(this.#chuiEmailMain);
|
|
42
42
|
}
|
|
43
43
|
getName() {
|
|
44
44
|
return this.#input.name;
|
|
@@ -55,17 +55,17 @@ class EmailInput {
|
|
|
55
55
|
setDisabled(boolean = Boolean()) {
|
|
56
56
|
this.#input.disabled = boolean;
|
|
57
57
|
if (boolean) {
|
|
58
|
-
this.#
|
|
58
|
+
this.#chuiEmailMain.classList.add("chui_email_main_disabled");
|
|
59
59
|
this.#input.className = "email_input_disabled";
|
|
60
60
|
this.#label.className = "email_label_disabled";
|
|
61
61
|
} else {
|
|
62
|
-
this.#
|
|
62
|
+
this.#chuiEmailMain.classList.remove("chui_email_main_disabled");
|
|
63
63
|
this.#input.className = "email_input";
|
|
64
64
|
this.#label.className = "email_label";
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
set() {
|
|
68
|
-
return this.#
|
|
68
|
+
return this.#chuiEmailInput;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -4,12 +4,12 @@ chui_email_input {
|
|
|
4
4
|
карточку. Токены переопределены у корня поля, поэтому действуют только внутри него
|
|
5
5
|
(тот же приём у полосы меню-бара). */
|
|
6
6
|
--control_padding: var(--control_padding_sm);
|
|
7
|
-
--
|
|
7
|
+
--block_padding: var(--block_padding_sm);
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
width: var(--control_width);
|
|
11
11
|
height: max-content;
|
|
12
|
-
margin: var(--
|
|
12
|
+
margin: var(--block_margin);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
chui_email_main {
|
|
@@ -17,11 +17,11 @@ chui_email_main {
|
|
|
17
17
|
width: -webkit-fill-available;
|
|
18
18
|
height: max-content;
|
|
19
19
|
margin: 0;
|
|
20
|
-
border-radius: var(--
|
|
20
|
+
border-radius: var(--radius_sm);
|
|
21
21
|
color: var(--text_color);
|
|
22
22
|
align-items: center;
|
|
23
23
|
position: relative;
|
|
24
|
-
padding: var(--
|
|
24
|
+
padding: var(--block_padding);
|
|
25
25
|
background: var(--element_background);
|
|
26
26
|
border: 1px solid var(--border_color);
|
|
27
27
|
}
|
|
@@ -40,7 +40,7 @@ chui_email_main {
|
|
|
40
40
|
.email_label {
|
|
41
41
|
height: max-content;
|
|
42
42
|
width: max-content;
|
|
43
|
-
margin: 0 0 var(--
|
|
43
|
+
margin: 0 0 var(--block_margin);
|
|
44
44
|
font-size: var(--font_labels_size);
|
|
45
45
|
font-weight: 500;
|
|
46
46
|
color: var(--text_color);
|
|
@@ -63,7 +63,7 @@ chui_email_main {
|
|
|
63
63
|
cursor: not-allowed;
|
|
64
64
|
height: max-content;
|
|
65
65
|
width: max-content;
|
|
66
|
-
margin: 0 0 var(--
|
|
66
|
+
margin: 0 0 var(--block_margin);
|
|
67
67
|
font-size: var(--font_labels_size);
|
|
68
68
|
font-weight: 500;
|
|
69
69
|
color: var(--text_color_disabled);
|
|
@@ -18,8 +18,8 @@ class AcceptTypes {
|
|
|
18
18
|
exports.AcceptTypes = AcceptTypes;
|
|
19
19
|
|
|
20
20
|
class FileInput {
|
|
21
|
-
#
|
|
22
|
-
#
|
|
21
|
+
#chuiFileMain = document.createElement("chui_file_main");
|
|
22
|
+
#chuiFileInput = document.createElement("chui_file_input");
|
|
23
23
|
#id = require("randomstring").generate();
|
|
24
24
|
#title = String();
|
|
25
25
|
#input = document.createElement("input");
|
|
@@ -58,10 +58,10 @@ class FileInput {
|
|
|
58
58
|
this.#label.innerText = options.title;
|
|
59
59
|
this.#label.className = "input_label";
|
|
60
60
|
this.#label.setAttribute("for", this.#id);
|
|
61
|
-
this.#
|
|
61
|
+
this.#chuiFileInput.appendChild(this.#label);
|
|
62
62
|
}
|
|
63
|
-
this.#
|
|
64
|
-
this.#
|
|
63
|
+
this.#chuiFileMain.appendChild(this.#input);
|
|
64
|
+
this.#chuiFileInput.appendChild(this.#chuiFileMain);
|
|
65
65
|
}
|
|
66
66
|
addChangeListener(listener = () => {}) {
|
|
67
67
|
this.#input.addEventListener("change", listener);
|
|
@@ -87,17 +87,17 @@ class FileInput {
|
|
|
87
87
|
setDisabled(value = Boolean()) {
|
|
88
88
|
this.#input.disabled = value;
|
|
89
89
|
if (value) {
|
|
90
|
-
this.#
|
|
90
|
+
this.#chuiFileMain.classList.add("chui_file_main_disabled");
|
|
91
91
|
this.#input.className = "file_input_disabled";
|
|
92
92
|
this.#label.className = "input_label_disabled";
|
|
93
93
|
} else {
|
|
94
|
-
this.#
|
|
94
|
+
this.#chuiFileMain.classList.remove("chui_file_main_disabled");
|
|
95
95
|
this.#input.className = "file_input";
|
|
96
96
|
this.#label.className = "input_label";
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
set() {
|
|
100
|
-
return this.#
|
|
100
|
+
return this.#chuiFileInput;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -4,12 +4,12 @@ chui_file_input {
|
|
|
4
4
|
карточку. Токены переопределены у корня поля, поэтому действуют только внутри него
|
|
5
5
|
(тот же приём у полосы меню-бара). */
|
|
6
6
|
--control_padding: var(--control_padding_sm);
|
|
7
|
-
--
|
|
7
|
+
--block_padding: var(--block_padding_sm);
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
width: max-content;
|
|
11
11
|
height: max-content;
|
|
12
|
-
margin: var(--
|
|
12
|
+
margin: var(--block_margin);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
chui_file_main {
|
|
@@ -17,7 +17,7 @@ chui_file_main {
|
|
|
17
17
|
width: max-content;
|
|
18
18
|
height: max-content;
|
|
19
19
|
margin: 0;
|
|
20
|
-
border-radius: var(--
|
|
20
|
+
border-radius: var(--radius_sm);
|
|
21
21
|
background: transparent;
|
|
22
22
|
color: var(--text_color);
|
|
23
23
|
border: none;
|
|
@@ -46,7 +46,7 @@ chui_file_main {
|
|
|
46
46
|
cursor: not-allowed;
|
|
47
47
|
height: max-content;
|
|
48
48
|
width: max-content;
|
|
49
|
-
margin: 0 0 var(--
|
|
49
|
+
margin: 0 0 var(--block_margin);
|
|
50
50
|
font-size: var(--font_labels_size);
|
|
51
51
|
font-weight: 500;
|
|
52
52
|
color: var(--text_color_disabled);
|
|
@@ -65,7 +65,7 @@ chui_file_main {
|
|
|
65
65
|
.input_label {
|
|
66
66
|
height: max-content;
|
|
67
67
|
width: max-content;
|
|
68
|
-
margin: 0 0 var(--
|
|
68
|
+
margin: 0 0 var(--block_margin);
|
|
69
69
|
font-size: var(--font_labels_size);
|
|
70
70
|
font-weight: 500;
|
|
71
71
|
color: var(--text_color);
|
|
@@ -75,14 +75,17 @@ input[type="file"]::file-selector-button {
|
|
|
75
75
|
cursor: pointer;
|
|
76
76
|
height: max-content;
|
|
77
77
|
width: max-content;
|
|
78
|
-
border-radius: var(--
|
|
79
|
-
padding: var(--
|
|
78
|
+
border-radius: var(--radius_sm);
|
|
79
|
+
padding: var(--block_padding);
|
|
80
80
|
font-size: var(--font_default_size);
|
|
81
81
|
font-weight: 400;
|
|
82
82
|
margin-block: 0 0;
|
|
83
|
-
margin-inline: 0 var(--
|
|
83
|
+
margin-inline: 0 var(--block_margin);
|
|
84
84
|
color: var(--text_color);
|
|
85
|
-
transition:
|
|
85
|
+
transition:
|
|
86
|
+
background-color var(--motion_fast) var(--motion_ease),
|
|
87
|
+
color var(--motion_fast) var(--motion_ease),
|
|
88
|
+
border-color var(--motion_fast) var(--motion_ease);
|
|
86
89
|
font-family: "chui_I";
|
|
87
90
|
background: var(--button_background);
|
|
88
91
|
border: 1px solid var(--button_border_color);
|
|
@@ -59,19 +59,19 @@ class HotkeyInput {
|
|
|
59
59
|
#row = document.createElement("hotkey_row");
|
|
60
60
|
#field = document.createElement("hotkey_field");
|
|
61
61
|
#kbd = undefined;
|
|
62
|
-
#
|
|
62
|
+
#clearButton = document.createElement("button");
|
|
63
63
|
#hint = document.createElement("hotkey_hint");
|
|
64
64
|
#status = document.createElement("hotkey_status");
|
|
65
65
|
#id = undefined;
|
|
66
66
|
#name = undefined;
|
|
67
|
-
#
|
|
68
|
-
#
|
|
67
|
+
#titleText = undefined;
|
|
68
|
+
#labelText = undefined;
|
|
69
69
|
#value = "";
|
|
70
|
-
#
|
|
71
|
-
#
|
|
70
|
+
#allowSingle = false;
|
|
71
|
+
#readOnly = false;
|
|
72
72
|
#disabled = false;
|
|
73
73
|
#listeners = [];
|
|
74
|
-
#
|
|
74
|
+
#onChange = undefined;
|
|
75
75
|
|
|
76
76
|
constructor(
|
|
77
77
|
options = {
|
|
@@ -93,9 +93,9 @@ class HotkeyInput {
|
|
|
93
93
|
HotkeyInput.#counter += 1;
|
|
94
94
|
this.#id = options.id === undefined ? `chui_hotkey_input_${HotkeyInput.#counter}` : options.id;
|
|
95
95
|
this.#name = options.name;
|
|
96
|
-
this.#
|
|
97
|
-
this.#
|
|
98
|
-
this.#
|
|
96
|
+
this.#labelText = options.label;
|
|
97
|
+
this.#allowSingle = options.allowSingle === true;
|
|
98
|
+
this.#onChange = options.onChange;
|
|
99
99
|
if (options.changeListener !== undefined) this.addChangeListener(options.changeListener);
|
|
100
100
|
this.#root.id = this.#id;
|
|
101
101
|
this.#label.className = "hotkey_label";
|
|
@@ -112,13 +112,13 @@ class HotkeyInput {
|
|
|
112
112
|
// Клавиши — внешний вид: имя и значение несёт само поле
|
|
113
113
|
keys.setAttribute("aria-hidden", "true");
|
|
114
114
|
this.#field.appendChild(keys);
|
|
115
|
-
this.#
|
|
116
|
-
this.#
|
|
117
|
-
this.#
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
this.#
|
|
121
|
-
this.#
|
|
115
|
+
this.#clearButton.type = "button";
|
|
116
|
+
this.#clearButton.className = "hotkey_clear";
|
|
117
|
+
this.#clearButton.setAttribute("aria-label", I18n.t("forms.hotkeyClear"));
|
|
118
|
+
const clearIcon = new Icon(Icons.NAVIGATION.CLOSE).set();
|
|
119
|
+
clearIcon.setAttribute("aria-hidden", "true");
|
|
120
|
+
this.#clearButton.appendChild(clearIcon);
|
|
121
|
+
this.#clearButton.addEventListener("click", () => {
|
|
122
122
|
if (this.#disabled) return;
|
|
123
123
|
this.#apply("", true);
|
|
124
124
|
this.#field.focus();
|
|
@@ -132,7 +132,7 @@ class HotkeyInput {
|
|
|
132
132
|
this.#status.setAttribute("role", "status");
|
|
133
133
|
this.#status.setAttribute("aria-live", "polite");
|
|
134
134
|
this.#row.appendChild(this.#field);
|
|
135
|
-
this.#row.appendChild(this.#
|
|
135
|
+
this.#row.appendChild(this.#clearButton);
|
|
136
136
|
if (options.title !== undefined) this.setTitle(options.title);
|
|
137
137
|
else this.#label.hidden = true;
|
|
138
138
|
this.#root.appendChild(this.#label);
|
|
@@ -164,12 +164,12 @@ class HotkeyInput {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
getTitle() {
|
|
167
|
-
return this.#
|
|
167
|
+
return this.#titleText;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
/** Доступное имя поля, заданное в `label` */
|
|
171
171
|
getLabel() {
|
|
172
|
-
return this.#
|
|
172
|
+
return this.#labelText;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
/** Сочетание в каноническом виде («Ctrl+Shift+S»); пустая строка — не задано */
|
|
@@ -187,11 +187,11 @@ class HotkeyInput {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
isReadOnly() {
|
|
190
|
-
return this.#
|
|
190
|
+
return this.#readOnly;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
isAllowSingle() {
|
|
194
|
-
return this.#
|
|
194
|
+
return this.#allowSingle;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
/**
|
|
@@ -238,7 +238,7 @@ class HotkeyInput {
|
|
|
238
238
|
|
|
239
239
|
/** Подпись над полем; `undefined` её убирает */
|
|
240
240
|
setTitle(text = undefined) {
|
|
241
|
-
this.#
|
|
241
|
+
this.#titleText = text;
|
|
242
242
|
this.#label.id = `${this.#id}_label`;
|
|
243
243
|
if (text === undefined || text === "") {
|
|
244
244
|
this.#label.hidden = true;
|
|
@@ -258,8 +258,8 @@ class HotkeyInput {
|
|
|
258
258
|
|
|
259
259
|
/** Доступное имя поля, когда подписи в разметке нет */
|
|
260
260
|
setLabel(text = undefined) {
|
|
261
|
-
this.#
|
|
262
|
-
if (this.#
|
|
261
|
+
this.#labelText = text;
|
|
262
|
+
if (this.#titleText === undefined || this.#titleText === "") {
|
|
263
263
|
if (text === undefined) this.#field.removeAttribute("aria-label");
|
|
264
264
|
else this.#field.setAttribute("aria-label", String(text));
|
|
265
265
|
}
|
|
@@ -298,15 +298,15 @@ class HotkeyInput {
|
|
|
298
298
|
|
|
299
299
|
/** Разрешить одиночные клавиши без модификаторов (`F5`, `A`) */
|
|
300
300
|
setAllowSingle(allow = Boolean()) {
|
|
301
|
-
this.#
|
|
301
|
+
this.#allowSingle = allow === true;
|
|
302
302
|
return this;
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
/** Режим показа: сочетание видно, но поле не принимает фокус и нажатия */
|
|
306
|
-
setReadOnly(
|
|
307
|
-
this.#
|
|
308
|
-
this.#root.classList.toggle("hotkey_readonly", this.#
|
|
309
|
-
if (this.#
|
|
306
|
+
setReadOnly(readOnly = Boolean()) {
|
|
307
|
+
this.#readOnly = readOnly === true;
|
|
308
|
+
this.#root.classList.toggle("hotkey_readonly", this.#readOnly);
|
|
309
|
+
if (this.#readOnly) {
|
|
310
310
|
this.#field.removeAttribute("tabindex");
|
|
311
311
|
this.#hint.hidden = true;
|
|
312
312
|
this.#field.removeAttribute("aria-describedby");
|
|
@@ -330,11 +330,11 @@ class HotkeyInput {
|
|
|
330
330
|
if (this.#disabled) {
|
|
331
331
|
this.#field.setAttribute("tabindex", "-1");
|
|
332
332
|
this.#field.setAttribute("aria-disabled", "true");
|
|
333
|
-
this.#
|
|
333
|
+
this.#clearButton.disabled = true;
|
|
334
334
|
} else {
|
|
335
335
|
this.#field.removeAttribute("aria-disabled");
|
|
336
|
-
this.#
|
|
337
|
-
if (!this.#
|
|
336
|
+
this.#clearButton.disabled = false;
|
|
337
|
+
if (!this.#readOnly) this.#field.setAttribute("tabindex", "0");
|
|
338
338
|
}
|
|
339
339
|
this.#render();
|
|
340
340
|
return this;
|
|
@@ -348,7 +348,7 @@ class HotkeyInput {
|
|
|
348
348
|
|
|
349
349
|
/** Фокус на поле: `Form` зовёт это при ошибке валидации */
|
|
350
350
|
focus() {
|
|
351
|
-
if (!this.#disabled && !this.#
|
|
351
|
+
if (!this.#disabled && !this.#readOnly) this.#field.focus();
|
|
352
352
|
return this;
|
|
353
353
|
}
|
|
354
354
|
|
|
@@ -359,8 +359,8 @@ class HotkeyInput {
|
|
|
359
359
|
|
|
360
360
|
// === ВНУТРЕННЕЕ ===
|
|
361
361
|
#accessibleName() {
|
|
362
|
-
if (this.#
|
|
363
|
-
if (this.#
|
|
362
|
+
if (this.#titleText !== undefined && this.#titleText !== "") return this.#titleText;
|
|
363
|
+
if (this.#labelText !== undefined && this.#labelText !== "") return this.#labelText;
|
|
364
364
|
return I18n.t("forms.hotkeyLabel");
|
|
365
365
|
}
|
|
366
366
|
|
|
@@ -377,7 +377,7 @@ class HotkeyInput {
|
|
|
377
377
|
: I18n.t("forms.hotkeyRecorded", { value: value.split("+").join(" + ") })
|
|
378
378
|
);
|
|
379
379
|
for (const listener of [...this.#listeners]) listener(value, this);
|
|
380
|
-
if (this.#
|
|
380
|
+
if (this.#onChange !== undefined) this.#onChange(value, this);
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
#render() {
|
|
@@ -386,7 +386,7 @@ class HotkeyInput {
|
|
|
386
386
|
keys.setAttribute("aria-hidden", "true");
|
|
387
387
|
if (this.#value === "") this.#field.removeAttribute("aria-keyshortcuts");
|
|
388
388
|
else this.#field.setAttribute("aria-keyshortcuts", this.#ariaShortcut());
|
|
389
|
-
this.#
|
|
389
|
+
this.#clearButton.hidden = this.#value === "" || this.#readOnly;
|
|
390
390
|
this.#field.classList.toggle("hotkey_field_empty", this.#value === "");
|
|
391
391
|
}
|
|
392
392
|
|
|
@@ -402,7 +402,7 @@ class HotkeyInput {
|
|
|
402
402
|
}
|
|
403
403
|
|
|
404
404
|
#onKeyDown = (event) => {
|
|
405
|
-
if (this.#disabled || this.#
|
|
405
|
+
if (this.#disabled || this.#readOnly) return;
|
|
406
406
|
// Tab не перехватываем: иначе поле нельзя было бы покинуть
|
|
407
407
|
if (event.key === "Tab") return;
|
|
408
408
|
// Escape, Delete и Backspace снимают сочетание, поэтому связать их нельзя
|
|
@@ -426,7 +426,7 @@ class HotkeyInput {
|
|
|
426
426
|
);
|
|
427
427
|
return;
|
|
428
428
|
}
|
|
429
|
-
if (modifiers.length === 0 && !this.#
|
|
429
|
+
if (modifiers.length === 0 && !this.#allowSingle) {
|
|
430
430
|
event.preventDefault();
|
|
431
431
|
this.#announce(I18n.t("forms.hotkeyNeedModifier"));
|
|
432
432
|
return;
|
|
@@ -5,20 +5,20 @@ chui_hotkey_input {
|
|
|
5
5
|
карточку. Токены переопределены у корня поля, поэтому действуют только внутри него
|
|
6
6
|
(тот же приём у полосы меню-бара). */
|
|
7
7
|
--control_padding: var(--control_padding_sm);
|
|
8
|
-
--
|
|
8
|
+
--block_padding: var(--block_padding_sm);
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
width: max-content;
|
|
12
12
|
max-width: 100%;
|
|
13
|
-
margin: var(--
|
|
13
|
+
margin: var(--block_margin);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.hotkey_label {
|
|
17
17
|
display: block;
|
|
18
18
|
width: max-content;
|
|
19
|
-
/* Только нижний отступ: верхний и боковые уже даёт корень поля (--
|
|
19
|
+
/* Только нижний отступ: верхний и боковые уже даёт корень поля (--block_margin), а свой
|
|
20
20
|
боковой отступ сдвигал подпись вправо от коробки поля */
|
|
21
|
-
margin: 0 0 var(--
|
|
21
|
+
margin: 0 0 var(--block_margin);
|
|
22
22
|
color: var(--text_color);
|
|
23
23
|
font-size: var(--font_labels_size);
|
|
24
24
|
font-weight: 500;
|
|
@@ -34,7 +34,7 @@ chui_hotkey_input {
|
|
|
34
34
|
gap: 8px;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/* Поле — та же коробка, что у текстового поля: --control_height, hairline и --
|
|
37
|
+
/* Поле — та же коробка, что у текстового поля: --control_height, hairline и --radius_sm */
|
|
38
38
|
.hotkey_field {
|
|
39
39
|
display: flex;
|
|
40
40
|
align-items: center;
|
|
@@ -43,7 +43,7 @@ chui_hotkey_input {
|
|
|
43
43
|
min-height: var(--control_height);
|
|
44
44
|
padding: 3px 10px;
|
|
45
45
|
border: 1px solid var(--border_color);
|
|
46
|
-
border-radius: var(--
|
|
46
|
+
border-radius: var(--radius_sm);
|
|
47
47
|
background: var(--element_background);
|
|
48
48
|
color: var(--text_color);
|
|
49
49
|
cursor: text;
|