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