chuijs 4.0.2 → 4.0.3
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 +61 -0
- package/README.md +43 -644
- package/framework/appLayout/default/chui_app_layout.js +308 -260
- package/framework/appLayout/default/global_style.css +85 -48
- package/framework/components/chui_accordion/accordion.js +29 -26
- package/framework/components/chui_accordion/styles.css +6 -5
- package/framework/components/chui_action_sheet/action_sheet.js +59 -33
- package/framework/components/chui_action_sheet/styles.css +2 -1
- package/framework/components/chui_affix/affix.js +11 -6
- package/framework/components/chui_alert/alert.js +23 -14
- package/framework/components/chui_avatar/avatar.js +23 -22
- package/framework/components/chui_avatar_group/avatar_group.js +21 -19
- package/framework/components/chui_backtop/backtop.js +35 -19
- package/framework/components/chui_badge/badge.js +15 -13
- package/framework/components/chui_breadcrumb/breadcrumb.js +15 -13
- package/framework/components/chui_button/button.js +42 -22
- package/framework/components/chui_button/styles.css +2 -2
- package/framework/components/chui_calendar/calendar.js +12 -10
- package/framework/components/chui_card/card.js +43 -23
- package/framework/components/chui_chat/chat.js +72 -33
- package/framework/components/chui_clipboard_history/clipboard_history.js +30 -21
- package/framework/components/chui_clipboard_history/styles.css +4 -2
- package/framework/components/chui_code/code.js +2 -2
- package/framework/components/chui_code/styles.css +2 -2
- package/framework/components/chui_code_editor/code_editor.js +47 -31
- package/framework/components/chui_code_editor/styles.css +3 -2
- package/framework/components/chui_command_palette/command_palette.js +60 -37
- package/framework/components/chui_console/console.js +5 -5
- package/framework/components/chui_console/styles.css +1 -1
- package/framework/components/chui_content_block/content_block.js +33 -19
- package/framework/components/chui_content_block/styles.css +2 -2
- package/framework/components/chui_context_menu/context_menu.js +9 -4
- package/framework/components/chui_custom_element/custom_element.js +22 -15
- package/framework/components/chui_data_grid/data_grid.js +396 -234
- package/framework/components/chui_data_grid/styles.css +10 -8
- package/framework/components/chui_descriptions/descriptions.js +34 -17
- package/framework/components/chui_details/details.js +32 -26
- package/framework/components/chui_details/styles.css +5 -4
- package/framework/components/chui_diff_viewer/diff_viewer.js +91 -66
- package/framework/components/chui_diff_viewer/styles.css +1 -1
- package/framework/components/chui_divider/divider.js +13 -11
- package/framework/components/chui_drawer/drawer.js +27 -25
- package/framework/components/chui_drop_zone/drop_zone.js +31 -21
- package/framework/components/chui_empty_state/empty_state.js +20 -15
- package/framework/components/chui_fieldset/fieldset.js +37 -20
- package/framework/components/chui_fieldset/styles.css +1 -1
- package/framework/components/chui_file_explorer/file_explorer.js +157 -86
- package/framework/components/chui_file_explorer/styles.css +2 -1
- package/framework/components/chui_form/form.js +31 -19
- package/framework/components/chui_form/styles.css +1 -1
- package/framework/components/chui_gantt/gantt.js +64 -40
- package/framework/components/chui_graphs/graphs.js +301 -200
- package/framework/components/chui_graphs/styles.css +1 -1
- package/framework/components/chui_hero/hero.js +40 -22
- package/framework/components/chui_html_block/html_block.js +6 -6
- package/framework/components/chui_html_block/styles.css +2 -2
- package/framework/components/chui_hx/hx.js +3 -3
- package/framework/components/chui_hx/styles.css +11 -4
- package/framework/components/chui_icons/icons.js +2109 -2109
- package/framework/components/chui_icons/styles.css +2 -2
- package/framework/components/chui_inputs/chui_check_box/check_box.js +31 -19
- package/framework/components/chui_inputs/chui_check_box/styles.css +18 -18
- package/framework/components/chui_inputs/chui_chips/chips.js +50 -40
- package/framework/components/chui_inputs/chui_chips/styles.css +4 -2
- package/framework/components/chui_inputs/chui_color_picker/color_picker.js +36 -24
- package/framework/components/chui_inputs/chui_combo_box/combo_box.js +100 -82
- package/framework/components/chui_inputs/chui_combo_box/styles.css +14 -12
- package/framework/components/chui_inputs/chui_date/date.js +102 -66
- package/framework/components/chui_inputs/chui_date/styles.css +12 -11
- package/framework/components/chui_inputs/chui_date_range/date_range.js +40 -29
- package/framework/components/chui_inputs/chui_datetime/datetime.js +35 -27
- package/framework/components/chui_inputs/chui_email/email.js +43 -31
- package/framework/components/chui_inputs/chui_email/styles.css +5 -5
- package/framework/components/chui_inputs/chui_file/file.js +68 -41
- package/framework/components/chui_inputs/chui_file/styles.css +13 -12
- package/framework/components/chui_inputs/chui_hotkey/hotkey.js +61 -36
- package/framework/components/chui_inputs/chui_masked/masked.js +39 -28
- package/framework/components/chui_inputs/chui_mention/mention.js +77 -30
- package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +173 -153
- package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +9 -7
- package/framework/components/chui_inputs/chui_number/number.js +58 -41
- package/framework/components/chui_inputs/chui_number/styles.css +7 -7
- package/framework/components/chui_inputs/chui_otp/otp.js +38 -29
- package/framework/components/chui_inputs/chui_password/password.js +58 -36
- package/framework/components/chui_inputs/chui_password/styles.css +8 -8
- package/framework/components/chui_inputs/chui_radio_button/radio_button.js +37 -25
- package/framework/components/chui_inputs/chui_radio_button/styles.css +20 -20
- package/framework/components/chui_inputs/chui_rating/rating.js +26 -22
- package/framework/components/chui_inputs/chui_select_box/select_box.js +102 -78
- package/framework/components/chui_inputs/chui_select_box/styles.css +11 -11
- package/framework/components/chui_inputs/chui_slider/slider.js +29 -26
- package/framework/components/chui_inputs/chui_slider/styles.css +2 -1
- package/framework/components/chui_inputs/chui_text/styles.css +8 -8
- package/framework/components/chui_inputs/chui_text/text.js +65 -44
- package/framework/components/chui_inputs/chui_text_area/styles.css +6 -6
- package/framework/components/chui_inputs/chui_text_area/text_area.js +51 -28
- package/framework/components/chui_inputs/chui_time/styles.css +5 -3
- package/framework/components/chui_inputs/chui_time/time.js +38 -27
- package/framework/components/chui_inputs/chui_toggle/styles.css +3 -3
- package/framework/components/chui_inputs/chui_toggle/toggle.js +16 -16
- package/framework/components/chui_json_editor/json_editor.js +53 -43
- package/framework/components/chui_json_viewer/json_viewer.js +52 -33
- package/framework/components/chui_json_viewer/styles.css +3 -2
- package/framework/components/chui_kanban/kanban.js +52 -34
- package/framework/components/chui_kbd/kbd.js +12 -10
- package/framework/components/chui_label/label.js +14 -12
- package/framework/components/chui_label/styles.css +2 -2
- package/framework/components/chui_link/link.js +27 -20
- package/framework/components/chui_list/list.js +31 -27
- package/framework/components/chui_list/styles.css +2 -1
- package/framework/components/chui_markdown_editor/markdown_editor.js +60 -44
- package/framework/components/chui_media/audio.js +326 -227
- package/framework/components/chui_media/audio_styles.css +40 -21
- package/framework/components/chui_media/image.js +70 -38
- package/framework/components/chui_media/image_compare.js +52 -21
- package/framework/components/chui_media/image_styles.css +3 -3
- package/framework/components/chui_media/video.js +155 -62
- package/framework/components/chui_media/video_styles.css +33 -16
- package/framework/components/chui_menu_bar/menu_bar.js +26 -24
- package/framework/components/chui_menu_bar/styles.css +4 -2
- package/framework/components/chui_modal/modal.js +44 -43
- package/framework/components/chui_modal/styles.css +3 -2
- package/framework/components/chui_notification/notification.js +50 -34
- package/framework/components/chui_notification/notification_download.js +31 -25
- package/framework/components/chui_notification/notification_download_progress.css +3 -2
- package/framework/components/chui_notification/notification_download_progress.js +47 -41
- package/framework/components/chui_notification/notification_update.js +23 -16
- package/framework/components/chui_notification/status_plate.js +2 -2
- package/framework/components/chui_notification/styles_download.css +1 -1
- package/framework/components/chui_notification/styles_update.css +1 -1
- package/framework/components/chui_org_chart/org_chart.js +74 -35
- package/framework/components/chui_pagination/pagination.js +62 -27
- package/framework/components/chui_paragraph/paragraph.js +2 -2
- package/framework/components/chui_paragraph/styles.css +1 -1
- package/framework/components/chui_popover/popover.js +49 -28
- package/framework/components/chui_popups/popups.js +137 -108
- package/framework/components/chui_popups/styles.css +2 -2
- package/framework/components/chui_print_button/print_button.js +33 -23
- package/framework/components/chui_progress_bar/progress_bar.js +23 -15
- package/framework/components/chui_progress_bar/styles.css +2 -2
- package/framework/components/chui_progress_ring/progress_ring.js +17 -15
- package/framework/components/chui_qrcode/qrcode.js +75 -31
- package/framework/components/chui_query_builder/query_builder.js +216 -123
- package/framework/components/chui_radio_group/radio_group.js +36 -26
- package/framework/components/chui_radio_group/styles.css +1 -1
- package/framework/components/chui_result/result.js +26 -16
- package/framework/components/chui_scheduler/scheduler.js +57 -35
- package/framework/components/chui_scheduler/styles.css +6 -2
- package/framework/components/chui_segmented_control/segmented_control.js +27 -21
- package/framework/components/chui_settings/settings.js +122 -48
- package/framework/components/chui_shortcut_help/shortcut_help.js +55 -32
- package/framework/components/chui_sidebar_nav/sidebar_nav.js +33 -23
- package/framework/components/chui_skeleton/skeleton.js +29 -24
- package/framework/components/chui_slideshow/slideshow.js +60 -41
- package/framework/components/chui_slideshow/styles.css +18 -12
- package/framework/components/chui_spinner/spinner.js +8 -8
- package/framework/components/chui_spinner/styles.css +0 -1
- package/framework/components/chui_split_button/split_button.js +23 -18
- package/framework/components/chui_split_button/styles.css +1 -1
- package/framework/components/chui_splitter/splitter.js +35 -28
- package/framework/components/chui_statistic/statistic.js +65 -38
- package/framework/components/chui_status_bar/status_bar.js +11 -9
- package/framework/components/chui_stepper/stepper.js +27 -22
- package/framework/components/chui_sticky_bar/sticky_bar.js +9 -4
- package/framework/components/chui_sticky_bar/styles.css +3 -1
- package/framework/components/chui_tabs/chui_tabs.js +28 -22
- package/framework/components/chui_tabs/styles.css +3 -3
- package/framework/components/chui_text_editor/styles.css +20 -19
- package/framework/components/chui_text_editor/text_editor.js +85 -61
- package/framework/components/chui_text_editor/text_editor_panel.js +346 -284
- package/framework/components/chui_theme_toggle/theme_toggle.js +27 -22
- package/framework/components/chui_timeline/timeline.js +14 -12
- package/framework/components/chui_toast_queue/toast_queue.js +52 -46
- package/framework/components/chui_toolbar/toolbar.js +20 -13
- package/framework/components/chui_tooltip/tooltip.js +37 -24
- package/framework/components/chui_tour/styles.css +8 -3
- package/framework/components/chui_tour/tour.js +61 -27
- package/framework/components/chui_transfer/styles.css +2 -1
- package/framework/components/chui_transfer/transfer.js +75 -42
- package/framework/components/chui_tree_table/tree_table.js +43 -29
- package/framework/components/chui_tree_view/styles.css +4 -2
- package/framework/components/chui_tree_view/tree_view.js +142 -99
- package/framework/components/chui_watermark/watermark.js +24 -16
- package/framework/components/chui_webview/styles.css +2 -2
- package/framework/components/chui_webview/webview.js +62 -50
- package/framework/components/telegram_bot/chui_telegram_bot.js +71 -64
- package/framework/modules/chui_a11y/chui_a11y.js +77 -46
- package/framework/modules/chui_animations/animations.js +42 -42
- package/framework/modules/chui_animations/styles.css +1 -1
- package/framework/modules/chui_bridge/preload.js +36 -25
- package/framework/modules/chui_functions.js +52 -50
- package/framework/modules/chui_highlight/chui_highlight.js +25 -22
- package/framework/modules/chui_i18n/chui_i18n.js +9 -7
- package/framework/modules/chui_i18n/locales/a11y.js +5 -5
- package/framework/modules/chui_i18n/locales/app_layout.js +5 -5
- package/framework/modules/chui_i18n/locales/calendar.js +3 -3
- package/framework/modules/chui_i18n/locales/common.js +3 -3
- package/framework/modules/chui_i18n/locales/data.js +36 -26
- package/framework/modules/chui_i18n/locales/editors.js +40 -13
- package/framework/modules/chui_i18n/locales/feedback.js +3 -3
- package/framework/modules/chui_i18n/locales/forms.js +8 -8
- package/framework/modules/chui_i18n/locales/graphics.js +8 -8
- package/framework/modules/chui_i18n/locales/media.js +4 -4
- package/framework/modules/chui_i18n/locales/navigation.js +8 -8
- package/framework/modules/chui_i18n/locales/validate.js +3 -3
- package/framework/modules/chui_json/chui_json.js +9 -9
- package/framework/modules/chui_layout/chui_layout.js +12 -10
- package/framework/modules/chui_logger/chui_logger.js +29 -25
- package/framework/modules/chui_page/page.js +33 -27
- package/framework/modules/chui_qr/chui_qr.js +158 -67
- package/framework/modules/chui_scrollbar/chui_scrollbar.js +35 -24
- package/framework/modules/chui_scrollbar/styles.css +3 -1
- package/framework/modules/chui_services/chui_channels.js +27 -13
- package/framework/modules/chui_services/chui_services.js +39 -31
- package/framework/modules/chui_services/desktop.js +32 -31
- package/framework/modules/chui_sortable/chui_sortable.js +17 -12
- package/framework/modules/chui_validate/chui_validate.js +7 -4
- package/framework/tray_bar/chui_menu_items.js +136 -46
- package/index.d.ts +4814 -0
- package/index.js +385 -292
- package/package.json +79 -68
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const {setStyles, optionOr} = require(
|
|
2
|
-
const {I18n} = require(
|
|
1
|
+
const { setStyles, optionOr } = require("../../modules/chui_functions");
|
|
2
|
+
const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Плейсхолдер загрузки (skeleton): серые фигуры на месте будущего содержимого.
|
|
@@ -20,12 +20,12 @@ class Skeleton {
|
|
|
20
20
|
TEXT: "text",
|
|
21
21
|
TITLE: "title",
|
|
22
22
|
CIRCLE: "circle",
|
|
23
|
-
RECT: "rect"
|
|
23
|
+
RECT: "rect",
|
|
24
24
|
};
|
|
25
25
|
static ANIMATION = {
|
|
26
26
|
SHIMMER: "shimmer",
|
|
27
27
|
PULSE: "pulse",
|
|
28
|
-
NONE: "none"
|
|
28
|
+
NONE: "none",
|
|
29
29
|
};
|
|
30
30
|
/** Ширина последней строки многострочного текста — строки не должны быть равными */
|
|
31
31
|
static LAST_LINE_WIDTH = "60%";
|
|
@@ -37,19 +37,21 @@ class Skeleton {
|
|
|
37
37
|
#id = undefined;
|
|
38
38
|
#animation = Skeleton.ANIMATION.SHIMMER;
|
|
39
39
|
|
|
40
|
-
constructor(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
constructor(
|
|
41
|
+
options = {
|
|
42
|
+
id: String(),
|
|
43
|
+
shape: String(),
|
|
44
|
+
lines: Number(),
|
|
45
|
+
width: String(),
|
|
46
|
+
height: String(),
|
|
47
|
+
radius: String(),
|
|
48
|
+
gap: String(),
|
|
49
|
+
animation: String(),
|
|
50
|
+
label: String(),
|
|
51
|
+
style: String(),
|
|
52
|
+
shapes: [],
|
|
53
|
+
}
|
|
54
|
+
) {
|
|
53
55
|
setStyles(__dirname + "/styles.css", "chUiJS_Skeleton");
|
|
54
56
|
Skeleton.#counter += 1;
|
|
55
57
|
this.#id = options.id === undefined ? `chui_skeleton_${Skeleton.#counter}` : options.id;
|
|
@@ -71,17 +73,20 @@ class Skeleton {
|
|
|
71
73
|
}
|
|
72
74
|
const shape = options.shape === undefined ? Skeleton.SHAPE.TEXT : options.shape;
|
|
73
75
|
if (shape !== Skeleton.SHAPE.TEXT && shape !== Skeleton.SHAPE.TITLE) {
|
|
74
|
-
this.addShape({shape, width: options.width, height: options.height, radius: options.radius});
|
|
76
|
+
this.addShape({ shape, width: options.width, height: options.height, radius: options.radius });
|
|
75
77
|
return;
|
|
76
78
|
}
|
|
77
79
|
const lines = options.lines === undefined ? 1 : options.lines;
|
|
78
80
|
for (let line = 1; line <= lines; line++) {
|
|
79
81
|
// Последняя строка многострочного текста короче — так скелет читается как текст
|
|
80
82
|
const isLast = line === lines;
|
|
81
|
-
const width =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
const width =
|
|
84
|
+
options.width !== undefined
|
|
85
|
+
? options.width
|
|
86
|
+
: isLast && lines > 1
|
|
87
|
+
? Skeleton.LAST_LINE_WIDTH
|
|
88
|
+
: undefined;
|
|
89
|
+
this.addShape({ shape, width, height: options.height, radius: options.radius });
|
|
85
90
|
}
|
|
86
91
|
}
|
|
87
92
|
|
|
@@ -140,7 +145,7 @@ class Skeleton {
|
|
|
140
145
|
|
|
141
146
|
// ФИГУРЫ
|
|
142
147
|
/** Добавляет фигуру: shape, width, height, radius, style */
|
|
143
|
-
addShape(options = {shape: String(), width: String(), height: String(), radius: String(), style: String()}) {
|
|
148
|
+
addShape(options = { shape: String(), width: String(), height: String(), radius: String(), style: String() }) {
|
|
144
149
|
const shape = options.shape === undefined ? Skeleton.SHAPE.TEXT : options.shape;
|
|
145
150
|
const element = document.createElement("skeleton_shape");
|
|
146
151
|
element.classList.add(`skeleton_${shape}`);
|
|
@@ -174,4 +179,4 @@ class Skeleton {
|
|
|
174
179
|
}
|
|
175
180
|
}
|
|
176
181
|
|
|
177
|
-
exports.Skeleton = Skeleton
|
|
182
|
+
exports.Skeleton = Skeleton;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
const {Icon, Icons} = require("../chui_icons/icons");
|
|
2
|
-
const {optionOr} = require("../../modules/chui_functions");
|
|
3
|
-
const {Animation} = require("../../modules/chui_animations/animations");
|
|
4
|
-
const {makeKeyboardButton} = require("../../modules/chui_a11y/chui_a11y");
|
|
5
|
-
const {I18n} = require("../../modules/chui_i18n/chui_i18n");
|
|
1
|
+
const { Icon, Icons } = require("../chui_icons/icons");
|
|
2
|
+
const { optionOr } = require("../../modules/chui_functions");
|
|
3
|
+
const { Animation } = require("../../modules/chui_animations/animations");
|
|
4
|
+
const { makeKeyboardButton } = require("../../modules/chui_a11y/chui_a11y");
|
|
5
|
+
const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
6
6
|
|
|
7
7
|
class SlideShow {
|
|
8
8
|
#default_slide = 0;
|
|
9
|
-
#chui_slides_main = document.createElement(
|
|
9
|
+
#chui_slides_main = document.createElement("chui_slides_main");
|
|
10
10
|
//
|
|
11
|
-
#chui_slides_list = document.createElement("chui_slides_list")
|
|
12
|
-
#chui_next_slide = document.createElement(
|
|
13
|
-
#chui_prev_slide = document.createElement(
|
|
14
|
-
#chui_slideshow_controls = document.createElement(
|
|
15
|
-
#chui_slideshow_dots = document.createElement(
|
|
16
|
-
#chui_slideshow_pause = document.createElement(
|
|
11
|
+
#chui_slides_list = document.createElement("chui_slides_list");
|
|
12
|
+
#chui_next_slide = document.createElement("chui_next_slide");
|
|
13
|
+
#chui_prev_slide = document.createElement("chui_prev_slide");
|
|
14
|
+
#chui_slideshow_controls = document.createElement("chui_slideshow_controls");
|
|
15
|
+
#chui_slideshow_dots = document.createElement("chui_slideshow_dots");
|
|
16
|
+
#chui_slideshow_pause = document.createElement("chui_slideshow_pause");
|
|
17
17
|
//
|
|
18
18
|
#slides_list = undefined;
|
|
19
19
|
#autoplay = undefined;
|
|
20
20
|
#autoplay_timer = undefined;
|
|
21
21
|
#user_paused = false;
|
|
22
22
|
constructor(options = {}) {
|
|
23
|
-
require(
|
|
23
|
+
require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_SlideShow");
|
|
24
24
|
// Частичный объект опций: у каждого поля своё значение по умолчанию
|
|
25
25
|
const width = optionOr(options.width, undefined);
|
|
26
26
|
const height = optionOr(options.height, undefined);
|
|
@@ -35,7 +35,10 @@ class SlideShow {
|
|
|
35
35
|
// Частичный объект опций: у каждого поля своё значение по умолчанию. Без этого
|
|
36
36
|
// `autoplay: {status: true}` без interval давал setInterval с NaN — слайды мелькали,
|
|
37
37
|
// а `autoplay: true` вообще не включал прокрутку
|
|
38
|
-
const autoplay =
|
|
38
|
+
const autoplay =
|
|
39
|
+
options.autoplay === undefined || options.autoplay === null || typeof options.autoplay !== "object"
|
|
40
|
+
? {}
|
|
41
|
+
: options.autoplay;
|
|
39
42
|
const interval = Number(autoplay.interval);
|
|
40
43
|
this.#autoplay = {
|
|
41
44
|
status: options.autoplay === true || autoplay.status === true,
|
|
@@ -50,8 +53,8 @@ class SlideShow {
|
|
|
50
53
|
this.#chui_prev_slide.setAttribute("aria-label", I18n.t("feedback.previousSlide"));
|
|
51
54
|
makeKeyboardButton(this.#chui_next_slide);
|
|
52
55
|
makeKeyboardButton(this.#chui_prev_slide);
|
|
53
|
-
this.#chui_next_slide.addEventListener("click", () => this.#changeSlide(1))
|
|
54
|
-
this.#chui_prev_slide.addEventListener("click", () => this.#changeSlide(-1))
|
|
56
|
+
this.#chui_next_slide.addEventListener("click", () => this.#changeSlide(1));
|
|
57
|
+
this.#chui_prev_slide.addEventListener("click", () => this.#changeSlide(-1));
|
|
55
58
|
this.#chui_slides_main.appendChild(this.#chui_slides_list);
|
|
56
59
|
// Шевроны, а не изогнутые redo/undo: в круглой кнопке они читаются как «назад/вперёд».
|
|
57
60
|
// Цвет не задаём — его берёт глиф из кнопки (`color: inherit` в styles.css), поэтому
|
|
@@ -85,14 +88,17 @@ class SlideShow {
|
|
|
85
88
|
this.#changeSlide(event.key === "ArrowRight" ? 1 : -1);
|
|
86
89
|
});
|
|
87
90
|
//
|
|
88
|
-
this.#renderSlide(true)
|
|
91
|
+
this.#renderSlide(true);
|
|
89
92
|
//
|
|
90
93
|
}
|
|
91
94
|
#buildDots() {
|
|
92
95
|
this.#slides_list.forEach((_, index) => {
|
|
93
96
|
const dot = document.createElement("chui_slideshow_dot");
|
|
94
97
|
dot.setAttribute("role", "button");
|
|
95
|
-
dot.setAttribute(
|
|
98
|
+
dot.setAttribute(
|
|
99
|
+
"aria-label",
|
|
100
|
+
I18n.t("feedback.slideOf", { index: index + 1, total: this.#slides_list.length })
|
|
101
|
+
);
|
|
96
102
|
makeKeyboardButton(dot);
|
|
97
103
|
dot.addEventListener("click", () => this.#goToSlide(index));
|
|
98
104
|
this.#chui_slideshow_dots.appendChild(dot);
|
|
@@ -111,22 +117,27 @@ class SlideShow {
|
|
|
111
117
|
#changeSlide(n = Number()) {
|
|
112
118
|
let sum_slides = this.#slides_list.length;
|
|
113
119
|
this.#default_slide = this.#default_slide + n;
|
|
114
|
-
if (this.#default_slide >
|
|
120
|
+
if (this.#default_slide > sum_slides - 1) this.#default_slide = 0;
|
|
115
121
|
if (this.#default_slide < 0) this.#default_slide = sum_slides - 1;
|
|
116
122
|
this.#renderSlide();
|
|
117
123
|
}
|
|
118
124
|
#renderSlide(is_initial = false) {
|
|
119
|
-
for (let child of this.#chui_slides_list.childNodes) {
|
|
125
|
+
for (let child of this.#chui_slides_list.childNodes) {
|
|
126
|
+
this.#chui_slides_list.removeChild(child);
|
|
127
|
+
}
|
|
120
128
|
let slide = this.#slides_list[this.#default_slide].set();
|
|
121
129
|
slide.setAttribute("role", "group");
|
|
122
130
|
slide.setAttribute("aria-roledescription", I18n.t("feedback.slide"));
|
|
123
|
-
slide.setAttribute(
|
|
124
|
-
|
|
131
|
+
slide.setAttribute(
|
|
132
|
+
"aria-label",
|
|
133
|
+
I18n.t("feedback.slideOf", { index: this.#default_slide + 1, total: this.#slides_list.length })
|
|
134
|
+
);
|
|
135
|
+
this.#chui_slides_list.appendChild(slide);
|
|
125
136
|
// Первый слайд показываем так же, как раньше (display: flex до анимации)
|
|
126
|
-
if (is_initial) slide.style.display =
|
|
127
|
-
else slide.style.display =
|
|
128
|
-
new Animation(slide).fadeIn()
|
|
129
|
-
this.#syncIndicators()
|
|
137
|
+
if (is_initial) slide.style.display = "flex";
|
|
138
|
+
else slide.style.display = "none";
|
|
139
|
+
new Animation(slide).fadeIn();
|
|
140
|
+
this.#syncIndicators();
|
|
130
141
|
}
|
|
131
142
|
// === АВТОПРОКРУТКА ===
|
|
132
143
|
#startAutoplay() {
|
|
@@ -145,13 +156,17 @@ class SlideShow {
|
|
|
145
156
|
}
|
|
146
157
|
#toggleAutoplay() {
|
|
147
158
|
this.#user_paused = !this.#user_paused;
|
|
148
|
-
if (this.#user_paused) this.#stopAutoplay();
|
|
159
|
+
if (this.#user_paused) this.#stopAutoplay();
|
|
160
|
+
else this.#startAutoplay();
|
|
149
161
|
this.#updatePauseButton();
|
|
150
162
|
}
|
|
151
163
|
#updatePauseButton() {
|
|
152
164
|
const icon = this.#user_paused ? Icons.AUDIO_VIDEO.PLAY_ARROW : Icons.AUDIO_VIDEO.PAUSE;
|
|
153
165
|
this.#chui_slideshow_pause.innerHTML = new Icon(icon, "14pt", "var(--button_text_color)").getHTML();
|
|
154
|
-
this.#chui_slideshow_pause.setAttribute(
|
|
166
|
+
this.#chui_slideshow_pause.setAttribute(
|
|
167
|
+
"aria-label",
|
|
168
|
+
this.#user_paused ? I18n.t("feedback.autoplayStart") : I18n.t("feedback.autoplayPause")
|
|
169
|
+
);
|
|
155
170
|
this.#chui_slideshow_pause.setAttribute("aria-pressed", this.#user_paused ? "true" : "false");
|
|
156
171
|
}
|
|
157
172
|
/** Полное удаление: остановить автопрокрутку (остальные слушатели — на элементах компонента) */
|
|
@@ -163,19 +178,21 @@ class SlideShow {
|
|
|
163
178
|
return this.#chui_slides_main;
|
|
164
179
|
}
|
|
165
180
|
static SLIDE(options = { width: String(), height: String(), components: [] }) {
|
|
166
|
-
return new Slide(options)
|
|
181
|
+
return new Slide(options);
|
|
167
182
|
}
|
|
168
183
|
}
|
|
169
|
-
exports.SlideShow = SlideShow
|
|
184
|
+
exports.SlideShow = SlideShow;
|
|
170
185
|
|
|
171
186
|
class Slide {
|
|
172
|
-
#chui_slide = document.createElement(
|
|
173
|
-
#chui_slide_content = document.createElement(
|
|
174
|
-
constructor(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
187
|
+
#chui_slide = document.createElement("chui_slide");
|
|
188
|
+
#chui_slide_content = document.createElement("chui_slide_content");
|
|
189
|
+
constructor(
|
|
190
|
+
options = {
|
|
191
|
+
size: { width: String(), height: String() },
|
|
192
|
+
style: { direction: String(), wrap: String(), align: String(), justify: String() },
|
|
193
|
+
components: [],
|
|
194
|
+
}
|
|
195
|
+
) {
|
|
179
196
|
// Частичный объект опций: `SLIDE({components})` падал на отсутствующем `size`
|
|
180
197
|
const size = options.size === undefined ? {} : options.size;
|
|
181
198
|
const style = options.style === undefined ? {} : options.style;
|
|
@@ -186,8 +203,10 @@ class Slide {
|
|
|
186
203
|
if (style.wrap !== undefined) this.#chui_slide_content.style.flexWrap = style.wrap;
|
|
187
204
|
if (style.align !== undefined) this.#chui_slide_content.style.alignItems = style.align;
|
|
188
205
|
if (style.justify !== undefined) this.#chui_slide_content.style.justifyContent = style.justify;
|
|
189
|
-
for (let child of components) this.#chui_slide_content.appendChild(child.set())
|
|
190
|
-
this.#chui_slide.appendChild(this.#chui_slide_content)
|
|
206
|
+
for (let child of components) this.#chui_slide_content.appendChild(child.set());
|
|
207
|
+
this.#chui_slide.appendChild(this.#chui_slide_content);
|
|
191
208
|
}
|
|
192
|
-
set() {
|
|
193
|
-
|
|
209
|
+
set() {
|
|
210
|
+
return this.#chui_slide;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -12,7 +12,8 @@ chui_slides_main {
|
|
|
12
12
|
|
|
13
13
|
/* Стрелки — круглые кнопки-стёкла на середине высоты: полоса во всю высоту читалась
|
|
14
14
|
тяжёлой границей, а кнопка не спорит с содержимым слайда. Хит-зона 40px */
|
|
15
|
-
chui_next_slide,
|
|
15
|
+
chui_next_slide,
|
|
16
|
+
chui_prev_slide {
|
|
16
17
|
cursor: pointer;
|
|
17
18
|
position: absolute;
|
|
18
19
|
top: 50%;
|
|
@@ -32,30 +33,33 @@ chui_next_slide, chui_prev_slide {
|
|
|
32
33
|
box-shadow: var(--box_shadow_main);
|
|
33
34
|
display: flex;
|
|
34
35
|
align-items: center;
|
|
35
|
-
justify-content: center
|
|
36
|
+
justify-content: center;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
chui_next_slide {
|
|
39
|
-
inset-inline-end: 10px
|
|
40
|
+
inset-inline-end: 10px;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
chui_prev_slide {
|
|
43
|
-
inset-inline-start: 10px
|
|
44
|
+
inset-inline-start: 10px;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
chui_next_slide:hover,
|
|
47
|
+
chui_next_slide:hover,
|
|
48
|
+
chui_prev_slide:hover {
|
|
47
49
|
background-color: var(--element_background_hover);
|
|
48
|
-
color: var(--text_color)
|
|
50
|
+
color: var(--text_color);
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
chui_next_slide:active,
|
|
53
|
+
chui_next_slide:active,
|
|
54
|
+
chui_prev_slide:active {
|
|
52
55
|
background-color: var(--blue_prime_background);
|
|
53
|
-
color: var(--text_color_hover)
|
|
56
|
+
color: var(--text_color_hover);
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
/* chui_icon задаёт собственный color, поэтому цвет берём от кнопки: тогда значок
|
|
57
60
|
меняется вместе с ней в наведении и нажатии */
|
|
58
|
-
chui_next_slide chui_icon,
|
|
61
|
+
chui_next_slide chui_icon,
|
|
62
|
+
chui_prev_slide chui_icon {
|
|
59
63
|
color: inherit;
|
|
60
64
|
}
|
|
61
65
|
|
|
@@ -88,7 +92,9 @@ chui_slideshow_dot {
|
|
|
88
92
|
height: 8px;
|
|
89
93
|
border-radius: var(--radius_pill);
|
|
90
94
|
background: var(--element_background);
|
|
91
|
-
transition:
|
|
95
|
+
transition:
|
|
96
|
+
width var(--transition_time) ease,
|
|
97
|
+
background-color var(--transition_time) ease;
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
/* Наведение — нейтральная ступень, кружок текущего слайда — акцент */
|
|
@@ -138,7 +144,7 @@ chui_slide {
|
|
|
138
144
|
color: var(--text_color);
|
|
139
145
|
border-radius: var(--border_radius);
|
|
140
146
|
width: 100%;
|
|
141
|
-
height: -webkit-fill-available
|
|
147
|
+
height: -webkit-fill-available;
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
chui_slide_content {
|
|
@@ -147,7 +153,7 @@ chui_slide_content {
|
|
|
147
153
|
border-radius: var(--border_radius);
|
|
148
154
|
width: -webkit-fill-available;
|
|
149
155
|
height: -webkit-fill-available;
|
|
150
|
-
overflow: auto
|
|
156
|
+
overflow: auto;
|
|
151
157
|
}
|
|
152
158
|
|
|
153
159
|
/* Нажатие — акцент, как у Button: контрол отвечает на клик ещё до действия */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const {Animation} = require(
|
|
2
|
-
const {I18n} = require(
|
|
1
|
+
const { Animation } = require("../../modules/chui_animations/animations");
|
|
2
|
+
const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
3
3
|
|
|
4
4
|
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
5
5
|
/** Доля кольца, которую занимает дуга: четверть — самый читаемый «бегунок» */
|
|
@@ -15,12 +15,12 @@ const ARC_SHARE = 0.25;
|
|
|
15
15
|
* Слушателей и таймеров нет: `remove()` убирает узел и повторный вызов уже ничего не делает.
|
|
16
16
|
*/
|
|
17
17
|
class Spinner {
|
|
18
|
-
#spinner_main = document.createElement(
|
|
19
|
-
#spinner = document.createElement(
|
|
18
|
+
#spinner_main = document.createElement("chui_spiner");
|
|
19
|
+
#spinner = document.createElement("spinner");
|
|
20
20
|
#label = I18n.t("feedback.loading");
|
|
21
21
|
#removed = false;
|
|
22
22
|
constructor(size = Spinner.SIZE.DEFAULT, margin = String(), label = I18n.t("feedback.loading")) {
|
|
23
|
-
require(
|
|
23
|
+
require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_Spinner");
|
|
24
24
|
this.#spinner_main.style.margin = margin;
|
|
25
25
|
this.#spinner_main.setAttribute("role", "status");
|
|
26
26
|
this.#spinner_main.setAttribute("aria-live", "polite");
|
|
@@ -91,8 +91,8 @@ class Spinner {
|
|
|
91
91
|
SMALL: { SIZE: 45, BORDER: 3 },
|
|
92
92
|
DEFAULT: { SIZE: 60, BORDER: 4 },
|
|
93
93
|
BIG: { SIZE: 75, BORDER: 5 },
|
|
94
|
-
V_BIG: { SIZE: 90, BORDER: 5 }
|
|
95
|
-
}
|
|
94
|
+
V_BIG: { SIZE: 90, BORDER: 5 },
|
|
95
|
+
};
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
exports.Spinner = Spinner
|
|
98
|
+
exports.Spinner = Spinner;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const {setStyles} = require("../../modules/chui_functions");
|
|
2
|
-
const {Icon, Icons} = require("../chui_icons/icons");
|
|
3
|
-
const {MenuKeyboard} = require("../../modules/chui_a11y/chui_a11y");
|
|
4
|
-
const {I18n} = require("../../modules/chui_i18n/chui_i18n");
|
|
1
|
+
const { setStyles } = require("../../modules/chui_functions");
|
|
2
|
+
const { Icon, Icons } = require("../chui_icons/icons");
|
|
3
|
+
const { MenuKeyboard } = require("../../modules/chui_a11y/chui_a11y");
|
|
4
|
+
const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
5
5
|
|
|
6
6
|
const SPLIT_MENU_GAP = 4;
|
|
7
7
|
const SPLIT_MENU_EDGE = 8;
|
|
@@ -53,16 +53,18 @@ class SplitButton {
|
|
|
53
53
|
#is_open = false;
|
|
54
54
|
#destroyed = false;
|
|
55
55
|
|
|
56
|
-
constructor(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
constructor(
|
|
57
|
+
options = {
|
|
58
|
+
id: String(),
|
|
59
|
+
title: String(),
|
|
60
|
+
icon: String(),
|
|
61
|
+
reverse: Boolean(),
|
|
62
|
+
disabled: Boolean(),
|
|
63
|
+
label: String(),
|
|
64
|
+
clickEvent: undefined,
|
|
65
|
+
items: [],
|
|
66
|
+
}
|
|
67
|
+
) {
|
|
66
68
|
setStyles(__dirname + "/styles.css", "chUiJS_SplitButton");
|
|
67
69
|
SplitButton.#counter += 1;
|
|
68
70
|
this.#id = options.id === undefined ? `chui_split_button_${SplitButton.#counter}` : options.id;
|
|
@@ -91,7 +93,7 @@ class SplitButton {
|
|
|
91
93
|
this.#keyboard = new MenuKeyboard(this.#menu, {
|
|
92
94
|
itemSelector: "button",
|
|
93
95
|
onEscape: () => this.close(),
|
|
94
|
-
trigger: this.#caret
|
|
96
|
+
trigger: this.#caret,
|
|
95
97
|
});
|
|
96
98
|
this.#keyboard.setExpanded(false);
|
|
97
99
|
this.#caret.addEventListener("click", this.#onCaretClick);
|
|
@@ -183,7 +185,9 @@ class SplitButton {
|
|
|
183
185
|
}
|
|
184
186
|
|
|
185
187
|
/** Пункт меню: заголовок, значок, горячая клавиша и обработчик */
|
|
186
|
-
static Item(
|
|
188
|
+
static Item(
|
|
189
|
+
options = { title: String(), icon: String(), shortcut: String(), disabled: Boolean(), clickEvent: undefined }
|
|
190
|
+
) {
|
|
187
191
|
return Object.assign({ type: "item" }, options);
|
|
188
192
|
}
|
|
189
193
|
|
|
@@ -301,7 +305,8 @@ class SplitButton {
|
|
|
301
305
|
#positionMenu() {
|
|
302
306
|
const button = this.#caret.getBoundingClientRect();
|
|
303
307
|
let left = button.right - this.#menu.offsetWidth;
|
|
304
|
-
if (left + this.#menu.offsetWidth > window.innerWidth - SPLIT_MENU_EDGE)
|
|
308
|
+
if (left + this.#menu.offsetWidth > window.innerWidth - SPLIT_MENU_EDGE)
|
|
309
|
+
left = window.innerWidth - SPLIT_MENU_EDGE - this.#menu.offsetWidth;
|
|
305
310
|
if (left < SPLIT_MENU_EDGE) left = SPLIT_MENU_EDGE;
|
|
306
311
|
this.#menu.style.left = `${Math.round(left)}px`;
|
|
307
312
|
this.#menu.style.top = `${Math.round(button.bottom + SPLIT_MENU_GAP)}px`;
|
|
@@ -325,4 +330,4 @@ class SplitButton {
|
|
|
325
330
|
static ICON_SIZE = "16px";
|
|
326
331
|
}
|
|
327
332
|
|
|
328
|
-
exports.SplitButton = SplitButton
|
|
333
|
+
exports.SplitButton = SplitButton;
|
|
@@ -91,7 +91,7 @@ chui_split_button:not(.split_button_disabled):hover {
|
|
|
91
91
|
правилом, а половинка кнопки, сжимающаяся отдельно, читалась бы поломкой */
|
|
92
92
|
chui_split_button:not(.split_button_disabled):has(.split_button_main:active, .split_button_caret:active) {
|
|
93
93
|
border-color: var(--button_border_color_hover);
|
|
94
|
-
transform: scale(.97);
|
|
94
|
+
transform: scale(0.97);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/* Нажатие — акцент, как у Button: обе половины отвечают одинаково */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const {setStyles, optionOr} = require(
|
|
2
|
-
const {I18n} = require(
|
|
1
|
+
const { setStyles, optionOr } = require("../../modules/chui_functions");
|
|
2
|
+
const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Разделитель панелей: несколько областей и перетаскиваемые границы между ними.
|
|
@@ -31,7 +31,7 @@ const {I18n} = require('../../modules/chui_i18n/chui_i18n');
|
|
|
31
31
|
class Splitter {
|
|
32
32
|
static DIRECTION = {
|
|
33
33
|
HORIZONTAL: "horizontal",
|
|
34
|
-
VERTICAL: "vertical"
|
|
34
|
+
VERTICAL: "vertical",
|
|
35
35
|
};
|
|
36
36
|
static DEFAULT_SIZE = 6;
|
|
37
37
|
static DEFAULT_STEP = 2;
|
|
@@ -53,21 +53,23 @@ class Splitter {
|
|
|
53
53
|
#on_reset = undefined;
|
|
54
54
|
#dragging = undefined;
|
|
55
55
|
|
|
56
|
-
constructor(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
constructor(
|
|
57
|
+
options = {
|
|
58
|
+
id: String(),
|
|
59
|
+
direction: String(),
|
|
60
|
+
sizes: [],
|
|
61
|
+
min: undefined,
|
|
62
|
+
panes: [],
|
|
63
|
+
width: String(),
|
|
64
|
+
height: String(),
|
|
65
|
+
disabled: Boolean(),
|
|
66
|
+
label: String(),
|
|
67
|
+
step: Number(),
|
|
68
|
+
onResize: undefined,
|
|
69
|
+
onResizeEnd: undefined,
|
|
70
|
+
onReset: undefined,
|
|
71
|
+
}
|
|
72
|
+
) {
|
|
71
73
|
setStyles(__dirname + "/styles.css", "chUiJS_Splitter");
|
|
72
74
|
Splitter.#counter += 1;
|
|
73
75
|
// Заготовка опции (`String()`) равносильна отсутствующей: иначе вызов без аргументов
|
|
@@ -75,7 +77,7 @@ class Splitter {
|
|
|
75
77
|
this.#id = optionOr(options.id, `chui_splitter_${Splitter.#counter}`);
|
|
76
78
|
this.#root.id = this.#id;
|
|
77
79
|
this.#direction = options.direction === undefined ? Splitter.DIRECTION.HORIZONTAL : options.direction;
|
|
78
|
-
this.#min = options.min === undefined ? [] :
|
|
80
|
+
this.#min = options.min === undefined ? [] : Array.isArray(options.min) ? options.min : [options.min];
|
|
79
81
|
this.#step = options.step === undefined ? Splitter.DEFAULT_STEP : options.step;
|
|
80
82
|
this.#on_resize = options.onResize;
|
|
81
83
|
this.#on_resize_end = options.onResizeEnd;
|
|
@@ -287,13 +289,16 @@ class Splitter {
|
|
|
287
289
|
const side = this.#isHorizontal()
|
|
288
290
|
? [I18n.t("a11y.sideLeft"), I18n.t("a11y.sideRight")]
|
|
289
291
|
: [I18n.t("a11y.sideTop"), I18n.t("a11y.sideBottom")];
|
|
290
|
-
handle.setAttribute(
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
292
|
+
handle.setAttribute(
|
|
293
|
+
"aria-valuetext",
|
|
294
|
+
I18n.t("a11y.splitterValue", {
|
|
295
|
+
first: side[0],
|
|
296
|
+
firstPercent: Math.round(first),
|
|
297
|
+
second: side[1].toLowerCase(),
|
|
298
|
+
secondPercent: Math.round(second),
|
|
299
|
+
total: Math.round(total),
|
|
300
|
+
})
|
|
301
|
+
);
|
|
297
302
|
});
|
|
298
303
|
}
|
|
299
304
|
|
|
@@ -307,7 +312,9 @@ class Splitter {
|
|
|
307
312
|
const position = clientPosition - start;
|
|
308
313
|
const before = this.#panes[index];
|
|
309
314
|
const after = this.#panes[index + 1];
|
|
310
|
-
const beforeStart = this.#isHorizontal()
|
|
315
|
+
const beforeStart = this.#isHorizontal()
|
|
316
|
+
? before.getBoundingClientRect().left - start
|
|
317
|
+
: before.getBoundingClientRect().top - start;
|
|
311
318
|
const pairSize = this.#paneSize(before) + this.#paneSize(after);
|
|
312
319
|
if (pairSize === 0) return undefined;
|
|
313
320
|
const pairShare = this.#sizes[index] + this.#sizes[index + 1];
|
|
@@ -428,4 +435,4 @@ class Splitter {
|
|
|
428
435
|
};
|
|
429
436
|
}
|
|
430
437
|
|
|
431
|
-
exports.Splitter = Splitter
|
|
438
|
+
exports.Splitter = Splitter;
|