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,16 +1,16 @@
1
- const {setStyles} = require("../../modules/chui_functions");
2
- const {Validate} = require("../../modules/chui_validate/chui_validate");
3
- const {Json} = require("../../modules/chui_json/chui_json");
4
- const {RovingKeyboard} = require("../../modules/chui_a11y/chui_a11y");
5
- const {CodeEditor} = require("../chui_code_editor/code_editor");
6
- const {JsonViewer} = require("../chui_json_viewer/json_viewer");
7
- const {I18n} = require("../../modules/chui_i18n/chui_i18n");
1
+ const { setStyles } = require("../../modules/chui_functions");
2
+ const { Validate } = require("../../modules/chui_validate/chui_validate");
3
+ const { Json } = require("../../modules/chui_json/chui_json");
4
+ const { RovingKeyboard } = require("../../modules/chui_a11y/chui_a11y");
5
+ const { CodeEditor } = require("../chui_code_editor/code_editor");
6
+ const { JsonViewer } = require("../chui_json_viewer/json_viewer");
7
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
8
8
 
9
9
  /** Кнопки панели: ключ подписи, ключ подсказки и действие */
10
10
  const ACTIONS = [
11
- {id: "format", labelKey: "jsonEditor.format", hintKey: "jsonEditor.formatHint"},
12
- {id: "minify", labelKey: "jsonEditor.minify", hintKey: "jsonEditor.minifyHint"},
13
- {id: "check", labelKey: "jsonEditor.check", hintKey: "jsonEditor.checkHint"}
11
+ { id: "format", labelKey: "jsonEditor.format", hintKey: "jsonEditor.formatHint" },
12
+ { id: "minify", labelKey: "jsonEditor.minify", hintKey: "jsonEditor.minifyHint" },
13
+ { id: "check", labelKey: "jsonEditor.check", hintKey: "jsonEditor.checkHint" },
14
14
  ];
15
15
 
