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,8 +1,8 @@
1
- const {setStyles, markdownToHtml, optionOr} = require("../../modules/chui_functions");
2
- const {Icon, Icons} = require("../chui_icons/icons");
3
- const {I18n} = require("../../modules/chui_i18n/chui_i18n");
1
+ const { setStyles, markdownToHtml, optionOr } = require("../../modules/chui_functions");
2
+ const { Icon, Icons } = require("../chui_icons/icons");
3
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
4
4
  // Плашка значка — общая с уведомлениями: одна фигура и одни цвета состояния
5
- const {setStatusPlate} = require("../chui_notification/status_plate");
5
+ const { setStatusPlate } = require("../chui_notification/status_plate");
6
6
 
7
7
  /**
8
8
  * Сообщение в потоке страницы: подсказка, предупреждение или ошибка прямо в разметке, а не
@@ -34,7 +34,7 @@ class Alert {
34
34
  INFO: "alert_info",
35
35
  SUCCESS: "alert_success",
36
36
  WARNING: "alert_warning",
37
- ERROR: "alert_error"
37
+ ERROR: "alert_error",
38
38
  };
39
39
  static #counter = 0;
40
40
 
@@ -50,12 +50,20 @@ class Alert {
50
50
  #dismissed = false;
51
51
  #custom_icon = false;
52
52
 
53
- constructor(options = {
54
- id: String(), title: String(), markdownTitle: String(),
55
- text: String(), markdownText: String(),
56
- style: String(), icon: undefined, dismissible: Boolean(),
57
- actions: [], margin: Object()
58
- }) {
53
+ constructor(
54
+ options = {
55
+ id: String(),
56
+ title: String(),
57
+ markdownTitle: String(),
58
+ text: String(),
59
+ markdownText: String(),
60
+ style: String(),
61
+ icon: undefined,
62
+ dismissible: Boolean(),
63
+ actions: [],
64
+ margin: Object(),
65
+ }
66
+ ) {
59
67
  setStyles(__dirname + "/styles.css", "chUiJS_Alert");
60
68
  Alert.#counter += 1;
61
69
  this.#id = options.id === undefined ? `chui_alert_${Alert.#counter}` : options.id;
@@ -119,7 +127,8 @@ class Alert {
119
127
  this.#root.setAttribute("aria-live", assertive ? "assertive" : "polite");
120
128
  // Цвет и глиф плашки выбирает общий помощник семьи — по ключу стиля (`alert_error` → `error`).
121
129
  // Своя иконка (`setIcon`) важнее статусного глифа и остаётся собой
122
- if (this.#custom_icon === false) setStatusPlate(this.#icon, typeof style === "string" ? style.replace("alert_", "") : undefined);
130
+ if (this.#custom_icon === false)
131
+ setStatusPlate(this.#icon, typeof style === "string" ? style.replace("alert_", "") : undefined);
123
132
  return this;
124
133
  }
125
134
 
@@ -216,7 +225,7 @@ class Alert {
216
225
  }
217
226
 
218
227
  /** Отступы сообщения: {top, bottom, left, right} — как у `Divider.setMargin()` */
