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
|
@@ -32,14 +32,14 @@ class ProgressRing {
|
|
|
32
32
|
#root = document.createElement("chui_progress_ring");
|
|
33
33
|
#svg = undefined;
|
|
34
34
|
#track = undefined;
|
|
35
|
-
#
|
|
35
|
+
#valueArc = undefined;
|
|
36
36
|
#text = document.createElement("progress_ring_text");
|
|
37
37
|
#id = undefined;
|
|
38
38
|
#value = 0;
|
|
39
39
|
#max = 100;
|
|
40
40
|
#size = ProgressRing.DEFAULT_SIZE;
|
|
41
41
|
#thickness = ProgressRing.DEFAULT_THICKNESS;
|
|
42
|
-
#
|
|
42
|
+
#showValue = true;
|
|
43
43
|
#indeterminate = false;
|
|
44
44
|
#label = undefined;
|
|
45
45
|
#format = undefined;
|
|
@@ -66,7 +66,7 @@ class ProgressRing {
|
|
|
66
66
|
if (options.max !== undefined) this.#max = options.max;
|
|
67
67
|
if (options.size !== undefined) this.#size = options.size;
|
|
68
68
|
if (options.thickness !== undefined) this.#thickness = options.thickness;
|
|
69
|
-
this.#
|
|
69
|
+
this.#showValue = options.showValue !== false;
|
|
70
70
|
this.#format = options.format;
|
|
71
71
|
this.#build();
|
|
72
72
|
if (options.color !== undefined) this.setColor(options.color);
|
|
@@ -111,7 +111,7 @@ class ProgressRing {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
isValueVisible() {
|
|
114
|
-
return this.#
|
|
114
|
+
return this.#showValue;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// SET
|
|
@@ -149,7 +149,7 @@ class ProgressRing {
|
|
|
149
149
|
|
|
150
150
|
/** Показывать ли процент внутри кольца */
|
|
151
151
|
setShowValue(visible = Boolean()) {
|
|
152
|
-
this.#
|
|
152
|
+
this.#showValue = visible === true;
|
|
153
153
|
this.#render();
|
|
154
154
|
return this;
|
|
155
155
|
}
|
|
@@ -202,13 +202,13 @@ class ProgressRing {
|
|
|
202
202
|
this.#track.setAttribute("cx", "50");
|
|
203
203
|
this.#track.setAttribute("cy", "50");
|
|
204
204
|
this.#track.setAttribute("r", "45");
|
|
205
|
-
this.#
|
|
206
|
-
this.#
|
|
207
|
-
this.#
|
|
208
|
-
this.#
|
|
209
|
-
this.#
|
|
205
|
+
this.#valueArc = document.createElementNS(namespace, "circle");
|
|
206
|
+
this.#valueArc.setAttribute("class", "progress_ring_value");
|
|
207
|
+
this.#valueArc.setAttribute("cx", "50");
|
|
208
|
+
this.#valueArc.setAttribute("cy", "50");
|
|
209
|
+
this.#valueArc.setAttribute("r", "45");
|
|
210
210
|
this.#svg.appendChild(this.#track);
|
|
211
|
-
this.#svg.appendChild(this.#
|
|
211
|
+
this.#svg.appendChild(this.#valueArc);
|
|
212
212
|
this.#text.setAttribute("aria-hidden", "true");
|
|
213
213
|
this.#root.appendChild(this.#svg);
|
|
214
214
|
this.#root.appendChild(this.#text);
|
|
@@ -230,13 +230,13 @@ class ProgressRing {
|
|
|
230
230
|
const radius = 50 - thickness / 2;
|
|
231
231
|
this.#svg.style.setProperty("--progress_ring_thickness", String(thickness));
|
|
232
232
|
this.#track.setAttribute("r", String(radius));
|
|
233
|
-
this.#
|
|
233
|
+
this.#valueArc.setAttribute("r", String(radius));
|
|
234
234
|
// Длина окружности: dasharray — периметр, dashoffset — доля от него.
|
|
235
235
|
// У неопределённого прогресса дуга фиксированной длины, а крутит её CSS-анимация
|
|
236
236
|
const circuit = 2 * Math.PI * radius;
|
|
237
|
-
this.#
|
|
238
|
-
this.#
|
|
239
|
-
this.#text.hidden = !this.#
|
|
237
|
+
this.#valueArc.style.strokeDasharray = this.#indeterminate ? "60 230" : String(circuit);
|
|
238
|
+
this.#valueArc.style.strokeDashoffset = this.#indeterminate ? "0" : String(circuit * (1 - this.getRatio()));
|
|
239
|
+
this.#text.hidden = !this.#showValue;
|
|
240
240
|
this.#text.innerText = this.#indeterminate ? "" : this.#valueText();
|
|
241
241
|
this.#root.setAttribute("aria-valuemin", String(0));
|
|
242
242
|
this.#root.setAttribute("aria-valuemax", String(this.#max));
|
|
@@ -34,7 +34,7 @@ chui_progress_ring {
|
|
|
34
34
|
.progress_ring_value {
|
|
35
35
|
stroke: var(--progress_ring_color);
|
|
36
36
|
stroke-linecap: round;
|
|
37
|
-
transition: stroke-dashoffset
|
|
37
|
+
transition: stroke-dashoffset var(--motion_base) var(--motion_ease);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
chui_progress_ring.progress_ring_indeterminate .progress_ring_value {
|
|
@@ -64,14 +64,14 @@ class QRCode {
|
|
|
64
64
|
#margin = QRCode.DEFAULT_MARGIN;
|
|
65
65
|
#level = QR.LEVEL.MEDIUM;
|
|
66
66
|
#mode = QR.MODE.AUTO;
|
|
67
|
-
#
|
|
67
|
+
#minVersion = undefined;
|
|
68
68
|
#mask = undefined;
|
|
69
69
|
#dark = QRCode.DEFAULT_DARK;
|
|
70
70
|
#light = QRCode.DEFAULT_LIGHT;
|
|
71
71
|
#label = undefined;
|
|
72
|
-
#
|
|
72
|
+
#emptyText = undefined;
|
|
73
73
|
#code = undefined;
|
|
74
|
-
#
|
|
74
|
+
#errorMessage = undefined;
|
|
75
75
|
|
|
76
76
|
constructor(
|
|
77
77
|
options = {
|
|
@@ -98,7 +98,7 @@ class QRCode {
|
|
|
98
98
|
this.#hint.setAttribute("role", "status");
|
|
99
99
|
this.#hint.setAttribute("aria-live", "polite");
|
|
100
100
|
this.#label = options.label;
|
|
101
|
-
this.#
|
|
101
|
+
this.#emptyText = options.emptyText;
|
|
102
102
|
this.#root.appendChild(this.#canvas);
|
|
103
103
|
this.#root.appendChild(this.#hint);
|
|
104
104
|
// Пустая заготовка опции равносильна отсутствующей: `String()` в описании опций
|
|
@@ -108,7 +108,7 @@ class QRCode {
|
|
|
108
108
|
if (optionOr(options.level, undefined) !== undefined) this.#level = QRCode.#toLevel(options.level);
|
|
109
109
|
if (optionOr(options.mode, undefined) !== undefined) this.#mode = QRCode.#toMode(options.mode);
|
|
110
110
|
if (Number.isInteger(Number(options.minVersion)) && Number(options.minVersion) > 0) {
|
|
111
|
-
this.#
|
|
111
|
+
this.#minVersion = QRCode.#toVersion(options.minVersion);
|
|
112
112
|
}
|
|
113
113
|
if (Number.isInteger(Number(options.mask)) && Number(options.mask) >= 0)
|
|
114
114
|
this.#mask = QRCode.#toMask(options.mask);
|
|
@@ -140,7 +140,7 @@ class QRCode {
|
|
|
140
140
|
return this.#code === undefined ? this.#mode : this.#code.mode;
|
|
141
141
|
}
|
|
142
142
|
getMinVersion() {
|
|
143
|
-
return this.#
|
|
143
|
+
return this.#minVersion;
|
|
144
144
|
}
|
|
145
145
|
/** Маска готового кода (0…7); без кода — заданная опция или `undefined` при автоподборе */
|
|
146
146
|
getMask() {
|
|
@@ -174,7 +174,7 @@ class QRCode {
|
|
|
174
174
|
}
|
|
175
175
|
/** Текст незаданного состояния или ошибки; `undefined`, если код построен */
|
|
176
176
|
getError() {
|
|
177
|
-
return this.#
|
|
177
|
+
return this.#errorMessage;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
// SET
|
|
@@ -215,7 +215,7 @@ class QRCode {
|
|
|
215
215
|
}
|
|
216
216
|
/** Наименьшая версия кода; `undefined` — подбирать самому */
|
|
217
217
|
setMinVersion(version = undefined) {
|
|
218
|
-
this.#
|
|
218
|
+
this.#minVersion = version === undefined || version === "" ? undefined : QRCode.#toVersion(version);
|
|
219
219
|
this.#render();
|
|
220
220
|
return this;
|
|
221
221
|
}
|
|
@@ -240,7 +240,7 @@ class QRCode {
|
|
|
240
240
|
}
|
|
241
241
|
/** Текст подсказки при пустом значении */
|
|
242
242
|
setEmptyText(text = String()) {
|
|
243
|
-
this.#
|
|
243
|
+
this.#emptyText = text;
|
|
244
244
|
this.#render();
|
|
245
245
|
return this;
|
|
246
246
|
}
|
|
@@ -263,12 +263,12 @@ class QRCode {
|
|
|
263
263
|
if (String(value).trim() === "") {
|
|
264
264
|
this.#code = undefined;
|
|
265
265
|
this.#clear();
|
|
266
|
-
this.#setHint(this.#
|
|
266
|
+
this.#setHint(this.#emptyText === undefined ? I18n.t("graphics.qrEmpty") : this.#emptyText);
|
|
267
267
|
this.#setLabel(I18n.t("graphics.qrLabel"));
|
|
268
268
|
return this;
|
|
269
269
|
}
|
|
270
270
|
const options = { level: this.#level, mode: this.#mode };
|
|
271
|
-
if (this.#
|
|
271
|
+
if (this.#minVersion !== undefined) options.minVersion = this.#minVersion;
|
|
272
272
|
if (this.#mask !== undefined) options.mask = this.#mask;
|
|
273
273
|
const result = QR.encode(value, options);
|
|
274
274
|
if (result.ok !== true) {
|
|
@@ -334,7 +334,7 @@ class QRCode {
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
#setHint(text) {
|
|
337
|
-
this.#
|
|
337
|
+
this.#errorMessage = text === "" ? undefined : text;
|
|
338
338
|
this.#hint.innerText = text;
|
|
339
339
|
return this;
|
|
340
340
|
}
|
|
@@ -151,20 +151,20 @@ class QueryBuilder {
|
|
|
151
151
|
#fields = [];
|
|
152
152
|
#value = undefined;
|
|
153
153
|
#listeners = [];
|
|
154
|
-
#
|
|
155
|
-
#
|
|
154
|
+
#onChange = undefined;
|
|
155
|
+
#maxDepth = QueryBuilder.MAX_DEPTH;
|
|
156
156
|
#disabled = false;
|
|
157
|
-
#
|
|
158
|
-
#
|
|
159
|
-
#
|
|
157
|
+
#errorShown = false;
|
|
158
|
+
#nodeCounter = 0;
|
|
159
|
+
#ruleCounter = 0;
|
|
160
160
|
// Переключатели «И/ИЛИ» живут по группе: при перерисовке пересобираются вместе с узлами
|
|
161
161
|
#combinators = new Map();
|
|
162
162
|
// Готовые поля условий: их нужно гасить, снимать у них слушатели окна и уметь закрыть
|
|
163
163
|
// раскрытый список при возврате фокуса после пересборки
|
|
164
164
|
#controls = [];
|
|
165
|
-
#
|
|
166
|
-
#
|
|
167
|
-
#
|
|
165
|
+
#titleText = undefined;
|
|
166
|
+
#labelText = undefined;
|
|
167
|
+
#emptyText = undefined;
|
|
168
168
|
|
|
169
169
|
constructor(
|
|
170
170
|
options = {
|
|
@@ -189,11 +189,11 @@ class QueryBuilder {
|
|
|
189
189
|
this.#name = options.name;
|
|
190
190
|
this.#root.id = this.#id;
|
|
191
191
|
this.#root.setAttribute("role", "group");
|
|
192
|
-
this.#
|
|
193
|
-
this.#
|
|
194
|
-
if (options.emptyText !== undefined) this.#
|
|
195
|
-
else this.#
|
|
196
|
-
if (options.maxDepth !== undefined) this.#
|
|
192
|
+
this.#labelText = options.label;
|
|
193
|
+
this.#onChange = options.onChange;
|
|
194
|
+
if (options.emptyText !== undefined) this.#emptyText = String(options.emptyText);
|
|
195
|
+
else this.#emptyText = I18n.t("queryBuilder.empty");
|
|
196
|
+
if (options.maxDepth !== undefined) this.#maxDepth = Math.max(1, Number(options.maxDepth));
|
|
197
197
|
this.#title.className = "query_builder_title";
|
|
198
198
|
this.#title.id = `${this.#id}_title`;
|
|
199
199
|
this.#tree.className = "query_builder_tree";
|
|
@@ -207,7 +207,7 @@ class QueryBuilder {
|
|
|
207
207
|
this.#root.appendChild(this.#status);
|
|
208
208
|
if (options.title !== undefined) this.setTitle(options.title);
|
|
209
209
|
else this.#title.hidden = true;
|
|
210
|
-
this.setLabel(this.#
|
|
210
|
+
this.setLabel(this.#labelText === undefined ? I18n.t("queryBuilder.title") : this.#labelText);
|
|
211
211
|
this.setFields(options.fields === undefined ? [] : options.fields);
|
|
212
212
|
if (options.value === undefined) this.clear(true);
|
|
213
213
|
else this.setValue(options.value);
|
|
@@ -220,9 +220,9 @@ class QueryBuilder {
|
|
|
220
220
|
() => (this.isEmpty() ? "" : this.getText()),
|
|
221
221
|
this.#tree
|
|
222
222
|
);
|
|
223
|
-
const
|
|
223
|
+
const baseValidate = this.validate;
|
|
224
224
|
this.validate = () => {
|
|
225
|
-
const result =
|
|
225
|
+
const result = baseValidate();
|
|
226
226
|
if (result.valid === false) return result;
|
|
227
227
|
const empty = this.#rules().find(
|
|
228
228
|
(rule) => this.#needsValue(rule.operator) && this.#isEmptyValue(rule.value)
|
|
@@ -244,11 +244,11 @@ class QueryBuilder {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
getTitle() {
|
|
247
|
-
return this.#
|
|
247
|
+
return this.#titleText;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
getLabel() {
|
|
251
|
-
return this.#
|
|
251
|
+
return this.#labelText;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
/** Имя запроса для формы: с ним `Form.getValues()`/`setValues()` знают, куда класть дерево */
|
|
@@ -304,7 +304,7 @@ class QueryBuilder {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
getMaxDepth() {
|
|
307
|
-
return this.#
|
|
307
|
+
return this.#maxDepth;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
isDisabled() {
|
|
@@ -312,7 +312,7 @@ class QueryBuilder {
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
getEmptyText() {
|
|
315
|
-
return this.#
|
|
315
|
+
return this.#emptyText;
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
/** Запрос словами: «Статус равно «Оплачен» И Сумма больше 1000» */
|
|
@@ -331,7 +331,7 @@ class QueryBuilder {
|
|
|
331
331
|
|
|
332
332
|
/** Подпись над запросом; `undefined` её убирает (имя тогда даёт `label`) */
|
|
333
333
|
setTitle(text = undefined) {
|
|
334
|
-
this.#
|
|
334
|
+
this.#titleText = text;
|
|
335
335
|
if (text === undefined || text === "") {
|
|
336
336
|
this.#title.hidden = true;
|
|
337
337
|
this.#title.innerText = "";
|
|
@@ -346,7 +346,7 @@ class QueryBuilder {
|
|
|
346
346
|
|
|
347
347
|
/** Имя запроса, когда подписи в разметке нет */
|
|
348
348
|
setLabel(text = undefined) {
|
|
349
|
-
this.#
|
|
349
|
+
this.#labelText = text;
|
|
350
350
|
this.#syncLabel();
|
|
351
351
|
return this;
|
|
352
352
|
}
|
|
@@ -389,7 +389,7 @@ class QueryBuilder {
|
|
|
389
389
|
|
|
390
390
|
/** Дерево запроса; `silent` (как у полей формы) — молча, без уведомления слушателей */
|
|
391
391
|
setValue(value = Object(), silent = false) {
|
|
392
|
-
this.#
|
|
392
|
+
this.#nodeCounter = 0;
|
|
393
393
|
this.#value = this.#toGroup(value, 1);
|
|
394
394
|
this.#render();
|
|
395
395
|
if (silent === false) this.#notify();
|
|
@@ -397,13 +397,13 @@ class QueryBuilder {
|
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
setMaxDepth(depth = Number()) {
|
|
400
|
-
this.#
|
|
400
|
+
this.#maxDepth = Math.max(1, Number(depth));
|
|
401
401
|
this.#render();
|
|
402
402
|
return this;
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
setEmptyText(text = String()) {
|
|
406
|
-
this.#
|
|
406
|
+
this.#emptyText = text === undefined ? "" : String(text);
|
|
407
407
|
this.#render();
|
|
408
408
|
return this;
|
|
409
409
|
}
|
|
@@ -449,7 +449,7 @@ class QueryBuilder {
|
|
|
449
449
|
addGroup(groupId = undefined) {
|
|
450
450
|
const group = groupId === undefined ? this.#value : this.#group(groupId);
|
|
451
451
|
if (group === undefined) return undefined;
|
|
452
|
-
if (this.#depthOf(group) >= this.#
|
|
452
|
+
if (this.#depthOf(group) >= this.#maxDepth) return undefined;
|
|
453
453
|
const field = this.#fields[0];
|
|
454
454
|
if (field === undefined) return undefined;
|
|
455
455
|
const nested = {
|
|
@@ -531,12 +531,12 @@ class QueryBuilder {
|
|
|
531
531
|
check() {
|
|
532
532
|
const result = this.validate();
|
|
533
533
|
if (result.valid) {
|
|
534
|
-
this.#
|
|
534
|
+
this.#errorShown = false;
|
|
535
535
|
this.clearError();
|
|
536
536
|
this.#announce(this.isEmpty() ? I18n.t("queryBuilder.empty") : I18n.t("queryBuilder.valid"));
|
|
537
537
|
return this;
|
|
538
538
|
}
|
|
539
|
-
this.#
|
|
539
|
+
this.#errorShown = true;
|
|
540
540
|
this.setError(result.message);
|
|
541
541
|
this.#syncErrors();
|
|
542
542
|
this.#announce(result.message);
|
|
@@ -562,8 +562,8 @@ class QueryBuilder {
|
|
|
562
562
|
|
|
563
563
|
// === ВНУТРЕННЕЕ ===
|
|
564
564
|
#nextId(prefix = String()) {
|
|
565
|
-
this.#
|
|
566
|
-
return `${this.#id}_${prefix}_${this.#
|
|
565
|
+
this.#nodeCounter += 1;
|
|
566
|
+
return `${this.#id}_${prefix}_${this.#nodeCounter}`;
|
|
567
567
|
}
|
|
568
568
|
|
|
569
569
|
#emptyRule(field = Object()) {
|
|
@@ -598,7 +598,7 @@ class QueryBuilder {
|
|
|
598
598
|
for (const child of children) {
|
|
599
599
|
if (child === undefined || child === null || typeof child !== "object") continue;
|
|
600
600
|
if (child.children !== undefined || child.combinator !== undefined) {
|
|
601
|
-
if (depth >= this.#
|
|
601
|
+
if (depth >= this.#maxDepth) continue;
|
|
602
602
|
group.children.push(this.#toGroup(child, depth + 1));
|
|
603
603
|
continue;
|
|
604
604
|
}
|
|
@@ -713,17 +713,17 @@ class QueryBuilder {
|
|
|
713
713
|
this.#destroyControls();
|
|
714
714
|
this.#tree.innerHTML = "";
|
|
715
715
|
this.#combinators.clear();
|
|
716
|
-
this.#
|
|
716
|
+
this.#ruleCounter = 0;
|
|
717
717
|
if (this.#value === undefined || this.#fields.length === 0) {
|
|
718
718
|
this.#tree.hidden = true;
|
|
719
719
|
this.#empty.hidden = false;
|
|
720
|
-
this.#empty.innerText = this.#fields.length === 0 ? I18n.t("queryBuilder.noFields") : this.#
|
|
720
|
+
this.#empty.innerText = this.#fields.length === 0 ? I18n.t("queryBuilder.noFields") : this.#emptyText;
|
|
721
721
|
return this;
|
|
722
722
|
}
|
|
723
723
|
this.#tree.appendChild(this.#groupNode(this.#value, 0));
|
|
724
724
|
this.#tree.hidden = false;
|
|
725
725
|
this.#empty.hidden = true;
|
|
726
|
-
this.#empty.innerText = this.#
|
|
726
|
+
this.#empty.innerText = this.#emptyText;
|
|
727
727
|
this.#syncErrors();
|
|
728
728
|
if (mark !== undefined) {
|
|
729
729
|
const node = this.#tree.querySelector(`[data-id="${CSS.escape(mark.owner)}"] ${mark.control}`);
|
|
@@ -761,8 +761,8 @@ class QueryBuilder {
|
|
|
761
761
|
const own = list.length > 0 ? `.${CSS.escape(list[0])}` : node.tagName.toLowerCase();
|
|
762
762
|
const holder = node.closest(".query_builder_field, .query_builder_operator, .query_builder_value");
|
|
763
763
|
if (holder === null) return own;
|
|
764
|
-
const
|
|
765
|
-
return
|
|
764
|
+
const holderClass = [...holder.classList].find((name) => name.startsWith("query_builder_"));
|
|
765
|
+
return holderClass === undefined ? own : `.${CSS.escape(holderClass)} ${own}`;
|
|
766
766
|
}
|
|
767
767
|
|
|
768
768
|
#groupNode(group = Object(), depth = Number()) {
|
|
@@ -836,7 +836,7 @@ class QueryBuilder {
|
|
|
836
836
|
if (group.children.length === 0) {
|
|
837
837
|
const note = document.createElement("query_builder_group_empty");
|
|
838
838
|
note.className = "query_builder_group_empty";
|
|
839
|
-
note.innerText = this.#
|
|
839
|
+
note.innerText = this.#emptyText;
|
|
840
840
|
list.appendChild(note);
|
|
841
841
|
return list;
|
|
842
842
|
}
|
|
@@ -859,7 +859,7 @@ class QueryBuilder {
|
|
|
859
859
|
onClick: () => this.addRule(group.id),
|
|
860
860
|
})
|
|
861
861
|
);
|
|
862
|
-
if (this.#depthOf(group) < this.#
|
|
862
|
+
if (this.#depthOf(group) < this.#maxDepth) {
|
|
863
863
|
foot.appendChild(
|
|
864
864
|
this.#addButton({
|
|
865
865
|
title: I18n.t("queryBuilder.groupShort"),
|
|
@@ -934,8 +934,8 @@ class QueryBuilder {
|
|
|
934
934
|
}
|
|
935
935
|
|
|
936
936
|
#ruleNode(rule = Object()) {
|
|
937
|
-
this.#
|
|
938
|
-
const index = this.#
|
|
937
|
+
this.#ruleCounter += 1;
|
|
938
|
+
const index = this.#ruleCounter;
|
|
939
939
|
const field = this.#fieldOf(rule.field);
|
|
940
940
|
const node = document.createElement("query_builder_rule");
|
|
941
941
|
node.className = "query_builder_rule";
|
|
@@ -1126,7 +1126,7 @@ class QueryBuilder {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
|
|
1128
1128
|
#syncLabel() {
|
|
1129
|
-
if (this.#
|
|
1129
|
+
if (this.#titleText !== undefined && this.#titleText !== "") {
|
|
1130
1130
|
this.#root.setAttribute("aria-labelledby", this.#title.id);
|
|
1131
1131
|
this.#root.removeAttribute("aria-label");
|
|
1132
1132
|
} else {
|
|
@@ -1137,8 +1137,8 @@ class QueryBuilder {
|
|
|
1137
1137
|
}
|
|
1138
1138
|
|
|
1139
1139
|
#accessibleName() {
|
|
1140
|
-
if (this.#
|
|
1141
|
-
if (this.#
|
|
1140
|
+
if (this.#titleText !== undefined && this.#titleText !== "") return this.#titleText;
|
|
1141
|
+
if (this.#labelText !== undefined && this.#labelText !== "") return this.#labelText;
|
|
1142
1142
|
return I18n.t("queryBuilder.title");
|
|
1143
1143
|
}
|
|
1144
1144
|
|
|
@@ -1157,10 +1157,10 @@ class QueryBuilder {
|
|
|
1157
1157
|
|
|
1158
1158
|
/** После правки показанная ошибка пересчитывается: она не должна пережить своё условие */
|
|
1159
1159
|
#refreshErrors() {
|
|
1160
|
-
if (this.#
|
|
1160
|
+
if (this.#errorShown === false) return this;
|
|
1161
1161
|
const result = this.validate();
|
|
1162
1162
|
if (result.valid) {
|
|
1163
|
-
this.#
|
|
1163
|
+
this.#errorShown = false;
|
|
1164
1164
|
this.clearError();
|
|
1165
1165
|
return this;
|
|
1166
1166
|
}
|
|
@@ -1177,7 +1177,7 @@ class QueryBuilder {
|
|
|
1177
1177
|
#notify() {
|
|
1178
1178
|
const value = this.getValue();
|
|
1179
1179
|
for (const listener of [...this.#listeners]) listener(value, this);
|
|
1180
|
-
if (this.#
|
|
1180
|
+
if (this.#onChange !== undefined) this.#onChange(value, this);
|
|
1181
1181
|
return this;
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
@@ -6,14 +6,14 @@ chui_query_builder {
|
|
|
6
6
|
box-sizing: border-box;
|
|
7
7
|
width: -webkit-fill-available;
|
|
8
8
|
max-width: 100%;
|
|
9
|
-
margin: var(--
|
|
9
|
+
margin: var(--block_margin);
|
|
10
10
|
color: var(--text_color);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.query_builder_title {
|
|
14
14
|
display: block;
|
|
15
15
|
width: max-content;
|
|
16
|
-
margin: var(--
|
|
16
|
+
margin: var(--block_margin);
|
|
17
17
|
color: var(--text_color);
|
|
18
18
|
font-family: system-ui, sans-serif;
|
|
19
19
|
font-size: var(--font_labels_size);
|
|
@@ -43,7 +43,7 @@ chui_query_builder {
|
|
|
43
43
|
width: -webkit-fill-available;
|
|
44
44
|
padding: 8px;
|
|
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
|
margin-inline-start: calc(var(--query_builder_depth, 0) * 14px);
|
|
49
49
|
}
|
|
@@ -97,7 +97,7 @@ chui_query_builder {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/* Контролы условия — готовые поля фреймворка (Select, TextInput, NumberInput, DateInput).
|
|
100
|
-
Их вид (35 px, --
|
|
100
|
+
Их вид (35 px, --radius_sm, hairline, фокус и запрет) держит сам компонент,
|
|
101
101
|
а строка условия задаёт только долю ширины и нулевой отступ. */
|
|
102
102
|
.query_builder_field,
|
|
103
103
|
.query_builder_operator,
|
|
@@ -64,9 +64,9 @@ class Result {
|
|
|
64
64
|
#actions = document.createElement("result_actions");
|
|
65
65
|
#id = undefined;
|
|
66
66
|
#style = Result.STYLE.INFO;
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
67
|
+
#titleValue = undefined;
|
|
68
|
+
#titleHidden = false;
|
|
69
|
+
#iconCustom = undefined;
|
|
70
70
|
|
|
71
71
|
constructor(
|
|
72
72
|
options = {
|
|
@@ -94,8 +94,8 @@ class Result {
|
|
|
94
94
|
this.#root.appendChild(this.#actions);
|
|
95
95
|
this.setStyle(optionOr(options.style, Result.STYLE.INFO));
|
|
96
96
|
if (options.icon !== undefined) this.setIcon(options.icon);
|
|
97
|
-
this.#
|
|
98
|
-
if (typeof options.title === "string" && options.title !== "") this.#
|
|
97
|
+
this.#titleHidden = options.title === null;
|
|
98
|
+
if (typeof options.title === "string" && options.title !== "") this.#titleValue = options.title;
|
|
99
99
|
this.#renderTitle();
|
|
100
100
|
this.setDescription(optionOr(options.description, ""));
|
|
101
101
|
this.setSize(optionOr(options.size, Result.SIZE.DEFAULT));
|
|
@@ -114,7 +114,7 @@ class Result {
|
|
|
114
114
|
|
|
115
115
|
/** Заголовок на экране (`""`, если он убран) */
|
|
116
116
|
getTitle() {
|
|
117
|
-
return this.#
|
|
117
|
+
return this.#titleHidden ? "" : this.#title.innerText;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
getDescription() {
|
|
@@ -150,7 +150,7 @@ class Result {
|
|
|
150
150
|
const assertive = known === Result.STYLE.ERROR;
|
|
151
151
|
this.#root.setAttribute("role", assertive ? "alert" : "status");
|
|
152
152
|
this.#root.setAttribute("aria-live", assertive ? "assertive" : "polite");
|
|
153
|
-
if (this.#
|
|
153
|
+
if (this.#iconCustom === undefined) this.#renderStyleIcon();
|
|
154
154
|
// Заголовок не задавали — он тоже описывает состояние
|
|
155
155
|
this.#renderTitle();
|
|
156
156
|
return this;
|
|
@@ -159,25 +159,25 @@ class Result {
|
|
|
159
159
|
/** Свой значок (имя из `Icons`, `Icon`, компонент или узел); `undefined` возвращает значок состояния */
|
|
160
160
|
setIcon(icon = undefined) {
|
|
161
161
|
if (icon === undefined || icon === null || icon === "") {
|
|
162
|
-
this.#
|
|
162
|
+
this.#iconCustom = undefined;
|
|
163
163
|
this.#renderStyleIcon();
|
|
164
164
|
return this;
|
|
165
165
|
}
|
|
166
|
-
this.#
|
|
166
|
+
this.#iconCustom =
|
|
167
167
|
typeof icon === "string"
|
|
168
168
|
? new Icon(icon, "36px").set()
|
|
169
169
|
: typeof icon.set === "function"
|
|
170
170
|
? icon.set()
|
|
171
171
|
: icon;
|
|
172
172
|
this.#icon.innerHTML = "";
|
|
173
|
-
this.#icon.appendChild(this.#
|
|
173
|
+
this.#icon.appendChild(this.#iconCustom);
|
|
174
174
|
return this;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
/** Заголовок; пустая строка — заголовок состояния, `null` — без заголовка */
|
|
178
178
|
setTitle(text = undefined) {
|
|
179
|
-
this.#
|
|
180
|
-
this.#
|
|
179
|
+
this.#titleHidden = text === null;
|
|
180
|
+
this.#titleValue = typeof text === "string" && text !== "" ? text : undefined;
|
|
181
181
|
this.#renderTitle();
|
|
182
182
|
return this;
|
|
183
183
|
}
|
|
@@ -228,9 +228,9 @@ class Result {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
#renderTitle() {
|
|
231
|
-
const text = this.#
|
|
232
|
-
this.#title.hidden = this.#
|
|
233
|
-
this.#title.innerText = this.#
|
|
231
|
+
const text = this.#titleValue === undefined ? Result.TITLE[this.#style] : this.#titleValue;
|
|
232
|
+
this.#title.hidden = this.#titleHidden;
|
|
233
|
+
this.#title.innerText = this.#titleHidden ? "" : text;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
|
|
@@ -72,17 +72,17 @@ result_actions:empty {
|
|
|
72
72
|
|
|
73
73
|
/* Стили состояния красят плашку значка — заливку блока они не трогают */
|
|
74
74
|
chui_result.result_success result_icon {
|
|
75
|
-
background: var(--
|
|
75
|
+
background: var(--badge_success_background);
|
|
76
76
|
color: var(--badge_success_text);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
chui_result.result_warning result_icon {
|
|
80
|
-
background: var(--
|
|
80
|
+
background: var(--badge_warning_background);
|
|
81
81
|
color: var(--badge_warning_text);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
chui_result.result_error result_icon {
|
|
85
|
-
background: var(--
|
|
85
|
+
background: var(--badge_error_background);
|
|
86
86
|
color: var(--badge_error_text);
|
|
87
87
|
}
|
|
88
88
|
|