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
|
@@ -36,37 +36,37 @@ class Transfer {
|
|
|
36
36
|
#root = document.createElement("chui_transfer");
|
|
37
37
|
#label = document.createElement("transfer_label");
|
|
38
38
|
#row = document.createElement("transfer_row");
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
39
|
+
#sourcePane = document.createElement("transfer_pane");
|
|
40
|
+
#targetPane = document.createElement("transfer_pane");
|
|
41
|
+
#sourceHead = document.createElement("transfer_head");
|
|
42
|
+
#targetHead = document.createElement("transfer_head");
|
|
43
|
+
#sourceList = document.createElement("transfer_list");
|
|
44
|
+
#targetList = document.createElement("transfer_list");
|
|
45
|
+
#sourceSearch = undefined;
|
|
46
|
+
#targetSearch = undefined;
|
|
47
|
+
#arrowTarget = document.createElement("button");
|
|
48
|
+
#arrowSource = document.createElement("button");
|
|
49
49
|
#hint = document.createElement("transfer_hint");
|
|
50
50
|
#status = document.createElement("transfer_status");
|
|
51
51
|
#error = document.createElement("chui_error_message");
|
|
52
|
-
#
|
|
53
|
-
#
|
|
52
|
+
#sourceRoving = undefined;
|
|
53
|
+
#targetRoving = undefined;
|
|
54
54
|
#items = [];
|
|
55
55
|
#marked = new Set();
|
|
56
56
|
#id = undefined;
|
|
57
57
|
#name = undefined;
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
#
|
|
58
|
+
#titleText = undefined;
|
|
59
|
+
#labelText = undefined;
|
|
60
|
+
#sourceTitle = undefined;
|
|
61
|
+
#targetTitle = undefined;
|
|
62
62
|
#searchable = false;
|
|
63
63
|
#disabled = false;
|
|
64
64
|
#min = undefined;
|
|
65
65
|
#max = undefined;
|
|
66
66
|
#listeners = [];
|
|
67
|
-
#
|
|
67
|
+
#onChange = undefined;
|
|
68
68
|
// Строка, к которой нужно вернуть фокус после перерисовки
|
|
69
|
-
#
|
|
69
|
+
#focusValue = undefined;
|
|
70
70
|
|
|
71
71
|
constructor(
|
|
72
72
|
options = {
|
|
@@ -91,13 +91,12 @@ class Transfer {
|
|
|
91
91
|
Transfer.#counter += 1;
|
|
92
92
|
this.#id = options.id === undefined ? `chui_transfer_${Transfer.#counter}` : options.id;
|
|
93
93
|
this.#name = options.name;
|
|
94
|
-
this.#
|
|
95
|
-
this.#
|
|
94
|
+
this.#labelText = options.label;
|
|
95
|
+
this.#onChange = options.onChange;
|
|
96
96
|
this.#searchable = options.searchable === true;
|
|
97
|
-
this.#
|
|
97
|
+
this.#sourceTitle =
|
|
98
98
|
options.sourceTitle === undefined ? I18n.t("transfer.available") : String(options.sourceTitle);
|
|
99
|
-
this.#
|
|
100
|
-
options.targetTitle === undefined ? I18n.t("transfer.chosen") : String(options.targetTitle);
|
|
99
|
+
this.#targetTitle = options.targetTitle === undefined ? I18n.t("transfer.chosen") : String(options.targetTitle);
|
|
101
100
|
this.#min = options.min;
|
|
102
101
|
this.#max = options.max;
|
|
103
102
|
this.#root.id = this.#id;
|
|
@@ -105,47 +104,35 @@ class Transfer {
|
|
|
105
104
|
this.#label.id = `${this.#id}_label`;
|
|
106
105
|
this.#row.className = "transfer_row";
|
|
107
106
|
this.#row.setAttribute("role", "group");
|
|
108
|
-
this.#
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
);
|
|
115
|
-
this.#
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.#
|
|
120
|
-
Transfer.SIDE.TARGET
|
|
121
|
-
);
|
|
122
|
-
this.#source_list.addEventListener("click", this.#onClick);
|
|
123
|
-
this.#target_list.addEventListener("click", this.#onClick);
|
|
124
|
-
this.#source_list.addEventListener("dblclick", this.#onDoubleClick);
|
|
125
|
-
this.#target_list.addEventListener("dblclick", this.#onDoubleClick);
|
|
126
|
-
this.#source_list.addEventListener("keydown", this.#onKeyDown);
|
|
127
|
-
this.#target_list.addEventListener("keydown", this.#onKeyDown);
|
|
128
|
-
this.#arrow_target.type = "button";
|
|
129
|
-
this.#arrow_source.type = "button";
|
|
130
|
-
this.#move_button(
|
|
131
|
-
this.#arrow_target,
|
|
107
|
+
this.#listPane(this.#sourcePane, this.#sourceHead, this.#sourceList, this.#sourceTitle, Transfer.SIDE.SOURCE);
|
|
108
|
+
this.#listPane(this.#targetPane, this.#targetHead, this.#targetList, this.#targetTitle, Transfer.SIDE.TARGET);
|
|
109
|
+
this.#sourceList.addEventListener("click", this.#onClick);
|
|
110
|
+
this.#targetList.addEventListener("click", this.#onClick);
|
|
111
|
+
this.#sourceList.addEventListener("dblclick", this.#onDoubleClick);
|
|
112
|
+
this.#targetList.addEventListener("dblclick", this.#onDoubleClick);
|
|
113
|
+
this.#sourceList.addEventListener("keydown", this.#onKeyDown);
|
|
114
|
+
this.#targetList.addEventListener("keydown", this.#onKeyDown);
|
|
115
|
+
this.#arrowTarget.type = "button";
|
|
116
|
+
this.#arrowSource.type = "button";
|
|
117
|
+
this.#moveButton(
|
|
118
|
+
this.#arrowTarget,
|
|
132
119
|
Transfer.SIDE.TARGET,
|
|
133
120
|
Icons.NAVIGATION.CHEVRON_RIGHT,
|
|
134
|
-
I18n.t("transfer.addMarked", { title: this.#
|
|
121
|
+
I18n.t("transfer.addMarked", { title: this.#targetTitle })
|
|
135
122
|
);
|
|
136
|
-
this.#
|
|
137
|
-
this.#
|
|
123
|
+
this.#moveButton(
|
|
124
|
+
this.#arrowSource,
|
|
138
125
|
Transfer.SIDE.SOURCE,
|
|
139
126
|
Icons.NAVIGATION.CHEVRON_LEFT,
|
|
140
|
-
I18n.t("transfer.removeMarked", { title: this.#
|
|
127
|
+
I18n.t("transfer.removeMarked", { title: this.#sourceTitle })
|
|
141
128
|
);
|
|
142
129
|
const controls = document.createElement("transfer_controls");
|
|
143
130
|
controls.className = "transfer_controls";
|
|
144
|
-
controls.appendChild(this.#
|
|
145
|
-
controls.appendChild(this.#
|
|
146
|
-
this.#row.appendChild(this.#
|
|
131
|
+
controls.appendChild(this.#arrowTarget);
|
|
132
|
+
controls.appendChild(this.#arrowSource);
|
|
133
|
+
this.#row.appendChild(this.#sourcePane);
|
|
147
134
|
this.#row.appendChild(controls);
|
|
148
|
-
this.#row.appendChild(this.#
|
|
135
|
+
this.#row.appendChild(this.#targetPane);
|
|
149
136
|
this.#hint.id = `${this.#id}_hint`;
|
|
150
137
|
this.#hint.className = "transfer_hint";
|
|
151
138
|
this.#hint.hidden = true;
|
|
@@ -159,16 +146,16 @@ class Transfer {
|
|
|
159
146
|
this.#root.appendChild(this.#status);
|
|
160
147
|
if (options.title !== undefined) this.setTitle(options.title);
|
|
161
148
|
else this.#label.hidden = true;
|
|
162
|
-
this.setLabel(this.#
|
|
149
|
+
this.setLabel(this.#labelText === undefined ? I18n.t("transfer.title") : this.#labelText);
|
|
163
150
|
if (options.hint !== undefined) this.setHint(options.hint);
|
|
164
151
|
// Число выбранных значений сравнивается своим правилом, а не строками
|
|
165
|
-
const
|
|
166
|
-
delete
|
|
167
|
-
delete
|
|
168
|
-
Validate.installField(this,
|
|
152
|
+
const rulesOptions = Object.assign({}, options);
|
|
153
|
+
delete rulesOptions.min;
|
|
154
|
+
delete rulesOptions.max;
|
|
155
|
+
Validate.installField(this, rulesOptions, this.#root, this.#error, () => this.getValue(), this.#row);
|
|
169
156
|
this.#installRules();
|
|
170
|
-
this.#
|
|
171
|
-
this.#
|
|
157
|
+
this.#sourceRoving = new RovingKeyboard(this.#sourceList, { itemSelector: ".transfer_item" });
|
|
158
|
+
this.#targetRoving = new RovingKeyboard(this.#targetList, { itemSelector: ".transfer_item" });
|
|
172
159
|
this.setItems(options.items);
|
|
173
160
|
if (options.value !== undefined) this.setValue(options.value);
|
|
174
161
|
this.setDisabled(options.disabled === true);
|
|
@@ -185,12 +172,12 @@ class Transfer {
|
|
|
185
172
|
}
|
|
186
173
|
|
|
187
174
|
getTitle() {
|
|
188
|
-
return this.#
|
|
175
|
+
return this.#titleText;
|
|
189
176
|
}
|
|
190
177
|
|
|
191
178
|
/** Доступное имя группы, заданное в `label` */
|
|
192
179
|
getLabel() {
|
|
193
|
-
return this.#
|
|
180
|
+
return this.#labelText;
|
|
194
181
|
}
|
|
195
182
|
|
|
196
183
|
/** Значения выбранного списка по порядку */
|
|
@@ -239,7 +226,7 @@ class Transfer {
|
|
|
239
226
|
|
|
240
227
|
/** Подпись над списками; `undefined` её убирает (имя тогда даёт `label`) */
|
|
241
228
|
setTitle(text = undefined) {
|
|
242
|
-
this.#
|
|
229
|
+
this.#titleText = text;
|
|
243
230
|
if (text === undefined || text === "") {
|
|
244
231
|
this.#label.hidden = true;
|
|
245
232
|
this.#label.innerText = "";
|
|
@@ -256,8 +243,8 @@ class Transfer {
|
|
|
256
243
|
|
|
257
244
|
/** Имя группы, когда подписи в разметке нет */
|
|
258
245
|
setLabel(text = undefined) {
|
|
259
|
-
this.#
|
|
260
|
-
if (this.#
|
|
246
|
+
this.#labelText = text;
|
|
247
|
+
if (this.#titleText === undefined || this.#titleText === "") {
|
|
261
248
|
if (text === undefined) this.#row.removeAttribute("aria-label");
|
|
262
249
|
else this.#row.setAttribute("aria-label", String(text));
|
|
263
250
|
}
|
|
@@ -350,13 +337,13 @@ class Transfer {
|
|
|
350
337
|
setDisabled(disabled = Boolean()) {
|
|
351
338
|
this.#disabled = disabled === true;
|
|
352
339
|
this.#root.classList.toggle("transfer_disabled", this.#disabled);
|
|
353
|
-
for (const list of [this.#
|
|
340
|
+
for (const list of [this.#sourceList, this.#targetList]) {
|
|
354
341
|
if (this.#disabled) list.setAttribute("aria-disabled", "true");
|
|
355
342
|
else list.removeAttribute("aria-disabled");
|
|
356
343
|
}
|
|
357
|
-
if (this.#
|
|
358
|
-
this.#
|
|
359
|
-
this.#
|
|
344
|
+
if (this.#sourceSearch !== undefined) {
|
|
345
|
+
this.#sourceSearch.disabled = this.#disabled;
|
|
346
|
+
this.#targetSearch.disabled = this.#disabled;
|
|
360
347
|
for (const clear of this.#root.querySelectorAll(".transfer_search_clear")) clear.disabled = this.#disabled;
|
|
361
348
|
}
|
|
362
349
|
this.#render();
|
|
@@ -372,7 +359,7 @@ class Transfer {
|
|
|
372
359
|
/** Фокус на первую строку: `Form` зовёт это при ошибке валидации */
|
|
373
360
|
focus() {
|
|
374
361
|
if (this.#disabled) return this;
|
|
375
|
-
const list = this.#
|
|
362
|
+
const list = this.#sourceList.querySelector(".transfer_item") === null ? this.#targetList : this.#sourceList;
|
|
376
363
|
const row = list.querySelector(".transfer_item");
|
|
377
364
|
if (row !== null) row.focus();
|
|
378
365
|
return this;
|
|
@@ -385,8 +372,8 @@ class Transfer {
|
|
|
385
372
|
|
|
386
373
|
// === ВНУТРЕННЕЕ ===
|
|
387
374
|
#accessibleName() {
|
|
388
|
-
if (this.#
|
|
389
|
-
if (this.#
|
|
375
|
+
if (this.#titleText !== undefined && this.#titleText !== "") return this.#titleText;
|
|
376
|
+
if (this.#labelText !== undefined && this.#labelText !== "") return this.#labelText;
|
|
390
377
|
return I18n.t("transfer.title");
|
|
391
378
|
}
|
|
392
379
|
|
|
@@ -416,7 +403,7 @@ class Transfer {
|
|
|
416
403
|
}
|
|
417
404
|
|
|
418
405
|
// Пара «заголовок + список» одного бока: поиск, список и место под пустое состояние
|
|
419
|
-
#
|
|
406
|
+
#listPane(pane = undefined, head = undefined, list = undefined, title = String(), side = String()) {
|
|
420
407
|
pane.className = "transfer_pane";
|
|
421
408
|
head.className = "transfer_head";
|
|
422
409
|
head.innerText = title;
|
|
@@ -455,8 +442,8 @@ class Transfer {
|
|
|
455
442
|
clear.hidden = search.value === "";
|
|
456
443
|
this.#render();
|
|
457
444
|
});
|
|
458
|
-
if (side === Transfer.SIDE.SOURCE) this.#
|
|
459
|
-
else this.#
|
|
445
|
+
if (side === Transfer.SIDE.SOURCE) this.#sourceSearch = search;
|
|
446
|
+
else this.#targetSearch = search;
|
|
460
447
|
box.appendChild(search);
|
|
461
448
|
box.appendChild(clear);
|
|
462
449
|
pane.appendChild(box);
|
|
@@ -465,7 +452,7 @@ class Transfer {
|
|
|
465
452
|
return pane;
|
|
466
453
|
}
|
|
467
454
|
|
|
468
|
-
#
|
|
455
|
+
#moveButton(button = undefined, side = String(), icon = String(), label = String()) {
|
|
469
456
|
button.className = "transfer_move";
|
|
470
457
|
button.setAttribute("aria-label", label);
|
|
471
458
|
button.addEventListener("click", () => this.#moveSelected(side));
|
|
@@ -498,30 +485,30 @@ class Transfer {
|
|
|
498
485
|
// запомним строку под фокусом, чтобы вернуть его после перерисовки
|
|
499
486
|
const active = document.activeElement;
|
|
500
487
|
const focused = active === null || !this.#root.contains(active) ? null : active.closest(".transfer_item");
|
|
501
|
-
if (focused !== null) this.#
|
|
502
|
-
this.#
|
|
503
|
-
this.#
|
|
504
|
-
const
|
|
505
|
-
const
|
|
506
|
-
let
|
|
507
|
-
let
|
|
488
|
+
if (focused !== null) this.#focusValue = focused.dataset.value;
|
|
489
|
+
this.#sourceList.innerHTML = "";
|
|
490
|
+
this.#targetList.innerHTML = "";
|
|
491
|
+
const sourceFilter = this.#filterOf(this.#sourceSearch);
|
|
492
|
+
const targetFilter = this.#filterOf(this.#targetSearch);
|
|
493
|
+
let sourceCount = 0;
|
|
494
|
+
let targetCount = 0;
|
|
508
495
|
for (const item of this.#items) {
|
|
509
|
-
const list = item.chosen ? this.#
|
|
510
|
-
const filter = item.chosen ?
|
|
511
|
-
if (item.chosen)
|
|
512
|
-
else
|
|
496
|
+
const list = item.chosen ? this.#targetList : this.#sourceList;
|
|
497
|
+
const filter = item.chosen ? targetFilter : sourceFilter;
|
|
498
|
+
if (item.chosen) targetCount += 1;
|
|
499
|
+
else sourceCount += 1;
|
|
513
500
|
if (filter !== "" && !this.#matches(item, filter)) continue;
|
|
514
501
|
list.appendChild(this.#rowNode(item));
|
|
515
502
|
}
|
|
516
|
-
this.#emptyNode(this.#
|
|
517
|
-
this.#emptyNode(this.#
|
|
518
|
-
this.#
|
|
519
|
-
this.#
|
|
503
|
+
this.#emptyNode(this.#sourceList, this.#sourceTitle, sourceFilter);
|
|
504
|
+
this.#emptyNode(this.#targetList, this.#targetTitle, targetFilter);
|
|
505
|
+
this.#sourceHead.querySelector("transfer_count").innerText = `(${sourceCount})`;
|
|
506
|
+
this.#targetHead.querySelector("transfer_count").innerText = `(${targetCount})`;
|
|
520
507
|
this.#applyButtons();
|
|
521
508
|
this.#restoreFocus();
|
|
522
509
|
// Остановка обхода подхватывает уже сфокусированную строку, а без неё — первую видимую
|
|
523
|
-
if (this.#
|
|
524
|
-
if (this.#
|
|
510
|
+
if (this.#sourceRoving !== undefined) this.#sourceRoving.refresh();
|
|
511
|
+
if (this.#targetRoving !== undefined) this.#targetRoving.refresh();
|
|
525
512
|
return this;
|
|
526
513
|
}
|
|
527
514
|
|
|
@@ -568,25 +555,25 @@ class Transfer {
|
|
|
568
555
|
|
|
569
556
|
#applyButtons() {
|
|
570
557
|
const marked = this.#selectedValues();
|
|
571
|
-
const
|
|
558
|
+
const canAdd = marked.some((value) => {
|
|
572
559
|
const item = this.#find(value);
|
|
573
560
|
return item !== undefined && !item.chosen && !item.disabled;
|
|
574
561
|
});
|
|
575
|
-
const
|
|
562
|
+
const canRemove = marked.some((value) => {
|
|
576
563
|
const item = this.#find(value);
|
|
577
564
|
return item !== undefined && item.chosen && !item.disabled;
|
|
578
565
|
});
|
|
579
566
|
const chosen = this.#markedItems().length;
|
|
580
567
|
const room = this.#max === undefined || chosen < this.#max;
|
|
581
|
-
this.#
|
|
582
|
-
this.#
|
|
568
|
+
this.#arrowTarget.disabled = this.#disabled || !canAdd || !room;
|
|
569
|
+
this.#arrowSource.disabled = this.#disabled || !canRemove;
|
|
583
570
|
return this;
|
|
584
571
|
}
|
|
585
572
|
|
|
586
573
|
// После перерисовки фокус возвращается на ту же строку, а если её не стало — никуда
|
|
587
574
|
#restoreFocus() {
|
|
588
|
-
const value = this.#
|
|
589
|
-
this.#
|
|
575
|
+
const value = this.#focusValue;
|
|
576
|
+
this.#focusValue = undefined;
|
|
590
577
|
if (value === undefined) return;
|
|
591
578
|
const row = this.#root.querySelector(`.transfer_item[data-value="${CSS.escape(value)}"]`);
|
|
592
579
|
if (row === null) return;
|
|
@@ -620,12 +607,12 @@ class Transfer {
|
|
|
620
607
|
titles.push(item.title);
|
|
621
608
|
this.#marked.delete(value);
|
|
622
609
|
}
|
|
623
|
-
this.#
|
|
610
|
+
this.#focusValue = moving[0];
|
|
624
611
|
this.#render();
|
|
625
|
-
const
|
|
612
|
+
const sideTitle = side === Transfer.SIDE.TARGET ? this.#targetTitle : this.#sourceTitle;
|
|
626
613
|
this.#announce(
|
|
627
614
|
I18n.t("transfer.moved", {
|
|
628
|
-
title:
|
|
615
|
+
title: sideTitle,
|
|
629
616
|
titles: titles.join(", "),
|
|
630
617
|
count: this.#markedItems().length,
|
|
631
618
|
total: this.#items.length,
|
|
@@ -641,7 +628,7 @@ class Transfer {
|
|
|
641
628
|
if (item === undefined || item.disabled) return;
|
|
642
629
|
if (this.#marked.has(value)) this.#marked.delete(value);
|
|
643
630
|
else this.#marked.add(value);
|
|
644
|
-
this.#
|
|
631
|
+
this.#focusValue = value;
|
|
645
632
|
this.#render();
|
|
646
633
|
// Об отметке сообщает сам список (aria-selected) — объявляем только снятие последней
|
|
647
634
|
if (this.#marked.size === 0) this.#announce(I18n.t("transfer.nothingMarked"));
|
|
@@ -651,7 +638,7 @@ class Transfer {
|
|
|
651
638
|
#notify() {
|
|
652
639
|
const values = this.getValue();
|
|
653
640
|
for (const listener of [...this.#listeners]) listener(values, this);
|
|
654
|
-
if (this.#
|
|
641
|
+
if (this.#onChange !== undefined) this.#onChange(values, this);
|
|
655
642
|
}
|
|
656
643
|
|
|
657
644
|
#announce(text = String()) {
|
|
@@ -6,14 +6,14 @@ chui_tree_table {
|
|
|
6
6
|
width: -webkit-fill-available;
|
|
7
7
|
max-width: 100%;
|
|
8
8
|
height: max-content;
|
|
9
|
-
margin: var(--
|
|
9
|
+
margin: var(--block_margin);
|
|
10
10
|
box-sizing: border-box;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.tree_table_label {
|
|
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-size: var(--font_labels_size);
|
|
19
19
|
font-weight: 500;
|
|
@@ -31,7 +31,7 @@ chui_tree_table {
|
|
|
31
31
|
max-width: 100%;
|
|
32
32
|
overflow: hidden;
|
|
33
33
|
border: 1px solid var(--border_color);
|
|
34
|
-
border-radius: var(--
|
|
34
|
+
border-radius: var(--radius_sm);
|
|
35
35
|
background: var(--element_background);
|
|
36
36
|
color: var(--text_color);
|
|
37
37
|
}
|
|
@@ -129,7 +129,7 @@ tree_table_toggle_spacer {
|
|
|
129
129
|
.tree_table_toggle chui_icon {
|
|
130
130
|
color: inherit;
|
|
131
131
|
font-size: 18px;
|
|
132
|
-
transition: transform var(--
|
|
132
|
+
transition: transform var(--motion_fast) var(--motion_ease);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
.tree_table_toggle:hover {
|