chuijs 3.6.2 → 3.6.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 (119) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +1203 -162
  3. package/framework/appLayout/default/chui_app_layout.js +747 -747
  4. package/framework/appLayout/default/global_style.css +592 -568
  5. package/framework/appLayout/default/main_theme_style.css +118 -101
  6. package/framework/components/chui_accordion/accordion.js +63 -63
  7. package/framework/components/chui_accordion/styles.css +79 -75
  8. package/framework/components/chui_badge/badge.js +55 -55
  9. package/framework/components/chui_badge/styles.css +29 -29
  10. package/framework/components/chui_button/button.js +48 -48
  11. package/framework/components/chui_button/styles.css +75 -70
  12. package/framework/components/chui_calendar/calendar.js +97 -97
  13. package/framework/components/chui_card/card.js +87 -0
  14. package/framework/components/chui_card/styles.css +72 -0
  15. package/framework/components/chui_code/code.js +18 -18
  16. package/framework/components/chui_code/styles.css +9 -9
  17. package/framework/components/chui_console/console.js +27 -27
  18. package/framework/components/chui_console/styles.css +31 -31
  19. package/framework/components/chui_content_block/content_block.js +51 -51
  20. package/framework/components/chui_content_block/styles.css +2 -2
  21. package/framework/components/chui_context_menu/context_menu.js +230 -0
  22. package/framework/components/chui_context_menu/styles.css +136 -0
  23. package/framework/components/chui_custom_element/custom_element.js +24 -24
  24. package/framework/components/chui_details/details.js +85 -85
  25. package/framework/components/chui_details/styles.css +70 -66
  26. package/framework/components/chui_fieldset/fieldset.js +40 -40
  27. package/framework/components/chui_fieldset/styles.css +24 -24
  28. package/framework/components/chui_form/form.js +40 -40
  29. package/framework/components/chui_form/styles.css +21 -21
  30. package/framework/components/chui_graphs/graphs.js +234 -190
  31. package/framework/components/chui_graphs/styles.css +37 -32
  32. package/framework/components/chui_hero/hero.js +98 -0
  33. package/framework/components/chui_hero/styles.css +91 -0
  34. package/framework/components/chui_html_block/html_block.js +16 -16
  35. package/framework/components/chui_html_block/styles.css +5 -5
  36. package/framework/components/chui_hx/hx.js +15 -15
  37. package/framework/components/chui_hx/styles.css +38 -38
  38. package/framework/components/chui_icons/icons.js +2144 -2144
  39. package/framework/components/chui_icons/styles.css +13 -13
  40. package/framework/components/chui_inputs/chui_check_box/check_box.js +32 -32
  41. package/framework/components/chui_inputs/chui_check_box/styles.css +91 -86
  42. package/framework/components/chui_inputs/chui_combo_box/combo_box.js +166 -150
  43. package/framework/components/chui_inputs/chui_combo_box/styles.css +113 -107
  44. package/framework/components/chui_inputs/chui_date/date.js +177 -174
  45. package/framework/components/chui_inputs/chui_date/styles.css +163 -128
  46. package/framework/components/chui_inputs/chui_email/email.js +61 -61
  47. package/framework/components/chui_inputs/chui_email/styles.css +69 -71
  48. package/framework/components/chui_inputs/chui_file/file.js +76 -76
  49. package/framework/components/chui_inputs/chui_file/styles.css +99 -99
  50. package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +295 -295
  51. package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +212 -235
  52. package/framework/components/chui_inputs/chui_number/number.js +108 -108
  53. package/framework/components/chui_inputs/chui_number/styles.css +84 -84
  54. package/framework/components/chui_inputs/chui_password/password.js +99 -99
  55. package/framework/components/chui_inputs/chui_password/styles.css +97 -97
  56. package/framework/components/chui_inputs/chui_radio_button/radio_button.js +45 -45
  57. package/framework/components/chui_inputs/chui_radio_button/styles.css +76 -73
  58. package/framework/components/chui_inputs/chui_select_box/select_box.js +187 -170
  59. package/framework/components/chui_inputs/chui_select_box/styles.css +123 -117
  60. package/framework/components/chui_inputs/chui_text/styles.css +83 -84
  61. package/framework/components/chui_inputs/chui_text/text.js +91 -91
  62. package/framework/components/chui_inputs/chui_text_area/styles.css +57 -57
  63. package/framework/components/chui_inputs/chui_text_area/text_area.js +61 -61
  64. package/framework/components/chui_inputs/chui_toggle/styles.css +66 -61
  65. package/framework/components/chui_inputs/chui_toggle/toggle.js +36 -36
  66. package/framework/components/chui_label/label.js +54 -54
  67. package/framework/components/chui_label/styles.css +11 -11
  68. package/framework/components/chui_media/audio.js +908 -908
  69. package/framework/components/chui_media/audio_styles.css +458 -458
  70. package/framework/components/chui_media/image.js +105 -105
  71. package/framework/components/chui_media/image_styles.css +61 -61
  72. package/framework/components/chui_media/video.js +248 -248
  73. package/framework/components/chui_media/video_styles.css +160 -160
  74. package/framework/components/chui_menu_bar/menu_bar.js +66 -74
  75. package/framework/components/chui_menu_bar/styles.css +114 -76
  76. package/framework/components/chui_modal/modal.js +142 -135
  77. package/framework/components/chui_modal/styles.css +36 -36
  78. package/framework/components/chui_notification/notification.js +72 -72
  79. package/framework/components/chui_notification/notification_download.js +78 -78
  80. package/framework/components/chui_notification/notification_download_progress.css +119 -123
  81. package/framework/components/chui_notification/notification_download_progress.js +105 -105
  82. package/framework/components/chui_notification/notification_update.js +54 -54
  83. package/framework/components/chui_notification/styles.css +91 -91
  84. package/framework/components/chui_notification/styles_download.css +85 -85
  85. package/framework/components/chui_notification/styles_update.css +73 -73
  86. package/framework/components/chui_paragraph/paragraph.js +14 -14
  87. package/framework/components/chui_paragraph/styles.css +6 -6
  88. package/framework/components/chui_popups/popups.js +250 -250
  89. package/framework/components/chui_popups/styles.css +129 -115
  90. package/framework/components/chui_progress_bar/progress_bar.js +28 -28
  91. package/framework/components/chui_progress_bar/styles.css +28 -28
  92. package/framework/components/chui_radio_group/radio_group.js +57 -57
  93. package/framework/components/chui_radio_group/styles.css +3 -3
  94. package/framework/components/chui_slideshow/slideshow.js +75 -75
  95. package/framework/components/chui_slideshow/styles.css +94 -85
  96. package/framework/components/chui_spinner/spinner.js +45 -45
  97. package/framework/components/chui_spinner/styles.css +23 -23
  98. package/framework/components/chui_table/styles.css +42 -42
  99. package/framework/components/chui_table/table.js +234 -234
  100. package/framework/components/chui_tabs/chui_tabs.js +77 -77
  101. package/framework/components/chui_tabs/styles.css +54 -48
  102. package/framework/components/chui_text_editor/styles.css +217 -217
  103. package/framework/components/chui_text_editor/text_editor.js +144 -144
  104. package/framework/components/chui_text_editor/text_editor_panel.js +568 -568
  105. package/framework/components/chui_tree_view/styles.css +81 -75
  106. package/framework/components/chui_tree_view/tree_view.js +90 -90
  107. package/framework/components/chui_webview/styles.css +27 -27
  108. package/framework/components/chui_webview/webview.js +103 -103
  109. package/framework/components/telegram_bot/chui_telegram_bot.js +183 -183
  110. package/framework/modules/chui_animations/animations.js +121 -121
  111. package/framework/modules/chui_animations/styles.css +79 -79
  112. package/framework/modules/chui_fonts.js +7129 -6974
  113. package/framework/modules/chui_functions.js +106 -78
  114. package/framework/modules/chui_logger/chui_logger.js +53 -53
  115. package/framework/modules/chui_page/page.js +86 -86
  116. package/framework/modules/chui_page/styles.css +9 -9
  117. package/framework/tray_bar/chui_menu_items.js +48 -48
  118. package/index.js +570 -555
  119. package/package.json +51 -46
