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.
Files changed (258) hide show
  1. package/CHANGELOG.md +536 -0
  2. package/framework/appLayout/default/chui_app_layout.js +361 -303
  3. package/framework/appLayout/default/global_style.css +243 -89
  4. package/framework/appLayout/default/main_theme_style.css +188 -101
  5. package/framework/components/chui_accordion/accordion.js +17 -17
  6. package/framework/components/chui_accordion/styles.css +7 -7
  7. package/framework/components/chui_action_sheet/action_sheet.js +35 -32
  8. package/framework/components/chui_action_sheet/styles.css +10 -4
  9. package/framework/components/chui_actions_bar/actions_bar.js +338 -0
  10. package/framework/components/chui_actions_bar/styles.css +139 -0
  11. package/framework/components/chui_affix/affix.js +4 -4
  12. package/framework/components/chui_affix/styles.css +5 -0
  13. package/framework/components/chui_alert/alert.js +11 -5
  14. package/framework/components/chui_alert/styles.css +7 -0
  15. package/framework/components/chui_avatar/avatar.js +13 -13
  16. package/framework/components/chui_avatar/styles.css +1 -1
  17. package/framework/components/chui_avatar_group/avatar_group.js +4 -4
  18. package/framework/components/chui_avatar_group/styles.css +1 -1
  19. package/framework/components/chui_backtop/backtop.js +25 -2
  20. package/framework/components/chui_backtop/styles.css +21 -0
  21. package/framework/components/chui_badge/badge.js +15 -15
  22. package/framework/components/chui_badge/styles.css +6 -6
  23. package/framework/components/chui_banner/banner.js +222 -0
  24. package/framework/components/chui_banner/styles.css +170 -0
  25. package/framework/components/chui_breadcrumb/styles.css +1 -1
  26. package/framework/components/chui_button/button.js +24 -28
  27. package/framework/components/chui_button/styles.css +5 -5
  28. package/framework/components/chui_calendar/calendar.js +6 -6
  29. package/framework/components/chui_card/card.js +14 -14
  30. package/framework/components/chui_card_scroll/card_scroll.js +169 -0
  31. package/framework/components/chui_card_scroll/styles.css +86 -0
  32. package/framework/components/chui_chat/chat.js +73 -51
  33. package/framework/components/chui_chat/styles.css +18 -7
  34. package/framework/components/chui_clipboard_history/clipboard_history.js +25 -20
  35. package/framework/components/chui_clipboard_history/styles.css +10 -8
  36. package/framework/components/chui_code/code.js +8 -8
  37. package/framework/components/chui_code/styles.css +2 -2
  38. package/framework/components/chui_code_editor/code_editor.js +26 -26
  39. package/framework/components/chui_code_editor/styles.css +3 -3
  40. package/framework/components/chui_command_palette/command_palette.js +29 -29
  41. package/framework/components/chui_command_palette/styles.css +5 -5
  42. package/framework/components/chui_console/console.js +9 -9
  43. package/framework/components/chui_console/styles.css +5 -2
  44. package/framework/components/chui_content_block/content_block.js +2 -2
  45. package/framework/components/chui_context_menu/context_menu.js +162 -54
  46. package/framework/components/chui_context_menu/styles.css +82 -8
  47. package/framework/components/chui_custom_element/custom_element.js +11 -11
  48. package/framework/components/chui_data_grid/data_grid.js +268 -268
  49. package/framework/components/chui_data_grid/styles.css +14 -14
  50. package/framework/components/chui_descriptions/styles.css +1 -1
  51. package/framework/components/chui_details/details.js +12 -12
  52. package/framework/components/chui_details/styles.css +7 -7
  53. package/framework/components/chui_diff_viewer/diff_viewer.js +88 -88
  54. package/framework/components/chui_diff_viewer/styles.css +9 -9
  55. package/framework/components/chui_divider/divider.js +6 -6
  56. package/framework/components/chui_divider/styles.css +2 -2
  57. package/framework/components/chui_drawer/drawer.js +37 -14
  58. package/framework/components/chui_drawer/styles.css +18 -4
  59. package/framework/components/chui_drop_zone/drop_zone.js +6 -6
  60. package/framework/components/chui_drop_zone/styles.css +10 -6
  61. package/framework/components/chui_fieldset/fieldset.js +6 -6
  62. package/framework/components/chui_fieldset/styles.css +5 -5
  63. package/framework/components/chui_file_explorer/file_explorer.js +115 -115
  64. package/framework/components/chui_file_explorer/styles.css +6 -6
  65. package/framework/components/chui_form/form.js +11 -11
  66. package/framework/components/chui_gantt/gantt.js +41 -41
  67. package/framework/components/chui_gantt/styles.css +5 -5
  68. package/framework/components/chui_graphs/graphs.js +82 -46
  69. package/framework/components/chui_graphs/styles.css +26 -5
  70. package/framework/components/chui_hero/hero.js +63 -20
  71. package/framework/components/chui_hero/styles.css +176 -7
  72. package/framework/components/chui_html_block/html_block.js +5 -5
  73. package/framework/components/chui_html_block/styles.css +1 -1
  74. package/framework/components/chui_hx/styles.css +2 -2
  75. package/framework/components/chui_icons/icons.js +7 -7
  76. package/framework/components/chui_icons/styles.css +2 -1
  77. package/framework/components/chui_inputs/chui_check_box/styles.css +12 -3
  78. package/framework/components/chui_inputs/chui_chips/chips.js +92 -31
  79. package/framework/components/chui_inputs/chui_chips/styles.css +28 -5
  80. package/framework/components/chui_inputs/chui_color_picker/color_picker.js +20 -15
  81. package/framework/components/chui_inputs/chui_color_picker/styles.css +7 -7
  82. package/framework/components/chui_inputs/chui_combo_box/combo_box.js +58 -58
  83. package/framework/components/chui_inputs/chui_combo_box/styles.css +9 -9
  84. package/framework/components/chui_inputs/chui_date/date.js +93 -95
  85. package/framework/components/chui_inputs/chui_date/styles.css +8 -8
  86. package/framework/components/chui_inputs/chui_date_range/date_range.js +22 -22
  87. package/framework/components/chui_inputs/chui_date_range/styles.css +3 -3
  88. package/framework/components/chui_inputs/chui_datetime/datetime.js +12 -12
  89. package/framework/components/chui_inputs/chui_datetime/styles.css +3 -3
  90. package/framework/components/chui_inputs/chui_email/email.js +10 -10
  91. package/framework/components/chui_inputs/chui_email/styles.css +6 -6
  92. package/framework/components/chui_inputs/chui_file/file.js +8 -8
  93. package/framework/components/chui_inputs/chui_file/styles.css +12 -9
  94. package/framework/components/chui_inputs/chui_hotkey/hotkey.js +39 -39
  95. package/framework/components/chui_inputs/chui_hotkey/styles.css +6 -6
  96. package/framework/components/chui_inputs/chui_masked/masked.js +44 -44
  97. package/framework/components/chui_inputs/chui_masked/styles.css +5 -5
  98. package/framework/components/chui_inputs/chui_mention/mention.js +13 -13
  99. package/framework/components/chui_inputs/chui_mention/styles.css +14 -8
  100. package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +147 -137
  101. package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +14 -8
  102. package/framework/components/chui_inputs/chui_number/number.js +42 -45
  103. package/framework/components/chui_inputs/chui_number/styles.css +6 -6
  104. package/framework/components/chui_inputs/chui_otp/otp.js +32 -32
  105. package/framework/components/chui_inputs/chui_otp/styles.css +5 -5
  106. package/framework/components/chui_inputs/chui_password/password.js +30 -36
  107. package/framework/components/chui_inputs/chui_password/styles.css +7 -7
  108. package/framework/components/chui_inputs/chui_radio_button/styles.css +2 -2
  109. package/framework/components/chui_inputs/chui_rating/rating.js +28 -28
  110. package/framework/components/chui_inputs/chui_rating/styles.css +3 -3
  111. package/framework/components/chui_inputs/chui_select_box/select_box.js +54 -54
  112. package/framework/components/chui_inputs/chui_select_box/styles.css +10 -10
  113. package/framework/components/chui_inputs/chui_slider/slider.js +14 -14
  114. package/framework/components/chui_inputs/chui_slider/styles.css +5 -4
  115. package/framework/components/chui_inputs/chui_text/styles.css +7 -7
  116. package/framework/components/chui_inputs/chui_text/text.js +13 -17
  117. package/framework/components/chui_inputs/chui_text_area/styles.css +8 -8
  118. package/framework/components/chui_inputs/chui_text_area/text_area.js +23 -23
  119. package/framework/components/chui_inputs/chui_time/styles.css +13 -17
  120. package/framework/components/chui_inputs/chui_time/time.js +35 -24
  121. package/framework/components/chui_inputs/chui_toggle/styles.css +10 -3
  122. package/framework/components/chui_inputs/chui_toggle/toggle.js +16 -16
  123. package/framework/components/chui_json_editor/json_editor.js +87 -87
  124. package/framework/components/chui_json_editor/styles.css +5 -5
  125. package/framework/components/chui_json_viewer/json_viewer.js +80 -80
  126. package/framework/components/chui_json_viewer/styles.css +6 -6
  127. package/framework/components/chui_kanban/kanban.js +27 -27
  128. package/framework/components/chui_kanban/styles.css +8 -4
  129. package/framework/components/chui_kbd/styles.css +1 -1
  130. package/framework/components/chui_label/label.js +17 -17
  131. package/framework/components/chui_label/styles.css +1 -1
  132. package/framework/components/chui_link/link.js +9 -9
  133. package/framework/components/chui_link/styles.css +11 -4
  134. package/framework/components/chui_list/list.js +11 -11
  135. package/framework/components/chui_list/styles.css +2 -2
  136. package/framework/components/chui_markdown_editor/markdown_editor.js +66 -66
  137. package/framework/components/chui_markdown_editor/styles.css +5 -5
  138. package/framework/components/chui_media/audio.js +240 -246
  139. package/framework/components/chui_media/audio_styles.css +41 -23
  140. package/framework/components/chui_media/image.js +49 -46
  141. package/framework/components/chui_media/image_compare.js +35 -35
  142. package/framework/components/chui_media/image_compare_styles.css +5 -5
  143. package/framework/components/chui_media/image_styles.css +1 -1
  144. package/framework/components/chui_media/video.js +148 -148
  145. package/framework/components/chui_media/video_styles.css +27 -11
  146. package/framework/components/chui_menu_bar/menu_bar.js +54 -54
  147. package/framework/components/chui_menu_bar/styles.css +10 -10
  148. package/framework/components/chui_message_bar/message_bar.js +551 -0
  149. package/framework/components/chui_message_bar/styles.css +248 -0
  150. package/framework/components/chui_modal/modal.js +37 -13
  151. package/framework/components/chui_notification/notification.js +76 -54
  152. package/framework/components/chui_notification/notification_download.js +26 -81
  153. package/framework/components/chui_notification/notification_download_card.js +115 -0
  154. package/framework/components/chui_notification/notification_download_progress.css +2 -2
  155. package/framework/components/chui_notification/notification_download_progress.js +70 -108
  156. package/framework/components/chui_notification/notification_update.js +31 -31
  157. package/framework/components/chui_notification/status_plate.css +3 -3
  158. package/framework/components/chui_notification/styles.css +6 -1
  159. package/framework/components/chui_notification/styles_download.css +1 -1
  160. package/framework/components/chui_notification/styles_update.css +2 -2
  161. package/framework/components/chui_org_chart/org_chart.js +29 -29
  162. package/framework/components/chui_org_chart/styles.css +2 -2
  163. package/framework/components/chui_pagination/pagination.js +3 -3
  164. package/framework/components/chui_pagination/styles.css +1 -1
  165. package/framework/components/chui_paragraph/styles.css +2 -2
  166. package/framework/components/chui_popover/popover.js +29 -23
  167. package/framework/components/chui_popover/styles.css +1 -1
  168. package/framework/components/chui_popups/popups.js +124 -124
  169. package/framework/components/chui_popups/styles.css +5 -5
  170. package/framework/components/chui_print_button/print_button.js +15 -10
  171. package/framework/components/chui_progress_bar/progress_bar.js +34 -12
  172. package/framework/components/chui_progress_bar/styles.css +4 -4
  173. package/framework/components/chui_progress_ring/progress_ring.js +15 -15
  174. package/framework/components/chui_progress_ring/styles.css +1 -1
  175. package/framework/components/chui_qrcode/qrcode.js +12 -12
  176. package/framework/components/chui_query_builder/query_builder.js +46 -46
  177. package/framework/components/chui_query_builder/styles.css +4 -4
  178. package/framework/components/chui_radio_group/styles.css +1 -1
  179. package/framework/components/chui_result/result.js +15 -15
  180. package/framework/components/chui_result/styles.css +3 -3
  181. package/framework/components/chui_scheduler/scheduler.js +74 -74
  182. package/framework/components/chui_scheduler/styles.css +5 -5
  183. package/framework/components/chui_screen_spinner/screen_spinner.js +167 -0
  184. package/framework/components/chui_screen_spinner/styles.css +49 -0
  185. package/framework/components/chui_segmented_control/segmented_control.js +63 -6
  186. package/framework/components/chui_segmented_control/styles.css +32 -6
  187. package/framework/components/chui_settings/settings.js +45 -46
  188. package/framework/components/chui_settings/styles.css +4 -4
  189. package/framework/components/chui_shortcut_help/shortcut_help.js +32 -34
  190. package/framework/components/chui_sidebar_nav/sidebar_nav.js +98 -29
  191. package/framework/components/chui_sidebar_nav/styles.css +9 -3
  192. package/framework/components/chui_slideshow/slideshow.js +85 -85
  193. package/framework/components/chui_slideshow/styles.css +6 -6
  194. package/framework/components/chui_spinner/spinner.js +10 -10
  195. package/framework/components/chui_split_button/split_button.js +30 -12
  196. package/framework/components/chui_split_button/styles.css +21 -5
  197. package/framework/components/chui_splitter/splitter.js +11 -11
  198. package/framework/components/chui_splitter/styles.css +2 -2
  199. package/framework/components/chui_statistic/statistic.js +47 -47
  200. package/framework/components/chui_status_bar/styles.css +2 -2
  201. package/framework/components/chui_stepper/stepper.js +202 -31
  202. package/framework/components/chui_stepper/styles.css +79 -14
  203. package/framework/components/chui_sticky_bar/sticky_bar.js +44 -13
  204. package/framework/components/chui_sticky_bar/styles.css +10 -8
  205. package/framework/components/chui_tabs/chui_tabs.js +74 -26
  206. package/framework/components/chui_tabs/styles.css +40 -12
  207. package/framework/components/chui_text_editor/styles.css +7 -7
  208. package/framework/components/chui_text_editor/text_editor.js +56 -56
  209. package/framework/components/chui_text_editor/text_editor_panel.js +173 -174
  210. package/framework/components/chui_theme_toggle/theme_toggle.js +21 -5
  211. package/framework/components/chui_timeline/styles.css +3 -1
  212. package/framework/components/chui_toast_queue/styles.css +11 -11
  213. package/framework/components/chui_toast_queue/toast_queue.js +30 -27
  214. package/framework/components/chui_toolbar/styles.css +2 -2
  215. package/framework/components/chui_tooltip/styles.css +2 -2
  216. package/framework/components/chui_tooltip/tooltip.js +3 -3
  217. package/framework/components/chui_tour/styles.css +8 -8
  218. package/framework/components/chui_tour/tour.js +72 -72
  219. package/framework/components/chui_transfer/styles.css +6 -6
  220. package/framework/components/chui_transfer/transfer.js +93 -106
  221. package/framework/components/chui_tree_table/styles.css +4 -4
  222. package/framework/components/chui_tree_table/tree_table.js +45 -45
  223. package/framework/components/chui_tree_view/styles.css +10 -8
  224. package/framework/components/chui_tree_view/tree_view.js +185 -183
  225. package/framework/components/chui_user_bar/styles.css +145 -0
  226. package/framework/components/chui_user_bar/user_bar.js +402 -0
  227. package/framework/components/chui_user_list_bar/styles.css +173 -0
  228. package/framework/components/chui_user_list_bar/user_list_bar.js +485 -0
  229. package/framework/components/chui_watermark/watermark.js +17 -17
  230. package/framework/components/chui_webview/webview.js +9 -9
  231. package/framework/components/chui_write_bar/styles.css +172 -0
  232. package/framework/components/chui_write_bar/write_bar.js +320 -0
  233. package/framework/main_window.js +1234 -0
  234. package/framework/modules/chui_a11y/chui_a11y.js +78 -79
  235. package/framework/modules/chui_animations/animations.js +77 -15
  236. package/framework/modules/chui_animations/motion.js +120 -0
  237. package/framework/modules/chui_animations/styles.css +36 -3
  238. package/framework/modules/chui_functions.js +31 -27
  239. package/framework/modules/chui_highlight/styles.css +13 -10
  240. package/framework/modules/chui_i18n/chui_i18n.js +3 -3
  241. package/framework/modules/chui_i18n/locales/feedback.js +62 -0
  242. package/framework/modules/chui_i18n/locales/navigation.js +4 -0
  243. package/framework/modules/chui_json/chui_json.js +2 -2
  244. package/framework/modules/chui_logger/chui_logger.js +23 -8
  245. package/framework/modules/chui_page/page.js +10 -10
  246. package/framework/modules/chui_palette/palette.js +61 -0
  247. package/framework/modules/chui_qr/chui_qr.js +23 -23
  248. package/framework/modules/chui_scrollbar/chui_scrollbar.js +45 -45
  249. package/framework/modules/chui_scrollbar/styles.css +3 -3
  250. package/framework/modules/chui_services/chui_services.js +8 -8
  251. package/framework/modules/chui_services/desktop.js +77 -71
  252. package/framework/modules/chui_sortable/chui_sortable.js +17 -17
  253. package/framework/modules/chui_validate/chui_validate.js +3 -3
  254. package/framework/tray_bar/chui_menu_items.js +2 -2
  255. package/index.d.ts +266 -34
  256. package/index.js +20 -1168
  257. package/package.json +6 -4
  258. package/framework/components/telegram_bot/chui_telegram_bot.js +0 -191