16
16
  /**
@@ -54,64 +54,66 @@ class JsonEditor {
54
54
  #panes = document.createElement("json_editor_panes");
55
55
  #editor = undefined;
56
56
  #viewer = undefined;
57
- #tree_button = undefined;
57
+ #treeButton = undefined;
58
58
  #actions = new Map();
59
59
  #state = document.createElement("json_editor_state");
60
- #parse_line = document.createElement("json_editor_parse");
60
+ #parseLine = document.createElement("json_editor_parse");
61
61
  #count = document.createElement("json_editor_count");
62
62
  #hint = document.createElement("json_editor_hint");
63
63
  #status = document.createElement("json_editor_status");
64
64
  #error = document.createElement("chui_error_message");
65
65
  #id = undefined;
66
66
  #name = undefined;
67
- #title_text = undefined;
68
- #label_text = undefined;
67
+ #titleText = undefined;
68
+ #labelText = undefined;
69
69
  #indent = 4;
70
- #preview_enabled = false;
71
- #preview_on = false;
72
- #max_length = undefined;
70
+ #previewEnabled = false;
71
+ #previewOn = false;
72
+ #maxLength = undefined;
73
73
  #width = undefined;
74
74
  #height = "260px";
75
75
  #disabled = false;
76
- #read_only = false;
77
- #toolbar_shown = true;
76
+ #readOnly = false;
77
+ #toolbarShown = true;
78
78
  #parsed = undefined;
79
- #error_object = undefined;
79
+ #errorObject = undefined;
80
80
  #listeners = [];
81
- #on_change = undefined;
82
- #notify_paused = false;
83
-
84
- constructor(options = {
85
- id: String(),
86
- name: String(),
87
- title: String(),
88
- label: String(),
89
- hint: String(),
90
- value: String(),
91
- data: undefined,
92
- height: String(),
93
- width: String(),
94
- indent: Number(),
95
- toolbar: Boolean(),
96
- preview: Boolean(),
97
- maxLength: Number(),
98
- disabled: Boolean(),
99
- readOnly: Boolean(),
100
- required: Boolean(),
101
- messages: Object(),
102
- changeListener: undefined,
103
- onChange: undefined
104
- }) {
81
+ #onChange = undefined;
82
+ #notifyPaused = false;
83
+
84
+ constructor(
85
+ options = {
86
+ id: String(),
87
+ name: String(),
88
+ title: String(),
89
+ label: String(),
90
+ hint: String(),
91
+ value: String(),
92
+ data: undefined,
93
+ height: String(),
94
+ width: String(),
95
+ indent: Number(),
96
+ toolbar: Boolean(),
97
+ preview: Boolean(),
98
+ maxLength: Number(),
99
+ disabled: Boolean(),
100
+ readOnly: Boolean(),
101
+ required: Boolean(),
102
+ messages: Object(),
103
+ changeListener: undefined,
104
+ onChange: undefined,
105
+ }
106
+ ) {
105
107
  setStyles(__dirname + "/styles.css", "chUiJS_JsonEditor");
106
108
  JsonEditor.#counter += 1;
107
109
  this.#id = options.id === undefined ? `chui_json_editor_${JsonEditor.#counter}` : options.id;
108
110
  this.#name = options.name;
109
- this.#label_text = options.label;
110
- this.#on_change = options.onChange;
111
+ this.#labelText = options.label;
112
+ this.#onChange = options.onChange;
111
113
  this.#indent = options.indent === undefined ? 4 : Number(options.indent);
112
- this.#preview_enabled = options.preview === true;
113
- this.#toolbar_shown = options.toolbar !== false;
114
- this.#max_length = options.maxLength === undefined ? undefined : Number(options.maxLength);
114
+ this.#previewEnabled = options.preview === true;
115
+ this.#toolbarShown = options.toolbar !== false;
116
+ this.#maxLength = options.maxLength === undefined ? undefined : Number(options.maxLength);
115
117
  this.#root.id = this.#id;
116
118
  this.#label.className = "json_editor_label";
117
119
  this.#label.hidden = true;
@@ -120,7 +122,7 @@ class JsonEditor {
120
122
  this.#toolbar.setAttribute("aria-label", I18n.t("jsonEditor.actions"));
121
123
  this.#panes.className = "json_editor_panes";
122
124
  this.#state.className = "json_editor_state";
123
- this.#parse_line.className = "json_editor_parse";
125
+ this.#parseLine.className = "json_editor_parse";
124
126
  this.#count.className = "json_editor_count";
125
127
  this.#count.setAttribute("aria-hidden", "true");
126
128
  this.#hint.className = "json_editor_hint";
@@ -136,28 +138,28 @@ class JsonEditor {
136
138
  this.#root.appendChild(this.#toolbar);
137
139
  this.#root.appendChild(this.#panes);
138
140
  // Состояние разбора и счётчик знаков — одна строка под полем
139
- this.#state.appendChild(this.#parse_line);
141
+ this.#state.appendChild(this.#parseLine);
140
142
  this.#state.appendChild(this.#count);
141
143
  this.#root.appendChild(this.#state);
142
144
  this.#root.appendChild(this.#hint);
143
145
  this.#root.appendChild(this.#status);
144
146
  if (options.title !== undefined) this.setTitle(options.title);
145
- this.setLabel(this.#label_text === undefined ? I18n.t("jsonEditor.text") : this.#label_text);
147
+ this.setLabel(this.#labelText === undefined ? I18n.t("jsonEditor.text") : this.#labelText);
146
148
  if (options.hint !== undefined) this.setHint(options.hint);
147
149
  if (options.width !== undefined) this.setWidth(options.width);
148
150
  this.setHeight(options.height === undefined ? this.#height : options.height);
149
151
  if (options.data !== undefined) this.setData(options.data);
150
152
  else this.setValue(options.value === undefined ? "" : options.value);
151
153
  Validate.installField(this, options, this.#root, this.#error, () => this.getValue(), this.#panes);
152
- const base_validate = this.validate;
154
+ const baseValidate = this.validate;
153
155
  // Разбор JSON — обязательное правило поля: неразобранный текст не проходит проверку,
154
156
  // даже если своих правил у поля нет. Правило называется `json`, чтобы по имени было
155
157
  // видно причину, а правила формы и своё правило из опций при этом сохраняются
156
158
  // (своё правило из опций тоже приходит сюда как `validate` — и тоже зовётся `json`)
157
159
  this.validate = () => {
158
- const result = base_validate();
160
+ const result = baseValidate();
159
161
  if (result.valid === false) {
160
- if (result.rule === "validate") return {valid: false, rule: "json", message: result.message};
162
+ if (result.rule === "validate") return { valid: false, rule: "json", message: result.message };
161
163
  return result;
162
164
  }
163
165
  const text = this.getValue();
@@ -165,11 +167,11 @@ class JsonEditor {
165
167
  if (text.trim() === "") return result;
166
168
  const state = Json.parse(text);
167
169
  if (state.ok) return result;
168
- return {valid: false, rule: "json", message: Json.errorText(state.error)};
170
+ return { valid: false, rule: "json", message: Json.errorText(state.error) };
169
171
  };
170
172
  this.setReadOnly(options.readOnly === true);
171
173
  this.setDisabled(options.disabled === true);
172
- this.setToolbar(this.#toolbar_shown);
174
+ this.setToolbar(this.#toolbarShown);
173
175
  if (options.changeListener !== undefined) this.addChangeListener(options.changeListener);
174
176
  }
175
177
 
@@ -183,11 +185,11 @@ class JsonEditor {
183
185
  }
184
186
 
185
187
  getTitle() {
186
- return this.#title_text;
188
+ return this.#titleText;
187
189
  }
188
190
 
189
191
  getLabel() {
190
- return this.#label_text;
192
+ return this.#labelText;
191
193
  }
192
194
 
193
195
  /** Текст JSON как есть */
