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
|
@@ -2,11 +2,11 @@ const { Button } = require("../chui_button/button");
|
|
|
2
2
|
|
|
3
3
|
class Form {
|
|
4
4
|
#id = require("randomstring").generate();
|
|
5
|
-
#
|
|
5
|
+
#chuiFormMain = document.createElement("chui_form_main");
|
|
6
6
|
#form = document.createElement("form");
|
|
7
7
|
#components = [];
|
|
8
|
-
#
|
|
9
|
-
#
|
|
8
|
+
#submitEvent = undefined;
|
|
9
|
+
#validateOnSubmit = true;
|
|
10
10
|
constructor(
|
|
11
11
|
options = {
|
|
12
12
|
action: String(),
|
|
@@ -17,19 +17,19 @@ class Form {
|
|
|
17
17
|
}
|
|
18
18
|
) {
|
|
19
19
|
require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_Forms");
|
|
20
|
-
this.#
|
|
21
|
-
this.#
|
|
20
|
+
this.#chuiFormMain.id = this.#id;
|
|
21
|
+
this.#chuiFormMain.appendChild(this.#form);
|
|
22
22
|
|
|
23
23
|
// Установка компонентов в форму (частичный объект опций без components — пустая форма)
|
|
24
24
|
this.#components = Array.isArray(options.components) ? options.components : [];
|
|
25
|
-
for (
|
|
25
|
+
for (const component of this.#components) this.#form.appendChild(component.set());
|
|
26
26
|
// ===
|
|
27
27
|
|
|
28
28
|
//Установка опций
|
|
29
29
|
if (options.action) this.#form.action = options.action;
|
|
30
30
|
if (options.method) this.#form.method = options.method;
|
|
31
|
-
if (options.validateOnSubmit !== undefined) this.#
|
|
32
|
-
this.#
|
|
31
|
+
if (options.validateOnSubmit !== undefined) this.#validateOnSubmit = options.validateOnSubmit;
|
|
32
|
+
this.#submitEvent = options.submitEvent;
|
|
33
33
|
// Своя валидация вместо нативной: свои тексты ошибок и разметка
|
|
34
34
|
this.#form.setAttribute("novalidate", "true");
|
|
35
35
|
this.#form.addEventListener("submit", this.#onSubmit);
|
|
@@ -37,14 +37,14 @@ class Form {
|
|
|
37
37
|
}
|
|
38
38
|
#onSubmit = (event) => {
|
|
39
39
|
event.preventDefault();
|
|
40
|
-
if (this.#
|
|
40
|
+
if (this.#validateOnSubmit) {
|
|
41
41
|
const result = this.validate();
|
|
42
42
|
if (!result.valid) {
|
|
43
43
|
if (result.first !== undefined && typeof result.first.focus === "function") result.first.focus();
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
if (this.#
|
|
47
|
+
if (this.#submitEvent !== undefined) this.#submitEvent(event, this.getValues(), this);
|
|
48
48
|
};
|
|
49
49
|
/** Проверить все поля формы: сами ошибки выставляются в поля */
|
|
50
50
|
validate() {
|
|
@@ -118,7 +118,7 @@ class Form {
|
|
|
118
118
|
}
|
|
119
119
|
//addSubmitEvent(listener = () => {}) { this.#form.addEventListener("submit", listener); }
|
|
120
120
|
set() {
|
|
121
|
-
return this.#
|
|
121
|
+
return this.#chuiFormMain;
|
|
122
122
|
}
|
|
123
123
|
static SubmitButton(title = String()) {
|
|
124
124
|
return new SubmitButton(title);
|
|
@@ -48,7 +48,7 @@ class Gantt {
|
|
|
48
48
|
|
|
49
49
|
#root = document.createElement("chui_gantt");
|
|
50
50
|
#corner = document.createElement("gantt_corner");
|
|
51
|
-
#
|
|
51
|
+
#scaleRow = document.createElement("gantt_scale");
|
|
52
52
|
#scroll = document.createElement("gantt_scroll");
|
|
53
53
|
#rows = document.createElement("gantt_rows");
|
|
54
54
|
#links = undefined;
|
|
@@ -57,15 +57,15 @@ class Gantt {
|
|
|
57
57
|
#from = undefined;
|
|
58
58
|
#to = undefined;
|
|
59
59
|
#scale = undefined;
|
|
60
|
-
#
|
|
61
|
-
#
|
|
62
|
-
#
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
60
|
+
#firstDay = 1;
|
|
61
|
+
#rowHeight = Gantt.DEFAULT_ROW_HEIGHT;
|
|
62
|
+
#barHeight = Gantt.DEFAULT_BAR_HEIGHT;
|
|
63
|
+
#labelWidth = Gantt.DEFAULT_LABEL_WIDTH;
|
|
64
|
+
#showProgress = true;
|
|
65
|
+
#showLinks = true;
|
|
66
66
|
#label = undefined;
|
|
67
|
-
#
|
|
68
|
-
#
|
|
67
|
+
#onTaskClick = undefined;
|
|
68
|
+
#rowsLayout = [];
|
|
69
69
|
|
|
70
70
|
constructor(
|
|
71
71
|
options = {
|
|
@@ -94,28 +94,28 @@ class Gantt {
|
|
|
94
94
|
this.#from = options.from;
|
|
95
95
|
this.#to = options.to;
|
|
96
96
|
this.#scale = Gantt.#knownScale(options.scale);
|
|
97
|
-
this.#
|
|
98
|
-
this.#
|
|
99
|
-
this.#
|
|
100
|
-
this.#
|
|
101
|
-
this.#
|
|
102
|
-
this.#
|
|
103
|
-
this.#
|
|
97
|
+
this.#firstDay = options.firstDay === undefined ? this.#firstDay : options.firstDay;
|
|
98
|
+
this.#rowHeight = options.rowHeight === undefined ? this.#rowHeight : options.rowHeight;
|
|
99
|
+
this.#barHeight = options.barHeight === undefined ? this.#barHeight : options.barHeight;
|
|
100
|
+
this.#labelWidth = options.labelWidth === undefined ? this.#labelWidth : options.labelWidth;
|
|
101
|
+
this.#showProgress = options.showProgress !== false;
|
|
102
|
+
this.#showLinks = options.showLinks !== false;
|
|
103
|
+
this.#onTaskClick = options.onTaskClick;
|
|
104
104
|
this.setLabel(optionOr(options.label, I18n.t("gantt.title")));
|
|
105
105
|
this.setHeight(options.height);
|
|
106
106
|
this.#corner.innerText = I18n.t("gantt.task");
|
|
107
107
|
this.#corner.setAttribute("aria-hidden", "true");
|
|
108
108
|
const head = document.createElement("gantt_head");
|
|
109
109
|
head.appendChild(this.#corner);
|
|
110
|
-
head.appendChild(this.#
|
|
110
|
+
head.appendChild(this.#scaleRow);
|
|
111
111
|
this.#root.appendChild(head);
|
|
112
112
|
this.#rows.appendChild(this.#createLinks());
|
|
113
113
|
this.#scroll.appendChild(this.#rows);
|
|
114
114
|
this.#root.appendChild(this.#scroll);
|
|
115
115
|
this.#root.addEventListener("click", this.#onClick);
|
|
116
|
-
this.setProperty("--gantt_label_width", `${this.#
|
|
117
|
-
this.#root.style.setProperty("--gantt_row_height", `${this.#
|
|
118
|
-
this.#root.style.setProperty("--gantt_bar_height", `${this.#
|
|
116
|
+
this.setProperty("--gantt_label_width", `${this.#labelWidth}px`);
|
|
117
|
+
this.#root.style.setProperty("--gantt_row_height", `${this.#rowHeight}px`);
|
|
118
|
+
this.#root.style.setProperty("--gantt_bar_height", `${this.#barHeight}px`);
|
|
119
119
|
this.#render();
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -153,11 +153,11 @@ class Gantt {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
getRowHeight() {
|
|
156
|
-
return this.#
|
|
156
|
+
return this.#rowHeight;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
getLabelWidth() {
|
|
160
|
-
return this.#
|
|
160
|
+
return this.#labelWidth;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/** Полоса задачи на диаграмме (если задача показана) */
|
|
@@ -295,7 +295,7 @@ class Gantt {
|
|
|
295
295
|
if (scale === Gantt.SCALE.MONTH) return new Date(date.getFullYear(), date.getMonth(), 1);
|
|
296
296
|
const day = Gantt.#startOfDay(date);
|
|
297
297
|
if (scale === Gantt.SCALE.WEEK) {
|
|
298
|
-
const offset = (day.getDay() - this.#
|
|
298
|
+
const offset = (day.getDay() - this.#firstDay + 7) % 7;
|
|
299
299
|
day.setDate(day.getDate() - offset);
|
|
300
300
|
}
|
|
301
301
|
return day;
|
|
@@ -361,8 +361,8 @@ class Gantt {
|
|
|
361
361
|
|
|
362
362
|
#renderScale(bounds = Object()) {
|
|
363
363
|
const scale = this.getScale();
|
|
364
|
-
this.#
|
|
365
|
-
this.#
|
|
364
|
+
this.#scaleRow.innerHTML = "";
|
|
365
|
+
this.#scaleRow.style.gridTemplateColumns = `repeat(${bounds.columns.length}, minmax(0, 1fr))`;
|
|
366
366
|
this.#root.style.setProperty("--gantt_columns", String(bounds.columns.length));
|
|
367
367
|
const today = Gantt.#startOfDay(new Date());
|
|
368
368
|
for (const column of bounds.columns) {
|
|
@@ -380,18 +380,18 @@ class Gantt {
|
|
|
380
380
|
if (scale === Gantt.SCALE.DAY && (column.from.getDay() === 0 || column.from.getDay() === 6))
|
|
381
381
|
cell.classList.add("gantt_weekend");
|
|
382
382
|
if (today >= column.from && today < column.to) cell.classList.add("gantt_today_cell");
|
|
383
|
-
this.#
|
|
383
|
+
this.#scaleRow.appendChild(cell);
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
#renderRows(bounds = Object()) {
|
|
388
388
|
// Заглушка "задач нет" тоже пересобирается: иначе она оставалась бы на диаграмме после setTasks()
|
|
389
389
|
this.#rows.querySelectorAll("gantt_row, gantt_group_row, gantt_empty").forEach((row) => row.remove());
|
|
390
|
-
this.#
|
|
390
|
+
this.#rowsLayout = [];
|
|
391
391
|
const today = Gantt.#startOfDay(new Date());
|
|
392
392
|
const todayFraction = today >= bounds.from && today < bounds.to ? this.#fraction(today, bounds) : undefined;
|
|
393
393
|
let lastGroup = undefined;
|
|
394
|
-
for (const [
|
|
394
|
+
for (const [taskIndex, task] of this.#tasks.entries()) {
|
|
395
395
|
if (task.group !== undefined && task.group !== lastGroup) {
|
|
396
396
|
lastGroup = task.group;
|
|
397
397
|
this.#rows.appendChild(this.#createGroupRow(task.group));
|
|
@@ -410,7 +410,7 @@ class Gantt {
|
|
|
410
410
|
if (start !== undefined && end !== undefined && end > bounds.from && start < bounds.to) {
|
|
411
411
|
const left = this.#fraction(start, bounds);
|
|
412
412
|
const right = this.#fraction(end, bounds);
|
|
413
|
-
track.appendChild(this.#createBar(task, start, end, left, Math.max(0.02, right - left),
|
|
413
|
+
track.appendChild(this.#createBar(task, start, end, left, Math.max(0.02, right - left), taskIndex));
|
|
414
414
|
}
|
|
415
415
|
if (todayFraction !== undefined) {
|
|
416
416
|
const line = document.createElement("gantt_today_line");
|
|
@@ -421,7 +421,7 @@ class Gantt {
|
|
|
421
421
|
row.appendChild(label);
|
|
422
422
|
row.appendChild(track);
|
|
423
423
|
this.#rows.appendChild(row);
|
|
424
|
-
this.#
|
|
424
|
+
this.#rowsLayout.push({ task: task, row: row });
|
|
425
425
|
}
|
|
426
426
|
if (this.#tasks.length === 0) {
|
|
427
427
|
const empty = document.createElement("gantt_empty");
|
|
@@ -430,7 +430,7 @@ class Gantt {
|
|
|
430
430
|
}
|
|
431
431
|
this.#rows.style.setProperty(
|
|
432
432
|
"--gantt_rows_height",
|
|
433
|
-
`${Math.max(1, this.#
|
|
433
|
+
`${Math.max(1, this.#rowsLayout.length) * this.#rowHeight}px`
|
|
434
434
|
);
|
|
435
435
|
}
|
|
436
436
|
|
|
@@ -453,13 +453,13 @@ class Gantt {
|
|
|
453
453
|
end = new Date(),
|
|
454
454
|
left = Number(),
|
|
455
455
|
width = Number(),
|
|
456
|
-
|
|
456
|
+
taskIndex = Number()
|
|
457
457
|
) {
|
|
458
458
|
const bar = document.createElement("button");
|
|
459
459
|
bar.type = "button";
|
|
460
460
|
bar.className = "gantt_bar";
|
|
461
461
|
bar.dataset.id = task.id === undefined ? "" : String(task.id);
|
|
462
|
-
bar.dataset.index = String(
|
|
462
|
+
bar.dataset.index = String(taskIndex);
|
|
463
463
|
bar.style.left = `${left * 100}%`;
|
|
464
464
|
bar.style.width = `${width * 100}%`;
|
|
465
465
|
if (task.color !== undefined) bar.style.background = String(task.color);
|
|
@@ -467,7 +467,7 @@ class Gantt {
|
|
|
467
467
|
title.innerText = task.title === undefined ? I18n.t("gantt.task") : String(task.title);
|
|
468
468
|
bar.appendChild(title);
|
|
469
469
|
const progress = this.#progress(task);
|
|
470
|
-
if (this.#
|
|
470
|
+
if (this.#showProgress && progress !== undefined) {
|
|
471
471
|
const fill = document.createElement("gantt_bar_progress");
|
|
472
472
|
fill.style.width = `${progress}%`;
|
|
473
473
|
bar.appendChild(fill);
|
|
@@ -510,18 +510,18 @@ class Gantt {
|
|
|
510
510
|
#renderLinks(bounds = Object()) {
|
|
511
511
|
if (this.#links === undefined) return;
|
|
512
512
|
this.#links.innerHTML = "";
|
|
513
|
-
if (!this.#
|
|
514
|
-
const index = new Map(this.#
|
|
515
|
-
const height = Math.max(1, this.#
|
|
513
|
+
if (!this.#showLinks) return;
|
|
514
|
+
const index = new Map(this.#rowsLayout.map((entry, position) => [String(entry.task.id), position]));
|
|
515
|
+
const height = Math.max(1, this.#rowsLayout.length) * this.#rowHeight;
|
|
516
516
|
this.#links.setAttribute("viewBox", `0 0 100 ${height}`);
|
|
517
517
|
this.#links.style.height = `${height}px`;
|
|
518
|
-
for (const { task } of this.#
|
|
518
|
+
for (const { task } of this.#rowsLayout) {
|
|
519
519
|
const dependencies = Array.isArray(task.dependencies) ? task.dependencies : [];
|
|
520
520
|
if (dependencies.length === 0) continue;
|
|
521
521
|
const start = Gantt.#taskStart(task);
|
|
522
522
|
if (start === undefined) continue;
|
|
523
523
|
const x2 = this.#fraction(start, bounds) * 100;
|
|
524
|
-
const y2 = (index.get(String(task.id)) + 0.5) * this.#
|
|
524
|
+
const y2 = (index.get(String(task.id)) + 0.5) * this.#rowHeight;
|
|
525
525
|
for (const dependency of dependencies) {
|
|
526
526
|
const position = index.get(String(dependency));
|
|
527
527
|
if (position === undefined) continue;
|
|
@@ -529,7 +529,7 @@ class Gantt {
|
|
|
529
529
|
const end = source === undefined ? undefined : Gantt.#taskEnd(source);
|
|
530
530
|
if (end === undefined) continue;
|
|
531
531
|
const x1 = this.#fraction(end, bounds) * 100;
|
|
532
|
-
const y1 = (position + 0.5) * this.#
|
|
532
|
+
const y1 = (position + 0.5) * this.#rowHeight;
|
|
533
533
|
// Колено всегда справа от конца предшественника: при наложении линия уйдёт назад
|
|
534
534
|
const elbow = x1 + 1.5;
|
|
535
535
|
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
@@ -555,7 +555,7 @@ class Gantt {
|
|
|
555
555
|
const bar = target.closest(".gantt_bar");
|
|
556
556
|
if (bar === null) return;
|
|
557
557
|
const task = this.#tasks[Number(bar.dataset.index)];
|
|
558
|
-
if (this.#
|
|
558
|
+
if (this.#onTaskClick !== undefined) this.#onTaskClick(task, bar);
|
|
559
559
|
};
|
|
560
560
|
}
|
|
561
561
|
|
|
@@ -9,12 +9,12 @@ chui_gantt {
|
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
width: -webkit-fill-available;
|
|
11
11
|
box-sizing: border-box;
|
|
12
|
-
margin: var(--
|
|
12
|
+
margin: var(--block_margin);
|
|
13
13
|
color: var(--text_color);
|
|
14
14
|
font-size: var(--font_default_size);
|
|
15
15
|
background: var(--element_background_2);
|
|
16
16
|
border: 1px solid var(--border_color);
|
|
17
|
-
border-radius: var(--
|
|
17
|
+
border-radius: var(--radius_sm);
|
|
18
18
|
overflow: hidden;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -128,7 +128,7 @@ button.gantt_bar {
|
|
|
128
128
|
padding: 0 6px;
|
|
129
129
|
overflow: hidden;
|
|
130
130
|
border: none;
|
|
131
|
-
border-radius: var(--
|
|
131
|
+
border-radius: var(--radius_sm);
|
|
132
132
|
background: var(--blue_prime_background);
|
|
133
133
|
color: var(--text_color_hover);
|
|
134
134
|
font-family: inherit;
|
|
@@ -163,7 +163,7 @@ gantt_bar_progress {
|
|
|
163
163
|
inset-inline-start: 0;
|
|
164
164
|
top: 0;
|
|
165
165
|
bottom: 0;
|
|
166
|
-
background:
|
|
166
|
+
background: var(--overlay_dim);
|
|
167
167
|
pointer-events: none;
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -199,7 +199,7 @@ svg.gantt_links circle.gantt_link_dot {
|
|
|
199
199
|
|
|
200
200
|
gantt_empty {
|
|
201
201
|
display: block;
|
|
202
|
-
padding: var(--
|
|
202
|
+
padding: var(--block_padding);
|
|
203
203
|
color: var(--text_color_disabled);
|
|
204
204
|
text-align: center;
|
|
205
205
|
}
|