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,16 +1,16 @@
|
|
|
1
|
-
const {setStyles} = require("../../modules/chui_functions");
|
|
2
|
-
const {Validate} = require("../../modules/chui_validate/chui_validate");
|
|
3
|
-
const {Json} = require("../../modules/chui_json/chui_json");
|
|
4
|
-
const {RovingKeyboard} = require("../../modules/chui_a11y/chui_a11y");
|
|
5
|
-
const {CodeEditor} = require("../chui_code_editor/code_editor");
|
|
6
|
-
const {JsonViewer} = require("../chui_json_viewer/json_viewer");
|
|
7
|
-
const {I18n} = require("../../modules/chui_i18n/chui_i18n");
|
|
1
|
+
const { setStyles } = require("../../modules/chui_functions");
|
|
2
|
+
const { Validate } = require("../../modules/chui_validate/chui_validate");
|
|
3
|
+
const { Json } = require("../../modules/chui_json/chui_json");
|
|
4
|
+
const { RovingKeyboard } = require("../../modules/chui_a11y/chui_a11y");
|
|
5
|
+
const { CodeEditor } = require("../chui_code_editor/code_editor");
|
|
6
|
+
const { JsonViewer } = require("../chui_json_viewer/json_viewer");
|
|
7
|
+
const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
8
8
|
|
|
9
9
|
/** Кнопки панели: ключ подписи, ключ подсказки и действие */
|
|
10
10
|
const ACTIONS = [
|
|
11
|
-
{id: "format", labelKey: "jsonEditor.format", hintKey: "jsonEditor.formatHint"},
|
|
12
|
-
{id: "minify", labelKey: "jsonEditor.minify", hintKey: "jsonEditor.minifyHint"},
|
|
13
|
-
{id: "check", labelKey: "jsonEditor.check", hintKey: "jsonEditor.checkHint"}
|
|
11
|
+
{ id: "format", labelKey: "jsonEditor.format", hintKey: "jsonEditor.formatHint" },
|
|
12
|
+
{ id: "minify", labelKey: "jsonEditor.minify", hintKey: "jsonEditor.minifyHint" },
|
|
13
|
+
{ id: "check", labelKey: "jsonEditor.check", hintKey: "jsonEditor.checkHint" },
|
|
14
14
|
];
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -81,27 +81,29 @@ class JsonEditor {
|
|
|
81
81
|
#on_change = undefined;
|
|
82
82
|
#notify_paused = false;
|
|
83
83
|
|
|
84
|
-
constructor(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
84
|
+
constructor(
|
|
85
|
+
options = {
|
|
86
|
+
id: String(),
|
|
87
|
+
name: String(),
|
|
88
|
+
title: String(),
|
|
89
|
+
label: String(),
|
|
90
|
+
hint: String(),
|
|
91
|
+
value: String(),
|
|
92
|
+
data: undefined,
|
|
93
|
+
height: String(),
|
|
94
|
+
width: String(),
|
|
95
|
+
indent: Number(),
|
|
96
|
+
toolbar: Boolean(),
|
|
97
|
+
preview: Boolean(),
|
|
98
|
+
maxLength: Number(),
|
|
99
|
+
disabled: Boolean(),
|
|
100
|
+
readOnly: Boolean(),
|
|
101
|
+
required: Boolean(),
|
|
102
|
+
messages: Object(),
|
|
103
|
+
changeListener: undefined,
|
|
104
|
+
onChange: undefined,
|
|
105
|
+
}
|
|
106
|
+
) {
|
|
105
107
|
setStyles(__dirname + "/styles.css", "chUiJS_JsonEditor");
|
|
106
108
|
JsonEditor.#counter += 1;
|
|
107
109
|
this.#id = options.id === undefined ? `chui_json_editor_${JsonEditor.#counter}` : options.id;
|
|
@@ -157,7 +159,7 @@ class JsonEditor {
|
|
|
157
159
|
this.validate = () => {
|
|
158
160
|
const result = base_validate();
|
|
159
161
|
if (result.valid === false) {
|
|
160
|
-
if (result.rule === "validate") return {valid: false, rule: "json", message: result.message};
|
|
162
|
+
if (result.rule === "validate") return { valid: false, rule: "json", message: result.message };
|
|
161
163
|
return result;
|
|
162
164
|
}
|
|
163
165
|
const text = this.getValue();
|
|
@@ -165,7 +167,7 @@ class JsonEditor {
|
|
|
165
167
|
if (text.trim() === "") return result;
|
|
166
168
|
const state = Json.parse(text);
|
|
167
169
|
if (state.ok) return result;
|
|
168
|
-
return {valid: false, rule: "json", message: Json.errorText(state.error)};
|
|
170
|
+
return { valid: false, rule: "json", message: Json.errorText(state.error) };
|
|
169
171
|
};
|
|
170
172
|
this.setReadOnly(options.readOnly === true);
|
|
171
173
|
this.setDisabled(options.disabled === true);
|
|
@@ -204,7 +206,7 @@ class JsonEditor {
|
|
|
204
206
|
/** Место ошибки разбора: `{line, column, offset}` или `undefined` (у ошибки может не быть места) */
|
|
205
207
|
getErrorPlace() {
|
|
206
208
|
if (this.#error_object === undefined || this.#error_object.offset === undefined) return undefined;
|
|
207
|
-
return {line: this.#error_object.line, column: this.#error_object.column, offset: this.#error_object.offset};
|
|
209
|
+
return { line: this.#error_object.line, column: this.#error_object.column, offset: this.#error_object.offset };
|
|
208
210
|
}
|
|
209
211
|
|
|
210
212
|
/** Текст ошибки разбора словами (пустая строка, если разбор прошёл) */
|
|
@@ -370,8 +372,13 @@ class JsonEditor {
|
|
|
370
372
|
if (this.#viewer !== undefined) this.#viewer.set().hidden = !this.#preview_on;
|
|
371
373
|
if (this.#tree_button !== undefined) {
|
|
372
374
|
this.#tree_button.setAttribute("aria-pressed", this.#preview_on ? "true" : "false");
|
|
373
|
-
this.#tree_button.setAttribute(
|
|
374
|
-
|
|
375
|
+
this.#tree_button.setAttribute(
|
|
376
|
+
"aria-label",
|
|
377
|
+
this.#preview_on ? I18n.t("jsonEditor.showText") : I18n.t("jsonEditor.showTree")
|
|
378
|
+
);
|
|
379
|
+
this.#tree_button.innerText = this.#preview_on
|
|
380
|
+
? I18n.t("jsonEditor.textShort")
|
|
381
|
+
: I18n.t("jsonEditor.treeShort");
|
|
375
382
|
}
|
|
376
383
|
return this;
|
|
377
384
|
}
|
|
@@ -450,7 +457,7 @@ class JsonEditor {
|
|
|
450
457
|
value: "",
|
|
451
458
|
height: this.#height,
|
|
452
459
|
lineNumbers: true,
|
|
453
|
-
onChange: () => this.#onInput()
|
|
460
|
+
onChange: () => this.#onInput(),
|
|
454
461
|
});
|
|
455
462
|
this.#editor.setLabel(this.#accessibleName());
|
|
456
463
|
const area = this.#editor.getTextArea();
|
|
@@ -486,7 +493,7 @@ class JsonEditor {
|
|
|
486
493
|
this.#toolbar.appendChild(this.#tree_button);
|
|
487
494
|
}
|
|
488
495
|
// Панель — одна остановка обхода: по кнопкам ходят стрелки/Home/End
|
|
489
|
-
new RovingKeyboard(this.#toolbar, {itemSelector: "button"});
|
|
496
|
+
new RovingKeyboard(this.#toolbar, { itemSelector: "button" });
|
|
490
497
|
return this;
|
|
491
498
|
}
|
|
492
499
|
|
|
@@ -498,9 +505,9 @@ class JsonEditor {
|
|
|
498
505
|
}
|
|
499
506
|
this.#viewer = new JsonViewer({
|
|
500
507
|
id: `${this.#id}_tree`,
|
|
501
|
-
label: I18n.t("jsonEditor.treeLabel", {name: this.#accessibleName()}),
|
|
508
|
+
label: I18n.t("jsonEditor.treeLabel", { name: this.#accessibleName() }),
|
|
502
509
|
value: this.getParsed(),
|
|
503
|
-
emptyText: I18n.t("jsonEditor.unparsed")
|
|
510
|
+
emptyText: I18n.t("jsonEditor.unparsed"),
|
|
504
511
|
});
|
|
505
512
|
this.#viewer.set().hidden = true;
|
|
506
513
|
this.#panes.appendChild(this.#viewer.set());
|
|
@@ -579,7 +586,8 @@ class JsonEditor {
|
|
|
579
586
|
if (this.#title_text !== undefined && this.#title_text !== "") area.removeAttribute("aria-label");
|
|
580
587
|
else area.setAttribute("aria-label", this.#accessibleName());
|
|
581
588
|
this.#syncDescribedBy();
|
|
582
|
-
if (this.#viewer !== undefined)
|
|
589
|
+
if (this.#viewer !== undefined)
|
|
590
|
+
this.#viewer.setLabel(I18n.t("jsonEditor.treeLabel", { name: this.#accessibleName() }));
|
|
583
591
|
return this;
|
|
584
592
|
}
|
|
585
593
|
|
|
@@ -615,7 +623,9 @@ class JsonEditor {
|
|
|
615
623
|
this.#parse_line.classList.toggle("json_editor_parse_ok", state.ok && blank === false);
|
|
616
624
|
this.#parse_line.innerText = blank
|
|
617
625
|
? I18n.t("jsonEditor.empty")
|
|
618
|
-
: state.ok
|
|
626
|
+
: state.ok
|
|
627
|
+
? I18n.t("jsonEditor.correct")
|
|
628
|
+
: Json.errorText(state.error);
|
|
619
629
|
this.#syncCount();
|
|
620
630
|
if (this.#viewer !== undefined && this.#viewer.set().hidden === false) this.#viewer.setValue(this.#parsed);
|
|
621
631
|
return this;
|
|
@@ -640,4 +650,4 @@ class JsonEditor {
|
|
|
640
650
|
};
|
|
641
651
|
}
|
|
642
652
|
|
|
643
|
-
exports.JsonEditor = JsonEditor
|
|
653
|
+
exports.JsonEditor = JsonEditor;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const {setStyles} = require("../../modules/chui_functions");
|
|
2
|
-
const {Icon, Icons} = require("../chui_icons/icons");
|
|
3
|
-
const {installHighlightStyles} = require("../../modules/chui_highlight/chui_highlight");
|
|
4
|
-
const {Json} = require("../../modules/chui_json/chui_json");
|
|
5
|
-
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 { installHighlightStyles } = require("../../modules/chui_highlight/chui_highlight");
|
|
4
|
+
const { Json } = require("../../modules/chui_json/chui_json");
|
|
5
|
+
const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
6
6
|
|
|
7
7
|
/** Типы узлов JSON */
|
|
8
8
|
const TYPE = {
|
|
@@ -11,7 +11,7 @@ const TYPE = {
|
|
|
11
11
|
STRING: "string",
|
|
12
12
|
NUMBER: "number",
|
|
13
13
|
BOOLEAN: "boolean",
|
|
14
|
-
NULL: "null"
|
|
14
|
+
NULL: "null",
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -80,18 +80,20 @@ class JsonViewer {
|
|
|
80
80
|
#active_path = undefined;
|
|
81
81
|
#focus_path = undefined;
|
|
82
82
|
|
|
83
|
-
constructor(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
constructor(
|
|
84
|
+
options = {
|
|
85
|
+
id: String(),
|
|
86
|
+
title: String(),
|
|
87
|
+
label: String(),
|
|
88
|
+
value: undefined,
|
|
89
|
+
text: String(),
|
|
90
|
+
expandDepth: Number(),
|
|
91
|
+
expanded: Array(),
|
|
92
|
+
searchable: Boolean(),
|
|
93
|
+
height: String(),
|
|
94
|
+
emptyText: String(),
|
|
95
|
+
}
|
|
96
|
+
) {
|
|
95
97
|
installHighlightStyles();
|
|
96
98
|
setStyles(__dirname + "/styles.css", "chUiJS_JsonViewer");
|
|
97
99
|
JsonViewer.#counter += 1;
|
|
@@ -471,7 +473,7 @@ class JsonViewer {
|
|
|
471
473
|
const match = /^\.("(?:\\.|[^"\\])*"|[^.[\]]+)/.exec(text.slice(index));
|
|
472
474
|
if (match === null) return undefined;
|
|
473
475
|
const raw = match[1];
|
|
474
|
-
segments.push(raw.startsWith("
|
|
476
|
+
segments.push(raw.startsWith('"') ? JSON.parse(raw) : raw);
|
|
475
477
|
index += match[0].length;
|
|
476
478
|
continue;
|
|
477
479
|
}
|
|
@@ -502,16 +504,25 @@ class JsonViewer {
|
|
|
502
504
|
|
|
503
505
|
static #childrenOf(node = Object()) {
|
|
504
506
|
if (Array.isArray(node.value)) {
|
|
505
|
-
return node.value.map((item, index) => ({
|
|
507
|
+
return node.value.map((item, index) => ({
|
|
508
|
+
path: `${node.path}[${index}]`,
|
|
509
|
+
key: String(index),
|
|
510
|
+
index: index,
|
|
511
|
+
value: item,
|
|
512
|
+
}));
|
|
506
513
|
}
|
|
507
514
|
if (JsonViewer.#typeOf(node.value) === TYPE.OBJECT) {
|
|
508
|
-
return Object.keys(node.value).map((key) => ({
|
|
515
|
+
return Object.keys(node.value).map((key) => ({
|
|
516
|
+
path: `${node.path}.${JsonViewer.#pathKey(key)}`,
|
|
517
|
+
key: key,
|
|
518
|
+
value: node.value[key],
|
|
519
|
+
}));
|
|
509
520
|
}
|
|
510
521
|
return [];
|
|
511
522
|
}
|
|
512
523
|
|
|
513
524
|
#rootNode() {
|
|
514
|
-
return {path: this.getRootPath(), key: undefined, value: this.#value};
|
|
525
|
+
return { path: this.getRootPath(), key: undefined, value: this.#value };
|
|
515
526
|
}
|
|
516
527
|
|
|
517
528
|
/** Есть ли такой путь в текущих данных (для чистки раскрытых путей после setValue) */
|
|
@@ -555,7 +566,7 @@ class JsonViewer {
|
|
|
555
566
|
const query = this.#search_text.trim().toLowerCase();
|
|
556
567
|
const walk = (node, level) => {
|
|
557
568
|
if (query !== "" && !this.#matchesTree(node, query)) return;
|
|
558
|
-
list.push({node: node, level: level});
|
|
569
|
+
list.push({ node: node, level: level });
|
|
559
570
|
if (!this.#isOpen(node, query)) return;
|
|
560
571
|
for (const child of JsonViewer.#childrenOf(node)) walk(child, level + 1);
|
|
561
572
|
};
|
|
@@ -585,14 +596,14 @@ class JsonViewer {
|
|
|
585
596
|
this.#root.setAttribute("aria-label", this.#accessibleName());
|
|
586
597
|
}
|
|
587
598
|
// Дерево внутри тоже с ролью, поэтому ему нужно своё имя — оттуда же
|
|
588
|
-
this.#tree.setAttribute("aria-label", I18n.t("jsonViewer.dataTree", {name: this.#accessibleName()}));
|
|
599
|
+
this.#tree.setAttribute("aria-label", I18n.t("jsonViewer.dataTree", { name: this.#accessibleName() }));
|
|
589
600
|
return this;
|
|
590
601
|
}
|
|
591
602
|
|
|
592
603
|
#summaryText(value = undefined) {
|
|
593
604
|
// Форму числа выбирает словарь через `Intl.PluralRules` — русские склонения больше не в коде
|
|
594
|
-
if (Array.isArray(value)) return I18n.t("jsonViewer.elements", {count: value.length});
|
|
595
|
-
return I18n.t("jsonViewer.properties", {count: Object.keys(value).length});
|
|
605
|
+
if (Array.isArray(value)) return I18n.t("jsonViewer.elements", { count: value.length });
|
|
606
|
+
return I18n.t("jsonViewer.properties", { count: Object.keys(value).length });
|
|
596
607
|
}
|
|
597
608
|
|
|
598
609
|
#toggleNode(node = Object(), open = Boolean()) {
|
|
@@ -601,7 +612,10 @@ class JsonViewer {
|
|
|
601
612
|
toggle.className = "json_viewer_toggle";
|
|
602
613
|
// Стрелка не отдельная остановка: у дерева одна остановка на узел
|
|
603
614
|
toggle.setAttribute("tabindex", "-1");
|
|
604
|
-
toggle.setAttribute(
|
|
615
|
+
toggle.setAttribute(
|
|
616
|
+
"aria-label",
|
|
617
|
+
I18n.t(open ? "a11y.collapseNode" : "a11y.expandNode", { name: this.#nodeName(node) })
|
|
618
|
+
);
|
|
605
619
|
toggle.dataset.path = node.path;
|
|
606
620
|
const glyph = new Icon(Icons.NAVIGATION.CHEVRON_RIGHT, "18px").set();
|
|
607
621
|
glyph.setAttribute("aria-hidden", "true");
|
|
@@ -691,7 +705,9 @@ class JsonViewer {
|
|
|
691
705
|
this.#render();
|
|
692
706
|
if (silent) return this;
|
|
693
707
|
const name = segments.length === 0 ? this.#accessibleName() : String(segments[segments.length - 1]);
|
|
694
|
-
this.#announce(
|
|
708
|
+
this.#announce(
|
|
709
|
+
value ? I18n.t("jsonViewer.expanded", { name: name }) : I18n.t("jsonViewer.collapsed", { name: name })
|
|
710
|
+
);
|
|
695
711
|
return this;
|
|
696
712
|
}
|
|
697
713
|
|
|
@@ -699,7 +715,8 @@ class JsonViewer {
|
|
|
699
715
|
const query = this.#search_text.trim();
|
|
700
716
|
if (query !== "") {
|
|
701
717
|
const matches = this.getMatches().length;
|
|
702
|
-
this.#status.innerText =
|
|
718
|
+
this.#status.innerText =
|
|
719
|
+
matches === 0 ? I18n.t("common.nothingFound") : I18n.t("jsonViewer.found", { count: matches });
|
|
703
720
|
return this;
|
|
704
721
|
}
|
|
705
722
|
if (this.#error_object !== undefined) {
|
|
@@ -710,7 +727,7 @@ class JsonViewer {
|
|
|
710
727
|
this.#status.innerText = this.#empty_text;
|
|
711
728
|
return this;
|
|
712
729
|
}
|
|
713
|
-
this.#status.innerText = I18n.t("jsonViewer.visible", {count: this.#visibleNodes().length});
|
|
730
|
+
this.#status.innerText = I18n.t("jsonViewer.visible", { count: this.#visibleNodes().length });
|
|
714
731
|
return this;
|
|
715
732
|
}
|
|
716
733
|
|
|
@@ -759,10 +776,12 @@ class JsonViewer {
|
|
|
759
776
|
}
|
|
760
777
|
|
|
761
778
|
#focusPath(path = String()) {
|
|
762
|
-
const row = [...this.#tree.querySelectorAll(".json_viewer_row")].find(
|
|
779
|
+
const row = [...this.#tree.querySelectorAll(".json_viewer_row")].find(
|
|
780
|
+
(node) => node.dataset.path === String(path)
|
|
781
|
+
);
|
|
763
782
|
if (row === undefined) return this;
|
|
764
783
|
this.#focusRow(row);
|
|
765
|
-
row.scrollIntoView({block: "nearest"});
|
|
784
|
+
row.scrollIntoView({ block: "nearest" });
|
|
766
785
|
return this;
|
|
767
786
|
}
|
|
768
787
|
|
|
@@ -860,4 +879,4 @@ class JsonViewer {
|
|
|
860
879
|
};
|
|
861
880
|
}
|
|
862
881
|
|
|
863
|
-
exports.JsonViewer = JsonViewer
|
|
882
|
+
exports.JsonViewer = JsonViewer;
|
|
@@ -53,7 +53,8 @@ chui_json_viewer {
|
|
|
53
53
|
height: var(--control_height);
|
|
54
54
|
margin: 0;
|
|
55
55
|
/* Место под кнопку очистки, чтобы текст не заезжал под неё */
|
|
56
|
-
padding-block: 0 0;
|
|
56
|
+
padding-block: 0 0;
|
|
57
|
+
padding-inline: 12px 40px;
|
|
57
58
|
border: 1px solid var(--border_color);
|
|
58
59
|
border-radius: var(--border_radius);
|
|
59
60
|
background: var(--element_background);
|
|
@@ -143,7 +144,7 @@ chui_json_viewer {
|
|
|
143
144
|
width: 100%;
|
|
144
145
|
overflow: auto;
|
|
145
146
|
padding: 4px 0;
|
|
146
|
-
font-family:
|
|
147
|
+
font-family: "chui_mono", monospace;
|
|
147
148
|
font-size: var(--font_default_size);
|
|
148
149
|
}
|
|
149
150
|
|
|
@@ -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
|
* Канбан-доска: колонки со карточками и переносом между ними.
|
|
@@ -48,14 +48,16 @@ class Kanban {
|
|
|
48
48
|
#drag_card = undefined;
|
|
49
49
|
#drag_column = undefined;
|
|
50
50
|
|
|
51
|
-
constructor(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
constructor(
|
|
52
|
+
options = {
|
|
53
|
+
id: String(),
|
|
54
|
+
columns: [],
|
|
55
|
+
draggable: Boolean(),
|
|
56
|
+
label: String(),
|
|
57
|
+
onCardMove: undefined,
|
|
58
|
+
onCardClick: undefined,
|
|
59
|
+
}
|
|
60
|
+
) {
|
|
59
61
|
setStyles(__dirname + "/styles.css", "chUiJS_Kanban");
|
|
60
62
|
Kanban.#counter += 1;
|
|
61
63
|
this.#id = options.id === undefined ? `chui_kanban_${Kanban.#counter}` : options.id;
|
|
@@ -90,7 +92,7 @@ class Kanban {
|
|
|
90
92
|
|
|
91
93
|
/** Колонки с карточками (копия данных) */
|
|
92
94
|
getColumns() {
|
|
93
|
-
return this.#columns.map((column) => ({...column, cards: column.cards.map((card) => ({...card}))}));
|
|
95
|
+
return this.#columns.map((column) => ({ ...column, cards: column.cards.map((card) => ({ ...card })) }));
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
getColumn(id = String()) {
|
|
@@ -99,13 +101,13 @@ class Kanban {
|
|
|
99
101
|
|
|
100
102
|
getCards(columnId = String()) {
|
|
101
103
|
const column = this.getColumn(columnId);
|
|
102
|
-
return column === undefined ? [] : column.cards.map((card) => ({...card}));
|
|
104
|
+
return column === undefined ? [] : column.cards.map((card) => ({ ...card }));
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
getCard(id = undefined) {
|
|
106
108
|
for (const column of this.#columns) {
|
|
107
109
|
const card = column.cards.find((item) => String(item.id) === String(id));
|
|
108
|
-
if (card !== undefined) return {...card};
|
|
110
|
+
if (card !== undefined) return { ...card };
|
|
109
111
|
}
|
|
110
112
|
return undefined;
|
|
111
113
|
}
|
|
@@ -146,7 +148,7 @@ class Kanban {
|
|
|
146
148
|
const column = this.getColumn(columnId);
|
|
147
149
|
if (column === undefined) return this;
|
|
148
150
|
const position = index === undefined ? column.cards.length : Math.max(0, Math.min(index, column.cards.length));
|
|
149
|
-
column.cards.splice(position, 0, {...card});
|
|
151
|
+
column.cards.splice(position, 0, { ...card });
|
|
150
152
|
this.#render();
|
|
151
153
|
return this;
|
|
152
154
|
}
|
|
@@ -182,19 +184,19 @@ class Kanban {
|
|
|
182
184
|
if (!Array.isArray(columns)) return [];
|
|
183
185
|
return columns.map((column, index) => ({
|
|
184
186
|
id: column.id === undefined ? `column_${index}` : column.id,
|
|
185
|
-
title: column.title === undefined ? I18n.t("graphics.kanbanColumn", {index: index + 1}) : column.title,
|
|
187
|
+
title: column.title === undefined ? I18n.t("graphics.kanbanColumn", { index: index + 1 }) : column.title,
|
|
186
188
|
limit: column.limit,
|
|
187
189
|
cards: (column.cards === undefined ? [] : column.cards).map((card, position) => ({
|
|
188
190
|
id: card.id === undefined ? `card_${index}_${position}` : card.id,
|
|
189
|
-
...card
|
|
190
|
-
}))
|
|
191
|
+
...card,
|
|
192
|
+
})),
|
|
191
193
|
}));
|
|
192
194
|
}
|
|
193
195
|
|
|
194
196
|
#findCard(cardId = undefined) {
|
|
195
197
|
for (const column of this.#columns) {
|
|
196
198
|
const index = column.cards.findIndex((card) => String(card.id) === String(cardId));
|
|
197
|
-
if (index !== -1) return {column: column, index: index, card: column.cards[index]};
|
|
199
|
+
if (index !== -1) return { column: column, index: index, card: column.cards[index] };
|
|
198
200
|
}
|
|
199
201
|
return undefined;
|
|
200
202
|
}
|
|
@@ -217,7 +219,7 @@ class Kanban {
|
|
|
217
219
|
}
|
|
218
220
|
|
|
219
221
|
#emitMove(card = Object(), from = String(), to = String(), index = Number()) {
|
|
220
|
-
if (this.#on_card_move !== undefined) this.#on_card_move(card, {from: from, to: to, index: index});
|
|
222
|
+
if (this.#on_card_move !== undefined) this.#on_card_move(card, { from: from, to: to, index: index });
|
|
221
223
|
}
|
|
222
224
|
|
|
223
225
|
#announce(text = String()) {
|
|
@@ -227,16 +229,17 @@ class Kanban {
|
|
|
227
229
|
#cardLabel(column = Object(), card = Object()) {
|
|
228
230
|
const parts = [card.title === undefined ? I18n.t("graphics.kanbanCard") : String(card.title)];
|
|
229
231
|
if (card.description !== undefined) parts.push(String(card.description));
|
|
230
|
-
if (Array.isArray(card.tags) && card.tags.length > 0)
|
|
231
|
-
|
|
232
|
+
if (Array.isArray(card.tags) && card.tags.length > 0)
|
|
233
|
+
parts.push(I18n.t("graphics.kanbanTags", { value: card.tags.join(", ") }));
|
|
234
|
+
parts.push(I18n.t("graphics.kanbanColumnOf", { value: column.title }));
|
|
232
235
|
return parts.join(", ");
|
|
233
236
|
}
|
|
234
237
|
|
|
235
238
|
#columnLabel(column = Object()) {
|
|
236
239
|
const count = column.cards.length;
|
|
237
240
|
return column.limit === undefined
|
|
238
|
-
? I18n.t("graphics.kanbanColumnCount", {title: column.title, count: count})
|
|
239
|
-
: I18n.t("graphics.kanbanColumnCountLimit", {title: column.title, count: count, limit: column.limit});
|
|
241
|
+
? I18n.t("graphics.kanbanColumnCount", { title: column.title, count: count })
|
|
242
|
+
: I18n.t("graphics.kanbanColumnCountLimit", { title: column.title, count: count, limit: column.limit });
|
|
240
243
|
}
|
|
241
244
|
|
|
242
245
|
#render() {
|
|
@@ -256,7 +259,8 @@ class Kanban {
|
|
|
256
259
|
const title = document.createElement("kanban_column_title");
|
|
257
260
|
title.innerText = column.title;
|
|
258
261
|
const count = document.createElement("kanban_column_count");
|
|
259
|
-
count.innerText =
|
|
262
|
+
count.innerText =
|
|
263
|
+
column.limit === undefined ? String(column.cards.length) : `${column.cards.length} / ${column.limit}`;
|
|
260
264
|
head.appendChild(title);
|
|
261
265
|
head.appendChild(count);
|
|
262
266
|
node.appendChild(head);
|
|
@@ -306,7 +310,7 @@ class Kanban {
|
|
|
306
310
|
if (target === null) return undefined;
|
|
307
311
|
const node = target.closest("kanban_column");
|
|
308
312
|
if (node === null || !this.#columns_box.contains(node)) return undefined;
|
|
309
|
-
return {node: node, column: this.getColumn(node.dataset.column)};
|
|
313
|
+
return { node: node, column: this.getColumn(node.dataset.column) };
|
|
310
314
|
}
|
|
311
315
|
|
|
312
316
|
/** Карточка под элементом */
|
|
@@ -346,7 +350,11 @@ class Kanban {
|
|
|
346
350
|
if (target === undefined) return;
|
|
347
351
|
const source = this.getColumn(this.#drag_column);
|
|
348
352
|
// Лимит: карточку из другой колонки в полную колонку не пускаем
|
|
349
|
-
if (
|
|
353
|
+
if (
|
|
354
|
+
target.column.limit !== undefined &&
|
|
355
|
+
source !== target.column &&
|
|
356
|
+
target.column.cards.length >= target.column.limit
|
|
357
|
+
) {
|
|
350
358
|
target.node.classList.add("kanban_column_reject");
|
|
351
359
|
if (event.dataTransfer !== null) event.dataTransfer.dropEffect = "none";
|
|
352
360
|
return;
|
|
@@ -387,7 +395,9 @@ class Kanban {
|
|
|
387
395
|
const from = this.#drag_column;
|
|
388
396
|
this.#drag_card = undefined;
|
|
389
397
|
this.#drag_column = undefined;
|
|
390
|
-
this.#columns_box
|
|
398
|
+
this.#columns_box
|
|
399
|
+
.querySelectorAll(".kanban_column_reject")
|
|
400
|
+
.forEach((node) => node.classList.remove("kanban_column_reject"));
|
|
391
401
|
if (card === undefined) return;
|
|
392
402
|
card.classList.remove("kanban_card_dragging");
|
|
393
403
|
const columnNode = card.closest("kanban_column");
|
|
@@ -396,15 +406,21 @@ class Kanban {
|
|
|
396
406
|
const cards = [...columnNode.querySelectorAll(".kanban_card")];
|
|
397
407
|
const index = cards.indexOf(card);
|
|
398
408
|
const cardId = card.dataset.id;
|
|
399
|
-
if (
|
|
409
|
+
if (
|
|
410
|
+
String(from) === String(to) &&
|
|
411
|
+
this.getColumn(to).cards.findIndex((item) => String(item.id) === String(cardId)) === index
|
|
412
|
+
)
|
|
413
|
+
return;
|
|
400
414
|
// Лимит уже проверен при наведении, поэтому модель приводим к тому, что видно в DOM
|
|
401
415
|
this.#applyMove(cardId, to, index);
|
|
402
|
-
this.#announce(
|
|
416
|
+
this.#announce(
|
|
417
|
+
I18n.t("graphics.kanbanMovedTo", { card: this.#titleOf(cardId), column: this.getColumn(to).title })
|
|
418
|
+
);
|
|
403
419
|
}
|
|
404
420
|
|
|
405
421
|
#titleOf(cardId = undefined) {
|
|
406
422
|
const card = this.getCard(cardId);
|
|
407
|
-
return card === undefined ? "" : I18n.t("graphics.quotedName", {name: card.title});
|
|
423
|
+
return card === undefined ? "" : I18n.t("graphics.quotedName", { name: card.title });
|
|
408
424
|
}
|
|
409
425
|
|
|
410
426
|
// === КЛИК И КЛАВИАТУРА ===
|
|
@@ -425,7 +441,9 @@ class Kanban {
|
|
|
425
441
|
const before = this.#findCard(node.dataset.id);
|
|
426
442
|
if (before === undefined) return;
|
|
427
443
|
if (vertical) {
|
|
428
|
-
const index = forward
|
|
444
|
+
const index = forward
|
|
445
|
+
? Math.min(before.index + 1, before.column.cards.length - 1)
|
|
446
|
+
: Math.max(before.index - 1, 0);
|
|
429
447
|
if (index === before.index) return;
|
|
430
448
|
this.moveCard(node.dataset.id, before.column.id, index);
|
|
431
449
|
} else {
|
|
@@ -437,13 +455,13 @@ class Kanban {
|
|
|
437
455
|
const after = this.#findCard(node.dataset.id);
|
|
438
456
|
// Единственная причина отказа — предел колонки: тогда ничего не объявляем о переносе
|
|
439
457
|
if (after.column === before.column && after.index === before.index) {
|
|
440
|
-
this.#announce(I18n.t("graphics.kanbanMoveRefused", {card: this.#titleOf(node.dataset.id)}));
|
|
458
|
+
this.#announce(I18n.t("graphics.kanbanMoveRefused", { card: this.#titleOf(node.dataset.id) }));
|
|
441
459
|
return;
|
|
442
460
|
}
|
|
443
461
|
const moved = this.#root.querySelector(`.kanban_card[data-id="${String(node.dataset.id)}"]`);
|
|
444
462
|
if (moved !== null) moved.focus();
|
|
445
|
-
this.#announce(I18n.t("graphics.kanbanMoved", {card: this.#titleOf(node.dataset.id)}));
|
|
463
|
+
this.#announce(I18n.t("graphics.kanbanMoved", { card: this.#titleOf(node.dataset.id) }));
|
|
446
464
|
};
|
|
447
465
|
}
|
|
448
466
|
|
|
449
|
-
exports.Kanban = Kanban
|
|
467
|
+
exports.Kanban = Kanban;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {setStyles} = require("../../modules/chui_functions");
|
|
1
|
+
const { setStyles } = require("../../modules/chui_functions");
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Обозначение горячей клавиши: одна или несколько клавиш в «кнопках», между ними разделитель.
|
|
@@ -21,7 +21,7 @@ const {setStyles} = require("../../modules/chui_functions");
|
|
|
21
21
|
class Kbd {
|
|
22
22
|
static SIZE = {
|
|
23
23
|
SMALL: "small",
|
|
24
|
-
DEFAULT: "default"
|
|
24
|
+
DEFAULT: "default",
|
|
25
25
|
};
|
|
26
26
|
static #counter = 0;
|
|
27
27
|
|
|
@@ -30,13 +30,15 @@ class Kbd {
|
|
|
30
30
|
#keys = [];
|
|
31
31
|
#separator = "+";
|
|
32
32
|
|
|
33
|
-
constructor(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
constructor(
|
|
34
|
+
options = {
|
|
35
|
+
id: String(),
|
|
36
|
+
keys: [],
|
|
37
|
+
separator: String(),
|
|
38
|
+
size: String(),
|
|
39
|
+
label: String(),
|
|
40
|
+
}
|
|
41
|
+
) {
|
|
40
42
|
setStyles(__dirname + "/styles.css", "chUiJS_Kbd");
|
|
41
43
|
Kbd.#counter += 1;
|
|
42
44
|
this.#id = options.id === undefined ? `chui_kbd_${Kbd.#counter}` : options.id;
|
|
@@ -123,4 +125,4 @@ class Kbd {
|
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
|
|
126
|
-
exports.Kbd = Kbd
|
|
128
|
+
exports.Kbd = Kbd;
|