@@ -203,13 +205,13 @@ class JsonEditor {
203
205
 
204
206
  /** Место ошибки разбора: `{line, column, offset}` или `undefined` (у ошибки может не быть места) */
205
207
  getErrorPlace() {
206
- if (this.#error_object === undefined || this.#error_object.offset === undefined) return undefined;
207
- return {line: this.#error_object.line, column: this.#error_object.column, offset: this.#error_object.offset};
208
+ if (this.#errorObject === undefined || this.#errorObject.offset === undefined) return undefined;
209
+ return { line: this.#errorObject.line, column: this.#errorObject.column, offset: this.#errorObject.offset };
208
210
  }
209
211
 
210
212
  /** Текст ошибки разбора словами (пустая строка, если разбор прошёл) */
211
213
  getErrorText() {
212
- return Json.errorText(this.#error_object);
214
+ return Json.errorText(this.#errorObject);
213
215
  }
214
216
 
215
217
  isValid() {
@@ -217,15 +219,15 @@ class JsonEditor {
217
219
  }
218
220
 
219
221
  isPreview() {
220
- return this.#preview_on;
222
+ return this.#previewOn;
221
223
  }
222
224
 
223
225
  isPreviewEnabled() {
224
- return this.#preview_enabled;
226
+ return this.#previewEnabled;
225
227
  }
226
228
 
227
229
  getMaxLength() {
228
- return this.#max_length;
230
+ return this.#maxLength;
229
231
  }
230
232
 
231
233
  getHeight() {
@@ -241,7 +243,7 @@ class JsonEditor {
241
243
  }
242
244
 
243
245
  isReadOnly() {
244
- return this.#read_only;
246
+ return this.#readOnly;
245
247
  }
246
248
 
247
249
  getDisabled() {
@@ -277,7 +279,7 @@ class JsonEditor {
277
279
  }
278
280
 
279
281
  setTitle(text = undefined) {
280
- this.#title_text = text;
282
+ this.#titleText = text;
281
283
  if (text === undefined || text === "") {
282
284
  this.#label.innerText = "";
283
285
  this.#label.hidden = true;
@@ -292,7 +294,7 @@ class JsonEditor {
292
294
 
293
295
  /** Имя поля, когда подписи в разметке нет */
294
296
  setLabel(text = undefined) {
295
- this.#label_text = text;
297
+ this.#labelText = text;
296
298
  this.#syncLabel();
297
299
  return this;
298
300
  }
@@ -314,10 +316,10 @@ class JsonEditor {
314
316
  setValue(value = String(), silent = false) {
315
317
  const text = value === undefined || value === null ? "" : String(value);
316
318
  // В тихом режиме (так зовёт Form.setValues) слишком длинный текст не подставляем
317
- if (silent === true && this.#max_length !== undefined && text.length > this.#max_length) return this;
318
- this.#notify_paused = true;
319
+ if (silent === true && this.#maxLength !== undefined && text.length > this.#maxLength) return this;
320
+ this.#notifyPaused = true;
319
321
  this.#editor.setValue(text);
320
- this.#notify_paused = false;
322
+ this.#notifyPaused = false;
321
323
  this.#refresh();
322
324
  return this;
323
325
  }
@@ -329,9 +331,9 @@ class JsonEditor {
329
331
 
330
332
  /** Очистка для форм */
331
333
  clear() {
332
- this.#notify_paused = true;
334
+ this.#notifyPaused = true;
333
335
  this.#editor.setValue("");
334
- this.#notify_paused = false;
336
+ this.#notifyPaused = false;
335
337
  this.#refresh();
336
338
  return this;
337
339
  }
@@ -363,27 +365,32 @@ class JsonEditor {
363
365
 
364
366
  /** Предпросмотр деревом (`JsonViewer`) вместо поля */
365
367
  setPreview(on = Boolean()) {
366
- if (!this.#preview_enabled) return this;
367
- this.#preview_on = on === true;
368
- if (this.#preview_on) this.#buildViewer();
369
- this.#editor.set().hidden = this.#preview_on;
370
- if (this.#viewer !== undefined) this.#viewer.set().hidden = !this.#preview_on;
371
- if (this.#tree_button !== undefined) {
372
- this.#tree_button.setAttribute("aria-pressed", this.#preview_on ? "true" : "false");
373
- this.#tree_button.setAttribute("aria-label", this.#preview_on ? I18n.t("jsonEditor.showText") : I18n.t("jsonEditor.showTree"));
374
- this.#tree_button.innerText = this.#preview_on ? I18n.t("jsonEditor.textShort") : I18n.t("jsonEditor.treeShort");
368
+ if (!this.#previewEnabled) return this;
369
+ this.#previewOn = on === true;
370
+ if (this.#previewOn) this.#buildViewer();
371
+ this.#editor.set().hidden = this.#previewOn;
372
+ if (this.#viewer !== undefined) this.#viewer.set().hidden = !this.#previewOn;
373
+ if (this.#treeButton !== undefined) {
374
+ this.#treeButton.setAttribute("aria-pressed", this.#previewOn ? "true" : "false");
375
+ this.#treeButton.setAttribute(
376
+ "aria-label",
377
+ this.#previewOn ? I18n.t("jsonEditor.showText") : I18n.t("jsonEditor.showTree")
378
+ );
379
+ this.#treeButton.innerText = this.#previewOn
380
+ ? I18n.t("jsonEditor.textShort")
381
+ : I18n.t("jsonEditor.treeShort");
375
382
  }
376
383
  return this;
377
384
  }
378
385
 
379
386
  togglePreview() {
380
- return this.setPreview(!this.#preview_on);
387
+ return this.setPreview(!this.#previewOn);
381
388
  }
382
389
 
383
390
  /** Панель действий: `false` её убирает, поле остаётся полем */
384
391
  setToolbar(shown = Boolean()) {
385
- this.#toolbar_shown = shown !== false;
386
- this.#toolbar.hidden = !this.#toolbar_shown;
392
+ this.#toolbarShown = shown !== false;
393
+ this.#toolbar.hidden = !this.#toolbarShown;
387
394
  return this;
388
395
  }
389
396
 
@@ -406,10 +413,10 @@ class JsonEditor {
406
413
  return this;
407
414
  }
408
415
 
409
- setReadOnly(read_only = Boolean()) {
410
- this.#read_only = read_only === true;
411
- this.#root.classList.toggle("json_editor_readonly", this.#read_only);
412
- this.#editor.setReadOnly(this.#read_only);
416
+ setReadOnly(readOnly = Boolean()) {
417
+ this.#readOnly = readOnly === true;
418
+ this.#root.classList.toggle("json_editor_readonly", this.#readOnly);
419
+ this.#editor.setReadOnly(this.#readOnly);
413
420
  this.#actionState();
414
421
  return this;
415
422
  }
@@ -432,7 +439,7 @@ class JsonEditor {
432
439
  /** Фокус в поле (из предпросмотра поле возвращается) */
433
440
  focus() {
434
441
  if (this.#disabled) return this;
435
- if (this.#preview_on) this.setPreview(false);
442
+ if (this.#previewOn) this.setPreview(false);
436
443
  this.#editor.focus();
437
444
  return this;
438
445
  }
@@ -450,7 +457,7 @@ class JsonEditor {
450
457
  value: "",
451
458
  height: this.#height,
452
459
  lineNumbers: true,
453
- onChange: () => this.#onInput()
460
+ onChange: () => this.#onInput(),
454
461
  });
455
462
  this.#editor.setLabel(this.#accessibleName());
456
463
  const area = this.#editor.getTextArea();
@@ -473,20 +480,20 @@ class JsonEditor {
473
480
  this.#actions.set(action.id, button);
474
481
  this.#toolbar.appendChild(button);
475
482
  }
476
- if (this.#preview_enabled) {
477
- this.#tree_button = document.createElement("button");
478
- this.#tree_button.type = "button";
479
- this.#tree_button.className = "json_editor_action json_editor_tree";
480
- this.#tree_button.setAttribute("aria-pressed", "false");
481
- this.#tree_button.setAttribute("aria-label", I18n.t("jsonEditor.showTree"));
483
+ if (this.#previewEnabled) {
484
+ this.#treeButton = document.createElement("button");
485
+ this.#treeButton.type = "button";
486
+ this.#treeButton.className = "json_editor_action json_editor_tree";
487
+ this.#treeButton.setAttribute("aria-pressed", "false");
488
+ this.#treeButton.setAttribute("aria-label", I18n.t("jsonEditor.showTree"));
482
489
  // `aria-controls` появится в `#buildViewer()`: до первого показа дерева узла
483
490
  // нет, а ссылка на несуществующий id — висячая
484
- this.#tree_button.innerText = I18n.t("jsonEditor.treeShort");
485
- this.#tree_button.addEventListener("click", () => this.togglePreview());
486
- this.#toolbar.appendChild(this.#tree_button);
491
+ this.#treeButton.innerText = I18n.t("jsonEditor.treeShort");
492
+ this.#treeButton.addEventListener("click", () => this.togglePreview());
493
+ this.#toolbar.appendChild(this.#treeButton);
487
494
  }
488
495
  // Панель — одна остановка обхода: по кнопкам ходят стрелки/Home/End
489
- new RovingKeyboard(this.#toolbar, {itemSelector: "button"});
496
+ new RovingKeyboard(this.#toolbar, { itemSelector: "button" });
490
497
  return this;
491
498
  }
492
499
 
@@ -498,18 +505,18 @@ class JsonEditor {
498
505
  }
499
506
  this.#viewer = new JsonViewer({
500
507
  id: `${this.#id}_tree`,
501
- label: I18n.t("jsonEditor.treeLabel", {name: this.#accessibleName()}),
508
+ label: I18n.t("jsonEditor.treeLabel", { name: this.#accessibleName() }),
502
509
  value: this.getParsed(),
503
- emptyText: I18n.t("jsonEditor.unparsed")
510
+ emptyText: I18n.t("jsonEditor.unparsed"),
504
511
  });
505
512
  this.#viewer.set().hidden = true;
506
513
  this.#panes.appendChild(this.#viewer.set());
507
- this.#tree_button.setAttribute("aria-controls", this.#viewer.getId());
514
+ this.#treeButton.setAttribute("aria-controls", this.#viewer.getId());
508
515
  return this;
509
516
  }
510
517
 
511
518
  #runAction(id = String()) {
512
- if (this.#disabled || this.#read_only) return this;
519
+ if (this.#disabled || this.#readOnly) return this;
513
520
  if (id === "format") this.format();
514
521
  else if (id === "minify") this.minify();
515
522
  else if (id === "check") this.check();
@@ -541,17 +548,17 @@ class JsonEditor {
541
548
  }
542
549
 
543
550
  #refuseAction(error = Object()) {
544
- this.#error_object = error;
545
- this.#parse_line.classList.add("json_editor_parse_error");
546
- this.#parse_line.innerText = Json.errorText(error);
551
+ this.#errorObject = error;
552
+ this.#parseLine.classList.add("json_editor_parse_error");
553
+ this.#parseLine.innerText = Json.errorText(error);
547
554
  this.#announce(Json.errorText(error));
548
555
  return this;
549
556
  }
550
557
 
551
558
  #actionState() {
552
- const off = this.#disabled || this.#read_only;
559
+ const off = this.#disabled || this.#readOnly;
553
560
  for (const button of this.#actions.values()) button.disabled = off;
554
- if (this.#tree_button !== undefined) this.#tree_button.disabled = this.#disabled;
561
+ if (this.#treeButton !== undefined) this.#treeButton.disabled = this.#disabled;
555
562
  return this;
556
563
  }
557
564
 
@@ -576,25 +583,26 @@ class JsonEditor {
576
583
  area.id = `${this.#id}_input`;
577
584
  // Подпись — настоящий <label>: связь с полем держим всегда, а видимость — по подписи
578
585
  this.#label.setAttribute("for", area.id);
579
- if (this.#title_text !== undefined && this.#title_text !== "") area.removeAttribute("aria-label");
586
+ if (this.#titleText !== undefined && this.#titleText !== "") area.removeAttribute("aria-label");
580
587
  else area.setAttribute("aria-label", this.#accessibleName());
581
588
  this.#syncDescribedBy();
582
- if (this.#viewer !== undefined) this.#viewer.setLabel(I18n.t("jsonEditor.treeLabel", {name: this.#accessibleName()}));
589
+ if (this.#viewer !== undefined)
590
+ this.#viewer.setLabel(I18n.t("jsonEditor.treeLabel", { name: this.#accessibleName() }));
583
591
  return this;
584
592
  }
585
593
 
586
594
  #accessibleName() {
587
- if (this.#title_text !== undefined && this.#title_text !== "") return this.#title_text;
588
- if (this.#label_text !== undefined && this.#label_text !== "") return this.#label_text;
595
+ if (this.#titleText !== undefined && this.#titleText !== "") return this.#titleText;
596
+ if (this.#labelText !== undefined && this.#labelText !== "") return this.#labelText;
589
597
  return I18n.t("jsonEditor.text");
590
598
  }
591
599
 
592
600
  #syncCount() {
593
- const has_limit = this.#max_length !== undefined;
594
- this.#count.hidden = !has_limit;
595
- if (!has_limit) return this;
596
- this.#count.innerText = `${this.getValue().length} / ${this.#max_length}`;
597
- this.#count.classList.toggle("json_editor_count_over", this.getValue().length > this.#max_length);
601
+ const hasLimit = this.#maxLength !== undefined;
602
+ this.#count.hidden = !hasLimit;
603
+ if (!hasLimit) return this;
604
+ this.#count.innerText = `${this.getValue().length} / ${this.#maxLength}`;
605
+ this.#count.classList.toggle("json_editor_count_over", this.getValue().length > this.#maxLength);
598
606
  return this;
599
607
  }
600
608
 
@@ -609,13 +617,15 @@ class JsonEditor {
609
617
  const state = Json.parse(text);
610
618
  // Пустое поле — не ошибка разбора (так же считает и `validate` ниже): `JSON.parse("")`
611
619
  // бросает исключение, но показывать его как ошибку нельзя — поле просто пустое
612
- this.#error_object = state.ok || blank ? undefined : state.error;
620
+ this.#errorObject = state.ok || blank ? undefined : state.error;
613
621
  this.#parsed = state.ok ? state.value : undefined;
614
- this.#parse_line.classList.toggle("json_editor_parse_error", !state.ok && blank === false);
615
- this.#parse_line.classList.toggle("json_editor_parse_ok", state.ok && blank === false);
616
- this.#parse_line.innerText = blank
622
+ this.#parseLine.classList.toggle("json_editor_parse_error", !state.ok && blank === false);
623
+ this.#parseLine.classList.toggle("json_editor_parse_ok", state.ok && blank === false);
624
+ this.#parseLine.innerText = blank
617
625
  ? I18n.t("jsonEditor.empty")
618
- : state.ok ? I18n.t("jsonEditor.correct") : Json.errorText(state.error);
626
+ : state.ok
627
+ ? I18n.t("jsonEditor.correct")
628
+ : Json.errorText(state.error);
619
629
  this.#syncCount();
620
630
  if (this.#viewer !== undefined && this.#viewer.set().hidden === false) this.#viewer.setValue(this.#parsed);
621
631
  return this;
@@ -629,15 +639,15 @@ class JsonEditor {
629
639
  #notify() {
630
640
  const value = this.getValue();
631
641
  for (const listener of [...this.#listeners]) listener(value, this);
632
- if (this.#on_change !== undefined) this.#on_change(value, this);
642
+ if (this.#onChange !== undefined) this.#onChange(value, this);
633
643
  return this;
634
644
  }
635
645
 
636
646
  #onInput = () => {
637
647
  this.#refresh();
638
- if (this.#notify_paused) return;
648
+ if (this.#notifyPaused) return;
639
649
  this.#notify();
640
650
  };
641
651
  }
642
652
 
643
- exports.JsonEditor = JsonEditor
653
+ exports.JsonEditor = JsonEditor;
@@ -8,14 +8,14 @@ chui_json_editor {
8
8
  width: -webkit-fill-available;
9
9
  max-width: 100%;
10
10
  height: max-content;
11
- margin: var(--margin);
11
+ margin: var(--block_margin);
12
12
  color: var(--text_color);
13
13
  }
14
14
 
15
15
  .json_editor_label {
16
16
  display: block;
17
17
  width: max-content;
18
- margin: var(--margin);
18
+ margin: var(--block_margin);
19
19
  color: var(--text_color);
20
20
  font-size: var(--font_labels_size);
21
21
  font-weight: 500;
@@ -34,7 +34,7 @@ chui_json_editor {
34
34
  padding: 4px;
35
35
  border: 1px solid var(--border_color);
36
36
  border-bottom: none;
37
- border-radius: var(--border_radius) var(--border_radius) 0 0;
37
+ border-radius: var(--radius_sm) var(--radius_sm) 0 0;
38
38
  background: var(--element_background_2);
39
39
  }
40
40
 
@@ -44,7 +44,7 @@ chui_json_editor {
44
44
 
45
45
  /* Скрытая панель не оставляет углов: поле занимает всю рамку само */
46
46
  .json_editor_toolbar[hidden] + .json_editor_panes {
47
- border-radius: var(--border_radius);
47
+ border-radius: var(--radius_sm);
48
48
  }
49
49
 
50
50
  .json_editor_action {
@@ -91,7 +91,7 @@ chui_json_editor {
91
91
  box-sizing: border-box;
92
92
  overflow: hidden;
93
93
  border: 1px solid var(--border_color);
94
- border-radius: 0 0 var(--border_radius) var(--border_radius);
94
+ border-radius: 0 0 var(--radius_sm) var(--radius_sm);
95
95
  background: var(--element_background);
96
96
  }
97
97