@@ -20,11 +20,11 @@ class Popup {
20
20
  cancelText: String(),
21
21
  }
22
22
  ) {
23
- try {
24
- return await new PopupConfirm(options);
25
- } catch (err) {
26
- return err;
27
- }
23
+ // `PopupConfirm` не отклоняется: он закрывается только выбором — `resolve(true/false)`
24
+ // в его конструкторе. Прежний `catch (err) { return err; }` ловил недостижимое и
25
+ // возвращал `Error` как успешный ответ: `if (await popup.confirm())` принял бы отказ
26
+ // за согласие
27
+ return new PopupConfirm(options);
28
28
  }
29
29
  async prompt(
30
30
  options = {
@@ -57,67 +57,67 @@ exports.Popup = Popup;
57
57
 
58
58
  class PopupAlert {
59
59
  #id = require("randomstring").generate();
60
- #chui_popup = document.createElement(`chui_popup`);
61
- #popup_content = document.createElement("popup_content");
62
- #popup_body = document.createElement("popup_body");
63
- #popup_buttons = document.createElement("popup_buttons");
64
- #button_OK = document.createElement("popup_button_ok");
65
-
66
- #popup_title = document.createElement("popup_title");
67
- #popup_message = document.createElement("popup_message");
60
+ #chuiPopup = document.createElement(`chui_popup`);
61
+ #popupContent = document.createElement("popup_content");
62
+ #popupBody = document.createElement("popup_body");
63
+ #popupButtons = document.createElement("popup_buttons");
64
+ #buttonOK = document.createElement("popup_button_ok");
65
+
66
+ #popupTitle = document.createElement("popup_title");
67
+ #popupMessage = document.createElement("popup_message");
68
68
  #a11y = undefined;
69
69
  constructor(options = { title: String(), message: String() }) {
70
- this.#chui_popup.id = this.#id;
70
+ this.#chuiPopup.id = this.#id;
71
71
  //ADDS
72
- this.#popup_content.appendChild(this.#popup_body);
73
- this.#popup_content.appendChild(this.#popup_buttons);
74
- this.#chui_popup.appendChild(this.#popup_content);
72
+ this.#popupContent.appendChild(this.#popupBody);
73
+ this.#popupContent.appendChild(this.#popupButtons);
74
+ this.#chuiPopup.appendChild(this.#popupContent);
75
75
 
76
- this.#popup_title.innerText = options.title;
77
- this.#popup_message.innerText = options.message;
76
+ this.#popupTitle.innerText = options.title;
77
+ this.#popupMessage.innerText = options.message;
78
78
 
79
- this.#popup_body.appendChild(this.#popup_title);
80
- this.#popup_body.appendChild(this.#popup_message);
79
+ this.#popupBody.appendChild(this.#popupTitle);
80
+ this.#popupBody.appendChild(this.#popupMessage);
81
81
 
82
82
  // СОБЫТИЯ
83
- this.#button_OK.innerText = I18n.t("common.ok");
84
- makeKeyboardButton(this.#button_OK);
85
- this.#button_OK.addEventListener("click", () => this.#dismiss());
86
- this.#popup_buttons.appendChild(this.#button_OK);
83
+ this.#buttonOK.innerText = I18n.t("common.ok");
84
+ makeKeyboardButton(this.#buttonOK);
85
+ this.#buttonOK.addEventListener("click", () => this.#dismiss());
86
+ this.#popupButtons.appendChild(this.#buttonOK);
87
87
 
88
88
  //
89
- document.body.appendChild(this.#chui_popup);
89
+ document.body.appendChild(this.#chuiPopup);
90
90
  // Доступность: alertdialog, имя из заголовка, описание из сообщения, Esc закрывает
91
- this.#a11y = new OverlayA11y(this.#chui_popup, {
91
+ this.#a11y = new OverlayA11y(this.#chuiPopup, {
92
92
  role: "alertdialog",
93
- labelNode: this.#popup_title,
94
- describedBy: this.#popup_message,
93
+ labelNode: this.#popupTitle,
94
+ describedBy: this.#popupMessage,
95
95
  onEscape: () => this.#dismiss(),
96
96
  });
97
- new Animation(this.#chui_popup).fadeIn();
98
- new Animation(this.#chui_popup.firstChild).scaleIn();
97
+ new Animation(this.#chuiPopup).fadeIn();
98
+ new Animation(this.#chuiPopup.firstChild).scaleIn();
99
99
  this.#a11y.open();
100
100
  }
101
101
  #dismiss() {
102
102
  // Попап мог быть уже убран (повторный Esc или клик) — тогда закрывать нечего
103
- if (!document.contains(this.#chui_popup)) return;
103
+ if (!document.contains(this.#chuiPopup)) return;
104
104
  this.#a11y.close();
105
- new Animation(this.#chui_popup.firstChild).scaleOut();
106
- new Animation(this.#chui_popup).fadeOutAndRemove();
105
+ new Animation(this.#chuiPopup.firstChild).scaleOut();
106
+ new Animation(this.#chuiPopup).fadeOutAndRemove();
107
107
  }
108
108
  }
109
109
 
110
110
  class PopupConfirm {
111
111
  #id = require("randomstring").generate();
112
- #chui_popup = document.createElement(`chui_popup`);
113
- #popup_content = document.createElement("popup_content");
114
- #popup_body = document.createElement("popup_body");
115
- #popup_buttons = document.createElement("popup_buttons");
116
- #button_accept = document.createElement("popup_button_accept");
117
- #button_cancel = document.createElement("popup_button_cancel");
118
-
119
- #popup_title = document.createElement("popup_title");
120
- #popup_message = document.createElement("popup_message");
112
+ #chuiPopup = document.createElement(`chui_popup`);
113
+ #popupContent = document.createElement("popup_content");
114
+ #popupBody = document.createElement("popup_body");
115
+ #popupButtons = document.createElement("popup_buttons");
116
+ #buttonAccept = document.createElement("popup_button_accept");
117
+ #buttonCancel = document.createElement("popup_button_cancel");
118
+
119
+ #popupTitle = document.createElement("popup_title");
120
+ #popupMessage = document.createElement("popup_message");
121
121
  #a11y = undefined;
122
122
  constructor(
123
123
  options = {
@@ -127,74 +127,74 @@ class PopupConfirm {
127
127
  cancelText: String(),
128
128
  }
129
129
  ) {
130
- this.#chui_popup.id = this.#id;
130
+ this.#chuiPopup.id = this.#id;
131
131
  //ADDS
132
- this.#popup_content.appendChild(this.#popup_body);
133
- this.#popup_content.appendChild(this.#popup_buttons);
134
- this.#chui_popup.appendChild(this.#popup_content);
132
+ this.#popupContent.appendChild(this.#popupBody);
133
+ this.#popupContent.appendChild(this.#popupButtons);
134
+ this.#chuiPopup.appendChild(this.#popupContent);
135
135
 
136
- this.#popup_title.innerText = options.title;
137
- this.#popup_message.innerText = options.message;
136
+ this.#popupTitle.innerText = options.title;
137
+ this.#popupMessage.innerText = options.message;
138
138
 
139
- this.#popup_body.appendChild(this.#popup_title);
140
- this.#popup_body.appendChild(this.#popup_message);
139
+ this.#popupBody.appendChild(this.#popupTitle);
140
+ this.#popupBody.appendChild(this.#popupMessage);
141
141
 
142
142
  // Пустая опция равносильна отсутствующей: без подписи кнопка печатала «undefined»
143
- this.#button_cancel.innerText = optionOr(options.cancelText, I18n.t("common.cancel"));
144
- this.#button_accept.innerText = optionOr(options.okText, I18n.t("common.ok"));
143
+ this.#buttonCancel.innerText = optionOr(options.cancelText, I18n.t("common.cancel"));
144
+ this.#buttonAccept.innerText = optionOr(options.okText, I18n.t("common.ok"));
145
145
 
146
- makeKeyboardButton(this.#button_cancel);
147
- makeKeyboardButton(this.#button_accept);
148
- this.#popup_buttons.appendChild(this.#button_cancel);
149
- this.#popup_buttons.appendChild(this.#button_accept);
146
+ makeKeyboardButton(this.#buttonCancel);
147
+ makeKeyboardButton(this.#buttonAccept);
148
+ this.#popupButtons.appendChild(this.#buttonCancel);
149
+ this.#popupButtons.appendChild(this.#buttonAccept);
150
150
 
151
151
  return new Promise((resolve) => {
152
- this.#button_cancel.addEventListener("click", () => {
152
+ this.#buttonCancel.addEventListener("click", () => {
153
153
  this.#dismiss();
154
154
  resolve(false);
155
155
  });
156
156
 
157
- this.#button_accept.addEventListener("click", () => {
157
+ this.#buttonAccept.addEventListener("click", () => {
158
158
  this.#dismiss();
159
159
  resolve(true);
160
160
  });
161
161
 
162
- document.body.appendChild(this.#chui_popup);
162
+ document.body.appendChild(this.#chuiPopup);
163
163
  // Доступность: имя из заголовка, описание из сообщения, Esc = отмена, фокус остаётся в диалоге
164
- this.#a11y = new OverlayA11y(this.#chui_popup, {
164
+ this.#a11y = new OverlayA11y(this.#chuiPopup, {
165
165
  role: "alertdialog",
166
- labelNode: this.#popup_title,
167
- describedBy: this.#popup_message,
168
- onEscape: () => this.#button_cancel.click(),
166
+ labelNode: this.#popupTitle,
167
+ describedBy: this.#popupMessage,
168
+ onEscape: () => this.#buttonCancel.click(),
169
169
  });
170
- new Animation(this.#chui_popup).fadeIn();
171
- new Animation(this.#chui_popup.firstChild).scaleIn();
170
+ new Animation(this.#chuiPopup).fadeIn();
171
+ new Animation(this.#chuiPopup.firstChild).scaleIn();
172
172
  this.#a11y.open();
173
173
  });
174
174
  }
175
175
  #dismiss() {
176
176
  // Попап мог быть уже убран (повторный Esc или клик) — тогда закрывать нечего
177
- if (!document.contains(this.#chui_popup)) return;
177
+ if (!document.contains(this.#chuiPopup)) return;
178
178
  this.#a11y.close();
179
- new Animation(this.#chui_popup.firstChild).scaleOut();
180
- new Animation(this.#chui_popup).fadeOutAndRemove();
179
+ new Animation(this.#chuiPopup.firstChild).scaleOut();
180
+ new Animation(this.#chuiPopup).fadeOutAndRemove();
181
181
  }
182
182
  }
183
183
 
184
184
  class PopupPrompt {
185
185
  #id = require("randomstring").generate();
186
- #chui_popup = document.createElement(`chui_popup`);
187
- #popup_content = document.createElement("popup_content");
188
- #popup_body = document.createElement("popup_body");
189
- #popup_buttons = document.createElement("popup_buttons");
190
- #button_accept = document.createElement("popup_button_accept");
191
- #button_cancel = document.createElement("popup_button_cancel");
192
-
193
- #popup_title = document.createElement("popup_title");
194
- #popup_message = document.createElement("popup_message");
195
-
196
- #input_text = undefined;
197
- #input_pass = undefined;
186
+ #chuiPopup = document.createElement(`chui_popup`);
187
+ #popupContent = document.createElement("popup_content");
188
+ #popupBody = document.createElement("popup_body");
189
+ #popupButtons = document.createElement("popup_buttons");
190
+ #buttonAccept = document.createElement("popup_button_accept");
191
+ #buttonCancel = document.createElement("popup_button_cancel");
192
+
193
+ #popupTitle = document.createElement("popup_title");
194
+ #popupMessage = document.createElement("popup_message");
195
+
196
+ #inputText = undefined;
197
+ #inputPass = undefined;
198
198
  #a11y = undefined;
199
199
 
200
200
  constructor(
@@ -215,106 +215,106 @@ class PopupPrompt {
215
215
  cancelText: String(),
216
216
  }
217
217
  ) {
218
- this.#chui_popup.id = this.#id;
218
+ this.#chuiPopup.id = this.#id;
219
219
  //ADDS
220
- this.#popup_content.appendChild(this.#popup_body);
221
- this.#popup_content.appendChild(this.#popup_buttons);
222
- this.#chui_popup.appendChild(this.#popup_content);
220
+ this.#popupContent.appendChild(this.#popupBody);
221
+ this.#popupContent.appendChild(this.#popupButtons);
222
+ this.#chuiPopup.appendChild(this.#popupContent);
223
223
 
224
- this.#popup_title.innerText = options.title;
225
- this.#popup_message.innerText = options.message;
224
+ this.#popupTitle.innerText = options.title;
225
+ this.#popupMessage.innerText = options.message;
226
226
 
227
- this.#popup_body.appendChild(this.#popup_title);
228
- this.#popup_body.appendChild(this.#popup_message);
227
+ this.#popupBody.appendChild(this.#popupTitle);
228
+ this.#popupBody.appendChild(this.#popupMessage);
229
229
 
230
230
  if (options.inputs.text === undefined && options.inputs.password === undefined) {
231
231
  throw new Error("render: Установите одно из полей ввода text или password");
232
232
  }
233
233
 
234
234
  if (options.inputs.text !== undefined) {
235
- this.#input_text = new TextInput({
235
+ this.#inputText = new TextInput({
236
236
  placeholder: options.inputs.text.placeholder,
237
237
  width: "-webkit-fill-available",
238
238
  });
239
- this.#popup_body.appendChild(this.#input_text.set());
239
+ this.#popupBody.appendChild(this.#inputText.set());
240
240
  }
241
241
 
242
242
  if (options.inputs.password !== undefined) {
243
- this.#input_pass = new PasswordInput({
243
+ this.#inputPass = new PasswordInput({
244
244
  placeholder: options.inputs.password.placeholder,
245
245
  width: "-webkit-fill-available",
246
246
  });
247
- this.#popup_body.appendChild(this.#input_pass.set());
247
+ this.#popupBody.appendChild(this.#inputPass.set());
248
248
  }
249
249
 
250
250
  // Пустая опция равносильна отсутствующей: без подписи кнопка печатала «undefined»
251
- this.#button_cancel.innerText = optionOr(options.cancelText, I18n.t("common.cancel"));
252
- this.#button_accept.innerText = optionOr(options.okText, I18n.t("common.ok"));
251
+ this.#buttonCancel.innerText = optionOr(options.cancelText, I18n.t("common.cancel"));
252
+ this.#buttonAccept.innerText = optionOr(options.okText, I18n.t("common.ok"));
253
253
 
254
- makeKeyboardButton(this.#button_cancel);
255
- makeKeyboardButton(this.#button_accept);
256
- this.#popup_buttons.appendChild(this.#button_cancel);
257
- this.#popup_buttons.appendChild(this.#button_accept);
254
+ makeKeyboardButton(this.#buttonCancel);
255
+ makeKeyboardButton(this.#buttonAccept);
256
+ this.#popupButtons.appendChild(this.#buttonCancel);
257
+ this.#popupButtons.appendChild(this.#buttonAccept);
258
258
 
259
259
  return new Promise((resolve) => {
260
- this.#button_cancel.addEventListener("click", () => {
260
+ this.#buttonCancel.addEventListener("click", () => {
261
261
  this.#dismiss();
262
262
  // Отмена тоже закрывает промис — иначе `await new Popup().prompt(...)` висел навсегда
263
263
  resolve(undefined);
264
264
  });
265
265
 
266
- this.#button_accept.addEventListener("click", () => {
266
+ this.#buttonAccept.addEventListener("click", () => {
267
267
  let close = false;
268
- if (this.#input_text && this.#input_pass === undefined) {
269
- if (this.#input_text.getValue() !== "") {
268
+ if (this.#inputText && this.#inputPass === undefined) {
269
+ if (this.#inputText.getValue() !== "") {
270
270
  close = true;
271
- resolve({ text: this.#input_text.getValue() });
271
+ resolve({ text: this.#inputText.getValue() });
272
272
  } else {
273
- this.#input_text.setErrorMessage(options.inputs.text.errorMessage);
273
+ this.#inputText.setErrorMessage(options.inputs.text.errorMessage);
274
274
  }
275
275
  }
276
- if (this.#input_text === undefined && this.#input_pass) {
277
- if (this.#input_pass.getValue() !== "") {
276
+ if (this.#inputText === undefined && this.#inputPass) {
277
+ if (this.#inputPass.getValue() !== "") {
278
278
  close = true;
279
- resolve({ password: this.#input_pass.getValue() });
279
+ resolve({ password: this.#inputPass.getValue() });
280
280
  } else {
281
- this.#input_pass.setErrorMessage(options.inputs.password.errorMessage);
281
+ this.#inputPass.setErrorMessage(options.inputs.password.errorMessage);
282
282
  }
283
283
  }
284
- if (this.#input_text && this.#input_pass) {
285
- let text = this.#input_text.getValue();
286
- let password = this.#input_pass.getValue();
284
+ if (this.#inputText && this.#inputPass) {
285
+ const text = this.#inputText.getValue();
286
+ const password = this.#inputPass.getValue();
287
287
  if (text !== "" && password !== "") {
288
288
  close = true;
289
289
  resolve({ text, password });
290
290
  }
291
- if (text === "") this.#input_text.setErrorMessage(options.inputs.text.errorMessage);
292
- if (password === "") this.#input_pass.setErrorMessage(options.inputs.password.errorMessage);
291
+ if (text === "") this.#inputText.setErrorMessage(options.inputs.text.errorMessage);
292
+ if (password === "") this.#inputPass.setErrorMessage(options.inputs.password.errorMessage);
293
293
  }
294
294
  if (close) {
295
295
  this.#dismiss();
296
296
  }
297
297
  });
298
298
 
299
- document.body.appendChild(this.#chui_popup);
299
+ document.body.appendChild(this.#chuiPopup);
300
300
 
301
301
  // Доступность: имя из заголовка, описание из сообщения, Esc = отмена, фокус уходит в первое поле
302
- this.#a11y = new OverlayA11y(this.#chui_popup, {
302
+ this.#a11y = new OverlayA11y(this.#chuiPopup, {
303
303
  role: "alertdialog",
304
- labelNode: this.#popup_title,
305
- describedBy: this.#popup_message,
306
- onEscape: () => this.#button_cancel.click(),
304
+ labelNode: this.#popupTitle,
305
+ describedBy: this.#popupMessage,
306
+ onEscape: () => this.#buttonCancel.click(),
307
307
  });
308
- new Animation(this.#chui_popup).fadeIn();
309
- new Animation(this.#chui_popup.firstChild).scaleIn();
308
+ new Animation(this.#chuiPopup).fadeIn();
309
+ new Animation(this.#chuiPopup.firstChild).scaleIn();
310
310
  this.#a11y.open();
311
311
  });
312
312
  }
313
313
  #dismiss() {
314
314
  // Попап мог быть уже убран (повторный Esc или клик) — тогда закрывать нечего
315
- if (!document.contains(this.#chui_popup)) return;
315
+ if (!document.contains(this.#chuiPopup)) return;
316
316
  this.#a11y.close();
317
- new Animation(this.#chui_popup.firstChild).scaleOut();
318
- new Animation(this.#chui_popup).fadeOutAndRemove();
317
+ new Animation(this.#chuiPopup.firstChild).scaleOut();
318
+ new Animation(this.#chuiPopup).fadeOutAndRemove();
319
319
  }
320
320
  }
@@ -16,7 +16,7 @@ chui_popup {
16
16
  popup_content {
17
17
  margin: 60px auto;
18
18
  width: 325px;
19
- max-width: calc(100% - (var(--margin) * 2));
19
+ max-width: calc(100% - (var(--block_margin) * 2));
20
20
  height: max-content;
21
21
  display: flex;
22
22
  flex-direction: column;
@@ -79,8 +79,8 @@ popup_button_cancel {
79
79
  flex: 1;
80
80
  min-width: 0;
81
81
  /* Компактный шаг — те же 29px высоты, что у .chui_button и полей */
82
- padding: var(--main_padding_sm);
83
- border-radius: var(--border_radius);
82
+ padding: var(--block_padding_sm);
83
+ border-radius: var(--radius_sm);
84
84
  background: var(--button_background);
85
85
  border: 1px solid var(--button_border_color);
86
86
  color: var(--text_color);
@@ -107,8 +107,8 @@ popup_button_accept {
107
107
 
108
108
  popup_button_ok:hover,
109
109
  popup_button_accept:hover {
110
- background: var(--blue_prime_background_trans);
111
- border-color: var(--blue_prime_background_trans);
110
+ background: var(--blue_prime_background_tint_strong);
111
+ border-color: var(--blue_prime_background_tint_strong);
112
112
  color: var(--text_color_hover);
113
113
  }
114
114
 
@@ -2,6 +2,7 @@ const { Button } = require("../chui_button/button");
2
2
  const { Icons } = require("../chui_icons/icons");
3
3
  const { Desktop } = require("../../modules/chui_services/desktop");
4
4
  const { I18n } = require("../../modules/chui_i18n/chui_i18n");
5
+ const { reportError } = require("../../modules/chui_logger/chui_logger");
5
6
 
6
7
  /**
7
8
  * Кнопка печати: печатает страницу целиком, готовый HTML или элемент с его стилями.
@@ -30,9 +31,10 @@ class PrintButton {
30
31
  #target = undefined;
31
32
  #html = undefined;
32
33
  #options = {};
33
- #file_name = undefined;
34
- #document_title = undefined;
35
- #on_result = undefined;
34
+ #fileName = undefined;
35
+ #documentTitle = undefined;
36
+ #onResult = undefined;
37
+ #onError = undefined;
36
38
 
37
39
  constructor(
38
40
  options = {
@@ -45,15 +47,17 @@ class PrintButton {
45
47
  documentTitle: String(),
46
48
  icon: undefined,
47
49
  onResult: undefined,
50
+ onError: undefined,
48
51
  }
49
52
  ) {
50
53
  this.#mode = options.mode === undefined ? PrintButton.MODE.PRINT : options.mode;
51
54
  this.#target = options.target;
52
55
  this.#html = options.html;
53
56
  this.#options = options.options === undefined ? {} : options.options;
54
- this.#file_name = options.fileName;
55
- this.#document_title = options.documentTitle;
56
- this.#on_result = options.onResult;
57
+ this.#fileName = options.fileName;
58
+ this.#documentTitle = options.documentTitle;
59
+ this.#onResult = options.onResult;
60
+ this.#onError = options.onError;
57
61
  this.#button = new Button({
58
62
  title:
59
63
  options.title === undefined
@@ -63,7 +67,8 @@ class PrintButton {
63
67
  : options.title,
64
68
  icon: options.icon === undefined ? Icons.ACTIONS.PRINT : options.icon,
65
69
  clickEvent: () => {
66
- this.print().catch(() => {});
70
+ // Отказ сервиса не глушим: приложению — `onError`, без него — в лог
71
+ this.print().catch((error) => reportError(error, this.#onError));
67
72
  },
68
73
  });
69
74
  }
@@ -107,7 +112,7 @@ class PrintButton {
107
112
  print() {
108
113
  const html = this.#buildHtml();
109
114
  const options = { ...this.#options };
110
- if (this.#file_name !== undefined) options.fileName = this.#file_name;
115
+ if (this.#fileName !== undefined) options.fileName = this.#fileName;
111
116
  const request =
112
117
  this.#mode === PrintButton.MODE.PDF
113
118
  ? Desktop.print.pdf(html === undefined ? document.documentElement.outerHTML : html, options)
@@ -115,7 +120,7 @@ class PrintButton {
115
120
  ? Desktop.print.page(options)
116
121
  : Desktop.print.html(html, options);
117
122
  return request.then((result) => {
118
- if (this.#on_result !== undefined) this.#on_result(result);
123
+ if (this.#onResult !== undefined) this.#onResult(result);
119
124
  return result;
120
125
  });
121
126
  }
@@ -132,7 +137,7 @@ class PrintButton {
132
137
  const node = this.#target instanceof Element ? this.#target : this.#target.set();
133
138
  if (node === undefined || node === null) return undefined;
134
139
  const styles = [...document.querySelectorAll("style")].map((style) => style.outerHTML).join("\n");
135
- const title = this.#document_title === undefined ? "" : `<title>${this.#document_title}</title>`;
140
+ const title = this.#documentTitle === undefined ? "" : `<title>${this.#documentTitle}</title>`;
136
141
  return `<!DOCTYPE html><html><head><meta charset="utf-8">${title}${styles}</head><body>${node.outerHTML}</body></html>`;
137
142
  }
138
143
  }
@@ -7,31 +7,35 @@
7
7
  * уходит в `aria-valuetext`, чтобы «40%» не читалось дважды.
8
8
  *
9
9
  * Значение зажимается в `0…max`, `setMax()` не принимает неположительный максимум —
10
- * иначе полоса и её озвучка расходились бы.
10
+ * иначе полоса и её озвучка расходились бы. Смена значения идёт движением: заливка догоняет
11
+ * число за время токена `--motion_base`, а при уменьшенном движении значение ставится сразу.
11
12
  */
13
+ const { animate, reducedMotion } = require("../../modules/chui_animations/motion");
12
14
  class ProgressBar {
13
15
  #id = require("randomstring").generate();
14
16
  #ProgressBar = document.createElement(`progress`);
15
17
  #main = document.createElement("progress_block");
16
- #progress_count = document.createElement("progress_count");
17
- #progress_text = document.createElement("progress_text");
18
+ #progressCount = document.createElement("progress_count");
19
+ #progressText = document.createElement("progress_text");
18
20
  #label = undefined;
21
+ // Остановка догоняющих кадров: новое значение отменяет прежнее движение
22
+ #stop = undefined;
19
23
  constructor(options = { max: Number(), label: String() }) {
20
24
  require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_ProgressBar");
21
25
  // Роль дублирует нативную у <progress>, но делает разметку явной для тестов и стендов
22
26
  this.#ProgressBar.setAttribute("role", "progressbar");
23
27
  if (options.max !== undefined) this.setMax(options.max);
24
28
  this.#ProgressBar.id = this.#id;
25
- this.#progress_count.setAttribute("for", this.#id);
26
- this.#progress_text.setAttribute("for", this.#id);
29
+ this.#progressCount.setAttribute("for", this.#id);
30
+ this.#progressText.setAttribute("for", this.#id);
27
31
  // Подписи рядом с полосой — внешний вид: значение объявляет сама полоса
28
- this.#progress_count.setAttribute("aria-hidden", "true");
29
- this.#progress_text.setAttribute("aria-hidden", "true");
32
+ this.#progressCount.setAttribute("aria-hidden", "true");
33
+ this.#progressText.setAttribute("aria-hidden", "true");
30
34
  // Вид подписей полностью в CSS: прежде отступы, ширина и выравнивание
31
35
  // задавались отсюда инлайново и расходились с темой
32
- this.#main.appendChild(this.#progress_count);
36
+ this.#main.appendChild(this.#progressCount);
33
37
  this.#main.appendChild(this.#ProgressBar);
34
- this.#main.appendChild(this.#progress_text);
38
+ this.#main.appendChild(this.#progressText);
35
39
  this.setLabel(options.label);
36
40
  }
37
41
  #clamp(value) {
@@ -68,15 +72,33 @@ class ProgressBar {
68
72
  return this;
69
73
  }
70
74
  setProgressCountText(text = String()) {
71
- this.#progress_count.innerText = text;
75
+ this.#progressCount.innerText = text;
72
76
  return this;
73
77
  }
74
78
  setValue(value = Number()) {
75
- this.#ProgressBar.value = this.#clamp(value);
79
+ this.#animateTo(this.#clamp(value));
76
80
  return this;
77
81
  }
82
+
83
+ /**
84
+ * Смена значения идёт движением: заливка догоняет число, а не перескакивает кадром.
85
+ * Ширину заливки у нативного `progress` задаёт браузер — переходом её не задать,
86
+ * поэтому целевое значение догоняют кадры, а их считает общий движок движения.
87
+ */
88
+ #animateTo(target = Number()) {
89
+ const from = Number(this.#ProgressBar.value);
90
+ this.#stop?.();
91
+ this.#stop = undefined;
92
+ if (from === target || reducedMotion()) {
93
+ this.#ProgressBar.value = target;
94
+ return;
95
+ }
96
+ this.#stop = animate((t) => {
97
+ this.#ProgressBar.value = from + (target - from) * t;
98
+ });
99
+ }
78
100
  setProgressText(text = String()) {
79
- this.#progress_text.innerText = text;
101
+ this.#progressText.innerText = text;
80
102
  // Тот же текст читает скринридер вместо числа: подпись помечена aria-hidden
81
103
  if (text === undefined || text === "") this.#ProgressBar.removeAttribute("aria-valuetext");
82
104
  else this.#ProgressBar.setAttribute("aria-valuetext", String(text));
@@ -1,10 +1,10 @@
1
1
  progress_block {
2
2
  /* Толщина дорожки одной переменной: полоса тоньше 29-пиксельного контрола и
3
3
  читается индикатором, а не плашкой (прежде было 15px — ростом с кнопку) */
4
- --progress_height: 8px;
4
+ --progress_bar_height: 8px;
5
5
  width: max-content;
6
6
  height: max-content;
7
- margin: var(--margin);
7
+ margin: var(--block_margin);
8
8
  font-size: var(--font_labels_size);
9
9
  color: var(--text_color_disabled);
10
10
  /* Подписи стоят по левому краю полосы: центрирование расходилось с полосой */
@@ -16,9 +16,9 @@ progress {
16
16
  display: block;
17
17
  border-radius: var(--radius_pill);
18
18
  text-align: start;
19
- margin: var(--margin) 0;
19
+ margin: var(--block_margin) 0;
20
20
  width: -webkit-fill-available;
21
- height: var(--progress_height);
21
+ height: var(--progress_bar_height);
22
22
  border: none;
23
23
  }
24
24