chuijs 4.0.2 → 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 (292) hide show
  1. package/CHANGELOG.md +597 -0
  2. package/README.md +43 -644
  3. package/framework/appLayout/default/chui_app_layout.js +602 -496
  4. package/framework/appLayout/default/global_style.css +288 -97
  5. package/framework/appLayout/default/main_theme_style.css +188 -101
  6. package/framework/components/chui_accordion/accordion.js +38 -35
  7. package/framework/components/chui_accordion/styles.css +13 -12
  8. package/framework/components/chui_action_sheet/action_sheet.js +93 -64
  9. package/framework/components/chui_action_sheet/styles.css +12 -5
  10. package/framework/components/chui_actions_bar/actions_bar.js +338 -0
  11. package/framework/components/chui_actions_bar/styles.css +139 -0
  12. package/framework/components/chui_affix/affix.js +16 -11
  13. package/framework/components/chui_affix/styles.css +5 -0
  14. package/framework/components/chui_alert/alert.js +34 -19
  15. package/framework/components/chui_alert/styles.css +7 -0
  16. package/framework/components/chui_avatar/avatar.js +36 -35
  17. package/framework/components/chui_avatar/styles.css +1 -1
  18. package/framework/components/chui_avatar_group/avatar_group.js +25 -23
  19. package/framework/components/chui_avatar_group/styles.css +1 -1
  20. package/framework/components/chui_backtop/backtop.js +60 -21
  21. package/framework/components/chui_backtop/styles.css +21 -0
  22. package/framework/components/chui_badge/badge.js +30 -28
  23. package/framework/components/chui_badge/styles.css +6 -6
  24. package/framework/components/chui_banner/banner.js +222 -0
  25. package/framework/components/chui_banner/styles.css +170 -0
  26. package/framework/components/chui_breadcrumb/breadcrumb.js +15 -13
  27. package/framework/components/chui_breadcrumb/styles.css +1 -1
  28. package/framework/components/chui_button/button.js +52 -36
  29. package/framework/components/chui_button/styles.css +7 -7
  30. package/framework/components/chui_calendar/calendar.js +18 -16
  31. package/framework/components/chui_card/card.js +52 -32
  32. package/framework/components/chui_card_scroll/card_scroll.js +169 -0
  33. package/framework/components/chui_card_scroll/styles.css +86 -0
  34. package/framework/components/chui_chat/chat.js +140 -79
  35. package/framework/components/chui_chat/styles.css +18 -7
  36. package/framework/components/chui_clipboard_history/clipboard_history.js +53 -39
  37. package/framework/components/chui_clipboard_history/styles.css +13 -9
  38. package/framework/components/chui_code/code.js +10 -10
  39. package/framework/components/chui_code/styles.css +4 -4
  40. package/framework/components/chui_code_editor/code_editor.js +73 -57
  41. package/framework/components/chui_code_editor/styles.css +6 -5
  42. package/framework/components/chui_command_palette/command_palette.js +87 -64
  43. package/framework/components/chui_command_palette/styles.css +5 -5
  44. package/framework/components/chui_console/console.js +13 -13
  45. package/framework/components/chui_console/styles.css +6 -3
  46. package/framework/components/chui_content_block/content_block.js +35 -21
  47. package/framework/components/chui_content_block/styles.css +2 -2
  48. package/framework/components/chui_context_menu/context_menu.js +171 -58
  49. package/framework/components/chui_context_menu/styles.css +82 -8
  50. package/framework/components/chui_custom_element/custom_element.js +25 -18
  51. package/framework/components/chui_data_grid/data_grid.js +633 -471
  52. package/framework/components/chui_data_grid/styles.css +24 -22
  53. package/framework/components/chui_descriptions/descriptions.js +34 -17
  54. package/framework/components/chui_descriptions/styles.css +1 -1
  55. package/framework/components/chui_details/details.js +42 -36
  56. package/framework/components/chui_details/styles.css +12 -11
  57. package/framework/components/chui_diff_viewer/diff_viewer.js +172 -147
  58. package/framework/components/chui_diff_viewer/styles.css +10 -10
  59. package/framework/components/chui_divider/divider.js +19 -17
  60. package/framework/components/chui_divider/styles.css +2 -2
  61. package/framework/components/chui_drawer/drawer.js +63 -38
  62. package/framework/components/chui_drawer/styles.css +18 -4
  63. package/framework/components/chui_drop_zone/drop_zone.js +37 -27
  64. package/framework/components/chui_drop_zone/styles.css +10 -6
  65. package/framework/components/chui_empty_state/empty_state.js +20 -15
  66. package/framework/components/chui_fieldset/fieldset.js +40 -23
  67. package/framework/components/chui_fieldset/styles.css +6 -6
  68. package/framework/components/chui_file_explorer/file_explorer.js +260 -189
  69. package/framework/components/chui_file_explorer/styles.css +8 -7
  70. package/framework/components/chui_form/form.js +40 -28
  71. package/framework/components/chui_form/styles.css +1 -1
  72. package/framework/components/chui_gantt/gantt.js +102 -78
  73. package/framework/components/chui_gantt/styles.css +5 -5
  74. package/framework/components/chui_graphs/graphs.js +376 -239
  75. package/framework/components/chui_graphs/styles.css +27 -6
  76. package/framework/components/chui_hero/hero.js +98 -37
  77. package/framework/components/chui_hero/styles.css +176 -7
  78. package/framework/components/chui_html_block/html_block.js +8 -8
  79. package/framework/components/chui_html_block/styles.css +3 -3
  80. package/framework/components/chui_hx/hx.js +3 -3
  81. package/framework/components/chui_hx/styles.css +13 -6
  82. package/framework/components/chui_icons/icons.js +2115 -2115
  83. package/framework/components/chui_icons/styles.css +4 -3
  84. package/framework/components/chui_inputs/chui_check_box/check_box.js +31 -19
  85. package/framework/components/chui_inputs/chui_check_box/styles.css +30 -21
  86. package/framework/components/chui_inputs/chui_chips/chips.js +141 -70
  87. package/framework/components/chui_inputs/chui_chips/styles.css +32 -7
  88. package/framework/components/chui_inputs/chui_color_picker/color_picker.js +55 -38
  89. package/framework/components/chui_inputs/chui_color_picker/styles.css +7 -7
  90. package/framework/components/chui_inputs/chui_combo_box/combo_box.js +127 -109
  91. package/framework/components/chui_inputs/chui_combo_box/styles.css +23 -21
  92. package/framework/components/chui_inputs/chui_date/date.js +161 -127
  93. package/framework/components/chui_inputs/chui_date/styles.css +20 -19
  94. package/framework/components/chui_inputs/chui_date_range/date_range.js +61 -50
  95. package/framework/components/chui_inputs/chui_date_range/styles.css +3 -3
  96. package/framework/components/chui_inputs/chui_datetime/datetime.js +47 -39
  97. package/framework/components/chui_inputs/chui_datetime/styles.css +3 -3
  98. package/framework/components/chui_inputs/chui_email/email.js +48 -36
  99. package/framework/components/chui_inputs/chui_email/styles.css +11 -11
  100. package/framework/components/chui_inputs/chui_file/file.js +71 -44
  101. package/framework/components/chui_inputs/chui_file/styles.css +23 -19
  102. package/framework/components/chui_inputs/chui_hotkey/hotkey.js +101 -76
  103. package/framework/components/chui_inputs/chui_hotkey/styles.css +6 -6
  104. package/framework/components/chui_inputs/chui_masked/masked.js +83 -72
  105. package/framework/components/chui_inputs/chui_masked/styles.css +5 -5
  106. package/framework/components/chui_inputs/chui_mention/mention.js +87 -40
  107. package/framework/components/chui_inputs/chui_mention/styles.css +14 -8
  108. package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +242 -212
  109. package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +23 -15
  110. package/framework/components/chui_inputs/chui_number/number.js +84 -70
  111. package/framework/components/chui_inputs/chui_number/styles.css +13 -13
  112. package/framework/components/chui_inputs/chui_otp/otp.js +71 -62
  113. package/framework/components/chui_inputs/chui_otp/styles.css +5 -5
  114. package/framework/components/chui_inputs/chui_password/password.js +72 -56
  115. package/framework/components/chui_inputs/chui_password/styles.css +15 -15
  116. package/framework/components/chui_inputs/chui_radio_button/radio_button.js +37 -25
  117. package/framework/components/chui_inputs/chui_radio_button/styles.css +22 -22
  118. package/framework/components/chui_inputs/chui_rating/rating.js +54 -50
  119. package/framework/components/chui_inputs/chui_rating/styles.css +3 -3
  120. package/framework/components/chui_inputs/chui_select_box/select_box.js +132 -108
  121. package/framework/components/chui_inputs/chui_select_box/styles.css +21 -21
  122. package/framework/components/chui_inputs/chui_slider/slider.js +41 -38
  123. package/framework/components/chui_inputs/chui_slider/styles.css +7 -5
  124. package/framework/components/chui_inputs/chui_text/styles.css +14 -14
  125. package/framework/components/chui_inputs/chui_text/text.js +69 -52
  126. package/framework/components/chui_inputs/chui_text_area/styles.css +14 -14
  127. package/framework/components/chui_inputs/chui_text_area/text_area.js +59 -36
  128. package/framework/components/chui_inputs/chui_time/styles.css +18 -20
  129. package/framework/components/chui_inputs/chui_time/time.js +71 -49
  130. package/framework/components/chui_inputs/chui_toggle/styles.css +13 -6
  131. package/framework/components/chui_inputs/chui_toggle/toggle.js +27 -27
  132. package/framework/components/chui_json_editor/json_editor.js +137 -127
  133. package/framework/components/chui_json_editor/styles.css +5 -5
  134. package/framework/components/chui_json_viewer/json_viewer.js +133 -114
  135. package/framework/components/chui_json_viewer/styles.css +9 -8
  136. package/framework/components/chui_kanban/kanban.js +78 -60
  137. package/framework/components/chui_kanban/styles.css +8 -4
  138. package/framework/components/chui_kbd/kbd.js +12 -10
  139. package/framework/components/chui_kbd/styles.css +1 -1
  140. package/framework/components/chui_label/label.js +31 -29
  141. package/framework/components/chui_label/styles.css +3 -3
  142. package/framework/components/chui_link/link.js +36 -29
  143. package/framework/components/chui_link/styles.css +11 -4
  144. package/framework/components/chui_list/list.js +42 -38
  145. package/framework/components/chui_list/styles.css +4 -3
  146. package/framework/components/chui_markdown_editor/markdown_editor.js +125 -109
  147. package/framework/components/chui_markdown_editor/styles.css +5 -5
  148. package/framework/components/chui_media/audio.js +457 -364
  149. package/framework/components/chui_media/audio_styles.css +74 -37
  150. package/framework/components/chui_media/image.js +99 -64
  151. package/framework/components/chui_media/image_compare.js +86 -55
  152. package/framework/components/chui_media/image_compare_styles.css +5 -5
  153. package/framework/components/chui_media/image_styles.css +4 -4
  154. package/framework/components/chui_media/video.js +264 -171
  155. package/framework/components/chui_media/video_styles.css +57 -24
  156. package/framework/components/chui_menu_bar/menu_bar.js +67 -65
  157. package/framework/components/chui_menu_bar/styles.css +14 -12
  158. package/framework/components/chui_message_bar/message_bar.js +551 -0
  159. package/framework/components/chui_message_bar/styles.css +248 -0
  160. package/framework/components/chui_modal/modal.js +81 -56
  161. package/framework/components/chui_modal/styles.css +3 -2
  162. package/framework/components/chui_notification/notification.js +107 -69
  163. package/framework/components/chui_notification/notification_download.js +28 -77
  164. package/framework/components/chui_notification/notification_download_card.js +115 -0
  165. package/framework/components/chui_notification/notification_download_progress.css +5 -4
  166. package/framework/components/chui_notification/notification_download_progress.js +73 -105
  167. package/framework/components/chui_notification/notification_update.js +44 -37
  168. package/framework/components/chui_notification/status_plate.css +3 -3
  169. package/framework/components/chui_notification/status_plate.js +2 -2
  170. package/framework/components/chui_notification/styles.css +6 -1
  171. package/framework/components/chui_notification/styles_download.css +2 -2
  172. package/framework/components/chui_notification/styles_update.css +3 -3
  173. package/framework/components/chui_org_chart/org_chart.js +101 -62
  174. package/framework/components/chui_org_chart/styles.css +2 -2
  175. package/framework/components/chui_pagination/pagination.js +65 -30
  176. package/framework/components/chui_pagination/styles.css +1 -1
  177. package/framework/components/chui_paragraph/paragraph.js +2 -2
  178. package/framework/components/chui_paragraph/styles.css +3 -3
  179. package/framework/components/chui_popover/popover.js +77 -50
  180. package/framework/components/chui_popover/styles.css +1 -1
  181. package/framework/components/chui_popups/popups.js +210 -181
  182. package/framework/components/chui_popups/styles.css +7 -7
  183. package/framework/components/chui_print_button/print_button.js +48 -33
  184. package/framework/components/chui_progress_bar/progress_bar.js +49 -19
  185. package/framework/components/chui_progress_bar/styles.css +6 -6
  186. package/framework/components/chui_progress_ring/progress_ring.js +32 -30
  187. package/framework/components/chui_progress_ring/styles.css +1 -1
  188. package/framework/components/chui_qrcode/qrcode.js +85 -41
  189. package/framework/components/chui_query_builder/query_builder.js +263 -170
  190. package/framework/components/chui_query_builder/styles.css +4 -4
  191. package/framework/components/chui_radio_group/radio_group.js +36 -26
  192. package/framework/components/chui_radio_group/styles.css +2 -2
  193. package/framework/components/chui_result/result.js +41 -31
  194. package/framework/components/chui_result/styles.css +3 -3
  195. package/framework/components/chui_scheduler/scheduler.js +126 -104
  196. package/framework/components/chui_scheduler/styles.css +11 -7
  197. package/framework/components/chui_screen_spinner/screen_spinner.js +167 -0
  198. package/framework/components/chui_screen_spinner/styles.css +49 -0
  199. package/framework/components/chui_segmented_control/segmented_control.js +90 -27
  200. package/framework/components/chui_segmented_control/styles.css +32 -6
  201. package/framework/components/chui_settings/settings.js +160 -87
  202. package/framework/components/chui_settings/styles.css +4 -4
  203. package/framework/components/chui_shortcut_help/shortcut_help.js +82 -61
  204. package/framework/components/chui_sidebar_nav/sidebar_nav.js +132 -53
  205. package/framework/components/chui_sidebar_nav/styles.css +9 -3
  206. package/framework/components/chui_skeleton/skeleton.js +29 -24
  207. package/framework/components/chui_slideshow/slideshow.js +122 -103
  208. package/framework/components/chui_slideshow/styles.css +22 -16
  209. package/framework/components/chui_spinner/spinner.js +17 -17
  210. package/framework/components/chui_spinner/styles.css +0 -1
  211. package/framework/components/chui_split_button/split_button.js +53 -30
  212. package/framework/components/chui_split_button/styles.css +22 -6
  213. package/framework/components/chui_splitter/splitter.js +46 -39
  214. package/framework/components/chui_splitter/styles.css +2 -2
  215. package/framework/components/chui_statistic/statistic.js +111 -84
  216. package/framework/components/chui_status_bar/status_bar.js +11 -9
  217. package/framework/components/chui_status_bar/styles.css +2 -2
  218. package/framework/components/chui_stepper/stepper.js +230 -54
  219. package/framework/components/chui_stepper/styles.css +79 -14
  220. package/framework/components/chui_sticky_bar/sticky_bar.js +53 -17
  221. package/framework/components/chui_sticky_bar/styles.css +11 -7
  222. package/framework/components/chui_tabs/chui_tabs.js +100 -46
  223. package/framework/components/chui_tabs/styles.css +43 -15
  224. package/framework/components/chui_text_editor/styles.css +24 -23
  225. package/framework/components/chui_text_editor/text_editor.js +103 -79
  226. package/framework/components/chui_text_editor/text_editor_panel.js +428 -367
  227. package/framework/components/chui_theme_toggle/theme_toggle.js +46 -25
  228. package/framework/components/chui_timeline/styles.css +3 -1
  229. package/framework/components/chui_timeline/timeline.js +14 -12
  230. package/framework/components/chui_toast_queue/styles.css +11 -11
  231. package/framework/components/chui_toast_queue/toast_queue.js +82 -73
  232. package/framework/components/chui_toolbar/styles.css +2 -2
  233. package/framework/components/chui_toolbar/toolbar.js +20 -13
  234. package/framework/components/chui_tooltip/styles.css +2 -2
  235. package/framework/components/chui_tooltip/tooltip.js +40 -27
  236. package/framework/components/chui_tour/styles.css +12 -7
  237. package/framework/components/chui_tour/tour.js +132 -98
  238. package/framework/components/chui_transfer/styles.css +8 -7
  239. package/framework/components/chui_transfer/transfer.js +143 -123
  240. package/framework/components/chui_tree_table/styles.css +4 -4
  241. package/framework/components/chui_tree_table/tree_table.js +88 -74
  242. package/framework/components/chui_tree_view/styles.css +14 -10
  243. package/framework/components/chui_tree_view/tree_view.js +298 -253
  244. package/framework/components/chui_user_bar/styles.css +145 -0
  245. package/framework/components/chui_user_bar/user_bar.js +402 -0
  246. package/framework/components/chui_user_list_bar/styles.css +173 -0
  247. package/framework/components/chui_user_list_bar/user_list_bar.js +485 -0
  248. package/framework/components/chui_watermark/watermark.js +41 -33
  249. package/framework/components/chui_webview/styles.css +2 -2
  250. package/framework/components/chui_webview/webview.js +64 -52
  251. package/framework/components/chui_write_bar/styles.css +172 -0
  252. package/framework/components/chui_write_bar/write_bar.js +320 -0
  253. package/framework/main_window.js +1234 -0
  254. package/framework/modules/chui_a11y/chui_a11y.js +153 -123
  255. package/framework/modules/chui_animations/animations.js +105 -43
  256. package/framework/modules/chui_animations/motion.js +120 -0
  257. package/framework/modules/chui_animations/styles.css +37 -4
  258. package/framework/modules/chui_bridge/preload.js +36 -25
  259. package/framework/modules/chui_functions.js +69 -63
  260. package/framework/modules/chui_highlight/chui_highlight.js +25 -22
  261. package/framework/modules/chui_highlight/styles.css +13 -10
  262. package/framework/modules/chui_i18n/chui_i18n.js +12 -10
  263. package/framework/modules/chui_i18n/locales/a11y.js +5 -5
  264. package/framework/modules/chui_i18n/locales/app_layout.js +5 -5
  265. package/framework/modules/chui_i18n/locales/calendar.js +3 -3
  266. package/framework/modules/chui_i18n/locales/common.js +3 -3
  267. package/framework/modules/chui_i18n/locales/data.js +36 -26
  268. package/framework/modules/chui_i18n/locales/editors.js +40 -13
  269. package/framework/modules/chui_i18n/locales/feedback.js +65 -3
  270. package/framework/modules/chui_i18n/locales/forms.js +8 -8
  271. package/framework/modules/chui_i18n/locales/graphics.js +8 -8
  272. package/framework/modules/chui_i18n/locales/media.js +4 -4
  273. package/framework/modules/chui_i18n/locales/navigation.js +12 -8
  274. package/framework/modules/chui_i18n/locales/validate.js +3 -3
  275. package/framework/modules/chui_json/chui_json.js +11 -11
  276. package/framework/modules/chui_layout/chui_layout.js +12 -10
  277. package/framework/modules/chui_logger/chui_logger.js +47 -28
  278. package/framework/modules/chui_page/page.js +39 -33
  279. package/framework/modules/chui_palette/palette.js +61 -0
  280. package/framework/modules/chui_qr/chui_qr.js +179 -88
  281. package/framework/modules/chui_scrollbar/chui_scrollbar.js +79 -68
  282. package/framework/modules/chui_scrollbar/styles.css +4 -2
  283. package/framework/modules/chui_services/chui_channels.js +27 -13
  284. package/framework/modules/chui_services/chui_services.js +47 -39
  285. package/framework/modules/chui_services/desktop.js +108 -101
  286. package/framework/modules/chui_sortable/chui_sortable.js +33 -28
  287. package/framework/modules/chui_validate/chui_validate.js +10 -7
  288. package/framework/tray_bar/chui_menu_items.js +136 -46
  289. package/index.d.ts +5046 -0
  290. package/index.js +199 -1254
  291. package/package.json +81 -68
  292. package/framework/components/telegram_bot/chui_telegram_bot.js +0 -184