219
- setMargin(margin = {top: undefined, bottom: undefined, left: undefined, right: undefined}) {
228
+ setMargin(margin = { top: undefined, bottom: undefined, left: undefined, right: undefined }) {
220
229
  if (margin.top !== undefined) this.#root.style.marginTop = margin.top;
221
230
  if (margin.bottom !== undefined) this.#root.style.marginBottom = margin.bottom;
222
231
  if (margin.left !== undefined) this.#root.style.marginLeft = margin.left;
@@ -238,4 +247,4 @@ class Alert {
238
247
  }
239
248
  }
240
249
 
241
- exports.Alert = Alert
250
+ exports.Alert = Alert;
@@ -1,5 +1,5 @@
1
- const {setStyles} = require('../../modules/chui_functions');
2
- const {I18n} = require('../../modules/chui_i18n/chui_i18n');
1
+ const { setStyles } = require("../../modules/chui_functions");
2
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
3
3
 
4
4
  /**
5
5
  * Аватар: изображение пользователя или его инициалы, при необходимости со значком состояния.
@@ -22,26 +22,26 @@ const {I18n} = require('../../modules/chui_i18n/chui_i18n');
22
22
  class Avatar {
23
23
  static SHAPE = {
24
24
  CIRCLE: "circle",
25
- SQUARE: "square"
25
+ SQUARE: "square",
26
26
  };
27
27
  static SIZE = {
28
28
  SMALL: "28px",
29
29
  DEFAULT: "40px",
30
30
  LARGE: "56px",
31
- BIG: "72px"
31
+ BIG: "72px",
32
32
  };
33
33
  static STATUS = {
34
34
  ONLINE: "online",
35
35
  OFFLINE: "offline",
36
36
  BUSY: "busy",
37
- AWAY: "away"
37
+ AWAY: "away",
38
38
  };
39
39
  static get STATUS_LABEL() {
40
40
  return {
41
41
  online: I18n.t("feedback.statusOnline"),
42
42
  offline: I18n.t("feedback.statusOffline"),
43
43
  busy: I18n.t("feedback.statusBusy"),
44
- away: I18n.t("feedback.statusAway")
44
+ away: I18n.t("feedback.statusAway"),
45
45
  };
46
46
  }
47
47
  static #counter = 0;
@@ -59,18 +59,20 @@ class Avatar {
59
59
  #decorative = false;
60
60
  #click_listeners = [];
61
61
 
62
- constructor(options = {
63
- id: String(),
64
- name: String(),
65
- initials: String(),
66
- image: Object(),
67
- size: String(),
68
- shape: String(),
69
- status: String(),
70
- label: String(),
71
- decorative: Boolean(),
72
- clickListener: undefined
73
- }) {
62
+ constructor(
63
+ options = {
64
+ id: String(),
65
+ name: String(),
66
+ initials: String(),
67
+ image: Object(),
68
+ size: String(),
69
+ shape: String(),
70
+ status: String(),
71
+ label: String(),
72
+ decorative: Boolean(),
73
+ clickListener: undefined,
74
+ }
75
+ ) {
74
76
  setStyles(__dirname + "/styles.css", "chUiJS_Avatar");
75
77
  Avatar.#counter += 1;
76
78
  this.#id = options.id === undefined ? `chui_avatar_${Avatar.#counter}` : options.id;
@@ -255,9 +257,8 @@ class Avatar {
255
257
  }
256
258
  this.#root.removeAttribute("aria-hidden");
257
259
  this.#root.setAttribute("role", "img");
258
- const base = this.#label === undefined
259
- ? (this.#name === undefined ? this.#deriveInitials() : this.#name)
260
- : this.#label;
260
+ const base =
261
+ this.#label === undefined ? (this.#name === undefined ? this.#deriveInitials() : this.#name) : this.#label;
261
262
  const status = this.#status === undefined ? undefined : Avatar.STATUS_LABEL[this.#status];
262
263
  this.#root.setAttribute("aria-label", status === undefined ? base : `${base}, ${status}`);
263
264
  }
@@ -267,4 +268,4 @@ class Avatar {
267
268
  };
268
269
  }
269
270
 
270
- exports.Avatar = Avatar
271
+ exports.Avatar = Avatar;
@@ -1,7 +1,7 @@
1
- const {setStyles, optionOr} = require('../../modules/chui_functions');
2
- const {Avatar} = require('../chui_avatar/avatar');
3
- const {I18n} = require('../../modules/chui_i18n/chui_i18n');
4
- const {makeKeyboardButton} = require('../../modules/chui_a11y/chui_a11y');
1
+ const { setStyles, optionOr } = require("../../modules/chui_functions");
2
+ const { Avatar } = require("../chui_avatar/avatar");
3
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
4
+ const { makeKeyboardButton } = require("../../modules/chui_a11y/chui_a11y");
5
5
 
6
6
  /**
7
7
  * Группа аватаров: несколько участников в ряд с нахлёстом и счётчиком скрытых.
@@ -48,15 +48,17 @@ class AvatarGroup {
48
48
  #extra_listener = undefined;
49
49
  #label = undefined;
50
50
 
51
- constructor(options = {
52
- id: String(),
53
- avatars: [],
54
- max: Number(),
55
- size: String(),
56
- shape: String(),
57
- label: String(),
58
- extraClickListener: undefined
59
- }) {
51
+ constructor(
52
+ options = {
53
+ id: String(),
54
+ avatars: [],
55
+ max: Number(),
56
+ size: String(),
57
+ shape: String(),
58
+ label: String(),
59
+ extraClickListener: undefined,
60
+ }
61
+ ) {
60
62
  setStyles(__dirname + "/styles.css", "chUiJS_AvatarGroup");
61
63
  AvatarGroup.#counter += 1;
62
64
  this.#id = optionOr(options.id, `chui_avatar_group_${AvatarGroup.#counter}`);
@@ -187,13 +189,13 @@ class AvatarGroup {
187
189
  #push(item = undefined) {
188
190
  if (item === undefined || item === null) return;
189
191
  if (item instanceof Element) {
190
- this.#entries.push({node: item, avatar: undefined});
192
+ this.#entries.push({ node: item, avatar: undefined });
191
193
  return;
192
194
  }
193
195
  const avatar = item instanceof Avatar ? item : new Avatar(item);
194
196
  if (this.#size !== undefined) avatar.setSize(this.#size);
195
197
  if (this.#shape !== undefined) avatar.setShape(this.#shape);
196
- this.#entries.push({node: avatar.set(), avatar: avatar});
198
+ this.#entries.push({ node: avatar.set(), avatar: avatar });
197
199
  }
198
200
 
199
201
  #sync() {
@@ -215,11 +217,11 @@ class AvatarGroup {
215
217
  extra.innerText = `+${hidden}`;
216
218
  if (this.#extra_listener === undefined) {
217
219
  extra.setAttribute("role", "img");
218
- extra.setAttribute("aria-label", I18n.t("feedback.avatarGroupMore", {count: hidden}));
220
+ extra.setAttribute("aria-label", I18n.t("feedback.avatarGroupMore", { count: hidden }));
219
221
  } else {
220
222
  // Кнопка: Enter/Space посылает click, поэтому обработчик один
221
223
  extra.classList.add("avatar_group_extra_button");
222
- extra.setAttribute("aria-label", I18n.t("feedback.avatarGroupShowAll", {count: hidden}));
224
+ extra.setAttribute("aria-label", I18n.t("feedback.avatarGroupShowAll", { count: hidden }));
223
225
  makeKeyboardButton(extra);
224
226
  extra.addEventListener("click", (event) => this.#extra_listener(event, hidden, this));
225
227
  }
@@ -228,9 +230,9 @@ class AvatarGroup {
228
230
  }
229
231
 
230
232
  #syncAria() {
231
- const name = optionOr(this.#label, I18n.t("feedback.avatarGroupCount", {count: this.#entries.length}));
233
+ const name = optionOr(this.#label, I18n.t("feedback.avatarGroupCount", { count: this.#entries.length }));
232
234
  this.#root.setAttribute("aria-label", name);
233
235
  }
234
236
  }
235
237
 
236
- exports.AvatarGroup = AvatarGroup
238
+ exports.AvatarGroup = AvatarGroup;
@@ -1,6 +1,6 @@
1
- const {setStyles, optionOr, scrollParent} = require('../../modules/chui_functions');
2
- const {Icon, Icons} = require('../chui_icons/icons');
3
- const {I18n} = require('../../modules/chui_i18n/chui_i18n');
1
+ const { setStyles, optionOr, scrollParent } = require("../../modules/chui_functions");
2
+ const { Icon, Icons } = require("../chui_icons/icons");
3
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
4
4
 
5
5
  /**
6
6
  * Кнопка «наверх»: появляется, когда контейнер прокручен дальше порога, и возвращает его к началу.
@@ -32,7 +32,7 @@ const {I18n} = require('../../modules/chui_i18n/chui_i18n');
32
32
  class Backtop {
33
33
  static POSITION = {
34
34
  FIXED: "fixed",
35
- STICKY: "sticky"
35
+ STICKY: "sticky",
36
36
  };
37
37
  static #counter = 0;
38
38
  static #DEFAULT_THRESHOLD = 200;
@@ -50,11 +50,19 @@ class Backtop {
50
50
  #visible = false;
51
51
  #destroyed = false;
52
52
 
53
- constructor(options = {
54
- id: String(), target: undefined, threshold: Number(),
55
- position: String(), bottom: String(), inlineEnd: String(),
56
- title: String(), icon: undefined, smooth: Boolean()
57
- }) {
53
+ constructor(
54
+ options = {
55
+ id: String(),
56
+ target: undefined,
57
+ threshold: Number(),
58
+ position: String(),
59
+ bottom: String(),
60
+ inlineEnd: String(),
61
+ title: String(),
62
+ icon: undefined,
63
+ smooth: Boolean(),
64
+ }
65
+ ) {
58
66
  setStyles(__dirname + "/styles.css", "chUiJS_Backtop");
59
67
  Backtop.#counter += 1;
60
68
  this.#id = optionOr(options.id, `chui_backtop_${Backtop.#counter}`);
@@ -74,7 +82,7 @@ class Backtop {
74
82
  this.setTitle(options.title);
75
83
  this.setIcon(options.icon);
76
84
  this.setSmooth(options.smooth !== false);
77
- window.addEventListener("scroll", this.#onScroll, {capture: true, passive: true});
85
+ window.addEventListener("scroll", this.#onScroll, { capture: true, passive: true });
78
86
  }
79
87
 
80
88
  // GET
@@ -150,9 +158,14 @@ class Backtop {
150
158
 
151
159
  /** Свой значок (имя из `Icons`, `Icon`, узел или компонент); `undefined` — стрелка вверх */
152
160
  setIcon(icon = undefined) {
153
- const node = icon === undefined || icon === null || icon === ""
154
- ? new Icon(Icons.NAVIGATION.ARROW_UPWARD, "18px").set()
155
- : (typeof icon === "string" ? new Icon(icon, "18px").set() : (typeof icon.set === "function" ? icon.set() : icon));
161
+ const node =
162
+ icon === undefined || icon === null || icon === ""
163
+ ? new Icon(Icons.NAVIGATION.ARROW_UPWARD, "18px").set()
164
+ : typeof icon === "string"
165
+ ? new Icon(icon, "18px").set()
166
+ : typeof icon.set === "function"
167
+ ? icon.set()
168
+ : icon;
156
169
  this.#icon.innerHTML = "";
157
170
  this.#icon.appendChild(node);
158
171
  return this;
@@ -175,8 +188,8 @@ class Backtop {
175
188
  const container = this.#resolveTarget();
176
189
  if (container === undefined) return this;
177
190
  const behavior = this.#smooth && Backtop.#reducedMotion() === false ? "smooth" : "auto";
178
- if (container === document.scrollingElement) window.scrollTo({top: 0, behavior: behavior});
179
- else container.scrollTo({top: 0, behavior: behavior});
191
+ if (container === document.scrollingElement) window.scrollTo({ top: 0, behavior: behavior });
192
+ else container.scrollTo({ top: 0, behavior: behavior });
180
193
  return this;
181
194
  }
182
195
 
@@ -184,7 +197,7 @@ class Backtop {
184
197
  destroy() {
185
198
  if (this.#destroyed) return this;
186
199
  this.#destroyed = true;
187
- window.removeEventListener("scroll", this.#onScroll, {capture: true});
200
+ window.removeEventListener("scroll", this.#onScroll, { capture: true });
188
201
  this.#root.remove();
189
202
  return this;
190
203
  }
@@ -196,8 +209,11 @@ class Backtop {
196
209
 
197
210
  // === ВНУТРЕННЕЕ ===
198
211
  static #reducedMotion() {
199
- return typeof window !== "undefined" && typeof window.matchMedia === "function" &&
200
- window.matchMedia("(prefers-reduced-motion: reduce)").matches;
212
+ return (
213
+ typeof window !== "undefined" &&
214
+ typeof window.matchMedia === "function" &&
215
+ window.matchMedia("(prefers-reduced-motion: reduce)").matches
216
+ );
201
217
  }
202
218
 
203
219
  /** Контейнер прокрутки: свой `target`, иначе ближайший прокручиваемый предок кнопки */
@@ -227,4 +243,4 @@ class Backtop {
227
243
  }
228
244
  }
229
245
 
230
- exports.Backtop = Backtop
246
+ exports.Backtop = Backtop;
@@ -1,14 +1,16 @@
1
- const {setStyles, markdownToHtml, htmlToMarkdown, optionOr} = require("../../modules/chui_functions");
1
+ const { setStyles, markdownToHtml, htmlToMarkdown, optionOr } = require("../../modules/chui_functions");
2
2
 
3
3
  class Badge {
4
4
  #chui_badge = document.createElement(`chui_badge`);
5
- constructor(options = {
6
- id: String(),
7
- text: String(),
8
- markdownText: String(),
9
- style: undefined
10
- }) {
11
- setStyles(__dirname + "/styles.css", 'chUiJS_Badge');
5
+ constructor(
6
+ options = {
7
+ id: String(),
8
+ text: String(),
9
+ markdownText: String(),
10
+ style: undefined,
11
+ }
12
+ ) {
13
+ setStyles(__dirname + "/styles.css", "chUiJS_Badge");
12
14
  if (options.id !== undefined) this.#chui_badge.id = options.id;
13
15
  const style = optionOr(options.style, undefined);
14
16
  if (style !== undefined) this.#chui_badge.classList.add(style);
@@ -52,10 +54,10 @@ class Badge {
52
54
  return this.#chui_badge;
53
55
  }
54
56
  static STYLE = {
55
- ERROR: 'badge_error',
56
- SUCCESS: 'badge_success',
57
- WARNING: 'badge_warning'
58
- }
57
+ ERROR: "badge_error",
58
+ SUCCESS: "badge_success",
59
+ WARNING: "badge_warning",
60
+ };
59
61
  }
60
62
 
61
- exports.Badge = Badge
63
+ exports.Badge = Badge;
@@ -1,7 +1,7 @@
1
- const {setStyles, optionOr} = require("../../modules/chui_functions");
2
- const {Icon, Icons} = require("../chui_icons/icons");
3
- const {Link} = require("../chui_link/link");
4
- const {I18n} = require("../../modules/chui_i18n/chui_i18n");
1
+ const { setStyles, optionOr } = require("../../modules/chui_functions");
2
+ const { Icon, Icons } = require("../chui_icons/icons");
3
+ const { Link } = require("../chui_link/link");
4
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
5
5
 
6
6
  /**
7
7
  * Навигационная цепочка: путь от корня к текущему месту с переходом по звеньям.
@@ -25,7 +25,7 @@ const {I18n} = require("../../modules/chui_i18n/chui_i18n");
25
25
  class Breadcrumb {
26
26
  static SIZE = {
27
27
  SMALL: "small",
28
- DEFAULT: "default"
28
+ DEFAULT: "default",
29
29
  };
30
30
  static #counter = 0;
31
31
 
@@ -34,12 +34,14 @@ class Breadcrumb {
34
34
  #items = [];
35
35
  #id = undefined;
36
36
 
37
- constructor(options = {
38
- id: String(),
39
- items: [],
40
- size: String(),
41
- label: String()
42
- }) {
37
+ constructor(
38
+ options = {
39
+ id: String(),
40
+ items: [],
41
+ size: String(),
42
+ label: String(),
43
+ }
44
+ ) {
43
45
  setStyles(__dirname + "/styles.css", "chUiJS_Breadcrumb");
44
46
  Breadcrumb.#counter += 1;
45
47
  this.#id = options.id === undefined ? `chui_breadcrumb_${Breadcrumb.#counter}` : options.id;
@@ -121,7 +123,7 @@ class Breadcrumb {
121
123
  node.appendChild(text);
122
124
  return node;
123
125
  }
124
- const link = new Link({text: item.title, href: item.href, clickEvent: item.clickEvent, icon: item.icon});
126
+ const link = new Link({ text: item.title, href: item.href, clickEvent: item.clickEvent, icon: item.icon });
125
127
  node.appendChild(link.set());
126
128
  return node;
127
129
  }
@@ -140,4 +142,4 @@ class Breadcrumb {
140
142
  static ICON_SIZE = "14px";
141
143
  }
142
144
 
143
- exports.Breadcrumb = Breadcrumb
145
+ exports.Breadcrumb = Breadcrumb;
@@ -1,21 +1,31 @@
1
- const {Icon} = require("../chui_icons/icons");
1
+ const { Icon } = require("../chui_icons/icons");
2
2
 
3
3
  class Button {
4
- #chui_button = document.createElement('chui_button');
5
- #button = document.createElement('button');
6
- #button_text = document.createElement('button_text');
7
- #button_icon = document.createElement('button_icon');
4
+ #chui_button = document.createElement("chui_button");
5
+ #button = document.createElement("button");
6
+ #button_text = document.createElement("button_text");
7
+ #button_icon = document.createElement("button_icon");
8
8
  #label_text = undefined;
9
- constructor(options = { reverse: Boolean(), title: String(), icon: undefined, label: String(), disabled: Boolean(), clickEvent: () => {} }) {
10
- require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", "chUiJS_Button")
9
+ constructor(
10
+ options = {
11
+ reverse: Boolean(),
12
+ title: String(),
13
+ icon: undefined,
14
+ label: String(),
15
+ disabled: Boolean(),
16
+ clickEvent: () => {},
17
+ }
18
+ ) {
19
+ require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_Button");
11
20
 
12
- this.#button.className = "chui_button"
13
- this.#button_text.className = "chui_button_text"
21
+ this.#button.className = "chui_button";
22
+ this.#button_text.className = "chui_button_text";
14
23
  // Иконка декоративна: иначе её глиф-имя («print», «delete»…) попадает в имя кнопки
15
24
  this.#button_icon.setAttribute("aria-hidden", "true");
16
25
 
17
26
  if (options.title !== undefined) this.#button_text.innerText = options.title;
18
- if (options.icon !== undefined) this.#button_icon.innerHTML = new Icon(options.icon, "var(--header_icon_size)").getHTML();
27
+ if (options.icon !== undefined)
28
+ this.#button_icon.innerHTML = new Icon(options.icon, "var(--header_icon_size)").getHTML();
19
29
 
20
30
  if (options.title !== undefined && options.icon === undefined) {
21
31
  this.#button.appendChild(this.#button_text);
@@ -35,28 +45,33 @@ class Button {
35
45
  }
36
46
  }
37
47
 
38
- if (options.clickEvent !== undefined) this.#button.addEventListener('click', options.clickEvent);
48
+ if (options.clickEvent !== undefined) this.#button.addEventListener("click", options.clickEvent);
39
49
  this.#button.addEventListener("mousedown", () => {
40
- return false
41
- })
42
- this.#chui_button.appendChild(this.#button)
50
+ return false;
51
+ });
52
+ this.#chui_button.appendChild(this.#button);
43
53
  // Доступное имя кнопки без надписи: значок декоративен (`aria-hidden`) и имени не даёт,
44
54
  // поэтому кнопка только со значком оставалась бы без имени
45
55
  if (options.label !== undefined) this.setLabel(options.label);
46
56
  // `disabled` в опциях — то же, что setDisabled(true): без этого опция молча терялась
47
57
  if (options.disabled === true) this.setDisabled(true);
48
58
  }
49
- getText() { return this.#button_text.innerText; }
59
+ getText() {
60
+ return this.#button_text.innerText;
61
+ }
50
62
  /** Новый текст. Пишем в `button_text`, а не в саму кнопку: запись в кнопку целиком
51
63
  * затирала бы и значок, и его разметку (`aria-hidden`), а `getText()` читал бы старый узел */
52
64
  setText(text = String()) {
53
65
  this.#button_text.innerText = text;
54
66
  // Пустой узел в разметку не дописываем: кнопке только со значком он ничего не даёт
55
- if (String(text) !== "" && !this.#button.contains(this.#button_text)) this.#button.appendChild(this.#button_text);
67
+ if (String(text) !== "" && !this.#button.contains(this.#button_text))
68
+ this.#button.appendChild(this.#button_text);
56
69
  this.#syncLabel();
57
70
  return this;
58
71
  }
59
- getLabel() { return this.#label_text; }
72
+ getLabel() {
73
+ return this.#label_text;
74
+ }
60
75
  /** Доступное имя кнопки без видимой надписи; `undefined` его убирает.
61
76
  * Пока надпись есть, имя даёт она сама — `aria-label` тогда не ставится и не подменяет её */
62
77
  setLabel(label = undefined) {
@@ -67,14 +82,19 @@ class Button {
67
82
  /** Имя кнопки: из видимой надписи, а если её нет — из `label` */
68
83
  #syncLabel() {
69
84
  const hasText = this.#button.contains(this.#button_text) && this.#button_text.innerText.trim() !== "";
70
- if (hasText || this.#label_text === undefined || this.#label_text === "") this.#button.removeAttribute("aria-label");
85
+ if (hasText || this.#label_text === undefined || this.#label_text === "")
86
+ this.#button.removeAttribute("aria-label");
71
87
  else this.#button.setAttribute("aria-label", String(this.#label_text));
72
88
  }
73
- addClickListener(listener = () => {}) { this.#button.addEventListener('click', listener); }
89
+ addClickListener(listener = () => {}) {
90
+ this.#button.addEventListener("click", listener);
91
+ }
74
92
  setDisabled(boolean = Boolean()) {
75
- this.#button.disabled = boolean
93
+ this.#button.disabled = boolean;
94
+ }
95
+ set() {
96
+ return this.#chui_button;
76
97
  }
77
- set() { return this.#chui_button; }
78
98
  }
79
99
 
80
- exports.Button = Button
100
+ exports.Button = Button;
@@ -45,7 +45,7 @@ chui_button {
45
45
  background: var(--blue_prime_background);
46
46
  border-color: var(--button_border_color_hover);
47
47
  /* Лёгкая усадка: нажатие читается даже тогда, когда заливка уже акцентная */
48
- transform: scale(.97);
48
+ transform: scale(0.97);
49
49
  }
50
50
 
51
51
  .chui_button_text {
@@ -97,4 +97,4 @@ chui_button {
97
97
 
98
98
  .chui_button:disabled:hover button_icon chui_icon {
99
99
  color: var(--text_color_disabled);
100
- }
100
+ }
@@ -1,4 +1,4 @@
1
- const {I18n} = require("../../modules/chui_i18n/chui_i18n");
1
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
2
2
 
3
3
  class Calendar {
4
4
  constructor(year, month) {
@@ -11,14 +11,16 @@ class Calendar {
11
11
  new Array(7),
12
12
  new Array(7),
13
13
  new Array(7),
14
- new Array(7)
14
+ new Array(7),
15
15
  ];
16
16
 
17
17
  // Названия дней недели берёт локаль текущего языка (воскресенье — 0):
18
18
  // семь подряд идущих дней месяца покрывают все дни недели
19
19
  for (let day = 0; day < 7; day++) {
20
20
  const sample = new Date(this.year, this.month, day + 1);
21
- this.calendar[0][sample.getDay()] = sample.toLocaleString(I18n.getLocale(), { weekday: 'short' }).toUpperCase();
21
+ this.calendar[0][sample.getDay()] = sample
22
+ .toLocaleString(I18n.getLocale(), { weekday: "short" })
23
+ .toUpperCase();
22
24
  }
23
25
 
24
26
  this.list = [];
@@ -37,11 +39,11 @@ class Calendar {
37
39
  while (this.date.getMonth() === this.month) {
38
40
  let dayToPush = this.date;
39
41
  let days = [];
40
- days.push(dayToPush.toLocaleString(I18n.getLocale(), {day: 'numeric'}));
41
- days.push(dayToPush.toLocaleString(I18n.getLocale(), {weekday: 'short'}).toUpperCase());
42
- days.push(dayToPush.toLocaleString(I18n.getLocale(), {month: 'long'}).toUpperCase());
42
+ days.push(dayToPush.toLocaleString(I18n.getLocale(), { day: "numeric" }));
43
+ days.push(dayToPush.toLocaleString(I18n.getLocale(), { weekday: "short" }).toUpperCase());
44
+ days.push(dayToPush.toLocaleString(I18n.getLocale(), { month: "long" }).toUpperCase());
43
45
  this.date.setDate(this.date.getDate() + 1);
44
- this.list.push(days)
46
+ this.list.push(days);
45
47
  }
46
48
  let index = 1;
47
49
  for (let day of this.list) {
@@ -60,10 +62,10 @@ class Calendar {
60
62
  return new Date();
61
63
  }
62
64
  getMonthName() {
63
- return new Date(this.year, this.month).toLocaleString(I18n.getLocale(), {month: 'long'}).toUpperCase();
65
+ return new Date(this.year, this.month).toLocaleString(I18n.getLocale(), { month: "long" }).toUpperCase();
64
66
  }
65
67
  getDayName() {
66
- return new Date(this.year, this.month).toLocaleString(I18n.getLocale(), { weekday: 'long' }).toUpperCase();
68
+ return new Date(this.year, this.month).toLocaleString(I18n.getLocale(), { weekday: "long" }).toUpperCase();
67
69
  }
68
70
  getDate() {
69
71
  return new Date(this.year, this.month).getDate();
@@ -79,4 +81,4 @@ class Calendar {
79
81
  }
80
82
  }
81
83
 
82
- exports.Calendar = Calendar
84
+ exports.Calendar = Calendar;