chuijs 4.0.1 → 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 (222) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/README.md +43 -632
  3. package/framework/appLayout/default/chui_app_layout.js +314 -273
  4. package/framework/appLayout/default/global_style.css +93 -53
  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 +56 -26
  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_page/styles.css +3 -26
  211. package/framework/modules/chui_qr/chui_qr.js +158 -67
  212. package/framework/modules/chui_scrollbar/chui_scrollbar.js +35 -24
  213. package/framework/modules/chui_scrollbar/styles.css +3 -1
  214. package/framework/modules/chui_services/chui_channels.js +76 -11
  215. package/framework/modules/chui_services/chui_services.js +39 -31
  216. package/framework/modules/chui_services/desktop.js +149 -30
  217. package/framework/modules/chui_sortable/chui_sortable.js +17 -12
  218. package/framework/modules/chui_validate/chui_validate.js +7 -4
  219. package/framework/tray_bar/chui_menu_items.js +136 -46
  220. package/index.d.ts +4814 -0
  221. package/index.js +449 -334
  222. package/package.json +79 -68
@@ -11,52 +11,52 @@ radiobutton {
11
11
  /* Тот же шаг шрифта, что у CheckBox: квадратик и кружок должны быть одного размера */
12
12
  font-size: var(--font_default_size);
13
13
  margin: var(--margin);
14
- width: max-content
14
+ width: max-content;
15
15
  }
16
16
 
17
17
  .radiobutton {
18
18
  position: absolute;
19
19
  z-index: -1;
20
- opacity: 0
20
+ opacity: 0;
21
21
  }
22
22
 