@@ -1,58 +1,58 @@
1
- chui_area_input {
2
- display: flex;
3
- flex-direction: column;
4
- width: 200px;
5
- height: max-content;
6
- margin: var(--margin);
7
- }
8
-
9
- .resize_off {
10
- resize: none
11
- }
12
-
13
- .resize_on {
14
- resize: auto
15
- }
16
-
17
- .area_input {
18
- height: inherit;
19
- width: -webkit-fill-available;
20
- border-radius: var(--border_radius);
21
- padding: var(--main_padding);
22
- font-size: var(--font_default_size);
23
- color: var(--text_color);
24
- background: var(--element_background);
25
- border: 1px solid var(--border_color);
26
- }
27
-
28
- .textarea_label {
29
- height: max-content;
30
- width: max-content;
31
- margin: var(--margin);
32
- font-size: var(--font_labels_size);
33
- font-weight:500;
34
- color: var(--text_color)
35
- }
36
-
37
- /* DISABLED STYLES */
38
- .area_input_disabled {
39
- cursor: not-allowed;
40
- height: inherit;
41
- width: -webkit-fill-available;
42
- border-radius: var(--border_radius);
43
- padding: var(--main_padding);
44
- font-size: var(--font_default_size);
45
- color: var(--text_color_disabled);
46
- background: var(--element_background_disabled);
47
- border: 1px solid var(--border_color);
48
- }
49
-
50
- .textarea_label_disabled {
51
- cursor: not-allowed;
52
- height: max-content;
53
- width: max-content;
54
- margin: var(--margin);
55
- font-size: var(--font_labels_size);
56
- font-weight:500;
57
- color: var(--text_color_disabled)
1
+ chui_area_input {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: var(--control_width);
5
+ height: max-content;
6
+ margin: var(--margin);
7
+ }
8
+
9
+ .resize_off {
10
+ resize: none
11
+ }
12
+
13
+ .resize_on {
14
+ resize: auto
15
+ }
16
+
17
+ .area_input {
18
+ height: inherit;
19
+ width: -webkit-fill-available;
20
+ border-radius: var(--border_radius);
21
+ padding: var(--main_padding);
22
+ font-size: var(--font_default_size);
23
+ color: var(--text_color);
24
+ background: var(--element_background);
25
+ border: 1px solid var(--border_color);
26
+ }
27
+
28
+ .textarea_label {
29
+ height: max-content;
30
+ width: max-content;
31
+ margin: var(--margin);
32
+ font-size: var(--font_labels_size);
33
+ font-weight:500;
34
+ color: var(--text_color)
35
+ }
36
+
37
+ /* DISABLED STYLES */
38
+ .area_input_disabled {
39
+ cursor: not-allowed;
40
+ height: inherit;
41
+ width: -webkit-fill-available;
42
+ border-radius: var(--border_radius);
43
+ padding: var(--main_padding);
44
+ font-size: var(--font_default_size);
45
+ color: var(--text_color_disabled);
46
+ background: var(--element_background_disabled);
47
+ border: 1px solid var(--border_color);
48
+ }
49
+
50
+ .textarea_label_disabled {
51
+ cursor: not-allowed;
52
+ height: max-content;
53
+ width: max-content;
54
+ margin: var(--margin);
55
+ font-size: var(--font_labels_size);
56
+ font-weight:500;
57
+ color: var(--text_color_disabled)
58
58
  }
@@ -1,61 +1,61 @@
1
- class TextArea {
2
- #id = require("randomstring").generate();
3
- #chui_text_input = document.createElement('chui_area_input');
4
- #text_area = document.createElement('textarea');
5
- #label = document.createElement('label');
6
- #title = undefined;
7
- constructor(options = {
8
- name: String(), title: String(), placeholder: String(),
9
- width: String(), height: String(), required: Boolean()
10
- }) {
11
- require('../../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_TextArea');
12
- this.#text_area.classList.add('area_input', 'resize_off');
13
- this.#text_area.id = this.#id;
14
- if (options.name !== undefined) this.#text_area.name = options.name;
15
- if (options.required !== undefined) this.#text_area.required = options.required;
16
- if (options.title !== undefined) {
17
- this.#title = options.title;
18
- this.#label.innerText = options.title;
19
- this.#label.classList.add('textarea_label')
20
- this.#label.setAttribute('for', this.#id);
21
- this.#chui_text_input.appendChild(this.#label);
22
- }
23
- if (options.placeholder !== undefined) this.#text_area.placeholder = options.placeholder;
24
- if (options.width !== undefined) this.#chui_text_input.style.width = options.width;
25
- if (options.height !== undefined) this.#chui_text_input.style.height = options.height;
26
- this.#text_area.addEventListener('focus', () => {
27
- this.#text_area.style.border = '1px solid var(--blue_prime_background)';
28
- if (options.title !== undefined) {
29
- this.#label.style.color = 'var(--blue_prime_background)';
30
- }
31
- })
32
- this.#text_area.addEventListener('blur', () => {
33
- this.#text_area.removeAttribute("style");
34
- if (options.title !== undefined) {
35
- this.#label.removeAttribute("style");
36
- }
37
- })
38
- this.#chui_text_input.appendChild(this.#text_area);
39
- }
40
- getName() { return this.#text_area.name; }
41
- getTitle() { return this.#title; }
42
- getValue() { return this.#text_area.value; }
43
- setValue(text = String()) { this.#text_area.value = text; }
44
- setDisabled(boolean = Boolean()) {
45
- this.#text_area.disabled = boolean
46
- if (boolean) {
47
- this.#text_area.classList.remove("area_input")
48
- this.#text_area.classList.add("area_input_disabled")
49
- this.#label.classList.remove("textarea_label")
50
- this.#label.classList.add("textarea_label_disabled")
51
- } else {
52
- this.#text_area.classList.add("area_input")
53
- this.#text_area.classList.remove("area_input_disabled")
54
- this.#label.classList.add("textarea_label")
55
- this.#label.classList.remove("textarea_label_disabled")
56
- }
57
- }
58
- set() { return this.#chui_text_input; }
59
- }
60
-
61
- exports.TextArea = TextArea
1
+ class TextArea {
2
+ #id = require("randomstring").generate();
3
+ #chui_text_input = document.createElement('chui_area_input');
4
+ #text_area = document.createElement('textarea');
5
+ #label = document.createElement('label');
6
+ #title = undefined;
7
+ constructor(options = {
8
+ name: String(), title: String(), placeholder: String(),
9
+ width: String(), height: String(), required: Boolean()
10
+ }) {
11
+ require('../../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_TextArea');
12
+ this.#text_area.classList.add('area_input', 'resize_off');
13
+ this.#text_area.id = this.#id;
14
+ if (options.name !== undefined) this.#text_area.name = options.name;
15
+ if (options.required !== undefined) this.#text_area.required = options.required;
16
+ if (options.title !== undefined) {
17
+ this.#title = options.title;
18
+ this.#label.innerText = options.title;
19
+ this.#label.classList.add('textarea_label')
20
+ this.#label.setAttribute('for', this.#id);
21
+ this.#chui_text_input.appendChild(this.#label);
22
+ }
23
+ if (options.placeholder !== undefined) this.#text_area.placeholder = options.placeholder;
24
+ if (options.width !== undefined) this.#chui_text_input.style.width = options.width;
25
+ if (options.height !== undefined) this.#chui_text_input.style.height = options.height;
26
+ this.#text_area.addEventListener('focus', () => {
27
+ this.#text_area.style.border = '1px solid var(--blue_prime_background)';
28
+ if (options.title !== undefined) {
29
+ this.#label.style.color = 'var(--blue_prime_background)';
30
+ }
31
+ })
32
+ this.#text_area.addEventListener('blur', () => {
33
+ this.#text_area.removeAttribute("style");
34
+ if (options.title !== undefined) {
35
+ this.#label.removeAttribute("style");
36
+ }
37
+ })
38
+ this.#chui_text_input.appendChild(this.#text_area);
39
+ }
40
+ getName() { return this.#text_area.name; }
41
+ getTitle() { return this.#title; }
42
+ getValue() { return this.#text_area.value; }
43
+ setValue(text = String()) { this.#text_area.value = text; }
44
+ setDisabled(boolean = Boolean()) {
45
+ this.#text_area.disabled = boolean
46
+ if (boolean) {
47
+ this.#text_area.classList.remove("area_input")
48
+ this.#text_area.classList.add("area_input_disabled")
49
+ this.#label.classList.remove("textarea_label")
50
+ this.#label.classList.add("textarea_label_disabled")
51
+ } else {
52
+ this.#text_area.classList.add("area_input")
53
+ this.#text_area.classList.remove("area_input_disabled")
54
+ this.#label.classList.add("textarea_label")
55
+ this.#label.classList.remove("textarea_label_disabled")
56
+ }
57
+ }
58
+ set() { return this.#chui_text_input; }
59
+ }
60
+
61
+ exports.TextArea = TextArea
@@ -1,62 +1,67 @@
1
- .switch {
2
- display: inline-block;
3
- width: 50px;
4
- height: 25px;
5
- border-radius: 50px;
6
- margin: var(--margin);
7
- background: var(--element_background);
8
- border: none;
9
- box-shadow: 0 0 1px 0 var(--element_background_2);
10
- }
11
-
12
- .switch input {
13
- opacity: 0;
14
- width: 0;
15
- height: 0;
16
- }
17
-
18
- .slider {
19
- cursor: pointer;
20
- position: absolute;
21
- top: 0;
22
- left: 0;
23
- right: 0;
24
- bottom: 0;
25
- background-color: var(--element_background);
26
- }
27
-
28
- .slider:before {
29
- position: absolute;
30
- content: '';
31
- height: 15px;
32
- width: 15px;
33
- left: 5px;
34
- bottom: 5px;
35
- background-color: var(--text_color);
36
- }
37
-
38
- input:checked + .slider:before {
39
- position: absolute;
40
- content: '';
41
- height: 15px;
42
- width: 15px;
43
- left: 5px;
44
- bottom: 5px;
45
- background-color: var(--text_color_hover);
46
- }
47
-
48
- input:checked + .slider {
49
- background: var(--blue_prime_background);
50
- }
51
-
52
- input:checked + .slider:before {
53
- transform: translateX(26px);
54
- }
55
-
56
- .slider.round {
57
- border-radius: 50px;
58
- }
59
-
60
- .slider.round:before {
61
- border-radius: 50px;
1
+ .switch {
2
+ display: inline-block;
3
+ width: 50px;
4
+ height: 25px;
5
+ border-radius: var(--radius_pill);
6
+ margin: var(--margin);
7
+ background: var(--element_background);
8
+ border: none;
9
+ box-shadow: 0 0 1px 0 var(--border_color);
10
+ }
11
+
12
+ .switch input {
13
+ opacity: 0;
14
+ width: 0;
15
+ height: 0;
16
+ }
17
+
18
+ .slider {
19
+ cursor: pointer;
20
+ position: absolute;
21
+ top: 0;
22
+ left: 0;
23
+ right: 0;
24
+ bottom: 0;
25
+ background-color: var(--element_background);
26
+ }
27
+
28
+ .slider:before {
29
+ position: absolute;
30
+ content: '';
31
+ height: 15px;
32
+ width: 15px;
33
+ left: 5px;
34
+ bottom: 5px;
35
+ background-color: var(--text_color);
36
+ }
37
+
38
+ input:checked + .slider:before {
39
+ position: absolute;
40
+ content: '';
41
+ height: 15px;
42
+ width: 15px;
43
+ left: 5px;
44
+ bottom: 5px;
45
+ background-color: var(--text_color_hover);
46
+ }
47
+
48
+ input:checked + .slider {
49
+ background: var(--blue_prime_background);
50
+ }
51
+
52
+ input:checked + .slider:before {
53
+ transform: translateX(26px);
54
+ }
55
+
56
+ .slider.round {
57
+ border-radius: var(--radius_pill);
58
+ }
59
+
60
+ .slider.round:before {
61
+ border-radius: var(--radius_circle);
62
+ }
63
+
64
+ .switch:has(input:focus-visible) {
65
+ outline: var(--focus_outline);
66
+ outline-offset: var(--focus_outline_offset);
62
67
  }
@@ -1,36 +1,36 @@
1
- class Toggle {
2
- #Toggle = document.createElement('label');
3
- #toggle_span = document.createElement('span');
4
- #toggle_input = document.createElement('input');
5
- constructor() {
6
- require('../../../modules/chui_functions').setStyles(__dirname + "/styles.css", "chUiJS_Toggle")
7
- this.#Toggle.className = 'switch';
8
- this.#toggle_input.type = 'checkbox';
9
- this.#toggle_span.className = 'slider round';
10
- this.#Toggle.appendChild(this.#toggle_input);
11
- this.#Toggle.appendChild(this.#toggle_span);
12
- }
13
- setMargin(pos = { top: undefined, bottom: undefined, left: undefined, right: undefined }) {
14
- if (pos.top !== undefined) this.#Toggle.style.marginTop = pos.top
15
- if (pos.bottom !== undefined) this.#Toggle.style.marginBottom = pos.bottom
16
- if (pos.left !== undefined) this.#Toggle.style.marginLeft = pos.left
17
- if (pos.right !== undefined) this.#Toggle.style.marginRight = pos.right
18
- }
19
- setId(id) {
20
- this.#Toggle.id = id;
21
- }
22
- addChangeListener (listener) {
23
- this.#toggle_input.addEventListener('change', listener);
24
- }
25
- getValue() {
26
- return this.#toggle_input.checked;
27
- }
28
- setValue(boolean) {
29
- this.#toggle_input.checked = boolean;
30
- }
31
- set() {
32
- return this.#Toggle;
33
- }
34
- }
35
-
36
- exports.Toggle = Toggle
1
+ class Toggle {
2
+ #Toggle = document.createElement('label');
3
+ #toggle_span = document.createElement('span');
4
+ #toggle_input = document.createElement('input');
5
+ constructor() {
6
+ require('../../../modules/chui_functions').setStyles(__dirname + "/styles.css", "chUiJS_Toggle")
7
+ this.#Toggle.className = 'switch';
8
+ this.#toggle_input.type = 'checkbox';
9
+ this.#toggle_span.className = 'slider round';
10
+ this.#Toggle.appendChild(this.#toggle_input);
11
+ this.#Toggle.appendChild(this.#toggle_span);
12
+ }
13
+ setMargin(pos = { top: undefined, bottom: undefined, left: undefined, right: undefined }) {
14
+ if (pos.top !== undefined) this.#Toggle.style.marginTop = pos.top
15
+ if (pos.bottom !== undefined) this.#Toggle.style.marginBottom = pos.bottom
16
+ if (pos.left !== undefined) this.#Toggle.style.marginLeft = pos.left
17
+ if (pos.right !== undefined) this.#Toggle.style.marginRight = pos.right
18
+ }
19
+ setId(id) {
20
+ this.#Toggle.id = id;
21
+ }
22
+ addChangeListener (listener) {
23
+ this.#toggle_input.addEventListener('change', listener);
24
+ }
25
+ getValue() {
26
+ return this.#toggle_input.checked;
27
+ }
28
+ setValue(boolean) {
29
+ this.#toggle_input.checked = boolean;
30
+ }
31
+ set() {
32
+ return this.#Toggle;
33
+ }
34
+ }
35
+
36
+ exports.Toggle = Toggle
@@ -1,55 +1,55 @@
1
- const {setStyles, htmlToMarkdown, markdownToHtml} = require('../../modules/chui_functions');
2
-
3
- class Label {
4
- #chui_label = document.createElement(`chui_label`);
5
- constructor(options = {
6
- id: String(),
7
- text: String(),
8
- markdownText: String(),
9
- textAlign: String(),
10
- wordBreak: String(),
11
- width: String(),
12
- fontSize: String(),
13
- }) {
14
- setStyles(__dirname + "/styles.css", 'chUiJS_Label');
15
- // Стили текста лейбла
16
- if (options.text !== undefined && options.markdownText !== undefined) {
17
- throw new Error("Должна быть установлена одна опция text или markdownText");
18
- } else {
19
- if (options.text !== undefined) this.#chui_label.innerText = options.text;
20
- if (options.markdownText !== undefined) this.#chui_label.innerHTML = markdownToHtml(options.markdownText);
21
- }
22
- //
23
- if (options.id !== undefined) this.#chui_label.id = options.id;
24
- if (options.textAlign !== undefined) this.#chui_label.style.textAlign = options.textAlign;
25
- if (options.wordBreak !== undefined) this.#chui_label.style.wordBreak = options.wordBreak;
26
- if (options.width !== undefined) this.#chui_label.style.width = options.width;
27
- if (options.fontSize !== undefined) this.#chui_label.style.fontSize = options.fontSize;
28
- }
29
- // GET
30
- getId() {
31
- return this.#chui_label.id;
32
- }
33
- getText() {
34
- return this.#chui_label.innerText;
35
- }
36
- getMarkdownText() {
37
- return htmlToMarkdown(this.#chui_label.innerHTML);
38
- }
39
- // SET
40
- setId(id = String()) {
41
- this.#chui_label.id = id;
42
- }
43
- setText(text = String()) {
44
- this.#chui_label.innerText = text;
45
- }
46
- setMarkdownText(text = String()) {
47
- this.#chui_label.innerHTML = markdownToHtml(text);
48
- }
49
- // RENDER
50
- set() {
51
- return this.#chui_label;
52
- }
53
- }
54
-
1
+ const {setStyles, htmlToMarkdown, markdownToHtml} = require('../../modules/chui_functions');
2
+
3
+ class Label {
4
+ #chui_label = document.createElement(`chui_label`);
5
+ constructor(options = {
6
+ id: String(),
7
+ text: String(),
8
+ markdownText: String(),
9
+ textAlign: String(),
10
+ wordBreak: String(),
11
+ width: String(),
12
+ fontSize: String(),
13
+ }) {
14
+ setStyles(__dirname + "/styles.css", 'chUiJS_Label');
15
+ // Стили текста лейбла
16
+ if (options.text !== undefined && options.markdownText !== undefined) {
17
+ throw new Error("Должна быть установлена одна опция text или markdownText");
18
+ } else {
19
+ if (options.text !== undefined) this.#chui_label.innerText = options.text;
20
+ if (options.markdownText !== undefined) this.#chui_label.innerHTML = markdownToHtml(options.markdownText);
21
+ }
22
+ //
23
+ if (options.id !== undefined) this.#chui_label.id = options.id;
24
+ if (options.textAlign !== undefined) this.#chui_label.style.textAlign = options.textAlign;
25
+ if (options.wordBreak !== undefined) this.#chui_label.style.wordBreak = options.wordBreak;
26
+ if (options.width !== undefined) this.#chui_label.style.width = options.width;
27
+ if (options.fontSize !== undefined) this.#chui_label.style.fontSize = options.fontSize;
28
+ }
29
+ // GET
30
+ getId() {
31
+ return this.#chui_label.id;
32
+ }
33
+ getText() {
34
+ return this.#chui_label.innerText;
35
+ }
36
+ getMarkdownText() {
37
+ return htmlToMarkdown(this.#chui_label.innerHTML);
38
+ }
39
+ // SET
40
+ setId(id = String()) {
41
+ this.#chui_label.id = id;
42
+ }
43
+ setText(text = String()) {
44
+ this.#chui_label.innerText = text;
45
+ }
46
+ setMarkdownText(text = String()) {
47
+ this.#chui_label.innerHTML = markdownToHtml(text);
48
+ }
49
+ // RENDER
50
+ set() {
51
+ return this.#chui_label;
52
+ }
53
+ }
54
+
55
55
  exports.Label = Label
@@ -1,12 +1,12 @@
1
- chui_label {
2
- height: max-content;
3
- width: max-content;
4
- margin: var(--margin);
5
- font-size: var(--font_default_size);
6
- font-weight:500;
7
- color: var(--text_color);
8
- }
9
-
10
- chui_label p {
11
- margin: 0;
1
+ chui_label {
2
+ height: max-content;
3
+ width: max-content;
4
+ margin: var(--margin);
5
+ font-size: var(--font_default_size);
6
+ font-weight:500;
7
+ color: var(--text_color);
8
+ }
9
+
10
+ chui_label p {
11
+ margin: 0;
12
12
  }