@@ -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
  * Расписание: сетка времени по дням с событиями.
@@ -36,7 +36,7 @@ const {I18n} = require('../../modules/chui_i18n/chui_i18n');
36
36
  class Scheduler {
37
37
  static VIEW = {
38
38
  DAY: "day",
39
- WEEK: "week"
39
+ WEEK: "week",
40
40
  };
41
41
  static DEFAULT_HOUR_HEIGHT = 48;
42
42
  static DEFAULT_SLOT_MINUTES = 30;
@@ -45,11 +45,11 @@ class Scheduler {
45
45
 
46
46
  #root = document.createElement("chui_scheduler");
47
47
  #title = document.createElement("scheduler_title");
48
- #prev_button = document.createElement("button");
49
- #next_button = document.createElement("button");
50
- #today_button = document.createElement("button");
51
- #view_buttons = new Map();
52
- #days_head = document.createElement("scheduler_days_head");
48
+ #prevButton = document.createElement("button");
49
+ #nextButton = document.createElement("button");
50
+ #todayButton = document.createElement("button");
51
+ #viewButtons = new Map();
52
+ #daysHead = document.createElement("scheduler_days_head");
53
53
  #scroll = document.createElement("scheduler_scroll");
54
54
  #times = document.createElement("scheduler_times");
55
55
  #days = document.createElement("scheduler_days");
@@ -57,32 +57,34 @@ class Scheduler {
57
57
  #date = new Date();
58
58
  #view = Scheduler.VIEW.WEEK;
59
59
  #events = [];
60
- #start_hour = 8;
61
- #end_hour = 20;
62
- #slot_minutes = Scheduler.DEFAULT_SLOT_MINUTES;
63
- #hour_height = Scheduler.DEFAULT_HOUR_HEIGHT;
64
- #first_day = Scheduler.DEFAULT_FIRST_DAY;
60
+ #startHour = 8;
61
+ #endHour = 20;
62
+ #slotMinutes = Scheduler.DEFAULT_SLOT_MINUTES;
63
+ #hourHeight = Scheduler.DEFAULT_HOUR_HEIGHT;
64
+ #firstDay = Scheduler.DEFAULT_FIRST_DAY;
65
65
  #label = undefined;
66
- #on_event_click = undefined;
67
- #on_slot_click = undefined;
68
- #on_period_change = undefined;
69
-
70
- constructor(options = {
71
- id: String(),
72
- date: undefined,
73
- view: String(),
74
- events: [],
75
- startHour: Number(),
76
- endHour: Number(),
77
- slotMinutes: Number(),
78
- hourHeight: Number(),
79
- firstDay: Number(),
80
- height: String(),
81
- label: String(),
82
- onEventClick: undefined,
83
- onSlotClick: undefined,
84
- onPeriodChange: undefined
85
- }) {
66
+ #onEventClick = undefined;
67
+ #onSlotClick = undefined;
68
+ #onPeriodChangeCallback = undefined;
69
+
70
+ constructor(
71
+ options = {
72
+ id: String(),
73
+ date: undefined,
74
+ view: String(),
75
+ events: [],
76
+ startHour: Number(),
77
+ endHour: Number(),
78
+ slotMinutes: Number(),
79
+ hourHeight: Number(),
80
+ firstDay: Number(),
81
+ height: String(),
82
+ label: String(),
83
+ onEventClick: undefined,
84
+ onSlotClick: undefined,
85
+ onPeriodChange: undefined,
86
+ }
87
+ ) {
86
88
  setStyles(__dirname + "/styles.css", "chUiJS_Scheduler");
87
89
  Scheduler.#counter += 1;
88
90
  this.#id = options.id === undefined ? `chui_scheduler_${Scheduler.#counter}` : options.id;
@@ -93,18 +95,18 @@ class Scheduler {
93
95
  // вид, которого сетка не рисует
94
96
  this.#view = options.view === Scheduler.VIEW.DAY ? Scheduler.VIEW.DAY : Scheduler.VIEW.WEEK;
95
97
  this.#events = Array.isArray(options.events) ? [...options.events] : [];
96
- this.#start_hour = options.startHour === undefined ? this.#start_hour : options.startHour;
97
- this.#end_hour = options.endHour === undefined ? this.#end_hour : options.endHour;
98
- this.#slot_minutes = options.slotMinutes === undefined ? this.#slot_minutes : options.slotMinutes;
99
- this.#hour_height = options.hourHeight === undefined ? this.#hour_height : options.hourHeight;
100
- this.#first_day = options.firstDay === undefined ? this.#first_day : options.firstDay;
101
- this.#on_event_click = options.onEventClick;
102
- this.#on_slot_click = options.onSlotClick;
103
- this.#on_period_change = options.onPeriodChange;
98
+ this.#startHour = options.startHour === undefined ? this.#startHour : options.startHour;
99
+ this.#endHour = options.endHour === undefined ? this.#endHour : options.endHour;
100
+ this.#slotMinutes = options.slotMinutes === undefined ? this.#slotMinutes : options.slotMinutes;
101
+ this.#hourHeight = options.hourHeight === undefined ? this.#hourHeight : options.hourHeight;
102
+ this.#firstDay = options.firstDay === undefined ? this.#firstDay : options.firstDay;
103
+ this.#onEventClick = options.onEventClick;
104
+ this.#onSlotClick = options.onSlotClick;
105
+ this.#onPeriodChangeCallback = options.onPeriodChange;
104
106
  this.setLabel(optionOr(options.label, I18n.t("scheduler.title")));
105
107
  if (options.height !== undefined) this.setHeight(options.height);
106
108
  this.#buildHead();
107
- this.#root.appendChild(this.#days_head);
109
+ this.#root.appendChild(this.#daysHead);
108
110
  this.#scroll.appendChild(this.#times);
109
111
  this.#scroll.appendChild(this.#days);
110
112
  this.#root.appendChild(this.#scroll);
@@ -129,7 +131,7 @@ class Scheduler {
129
131
  /** Начало и конец показанного периода (включительно) */
130
132
  getRange() {
131
133
  const days = this.#dayDates();
132
- return {from: days[0], to: days[days.length - 1]};
134
+ return { from: days[0], to: days[days.length - 1] };
133
135
  }
134
136
 
135
137
  getEvents() {
@@ -137,15 +139,15 @@ class Scheduler {
137
139
  }
138
140
 
139
141
  getStartHour() {
140
- return this.#start_hour;
142
+ return this.#startHour;
141
143
  }
142
144
 
143
145
  getEndHour() {
144
- return this.#end_hour;
146
+ return this.#endHour;
145
147
  }
146
148
 
147
149
  getSlotMinutes() {
148
- return this.#slot_minutes;
150
+ return this.#slotMinutes;
149
151
  }
150
152
 
151
153
  /** События, попавшие на день (с учётом пересечения полуночи) */
@@ -250,7 +252,11 @@ class Scheduler {
250
252
  }
251
253
 
252
254
  static #sameDay(left = new Date(), right = new Date()) {
253
- return left.getFullYear() === right.getFullYear() && left.getMonth() === right.getMonth() && left.getDate() === right.getDate();
255
+ return (
256
+ left.getFullYear() === right.getFullYear() &&
257
+ left.getMonth() === right.getMonth() &&
258
+ left.getDate() === right.getDate()
259
+ );
254
260
  }
255
261
 
256
262
  static #eventDate(event = Object(), key = "start") {
@@ -260,7 +266,7 @@ class Scheduler {
260
266
  #startOfPeriod() {
261
267
  const day = Scheduler.#startOfDay(this.#date);
262
268
  if (this.#view === Scheduler.VIEW.DAY) return day;
263
- const offset = (day.getDay() - this.#first_day + 7) % 7;
269
+ const offset = (day.getDay() - this.#firstDay + 7) % 7;
264
270
  day.setDate(day.getDate() - offset);
265
271
  return day;
266
272
  }
@@ -268,7 +274,7 @@ class Scheduler {
268
274
  #dayDates() {
269
275
  const start = this.#startOfPeriod();
270
276
  const count = this.#view === Scheduler.VIEW.DAY ? 1 : 7;
271
- return Array.from({length: count}, (_, index) => {
277
+ return Array.from({ length: count }, (_, index) => {
272
278
  const day = new Date(start);
273
279
  day.setDate(start.getDate() + index);
274
280
  return day;
@@ -299,13 +305,13 @@ class Scheduler {
299
305
  */
300
306
  #layout(date = new Date()) {
301
307
  const dayStart = this.#startOfDayMinutes();
302
- const dayEnd = this.#end_hour * 60;
308
+ const dayEnd = this.#endHour * 60;
303
309
  const items = [];
304
310
  for (const event of this.#events) {
305
311
  if (!this.#overlapsDay(event, date)) continue;
306
312
  const start = Scheduler.#eventDate(event, "start");
307
313
  const end = Scheduler.#eventDate(event, "end");
308
- const finished = Number.isNaN(end.getTime()) ? new Date(start.getTime() + this.#slot_minutes * 60000) : end;
314
+ const finished = Number.isNaN(end.getTime()) ? new Date(start.getTime() + this.#slotMinutes * 60000) : end;
309
315
  const sameStartDay = Scheduler.#sameDay(Scheduler.#startOfDay(start), date);
310
316
  const sameEndDay = Scheduler.#sameDay(Scheduler.#startOfDay(finished), date);
311
317
  let from = sameStartDay ? Scheduler.#minutesOf(start) : 0;
@@ -314,16 +320,16 @@ class Scheduler {
314
320
  from = 0;
315
321
  to = 24 * 60;
316
322
  }
317
- if (to <= from) to = from + this.#slot_minutes;
323
+ if (to <= from) to = from + this.#slotMinutes;
318
324
  from = Math.max(from, dayStart);
319
325
  to = Math.min(to, dayEnd);
320
326
  if (to <= from) continue;
321
- items.push({event: event, index: this.#events.indexOf(event), start: from, end: to, lane: 0, lanes: 1});
327
+ items.push({ event: event, index: this.#events.indexOf(event), start: from, end: to, lane: 0, lanes: 1 });
322
328
  }
323
329
  items.sort((left, right) => left.start - right.start || left.end - right.end);
324
330
  // Кластеры пересекающихся событий и дорожки внутри них
325
331
  let cluster = [];
326
- let cluster_end = -1;
332
+ let clusterEnd = -1;
327
333
  const flush = () => {
328
334
  if (cluster.length === 0) return;
329
335
  const lanes = [];
@@ -339,54 +345,57 @@ class Scheduler {
339
345
  }
340
346
  for (const item of cluster) item.lanes = lanes.length;
341
347
  cluster = [];
342
- cluster_end = -1;
348
+ clusterEnd = -1;
343
349
  };
344
350
  for (const item of items) {
345
- if (cluster.length > 0 && item.start >= cluster_end) flush();
351
+ if (cluster.length > 0 && item.start >= clusterEnd) flush();
346
352
  cluster.push(item);
347
- cluster_end = Math.max(cluster_end, item.end);
353
+ clusterEnd = Math.max(clusterEnd, item.end);
348
354
  }
349
355
  flush();
350
356
  return items;
351
357
  }
352
358
 
353
359
  #startOfDayMinutes() {
354
- return this.#start_hour * 60;
360
+ return this.#startHour * 60;
355
361
  }
356
362
 
357
363
  // === РЕНДЕР ===
358
364
  #buildHead() {
359
365
  const head = document.createElement("scheduler_head");
360
- this.#prev_button.type = "button";
361
- this.#next_button.type = "button";
362
- this.#today_button.type = "button";
363
- this.#prev_button.className = "scheduler_nav";
364
- this.#next_button.className = "scheduler_nav";
365
- this.#today_button.className = "scheduler_today";
366
- this.#prev_button.dataset.action = "prev";
367
- this.#next_button.dataset.action = "next";
368
- this.#today_button.dataset.action = "today";
369
- this.#prev_button.innerText = "‹";
370
- this.#next_button.innerText = "›";
371
- this.#today_button.innerText = I18n.t("scheduler.today");
372
- this.#prev_button.setAttribute("aria-label", I18n.t("scheduler.previousPeriod"));
373
- this.#next_button.setAttribute("aria-label", I18n.t("scheduler.nextPeriod"));
366
+ this.#prevButton.type = "button";
367
+ this.#nextButton.type = "button";
368
+ this.#todayButton.type = "button";
369
+ this.#prevButton.className = "scheduler_nav";
370
+ this.#nextButton.className = "scheduler_nav";
371
+ this.#todayButton.className = "scheduler_today";
372
+ this.#prevButton.dataset.action = "prev";
373
+ this.#nextButton.dataset.action = "next";
374
+ this.#todayButton.dataset.action = "today";
375
+ this.#prevButton.innerText = "‹";
376
+ this.#nextButton.innerText = "›";
377
+ this.#todayButton.innerText = I18n.t("scheduler.today");
378
+ this.#prevButton.setAttribute("aria-label", I18n.t("scheduler.previousPeriod"));
379
+ this.#nextButton.setAttribute("aria-label", I18n.t("scheduler.nextPeriod"));
374
380
  this.#title.setAttribute("aria-live", "polite");
375
381
  const views = document.createElement("scheduler_views");
376
382
  views.setAttribute("role", "group");
377
383
  views.setAttribute("aria-label", I18n.t("scheduler.view"));
378
- for (const [view, label] of [[Scheduler.VIEW.DAY, I18n.t("scheduler.day")], [Scheduler.VIEW.WEEK, I18n.t("scheduler.week")]]) {
384
+ for (const [view, label] of [
385
+ [Scheduler.VIEW.DAY, I18n.t("scheduler.day")],
386
+ [Scheduler.VIEW.WEEK, I18n.t("scheduler.week")],
387
+ ]) {
379
388
  const button = document.createElement("button");
380
389
  button.type = "button";
381
390
  button.className = "scheduler_view";
382
391
  button.dataset.view = view;
383
392
  button.innerText = label;
384
393
  views.appendChild(button);
385
- this.#view_buttons.set(view, button);
394
+ this.#viewButtons.set(view, button);
386
395
  }
387
- head.appendChild(this.#prev_button);
388
- head.appendChild(this.#next_button);
389
- head.appendChild(this.#today_button);
396
+ head.appendChild(this.#prevButton);
397
+ head.appendChild(this.#nextButton);
398
+ head.appendChild(this.#todayButton);
390
399
  head.appendChild(this.#title);
391
400
  head.appendChild(views);
392
401
  this.#root.appendChild(head);
@@ -396,28 +405,35 @@ class Scheduler {
396
405
  const days = this.#dayDates();
397
406
  const today = new Date();
398
407
  this.#title.innerText = this.#periodTitle(days);
399
- for (const [view, button] of this.#view_buttons) button.setAttribute("aria-pressed", view === this.#view ? "true" : "false");
400
- this.#prev_button.setAttribute("aria-label", this.#view === Scheduler.VIEW.DAY ? I18n.t("scheduler.previousDay") : I18n.t("scheduler.previousWeek"));
401
- this.#next_button.setAttribute("aria-label", this.#view === Scheduler.VIEW.DAY ? I18n.t("scheduler.nextDay") : I18n.t("scheduler.nextWeek"));
408
+ for (const [view, button] of this.#viewButtons)
409
+ button.setAttribute("aria-pressed", view === this.#view ? "true" : "false");
410
+ this.#prevButton.setAttribute(
411
+ "aria-label",
412
+ this.#view === Scheduler.VIEW.DAY ? I18n.t("scheduler.previousDay") : I18n.t("scheduler.previousWeek")
413
+ );
414
+ this.#nextButton.setAttribute(
415
+ "aria-label",
416
+ this.#view === Scheduler.VIEW.DAY ? I18n.t("scheduler.nextDay") : I18n.t("scheduler.nextWeek")
417
+ );
402
418
  // Заголовки дней лежат вне области прокрутки и повторяют колонки сетки; ширина
403
419
  // вертикальной полосы прокрутки компенсируется, иначе заголовки уехали бы вправо
404
420
  const scrollbar = Math.max(0, this.#scroll.offsetWidth - this.#scroll.clientWidth);
405
- this.#days_head.style.paddingRight = `${scrollbar}px`;
406
- this.#days_head.innerHTML = "";
407
- this.#days_head.style.gridTemplateColumns = `56px repeat(${days.length}, minmax(0, 1fr))`;
421
+ this.#daysHead.style.paddingRight = `${scrollbar}px`;
422
+ this.#daysHead.innerHTML = "";
423
+ this.#daysHead.style.gridTemplateColumns = `56px repeat(${days.length}, minmax(0, 1fr))`;
408
424
  const corner = document.createElement("scheduler_corner");
409
425
  corner.setAttribute("aria-hidden", "true");
410
- this.#days_head.appendChild(corner);
426
+ this.#daysHead.appendChild(corner);
411
427
  for (const day of days) {
412
428
  const head = document.createElement("scheduler_day_head");
413
429
  if (Scheduler.#sameDay(day, today)) head.classList.add("scheduler_today_head");
414
430
  const name = document.createElement("scheduler_day_name");
415
- name.innerText = day.toLocaleString(I18n.getLocale(), {weekday: "short"}).toUpperCase();
431
+ name.innerText = day.toLocaleString(I18n.getLocale(), { weekday: "short" }).toUpperCase();
416
432
  const number = document.createElement("scheduler_day_number");
417
433
  number.innerText = String(day.getDate());
418
434
  head.appendChild(name);
419
435
  head.appendChild(number);
420
- this.#days_head.appendChild(head);
436
+ this.#daysHead.appendChild(head);
421
437
  }
422
438
  this.#renderTimes();
423
439
  this.#renderDays(days, today);
@@ -425,9 +441,9 @@ class Scheduler {
425
441
 
426
442
  #renderTimes() {
427
443
  this.#times.innerHTML = "";
428
- for (let hour = this.#start_hour; hour < this.#end_hour; hour++) {
444
+ for (let hour = this.#startHour; hour < this.#endHour; hour++) {
429
445
  const cell = document.createElement("scheduler_hour");
430
- cell.style.height = `${this.#hour_height}px`;
446
+ cell.style.height = `${this.#hourHeight}px`;
431
447
  cell.innerText = `${String(hour).padStart(2, "0")}:00`;
432
448
  this.#times.appendChild(cell);
433
449
  }
@@ -439,10 +455,10 @@ class Scheduler {
439
455
  for (const day of days) {
440
456
  const column = document.createElement("scheduler_day");
441
457
  column.dataset.day = Scheduler.#key(day);
442
- column.style.height = `${(this.#end_hour - this.#start_hour) * this.#hour_height}px`;
458
+ column.style.height = `${(this.#endHour - this.#startHour) * this.#hourHeight}px`;
443
459
  if (Scheduler.#sameDay(day, today)) column.classList.add("scheduler_today");
444
460
  // Часовые линии рисует фон: узлы на каждый час не нужны
445
- column.style.backgroundSize = `100% ${this.#hour_height}px`;
461
+ column.style.backgroundSize = `100% ${this.#hourHeight}px`;
446
462
  for (const item of this.#layout(day)) column.appendChild(this.#createEvent(item, day));
447
463
  this.#days.appendChild(column);
448
464
  }
@@ -454,8 +470,8 @@ class Scheduler {
454
470
 
455
471
  #createEvent(item = Object(), day = new Date()) {
456
472
  const event = item.event;
457
- const top = ((item.start - this.#startOfDayMinutes()) / 60) * this.#hour_height;
458
- const height = Math.max(18, ((item.end - item.start) / 60) * this.#hour_height);
473
+ const top = ((item.start - this.#startOfDayMinutes()) / 60) * this.#hourHeight;
474
+ const height = Math.max(18, ((item.end - item.start) / 60) * this.#hourHeight);
459
475
  const lanes = Math.max(1, item.lanes);
460
476
  const width = 100 / lanes;
461
477
  const node = document.createElement("button");
@@ -486,20 +502,25 @@ class Scheduler {
486
502
  }
487
503
 
488
504
  static #dayText(day = new Date()) {
489
- return day.toLocaleString(I18n.getLocale(), {weekday: "long", day: "numeric", month: "long"});
505
+ return day.toLocaleString(I18n.getLocale(), { weekday: "long", day: "numeric", month: "long" });
490
506
  }
491
507
 
492
508
  #periodTitle(days = []) {
493
509
  const first = days[0];
494
510
  const last = days[days.length - 1];
495
511
  if (this.#view === Scheduler.VIEW.DAY) {
496
- return first.toLocaleString(I18n.getLocale(), {weekday: "long", day: "numeric", month: "long", year: "numeric"});
512
+ return first.toLocaleString(I18n.getLocale(), {
513
+ weekday: "long",
514
+ day: "numeric",
515
+ month: "long",
516
+ year: "numeric",
517
+ });
497
518
  }
498
519
  // Дата с числом даёт месяц в родительном падеже, поэтому диапазон собирается из дня
499
520
  // и полной даты конца периода, а не из отдельного названия месяца
500
- const until = last.toLocaleString(I18n.getLocale(), {day: "numeric", month: "long", year: "numeric"});
521
+ const until = last.toLocaleString(I18n.getLocale(), { day: "numeric", month: "long", year: "numeric" });
501
522
  if (first.getMonth() === last.getMonth()) return `${first.getDate()} – ${until}`;
502
- const from = first.toLocaleString(I18n.getLocale(), {day: "numeric", month: "long"});
523
+ const from = first.toLocaleString(I18n.getLocale(), { day: "numeric", month: "long" });
503
524
  return `${from} – ${until}`;
504
525
  }
505
526
 
@@ -523,18 +544,19 @@ class Scheduler {
523
544
  const eventNode = target.closest(".scheduler_event");
524
545
  if (eventNode !== null) {
525
546
  const found = this.#events[Number(eventNode.dataset.index)];
526
- if (this.#on_event_click !== undefined) this.#on_event_click(found === undefined ? undefined : found, eventNode);
547
+ if (this.#onEventClick !== undefined)
548
+ this.#onEventClick(found === undefined ? undefined : found, eventNode);
527
549
  return;
528
550
  }
529
551
  const dayNode = target.closest("scheduler_day");
530
552
  if (dayNode !== null) {
531
553
  const column = dayNode.getBoundingClientRect();
532
554
  const offset = Math.max(0, Math.min(event.clientY - column.top, column.height));
533
- const raw = this.#startOfDayMinutes() + (offset / this.#hour_height) * 60;
534
- const minutes = Math.round(raw / this.#slot_minutes) * this.#slot_minutes;
555
+ const raw = this.#startOfDayMinutes() + (offset / this.#hourHeight) * 60;
556
+ const minutes = Math.round(raw / this.#slotMinutes) * this.#slotMinutes;
535
557
  const date = this.#dayDates().find((day) => Scheduler.#key(day) === dayNode.dataset.day);
536
- if (date !== undefined && this.#on_slot_click !== undefined) {
537
- this.#on_slot_click({date: date, minutes: minutes, time: Scheduler.#timeText(minutes)});
558
+ if (date !== undefined && this.#onSlotClick !== undefined) {
559
+ this.#onSlotClick({ date: date, minutes: minutes, time: Scheduler.#timeText(minutes) });
538
560
  }
539
561
  }
540
562
  };
@@ -557,10 +579,10 @@ class Scheduler {
557
579
  };
558
580
 
559
581
  #onPeriodChange() {
560
- if (this.#on_period_change === undefined) return;
582
+ if (this.#onPeriodChangeCallback === undefined) return;
561
583
  const range = this.getRange();
562
- this.#on_period_change(range.from, range.to);
584
+ this.#onPeriodChangeCallback(range.from, range.to);
563
585
  }
564
586
  }
565
587
 
566
- exports.Scheduler = Scheduler
588
+ exports.Scheduler = Scheduler;
@@ -4,12 +4,12 @@ chui_scheduler {
4
4
  flex-direction: column;
5
5
  width: -webkit-fill-available;
6
6
  box-sizing: border-box;
7
- margin: var(--margin);
7
+ margin: var(--block_margin);
8
8
  color: var(--text_color);
9
9
  font-size: var(--font_default_size);
10
10
  background: var(--element_background_2);
11
11
  border: 1px solid var(--border_color);
12
- border-radius: var(--border_radius);
12
+ border-radius: var(--radius_sm);
13
13
  overflow: hidden;
14
14
  }
15
15
 
@@ -17,7 +17,7 @@ scheduler_head {
17
17
  display: flex;
18
18
  align-items: center;
19
19
  gap: 6px;
20
- padding: var(--main_padding);
20
+ padding: var(--block_padding);
21
21
  border-bottom: 1px solid var(--border_color);
22
22
  }
23
23
 
@@ -25,7 +25,7 @@ button.scheduler_nav,
25
25
  button.scheduler_today,
26
26
  button.scheduler_view {
27
27
  border: none;
28
- border-radius: var(--border_radius);
28
+ border-radius: var(--radius_sm);
29
29
  background: var(--element_background);
30
30
  color: var(--text_color);
31
31
  font-family: inherit;
@@ -52,7 +52,10 @@ button.scheduler_view[aria-pressed="true"] {
52
52
  color: var(--text_color_hover);
53
53
  }
54
54
 
55
- button.scheduler_nav:focus-visible, button.scheduler_today:focus-visible, button.scheduler_view:focus-visible, button.scheduler_event:focus-visible {
55
+ button.scheduler_nav:focus-visible,
56
+ button.scheduler_today:focus-visible,
57
+ button.scheduler_view:focus-visible,
58
+ button.scheduler_event:focus-visible {
56
59
  outline: var(--focus_outline);
57
60
  outline-offset: var(--focus_outline_offset);
58
61
  }
@@ -119,7 +122,8 @@ scheduler_times {
119
122
  scheduler_hour {
120
123
  display: block;
121
124
  box-sizing: border-box;
122
- padding-block: 2px 0; padding-inline: 0 6px;
125
+ padding-block: 2px 0;
126
+ padding-inline: 0 6px;
123
127
  text-align: end;
124
128
  color: var(--text_color_disabled);
125
129
  font-size: 0.85em;
@@ -153,7 +157,7 @@ button.scheduler_event {
153
157
  overflow: hidden;
154
158
  text-align: start;
155
159
  border: none;
156
- border-radius: var(--border_radius);
160
+ border-radius: var(--radius_sm);
157
161
  background: var(--blue_prime_background);
158
162
  color: var(--text_color_hover);
159
163
  font-family: inherit;