23
- .radiobutton+label {
23
+ .radiobutton + label {
24
24
  display: inline-flex;
25
25
  align-items: center;
26
- color:var(--text_color)
26
+ color: var(--text_color);
27
27
  }
28
28
 
29
- .radiobutton+label::before {
29
+ .radiobutton + label::before {
30
30
  font-size: var(--font_default_size);
31
- content: '';
31
+ content: "";
32
32
  display: flex;
33
33
  width: 1.2em;
34
34
  height: 1.2em;
35
35
  flex-shrink: 0;
36
- flex-grow:0;
37
- border-radius:50%;
38
- margin-inline-end:10px;
39
- align-items:center;
40
- justify-content:center;
36
+ flex-grow: 0;
37
+ border-radius: 50%;
38
+ margin-inline-end: 10px;
39
+ align-items: center;
40
+ justify-content: center;
41
41
  color: transparent;
42
42
  background: var(--element_background);
43
43
  border: none;
44
44
  box-shadow: 0 0 1px 0 var(--border_color);
45
45
  }
46
46
 
47
- .radiobutton:not(:disabled):not(:checked)+label:hover::before {
47
+ .radiobutton:not(:disabled):not(:checked) + label:hover::before {
48
48
  background: var(--element_background_hover);
49
49
  }
50
- .radiobutton:not(:disabled):active+label::before {
50
+ .radiobutton:not(:disabled):active + label::before {
51
51
  background: radial-gradient(circle, var(--text_color_hover) 22%, var(--blue_prime_background) 22%);
52
52
  }
53
53
 
54
- .radiobutton:focus-visible+label::before {
54
+ .radiobutton:focus-visible + label::before {
55
55
  outline: var(--focus_outline);
56
56
  outline-offset: var(--focus_outline_offset);
57
57
  }
58
58
 
59
- .radiobutton:checked+label::before {
59
+ .radiobutton:checked + label::before {
60
60
  background: radial-gradient(circle, var(--text_color_hover) 22%, var(--blue_prime_background) 22%);
61
61
  border: none;
62
62
  box-shadow: 0 0 1px 0 var(--blue_prime_background);
@@ -64,24 +64,24 @@ radiobutton {
64
64
 
65
65
  .labelr {
66
66
  cursor: pointer;
67
- font-size: var(--font_default_size)
67
+ font-size: var(--font_default_size);
68
68
  }
69
69
 
70
- .radiobutton:disabled+label {
70
+ .radiobutton:disabled + label {
71
71
  cursor: not-allowed;
72
72
  color: var(--text_color_disabled);
73
73
  }
74
74
 
75
- .radiobutton:disabled:not(:checked)+label::before {
75
+ .radiobutton:disabled:not(:checked) + label::before {
76
76
  cursor: not-allowed;
77
77
  background: var(--element_background_disabled);
78
78
  border: none;
79
79
  box-shadow: 0 0 1px 0 var(--border_color);
80
80
  }
81
81
 
82
- .radiobutton:disabled:checked+label::before {
82
+ .radiobutton:disabled:checked + label::before {
83
83
  cursor: not-allowed;
84
84
  background: radial-gradient(circle, var(--text_color_disabled) 22%, var(--element_background_disabled) 22%);
85
85
  border: none;
86
86
  box-shadow: 0 0 1px 0 var(--border_color);
87
- }
87
+ }
@@ -1,7 +1,7 @@
1
- const {setStyles} = require('../../../modules/chui_functions');
2
- const {Icon, Icons} = require('../../chui_icons/icons');
3
- const {Validate} = require('../../../modules/chui_validate/chui_validate');
4
- const {I18n} = require('../../../modules/chui_i18n/chui_i18n');
1
+ const { setStyles } = require("../../../modules/chui_functions");
2
+ const { Icon, Icons } = require("../../chui_icons/icons");
3
+ const { Validate } = require("../../../modules/chui_validate/chui_validate");
4
+ const { I18n } = require("../../../modules/chui_i18n/chui_i18n");
5
5
 
6
6
  /**
7
7
  * Оценка звёздами: поле ввода от 0 до `max`.
@@ -36,7 +36,7 @@ const {I18n} = require('../../../modules/chui_i18n/chui_i18n');
36
36
  class Rating {
37
37
  static SIZE = {
38
38
  SMALL: "small",
39
- DEFAULT: "default"
39
+ DEFAULT: "default",
40
40
  };
41
41
  static #counter = 0;
42
42
 
@@ -61,21 +61,23 @@ class Rating {
61
61
  #dragging = false;
62
62
  #moved = false;
63
63
 
64
- constructor(options = {
65
- id: String(),
66
- name: String(),
67
- title: String(),
68
- label: String(),
69
- value: Number(),
70
- max: Number(),
71
- readOnly: Boolean(),
72
- disabled: Boolean(),
73
- size: String(),
74
- icon: String(),
75
- iconEmpty: String(),
76
- changeListener: undefined,
77
- onChange: undefined
78
- }) {
64
+ constructor(
65
+ options = {
66
+ id: String(),
67
+ name: String(),
68
+ title: String(),
69
+ label: String(),
70
+ value: Number(),
71
+ max: Number(),
72
+ readOnly: Boolean(),
73
+ disabled: Boolean(),
74
+ size: String(),
75
+ icon: String(),
76
+ iconEmpty: String(),
77
+ changeListener: undefined,
78
+ onChange: undefined,
79
+ }
80
+ ) {
79
81
  setStyles(__dirname + "/styles.css", "chUiJS_Rating");
80
82
  Rating.#counter += 1;
81
83
  this.#id = options.id === undefined ? `chui_rating_${Rating.#counter}` : options.id;
@@ -150,7 +152,9 @@ class Rating {
150
152
 
151
153
  /** Читаемое значение: «4 из 5» или «Нет оценки» */
152
154
  getValueText() {
153
- return this.#value === 0 ? I18n.t("forms.ratingNone") : I18n.t("forms.ratingOf", {value: this.#value, max: this.#max});
155
+ return this.#value === 0
156
+ ? I18n.t("forms.ratingNone")
157
+ : I18n.t("forms.ratingOf", { value: this.#value, max: this.#max });
154
158
  }
155
159
 
156
160
  getDisabled() {
@@ -417,4 +421,4 @@ class Rating {
417
421
  static SMALL_ICON_SIZE = "14px";
418
422
  }
419
423
 
420
- exports.Rating = Rating
424
+ exports.Rating = Rating;
@@ -1,23 +1,23 @@
1
- const { Animation } = require('../../../modules/chui_animations/animations');
2
- const { dropdownPlacement } = require('../../../modules/chui_functions');
3
- const { Icon, Icons } = require('../../chui_icons/icons');
4
- const { ComboboxKeyboard } = require('../../../modules/chui_a11y/chui_a11y');
1
+ const { Animation } = require("../../../modules/chui_animations/animations");
2
+ const { dropdownPlacement } = require("../../../modules/chui_functions");
3
+ const { Icon, Icons } = require("../../chui_icons/icons");
4
+ const { ComboboxKeyboard } = require("../../../modules/chui_a11y/chui_a11y");
5
5
 
6
- const {Validate} = require('../../../modules/chui_validate/chui_validate');
6
+ const { Validate } = require("../../../modules/chui_validate/chui_validate");
7
7
 
8
8
  class Select {
9
9
  #id = require("randomstring").generate();
10
10
  #id_sb = require("randomstring").generate();
11
- #Select_main = document.createElement('chui_selectbox');
12
- #Select_second = document.createElement('selectbox');
13
- #label = document.createElement('label');
14
- #input = document.createElement('input');
15
- #button_open = document.createElement('select_button_open');
16
- #button_open_disabled = document.createElement('select_button_open');
11
+ #Select_main = document.createElement("chui_selectbox");
12
+ #Select_second = document.createElement("selectbox");
13
+ #label = document.createElement("label");
14
+ #input = document.createElement("input");
15
+ #button_open = document.createElement("select_button_open");
16
+ #button_open_disabled = document.createElement("select_button_open");
17
17
  #disabled_trigger = false;
18
18
  // Признак «вариант только что выбран мышью» — см. обработчик клика по полю
19
19
  #chosen_by_mouse = false;
20
- #dropdown = document.createElement('selectbox_dropdown');
20
+ #dropdown = document.createElement("selectbox_dropdown");
21
21
  #a11y = undefined;
22
22
  // Слушатель окна храним полем, чтобы можно было снять в destroy()
23
23
  // Клик вне поля закрывает список. Проверять надо весь контрол целиком, а не только
@@ -27,38 +27,51 @@ class Select {
27
27
  #window_click_event = (event) => {
28
28
  if (!this.#Select_main.contains(event.target)) this.#closeDropdown();
29
29
  };
30
- constructor(options = {
31
- name: String(), title: String(), placeholder: String(),
32
- width: String(), required: Boolean()
33
- }) {
34
- require('../../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_Select');
30
+ constructor(
31
+ options = {
32
+ name: String(),
33
+ title: String(),
34
+ placeholder: String(),
35
+ width: String(),
36
+ required: Boolean(),
37
+ }
38
+ ) {
39
+ require("../../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_Select");
35
40
  if (options.width !== undefined) this.#Select_main.style.width = options.width;
36
41
  if (options.placeholder !== undefined) this.#input.placeholder = options.placeholder;
37
42
  if (options.title !== undefined) {
38
- this.#label.classList.add('select_label')
43
+ this.#label.classList.add("select_label");
39
44
  this.#label.innerText = options.title;
40
- this.#label.setAttribute('for', this.#id_sb);
45
+ this.#label.setAttribute("for", this.#id_sb);
41
46
  this.#Select_main.appendChild(this.#label);
42
47
  }
43
48
  if (options.required !== undefined) this.#input.required = options.required;
44
49
  // Валидация: для списка required означает «есть выбранный вариант»
45
50
  Validate.installField(this, options, this.#Select_second, undefined, () => this.getValue());
46
- this.#input.setAttribute('id', this.#id_sb);
47
- this.#input.classList.add('selectbox_input');
48
- this.#input.type = 'text';
51
+ this.#input.setAttribute("id", this.#id_sb);
52
+ this.#input.classList.add("selectbox_input");
53
+ this.#input.type = "text";
49
54
  if (options.name !== undefined) this.#input.name = options.name;
50
- this.#input.readOnly = true
51
- this.#button_open.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_DOWN, undefined, "var(--blue_prime_background)").getHTML();
52
- this.#button_open_disabled.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_DOWN, undefined, "var(--text_color_disabled)").getHTML();
55
+ this.#input.readOnly = true;
56
+ this.#button_open.innerHTML = new Icon(
57
+ Icons.HARDWARE.KEYBOARD_ARROW_DOWN,
58
+ undefined,
59
+ "var(--blue_prime_background)"
60
+ ).getHTML();
61
+ this.#button_open_disabled.innerHTML = new Icon(
62
+ Icons.HARDWARE.KEYBOARD_ARROW_DOWN,
63
+ undefined,
64
+ "var(--text_color_disabled)"
65
+ ).getHTML();
53
66
  // Курсор выключенного поля даёт `.selectbox_disabled`: `cursor` наследуется
54
- this.#dropdown.setAttribute('id', this.#id);
55
- this.#Select_second.appendChild(this.#input)
56
- this.#Select_second.appendChild(this.#button_open)
57
- this.#Select_second.appendChild(this.#dropdown)
67
+ this.#dropdown.setAttribute("id", this.#id);
68
+ this.#Select_second.appendChild(this.#input);
69
+ this.#Select_second.appendChild(this.#button_open);
70
+ this.#Select_second.appendChild(this.#dropdown);
58
71
  //LISTENERS
59
- this.#input.addEventListener('focus', () => this.#openDropdown())
60
- this.#input.addEventListener('blur', () => this.#closeDropdown())
61
- this.#Select_second.addEventListener('click', (event) => {
72
+ this.#input.addEventListener("focus", () => this.#openDropdown());
73
+ this.#input.addEventListener("blur", () => this.#closeDropdown());
74
+ this.#Select_second.addEventListener("click", (event) => {
62
75
  // Клик по полю или стрелке открывает список сам. Одного `focus` мало:
63
76
  // если фокус уже в поле (повторный клик, диалог поставил фокус первым),
64
77
  // событие `focus` не придёт и список не раскроется
@@ -76,44 +89,44 @@ class Select {
76
89
  });
77
90
  // Слой списка не забирает фокус: клик по его отступу не должен закрывать список
78
91
  // (иначе поле теряло бы фокус на пустом месте слоя)
79
- this.#dropdown.addEventListener('mousedown', (event) => event.preventDefault());
80
- window.addEventListener('click', this.#window_click_event);
81
- this.#input.addEventListener('input', (event) => {
92
+ this.#dropdown.addEventListener("mousedown", (event) => event.preventDefault());
93
+ window.addEventListener("click", this.#window_click_event);
94
+ this.#input.addEventListener("input", (event) => {
82
95
  let dropdown = this.#dropdown;
83
96
  for (let option of dropdown.childNodes) {
84
- if (!option.getAttribute('option_value').includes(event.target.value)) {
85
- option.style.display = 'none'
97
+ if (!option.getAttribute("option_value").includes(event.target.value)) {
98
+ option.style.display = "none";
86
99
  } else {
87
- option.style.display = 'block'
100
+ option.style.display = "block";
88
101
  }
89
102
  }
90
103
  this.#a11y.refresh();
91
104
  });
92
- this.#Select_main.appendChild(this.#Select_second)
105
+ this.#Select_main.appendChild(this.#Select_second);
93
106
  // Клавиатура и aria: фокус в поле, стрелки/Home/End/Enter по опциям, Escape закрывает
94
107
  this.#a11y = new ComboboxKeyboard(this.#input, {
95
108
  dropdown: this.#dropdown,
96
109
  optionSelector: "selectbox_option",
97
110
  onEscape: () => this.#closeDropdown(),
98
- onOpen: () => this.#openDropdown()
111
+ onOpen: () => this.#openDropdown(),
99
112
  });
100
113
  }
101
114
  #openDropdown() {
102
115
  if (this.#disabled_trigger) return;
103
- this.#setOpenState(true)
116
+ this.#setOpenState(true);
104
117
  new Animation(this.#dropdown).fadeIn();
105
118
  setOptionDisplay(this.#dropdown);
106
119
  this.#setDropdownDirection();
107
120
  this.#a11y.setExpanded(true);
108
121
  }
109
122
  #closeDropdown() {
110
- this.#setOpenState(false)
123
+ this.#setOpenState(false);
111
124
  new Animation(this.#dropdown).fadeOut();
112
125
  if (this.#a11y !== undefined) this.#a11y.setExpanded(false);
113
126
  }
114
127
  /** Полное удаление: снять слушатели окна и клавиатурный слой */
115
128
  destroy() {
116
- window.removeEventListener('click', this.#window_click_event);
129
+ window.removeEventListener("click", this.#window_click_event);
117
130
  this.#a11y.destroy();
118
131
  this.#closeDropdown();
119
132
  }
@@ -139,7 +152,8 @@ class Select {
139
152
  setValue(value = String(), silent = Boolean()) {
140
153
  const text = String(value);
141
154
  const options = [...this.#dropdown.children];
142
- const option = options.find((item) => item.getAttribute("option_value") === text) ??
155
+ const option =
156
+ options.find((item) => item.getAttribute("option_value") === text) ??
143
157
  options.find((item) => item.getAttribute("option_title") === text);
144
158
  if (option === undefined) return this;
145
159
  this.#applyOption(option, silent === true);
@@ -183,8 +197,8 @@ class Select {
183
197
  }
184
198
  /** Выбор опции: подпись и значение идут в поле и в атрибуты корня, затем слушатели */
185
199
  #applyOption(option = new HTMLElement(), silent = Boolean()) {
186
- const title = option.getAttribute('option_title');
187
- const value = option.getAttribute('option_value');
200
+ const title = option.getAttribute("option_title");
201
+ const value = option.getAttribute("option_value");
188
202
  this.#input.value = title;
189
203
  this.#Select_main.setAttribute("option_title", title);
190
204
  this.#Select_main.setAttribute("option_value", value);
@@ -193,12 +207,14 @@ class Select {
193
207
  // Выбор варианта закрывает список: клику по опции это уже не поручить —
194
208
  // click схлопывается до общего предка (mousedown был в поле, mouseup — в слое)
195
209
  this.#closeDropdown();
196
- this.#Select_main.dispatchEvent(new CustomEvent("chui_select_option_changed", {
197
- detail: {
198
- title: title,
199
- value: value
200
- },
201
- }));
210
+ this.#Select_main.dispatchEvent(
211
+ new CustomEvent("chui_select_option_changed", {
212
+ detail: {
213
+ title: title,
214
+ value: value,
215
+ },
216
+ })
217
+ );
202
218
  }
203
219
  /**
204
220
  * Выбор опции: подпись и значение идут в поле и в атрибуты корня, затем слушатели.
@@ -207,13 +223,13 @@ class Select {
207
223
  * закрывался бы по blur до щелчка, и выбор терялся бы.
208
224
  */
209
225
  #wireOption(option = new HTMLElement()) {
210
- option.addEventListener('mousedown', (event) => {
226
+ option.addEventListener("mousedown", (event) => {
211
227
  event.preventDefault();
212
228
  // Признак «выбрано мышью»: гасит повторное раскрытие списка на `mouseup` по полю
213
229
  this.#chosen_by_mouse = true;
214
230
  this.#applyOption(option, false);
215
231
  });
216
- option.addEventListener('click', (event) => {
232
+ option.addEventListener("click", (event) => {
217
233
  if (event.detail !== 0) return;
218
234
  this.#applyOption(option, false);
219
235
  });
@@ -221,8 +237,8 @@ class Select {
221
237
  addOption(title, value) {
222
238
  let option = document.createElement(`selectbox_option`);
223
239
  option.innerHTML = title;
224
- option.setAttribute('option_title', title);
225
- option.setAttribute('option_value', value);
240
+ option.setAttribute("option_title", title);
241
+ option.setAttribute("option_value", value);
226
242
  this.#wireOption(option);
227
243
  this.#dropdown.appendChild(option);
228
244
  this.#a11y.refresh();
@@ -231,8 +247,8 @@ class Select {
231
247
  for (let opt of options) {
232
248
  let option = document.createElement(`selectbox_option`);
233
249
  option.innerHTML = opt.title;
234
- option.setAttribute('option_title', opt.title);
235
- option.setAttribute('option_value', opt.value);
250
+ option.setAttribute("option_title", opt.title);
251
+ option.setAttribute("option_value", opt.value);
236
252
  this.#wireOption(option);
237
253
  this.#dropdown.appendChild(option);
238
254
  }
@@ -247,31 +263,35 @@ class Select {
247
263
  */
248
264
  setDefaultOption(object = Object()) {
249
265
  const wanted = object !== null && typeof object === "object" ? object.value : object;
250
- let opt = this.#dropdown.getElementsByTagName('selectbox_option');
266
+ let opt = this.#dropdown.getElementsByTagName("selectbox_option");
251
267
  for (let i = 0; i < opt.length; i++) {
252
268
  let test = opt.item(i);
253
- if (test.getAttribute('option_value') === String(wanted)) test.click()
269
+ if (test.getAttribute("option_value") === String(wanted)) test.click();
254
270
  }
255
271
  }
256
272
  addValueChangeListener(listener = () => {}) {
257
- this.#Select_main.addEventListener("chui_select_option_changed", listener)
273
+ this.#Select_main.addEventListener("chui_select_option_changed", listener);
274
+ }
275
+ getName() {
276
+ return this.#input.name;
277
+ }
278
+ getValue() {
279
+ return this.#input.value;
258
280
  }
259
- getName() { return this.#input.name; }
260
- getValue() { return this.#input.value; }
261
281
  setDisabled(boolean = Boolean()) {
262
- this.#disabled_trigger = boolean
282
+ this.#disabled_trigger = boolean;
263
283
  if (boolean) {
264
- this.#setOpenState(false)
284
+ this.#setOpenState(false);
265
285
  if (this.#a11y !== undefined) this.#a11y.setExpanded(false);
266
- this.#Select_second.classList.add("selectbox_disabled")
267
- this.#input.className = "selectbox_input_disabled"
268
- this.#label.className = "select_label_disabled"
286
+ this.#Select_second.classList.add("selectbox_disabled");
287
+ this.#input.className = "selectbox_input_disabled";
288
+ this.#label.className = "select_label_disabled";
269
289
  this.#button_open.remove();
270
290
  this.#Select_second.appendChild(this.#button_open_disabled);
271
291
  } else {
272
- this.#Select_second.classList.remove("selectbox_disabled")
273
- this.#input.className = "selectbox_input"
274
- this.#label.className = "select_label"
292
+ this.#Select_second.classList.remove("selectbox_disabled");
293
+ this.#input.className = "selectbox_input";
294
+ this.#label.className = "select_label";
275
295
  this.#button_open_disabled.remove();
276
296
  this.#Select_second.appendChild(this.#button_open);
277
297
  }
@@ -280,25 +300,29 @@ class Select {
280
300
  // Рамку активного поля держит общее правило темы (`selectbox:focus-within`
281
301
  // в global_style.css, вместе с кольцом), а не индайн компонента: индайновая рамка
282
302
  // перебивала тему и мешала централизации состояний
283
- this.#button_open.style.transform = opened ? 'rotate(180deg)' : 'rotate(0deg)'
303
+ this.#button_open.style.transform = opened ? "rotate(180deg)" : "rotate(0deg)";
284
304
  }
285
305
  #setDropdownDirection() {
286
306
  const placement = dropdownPlacement(this.#dropdown, this.#Select_second);
287
307
  // Зазор до поля держит CSS (`top: calc(100% + 4px)`), вверх — то же число через `bottom`:
288
308
  // так список отстоит от поля на один зазор в обе стороны (вверх - `bottom`)
289
- this.#dropdown.style.top = placement.up ? 'auto' : '';
290
- this.#dropdown.style.bottom = placement.up ? 'calc(100% + 4px)' : '';
309
+ this.#dropdown.style.top = placement.up ? "auto" : "";
310
+ this.#dropdown.style.bottom = placement.up ? "calc(100% + 4px)" : "";
291
311
  // Слой не вылезает за видимую часть контейнера: лишнее уходит в прокрутку списка
292
312
  if (placement.maxHeight > 0) this.#dropdown.style.maxHeight = `${placement.maxHeight}px`;
293
- else this.#dropdown.style.removeProperty('max-height');
313
+ else this.#dropdown.style.removeProperty("max-height");
314
+ }
315
+ set() {
316
+ return this.#Select_main;
294
317
  }
295
- set() { return this.#Select_main; }
296
318
  }
297
319
 
298
320
  function setOptionDisplay(element = new HTMLElement()) {
299
321
  // Скрытый фильтром вариант показывается снятием инлайнового `display`:
300
322
  // базовый вид строки (блок) задаёт CSS, а не этот обход
301
- for (let option of element.childNodes) { option.style.removeProperty("display"); }
323
+ for (let option of element.childNodes) {
324
+ option.style.removeProperty("display");
325
+ }
302
326
  }
303
327
 
304
- exports.Select = Select
328
+ exports.Select = Select;
@@ -9,12 +9,12 @@ chui_selectbox {
9
9
  flex-direction: column;
10
10
  height: max-content;
11
11
  margin: var(--margin);
12
- width: var(--control_width)
12
+ width: var(--control_width);
13
13
  }
14
14
 
15
15
  selectbox {
16
16
  position: relative;
17
- display:flex;
17
+ display: flex;
18
18
  outline: none;
19
19
  height: max-content;
20
20
  width: -webkit-fill-available;
@@ -28,7 +28,7 @@ selectbox {
28
28
 
29
29
  .selectbox_input {
30
30
  cursor: pointer;
31
- width:100%;
31
+ width: 100%;
32
32
  display: block;
33
33
  outline: none;
34
34
  margin: 0;
@@ -59,8 +59,8 @@ selectbox_dropdown {
59
59
  -webkit-backdrop-filter: var(--global_blur);
60
60
  color: var(--text_color);
61
61
  outline: none;
62
- position:absolute;
63
- display:none;
62
+ position: absolute;
63
+ display: none;
64
64
  height: max-content;
65
65
  border-radius: var(--border_radius);
66
66
  padding: var(--control_padding);
@@ -124,8 +124,8 @@ selectbox_option:active {
124
124
  width: max-content;
125
125
  margin: 0 0 var(--margin);
126
126
  font-size: var(--font_labels_size);
127
- font-weight:500;
128
- color: var(--text_color)
127
+ font-weight: 500;
128
+ color: var(--text_color);
129
129
  }
130
130
 
131
131
  /* DISABLED STYLES */
@@ -137,7 +137,7 @@ selectbox_option:active {
137
137
 
138
138
  .selectbox_input_disabled {
139
139
  cursor: not-allowed;
140
- width:100%;
140
+ width: 100%;
141
141
  margin: 0;
142
142
  padding: var(--control_padding) 0 var(--main_padding);
143
143
  background: transparent;
@@ -162,6 +162,6 @@ selectbox_option:active {
162
162
  width: max-content;
163
163
  margin: 0 0 var(--margin);
164
164
  font-size: var(--font_labels_size);
165
- font-weight:500;
166
- color: var(--text_color_disabled)
167
- }
165
+ font-weight: 500;
166
+ color: var(--text_color_disabled);
167
+ }
@@ -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
  * Ползунок: одно значение или диапазон (`range: true`).
@@ -48,23 +48,25 @@ class Slider {
48
48
  #input_listeners = [];
49
49
  #dragging = undefined;
50
50
 
51
- constructor(options = {
52
- id: String(),
53
- name: String(),
54
- title: String(),
55
- label: String(),
56
- min: Number(),
57
- max: Number(),
58
- step: Number(),
59
- value: undefined,
60
- range: Boolean(),
61
- disabled: Boolean(),
62
- width: String(),
63
- showValue: Boolean(),
64
- format: undefined,
65
- changeListener: undefined,
66
- inputListener: undefined
67
- }) {
51
+ constructor(
52
+ options = {
53
+ id: String(),
54
+ name: String(),
55
+ title: String(),
56
+ label: String(),
57
+ min: Number(),
58
+ max: Number(),
59
+ step: Number(),
60
+ value: undefined,
61
+ range: Boolean(),
62
+ disabled: Boolean(),
63
+ width: String(),
64
+ showValue: Boolean(),
65
+ format: undefined,
66
+ changeListener: undefined,
67
+ inputListener: undefined,
68
+ }
69
+ ) {
68
70
  setStyles(__dirname + "/styles.css", "chUiJS_Slider");
69
71
  Slider.#counter += 1;
70
72
  this.#id = options.id === undefined ? `chui_slider_${Slider.#counter}` : options.id;
@@ -93,9 +95,7 @@ class Slider {
93
95
  if (options.title !== undefined) this.setTitle(options.title);
94
96
  else this.#header.hidden = true;
95
97
  if (options.showValue === false) this.#value_text.hidden = true;
96
- this.setValue(options.value === undefined
97
- ? (this.#range ? [this.#min, this.#max] : this.#min)
98
- : options.value);
98
+ this.setValue(options.value === undefined ? (this.#range ? [this.#min, this.#max] : this.#min) : options.value);
99
99
  if (options.disabled === true) this.setDisabled(true);
100
100
  if (options.width !== undefined) this.setWidth(options.width);
101
101
  if (options.changeListener !== undefined) this.addChangeListener(options.changeListener);
@@ -279,9 +279,12 @@ class Slider {
279
279
  }
280
280
 
281
281
  #thumbLabel(index = Number()) {
282
- const base = this.#label === undefined
283
- ? (this.#title_text === undefined ? I18n.t("forms.sliderValue") : this.#title_text)
284
- : this.#label;
282
+ const base =
283
+ this.#label === undefined
284
+ ? this.#title_text === undefined
285
+ ? I18n.t("forms.sliderValue")
286
+ : this.#title_text
287
+ : this.#label;
285
288
  if (!this.#range) return base;
286
289
  return `${base}: ${index === 0 ? I18n.t("forms.sliderMin") : I18n.t("forms.sliderMax")}`;
287
290
  }
@@ -422,4 +425,4 @@ class Slider {
422
425
  };
423
426
  }
424
427
 
425
- exports.Slider = Slider
428
+ exports.Slider = Slider;
@@ -76,7 +76,8 @@ slider_thumb {
76
76
  /* Кружок целиком — 20px: рамка 2px прибавляется к 16px, а не входит в них, поэтому
77
77
  половина равна 10px. С прежними -8px бегунок стоял на 2px ниже дорожки
78
78
  и на 2px правее своего значения */
79
- margin-block: -10px 0; margin-inline: -10px 0;
79
+ margin-block: -10px 0;
80
+ margin-inline: -10px 0;
80
81
  border-radius: var(--radius_circle);
81
82
  background: var(--blue_prime_background);
82
83
  border: 2px solid var(--main_background);