matestack-ui-bootstrap 1.4.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +17 -5
  3. data/README.md +53 -19
  4. data/lib/matestack/ui/bootstrap.rb +97 -17
  5. data/{app/concepts → lib}/matestack/ui/bootstrap/apps/admin_template.rb +14 -7
  6. data/lib/matestack/ui/bootstrap/base_component.rb +13 -0
  7. data/lib/matestack/ui/bootstrap/base_vue_js_component.rb +13 -0
  8. data/lib/matestack/ui/bootstrap/components/accordion.rb +58 -0
  9. data/{app/concepts → lib}/matestack/ui/bootstrap/components/alert.js +12 -9
  10. data/lib/matestack/ui/bootstrap/components/alert.rb +43 -0
  11. data/lib/matestack/ui/bootstrap/components/avatar.rb +27 -0
  12. data/lib/matestack/ui/bootstrap/components/badge.rb +32 -0
  13. data/lib/matestack/ui/bootstrap/components/breadcrumb.rb +50 -0
  14. data/lib/matestack/ui/bootstrap/components/button.rb +71 -0
  15. data/lib/matestack/ui/bootstrap/components/button_group.rb +36 -0
  16. data/lib/matestack/ui/bootstrap/components/card.rb +105 -0
  17. data/{app/concepts → lib}/matestack/ui/bootstrap/components/carousel.js +21 -18
  18. data/lib/matestack/ui/bootstrap/components/carousel.rb +103 -0
  19. data/{app/concepts → lib}/matestack/ui/bootstrap/components/close.rb +10 -9
  20. data/{app/concepts → lib}/matestack/ui/bootstrap/components/collapse.js +20 -17
  21. data/lib/matestack/ui/bootstrap/components/collapse.rb +54 -0
  22. data/{app/concepts → lib}/matestack/ui/bootstrap/components/dropdown.js +5 -2
  23. data/{app/concepts → lib}/matestack/ui/bootstrap/components/dropdown.rb +31 -26
  24. data/lib/matestack/ui/bootstrap/components/icon.rb +21 -0
  25. data/lib/matestack/ui/bootstrap/components/list_group.rb +148 -0
  26. data/{app/concepts → lib}/matestack/ui/bootstrap/components/modal.js +24 -21
  27. data/lib/matestack/ui/bootstrap/components/modal.rb +121 -0
  28. data/lib/matestack/ui/bootstrap/components/navbar.rb +163 -0
  29. data/{app/concepts → lib}/matestack/ui/bootstrap/components/page_heading.rb +7 -5
  30. data/{app/concepts → lib}/matestack/ui/bootstrap/components/pagination.rb +15 -13
  31. data/{app/concepts → lib}/matestack/ui/bootstrap/components/popover.js +4 -1
  32. data/{app/concepts → lib}/matestack/ui/bootstrap/components/popover.rb +26 -22
  33. data/{app/concepts → lib}/matestack/ui/bootstrap/components/progress.rb +24 -24
  34. data/lib/matestack/ui/bootstrap/components/scrollspy.rb +50 -0
  35. data/lib/matestack/ui/bootstrap/components/section_card.rb +33 -0
  36. data/lib/matestack/ui/bootstrap/components/spinner.rb +35 -0
  37. data/lib/matestack/ui/bootstrap/components/tab_nav.rb +79 -0
  38. data/lib/matestack/ui/bootstrap/components/tab_nav_content.rb +35 -0
  39. data/{app/concepts → lib}/matestack/ui/bootstrap/components/toast.js +27 -18
  40. data/lib/matestack/ui/bootstrap/components/toast.rb +113 -0
  41. data/{app/concepts → lib}/matestack/ui/bootstrap/components/tooltip.js +4 -1
  42. data/lib/matestack/ui/bootstrap/components/tooltip.rb +66 -0
  43. data/{app/concepts → lib}/matestack/ui/bootstrap/content/figure.rb +4 -2
  44. data/lib/matestack/ui/bootstrap/content/smart_collection/collection.rb +120 -0
  45. data/{app/concepts/matestack/ui/bootstrap/content/collection → lib/matestack/ui/bootstrap/content/smart_collection}/collection.scss +0 -0
  46. data/lib/matestack/ui/bootstrap/content/smart_collection/content.rb +118 -0
  47. data/{app/concepts/matestack/ui/bootstrap/content/collection → lib/matestack/ui/bootstrap/content/smart_collection}/filter.rb +7 -3
  48. data/{app/concepts/matestack/ui/bootstrap/content/collection → lib/matestack/ui/bootstrap/content/smart_collection}/paginate.rb +19 -14
  49. data/lib/matestack/ui/bootstrap/form/checkbox.rb +90 -0
  50. data/lib/matestack/ui/bootstrap/form/input.rb +118 -0
  51. data/lib/matestack/ui/bootstrap/form/radio.rb +57 -0
  52. data/lib/matestack/ui/bootstrap/form/select.rb +63 -0
  53. data/lib/matestack/ui/bootstrap/form/submit.rb +20 -0
  54. data/lib/matestack/ui/bootstrap/form/switch.rb +32 -0
  55. data/lib/matestack/ui/bootstrap/form/textarea.rb +49 -0
  56. data/lib/matestack/ui/bootstrap/index.js +24 -0
  57. data/lib/matestack/ui/bootstrap/layout/column.rb +49 -0
  58. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/container.rb +12 -9
  59. data/lib/matestack/ui/bootstrap/layout/row.rb +25 -0
  60. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.js +5 -2
  61. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.rb +10 -10
  62. data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.scss +0 -0
  63. data/lib/matestack/ui/bootstrap/registry.rb +173 -0
  64. data/{app/javascript/matestack-ui-bootstrap → lib/matestack/ui/bootstrap}/stylesheets/matestack-ui-bootstrap.scss +0 -0
  65. data/lib/matestack/ui/bootstrap/version.rb +1 -1
  66. data/lib/tasks/matestack/ui/bootstrap_tasks.rake +25 -25
  67. metadata +68 -76
  68. data/app/assets/images/avatar-placeholder.png +0 -0
  69. data/app/assets/images/icons/bootstrap-icons.svg +0 -1
  70. data/app/concepts/matestack/ui/bootstrap/components/accordion.rb +0 -53
  71. data/app/concepts/matestack/ui/bootstrap/components/alert.rb +0 -34
  72. data/app/concepts/matestack/ui/bootstrap/components/avatar.rb +0 -27
  73. data/app/concepts/matestack/ui/bootstrap/components/badge.rb +0 -30
  74. data/app/concepts/matestack/ui/bootstrap/components/breadcrumb.rb +0 -46
  75. data/app/concepts/matestack/ui/bootstrap/components/button.rb +0 -54
  76. data/app/concepts/matestack/ui/bootstrap/components/button_group.rb +0 -36
  77. data/app/concepts/matestack/ui/bootstrap/components/card.rb +0 -100
  78. data/app/concepts/matestack/ui/bootstrap/components/carousel.rb +0 -85
  79. data/app/concepts/matestack/ui/bootstrap/components/chart.js +0 -232
  80. data/app/concepts/matestack/ui/bootstrap/components/chart.rb +0 -71
  81. data/app/concepts/matestack/ui/bootstrap/components/collapse.rb +0 -43
  82. data/app/concepts/matestack/ui/bootstrap/components/icon.rb +0 -19
  83. data/app/concepts/matestack/ui/bootstrap/components/list_group.rb +0 -83
  84. data/app/concepts/matestack/ui/bootstrap/components/modal.rb +0 -106
  85. data/app/concepts/matestack/ui/bootstrap/components/navbar.rb +0 -120
  86. data/app/concepts/matestack/ui/bootstrap/components/scrollspy.rb +0 -33
  87. data/app/concepts/matestack/ui/bootstrap/components/section_card.rb +0 -31
  88. data/app/concepts/matestack/ui/bootstrap/components/spinner.rb +0 -31
  89. data/app/concepts/matestack/ui/bootstrap/components/tab_nav.rb +0 -81
  90. data/app/concepts/matestack/ui/bootstrap/components/tab_nav_content.rb +0 -32
  91. data/app/concepts/matestack/ui/bootstrap/components/toast.rb +0 -99
  92. data/app/concepts/matestack/ui/bootstrap/components/tooltip.rb +0 -82
  93. data/app/concepts/matestack/ui/bootstrap/content/collection/collection.rb +0 -112
  94. data/app/concepts/matestack/ui/bootstrap/content/collection/content.rb +0 -101
  95. data/app/concepts/matestack/ui/bootstrap/form/checkbox.rb +0 -90
  96. data/app/concepts/matestack/ui/bootstrap/form/date.js +0 -38
  97. data/app/concepts/matestack/ui/bootstrap/form/date.rb +0 -98
  98. data/app/concepts/matestack/ui/bootstrap/form/input.rb +0 -123
  99. data/app/concepts/matestack/ui/bootstrap/form/radio.rb +0 -65
  100. data/app/concepts/matestack/ui/bootstrap/form/select.haml +0 -11
  101. data/app/concepts/matestack/ui/bootstrap/form/select.rb +0 -74
  102. data/app/concepts/matestack/ui/bootstrap/form/submit.rb +0 -20
  103. data/app/concepts/matestack/ui/bootstrap/form/switch.rb +0 -90
  104. data/app/concepts/matestack/ui/bootstrap/layout/column.rb +0 -47
  105. data/app/concepts/matestack/ui/bootstrap/layout/row.rb +0 -15
  106. data/app/concepts/matestack/ui/bootstrap/pages/devise/sign_in.rb +0 -40
  107. data/app/concepts/matestack/ui/bootstrap/registry.rb +0 -63
  108. data/app/helpers/matestack/ui/bootstrap/application_helper.rb +0 -13
  109. data/app/javascript/matestack-ui-bootstrap/index.js +0 -26
  110. data/app/javascript/packs/matestack-ui-bootstrap.js +0 -2
  111. data/config/routes.rb +0 -2
  112. data/lib/matestack/ui/bootstrap/engine.rb +0 -26
@@ -1,54 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Button < Matestack::Ui::Component
2
-
3
- optional :text, :type, :variant, :size, :outline
4
- optional attributes: { as: :bs_attrs }, class: { as: :bs_class }
5
- optional :is_transition
6
-
7
- def response
8
- if is_transition
9
- transition button_attributes.merge({path: root_path}) do
10
- inner_response
11
- end
12
- else
13
- button_response
14
- end
15
- end
16
-
17
- def button_response
18
- button button_attributes do
19
- inner_response
20
- end
21
- end
22
-
23
- def inner_response
24
- plain text if text
25
- yield_components
26
- end
27
-
28
- protected
29
-
30
- def button_attributes
31
- html_attributes.merge(
32
- type: type || 'button',
33
- class: button_classes,
34
- attributes: bs_attrs
35
- )
36
- end
37
-
38
- def button_classes
39
- [].tap do |classes|
40
- classes << 'btn'
41
- # btn variants outlined or solid background
42
- if outline
43
- classes << "btn-outline-#{variant.to_s.gsub('_', '-') || 'primary'}"
44
- else
45
- classes << (variant ? "btn-#{variant.to_s.gsub('_', '-')}" : 'btn-primary')
46
- end
47
- # btn size
48
- classes << "btn-#{size}" if size
49
- # custom classes
50
- classes << bs_class
51
- end.join(' ').strip
52
- end
53
-
54
- end
@@ -1,36 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::ButtonGroup < Matestack::Ui::Component
2
-
3
- optional class: { as: :bs_class }
4
- optional label: { as: :bs_label }
5
- optional :toolbar, :size, :vertical
6
-
7
- def response
8
- div buttongroup_attributes do
9
- yield_components
10
- end
11
- end
12
-
13
- protected
14
-
15
- def buttongroup_attributes
16
- attributes = {}.tap do |hash|
17
- hash[:class] = buttongroup_classes
18
- hash[:attributes] = {
19
- role: "#{toolbar ? :toolbar : :group}",
20
- 'aria-label': bs_label
21
- }
22
- end
23
- html_attributes.merge(
24
- attributes
25
- )
26
- end
27
-
28
- def buttongroup_classes
29
- [].tap do |classes|
30
- classes << ("btn-#{toolbar ? :toolbar : :group}#{'-vertical' if vertical}")
31
- classes << "btn-group-#{size}" if size.present?
32
- classes << bs_class
33
- end.join(' ').strip
34
- end
35
-
36
- end
@@ -1,100 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Card < Matestack::Ui::Component
2
-
3
- optional class: { as: :bs_class }
4
-
5
- # header attributes, expects a hash or string
6
- # possible keys `:class, :text`
7
- optional :header
8
- # footer attributes, expects a hash or string
9
- # possible keys `:class, :text`
10
- optional :footer
11
-
12
- optional :title, :body, :subtitle # body attributes
13
- optional :img_path, :img_pos, :alt_text # image attributes
14
-
15
- optional :content_wrapper_class # class for content wrapper -> useful for content padding without affecting top image
16
-
17
- optional :slots # passed in slots for card header or footer
18
-
19
- def response
20
- div card_attributes do
21
- if header || slots && slots[:header]
22
- header_partial
23
- end
24
-
25
- img_partial :top unless img_pos == :bottom
26
- div class: content_wrapper_class do
27
- body_partial if title || body || slots && slots[:body]
28
-
29
- # custom body components
30
- # needed a div otherwise it will be displayed below footer
31
- div class: "p-3 pt-1" do yield_components end
32
-
33
- img_partial :bottom if img_pos == :bottom
34
-
35
- footer_partial if footer || slots && slots[:footer]
36
- end
37
- end
38
- end
39
-
40
- protected
41
-
42
- def header_partial
43
- header = self.header.is_a?(Hash) ? self.header : { text: self.header }
44
- div class: "card-header #{header[:class]}" do
45
- plain header[:text] if header[:text].present?
46
- slot slots[:header] if slots && slots[:header]
47
- end
48
- end
49
-
50
- def body_partial
51
- div class: "card-body" do
52
- # title
53
- card_title(title, "card-title")
54
- # subtitle
55
- card_title(subtitle, 6, "card-subtitle text-muted")
56
- # body
57
- if body.is_a? Hash
58
- paragraph class: "card-text #{body[:class]}", text: body[:text]
59
- elsif body
60
- paragraph class: "card-text", text: body
61
- end
62
- slot slots[:body] if slots && slots[:body]
63
- end
64
- end
65
-
66
- def footer_partial
67
- footer = self.footer.is_a?(Hash) ? self.footer : { text: self.footer }
68
- div class: "card-footer #{footer[:class]}" do
69
- plain footer[:text] if footer[:text].present?
70
- slot slots[:footer] if slots && slots[:footer]
71
- end
72
- end
73
-
74
- def img_partial pos
75
- img class: "card-img-#{pos}", path: img_path, alt: alt_text if img_path.present?
76
- end
77
-
78
- def card_attributes
79
- html_attributes.except(:title).merge(
80
- class: card_classes
81
- )
82
- end
83
-
84
- def card_classes
85
- [].tap do |classes|
86
- classes << 'card'
87
- classes << bs_class
88
- end.join(' ').strip
89
- end
90
-
91
- def card_title(options, default_size = 5, title_class)
92
- if options.is_a? Hash
93
- heading size: (options[:size] || default_size), class: "#{options[:class]} #{title_class}",
94
- text: options[:text]
95
- elsif options
96
- heading size: default_size, class: title_class, text: options
97
- end
98
- end
99
-
100
- end
@@ -1,85 +0,0 @@
1
- class Matestack::Ui::Bootstrap::Components::Carousel < Matestack::Ui::VueJsComponent
2
- vue_js_component_name "matestack-ui-bootstrap-carousel"
3
-
4
- optional :start, :controls, :indicators, :fade, :interval
5
- optional :items, class: { as: :bs_class }
6
- # possible keys for items: path, title, text, interval
7
- # event trigger
8
- optional :cycle_on, :pause_on, :prev_on, :next_on
9
-
10
- def setup
11
- @component_config["carousel-id"] = carousel_id
12
- end
13
-
14
- def response
15
- div carousel_attributes do
16
- # carousel indicator
17
- indicator_partial if indicators.present?
18
- # carousel content
19
- div class: "carousel-inner" do
20
- yield_components
21
- carousel_partial if items
22
- end
23
- controls_partial if controls
24
- end
25
- end
26
-
27
- protected
28
-
29
- def indicator_partial
30
- ol class: "carousel-indicators" do
31
- items.size.times do |index|
32
- li data: { target: carousel_id, 'slide-to': index },
33
- class: "#{'active' if index == (start || 0) }"
34
- end
35
- end
36
- end
37
-
38
- def carousel_partial
39
- items.each_with_index do |item, index|
40
- div class: "carousel-item #{'active' if index == (start || 0) } #{item[:class]}".strip,
41
- data: { interval: item[:interval] } do
42
- img class: "d-block w-100", path: item[:path]
43
- if item[:title] || item[:text]
44
- div class: "carousel-caption d-none d-md-block #{item[:title_class]}" do
45
- heading size: 5, text: item[:title]
46
- paragraph text: item[:text]
47
- end
48
- end
49
- end
50
- end
51
- end
52
-
53
- def controls_partial
54
- link class: "carousel-control-prev", path: "##{carousel_id}", data: { slide: :prev }, attributes: { 'role': "button" } do
55
- span class: "carousel-control-prev-icon", attributes: { 'aria-hidden': "true" }
56
- span class: "sr-only", text: "Previous"
57
- end
58
- link class: "carousel-control-next", path: "##{carousel_id}", data: { slide: :next }, attributes: { 'role': "button" } do
59
- span class: "carousel-control-next-icon", attributes: { 'aria-hidden': "true" }
60
- span class: "sr-only", text: "Next"
61
- end
62
- end
63
-
64
- def carousel_attributes
65
- html_attributes.merge(
66
- id: carousel_id,
67
- class: carousel_classes,
68
- data: { ride: 'carousel', interval: (interval || 5000) }
69
- )
70
- end
71
-
72
- def carousel_classes
73
- [].tap do |classes|
74
- classes << 'carousel slide'
75
- classes << 'carousel-fade' if fade
76
- #custom classes
77
- classes << bs_class
78
- end.join(' ').strip
79
- end
80
-
81
- def carousel_id
82
- @carousel_id ||= "matestack-carousel-#{SecureRandom.hex}"
83
- end
84
-
85
- end
@@ -1,232 +0,0 @@
1
- import Chart from 'chart.js';
2
-
3
- MatestackUiCore.Vue.component('matestack-ui-bootstrap-chart', {
4
- mixins: [MatestackUiCore.componentMixin],
5
-
6
- data() {
7
- return {
8
- chartJsInstance: undefined,
9
- defaultColor: undefined,
10
- fontColor: undefined,
11
- fontFamily: undefined
12
- };
13
- },
14
-
15
- methods: {
16
- getThemeColor: function(key){
17
- const style = getComputedStyle(document.body);
18
- return style.getPropertyValue('--bs-'+key);
19
- },
20
- getThemeColorArray: function(keysArray){
21
- let result = []
22
- const style = getComputedStyle(document.body);
23
- keysArray.forEach(function(key){
24
- result.push(style.getPropertyValue('--bs-'+key))
25
- })
26
- return result;
27
- },
28
- drawBarChart: function(chartElement){
29
- const self = this;
30
- this.componentConfig["datasets"].forEach(function(item){
31
- if (item["backgroundColor"] === undefined){
32
- item["backgroundColor"] = self.getThemeColor("primary")
33
- }else{
34
- if(Array.isArray(item["backgroundColor"])){
35
- item["backgroundColor"] = self.getThemeColorArray(item["backgroundColor"])
36
- }else{
37
- item["backgroundColor"] = self.getThemeColor(item["backgroundColor"])
38
- }
39
- }
40
- item["hoverBackgroundColor"] = "rgba(0, 0, 0, 0.1)"
41
- if (item["barThickness"] === undefined){
42
- item["barThickness"] = 10;
43
- }
44
- })
45
- this.chartJsInstance = new Chart(chartElement, {
46
- type: 'bar',
47
- data: {
48
- labels: this.componentConfig["labels"],
49
- datasets: this.componentConfig["datasets"]
50
- },
51
- options: {
52
- legend: {
53
- display: this.componentConfig["display_legend"],
54
- },
55
- scales: {
56
- yAxes: [{
57
- display: this.componentConfig["display_y_axes"],
58
- gridLines: {
59
- display: false,
60
- },
61
- ticks: {
62
- beginAtZero: true
63
- }
64
- }],
65
- xAxes: [{
66
- display: this.componentConfig["display_x_axes"],
67
- gridLines: {
68
- display: false,
69
- },
70
- ticks: {
71
- beginAtZero: true
72
- }
73
- }]
74
- }
75
- }
76
- });
77
- },
78
- drawLineChart: function(chartElement){
79
- const self = this;
80
- this.componentConfig["datasets"].forEach(function(item){
81
- if (item["borderColor"] === undefined){
82
- item["borderColor"] = self.getThemeColor("primary")
83
- }else{
84
- item["borderColor"] = self.getThemeColor(item["borderColor"])
85
- }
86
- item["hoverBackgroundColor"] = "rgba(0, 0, 0, 0.1)"
87
- if (item["fill"] === undefined){
88
- item["fill"] = false;
89
- }
90
- })
91
- this.chartJsInstance = new Chart(chartElement, {
92
- type: 'line',
93
- data: {
94
- labels: this.componentConfig["labels"],
95
- datasets: this.componentConfig["datasets"]
96
- },
97
- options: {
98
- legend: {
99
- display: this.componentConfig["display_legend"],
100
- },
101
- scales: {
102
- yAxes: [{
103
- display: this.componentConfig["display_y_axes"],
104
- gridLines: {
105
- display: false,
106
- },
107
- ticks: {
108
- beginAtZero: true
109
- }
110
- }],
111
- xAxes: [{
112
- display: this.componentConfig["display_x_axes"],
113
- gridLines: {
114
- display: false,
115
- },
116
- ticks: {
117
- beginAtZero: true
118
- }
119
- }]
120
- }
121
- }
122
- });
123
- },
124
- drawDoughnutChart: function(chartElement){
125
- const self = this;
126
- this.componentConfig["datasets"].forEach(function(item){
127
- if (item["backgroundColor"] === undefined){
128
- item["backgroundColor"] = self.getThemeColor("primary")
129
- }else{
130
- if(Array.isArray(item["backgroundColor"])){
131
- item["backgroundColor"] = self.getThemeColorArray(item["backgroundColor"])
132
- }else{
133
- item["backgroundColor"] = self.getThemeColor(item["backgroundColor"])
134
- }
135
- }
136
- item["hoverBackgroundColor"] = "rgba(0, 0, 0, 0.1)"
137
- if (item["borderColor"] === undefined){
138
- item["borderColor"] = self.getThemeColor("white")
139
- }else{
140
- item["borderColor"] = self.getThemeColor(item["borderColor"])
141
- }
142
- if (item["hoverBorderColor"] === undefined){
143
- item["hoverBorderColor"] = self.getThemeColor("white")
144
- }else{
145
- item["hoverBorderColor"] = self.getThemeColor(item["hoverBorderColor"])
146
- }
147
- if (item["borderWidth"] === undefined){
148
- item["borderWidth"] = 10
149
- }
150
- if (item["weight"] === undefined){
151
- item["weight"] = 1
152
- }
153
- })
154
- this.chartJsInstance = new Chart(chartElement, {
155
- type: 'doughnut',
156
- data: {
157
- labels: this.componentConfig["labels"],
158
- datasets: this.componentConfig["datasets"]
159
- },
160
- options: {
161
- legend: {
162
- display: this.componentConfig["display_legend"],
163
- },
164
- cutoutPercentage: this.componentConfig["cutout_percentage"]
165
- }
166
- });
167
- },
168
- drawPieChart: function(chartElement){
169
- const self = this;
170
- this.componentConfig["datasets"].forEach(function(item){
171
- if (item["backgroundColor"] === undefined){
172
- item["backgroundColor"] = self.getThemeColor("primary")
173
- }else{
174
- if(Array.isArray(item["backgroundColor"])){
175
- item["backgroundColor"] = self.getThemeColorArray(item["backgroundColor"])
176
- }else{
177
- item["backgroundColor"] = self.getThemeColor(item["backgroundColor"])
178
- }
179
- }
180
- item["hoverBackgroundColor"] = "rgba(0, 0, 0, 0.1)"
181
- })
182
- this.chartJsInstance = new Chart(chartElement, {
183
- type: 'pie',
184
- data: {
185
- labels: this.componentConfig["labels"],
186
- datasets: this.componentConfig["datasets"]
187
- },
188
- options: {
189
- legend: {
190
- display: this.componentConfig["display_legend"],
191
- }
192
- }
193
- });
194
- },
195
- },
196
-
197
- mounted: function() {
198
- const style = getComputedStyle(document.body);
199
-
200
- this.defaultColor = style.getPropertyValue('--bs-primary');
201
- this.fontColor = style.getPropertyValue('--bs-secondary');
202
- this.fontFamily = style.getPropertyValue('--bs-font-sans-serif');
203
-
204
- Chart.defaults.global.defaultFontColor = this.fontColor
205
- Chart.defaults.global.defaultFontFamily = this.fontFamily
206
- Chart.defaults.global.defaultColor = this.fontFamily
207
-
208
- const chartElement = this.$refs.chart
209
-
210
- if(this.componentConfig["type"] == "bar"){
211
- this.drawBarChart(chartElement);
212
- }
213
- if(this.componentConfig["type"] == "line"){
214
- this.drawLineChart(chartElement);
215
- }
216
- if(this.componentConfig["type"] == "doughnut"){
217
- this.drawDoughnutChart(chartElement);
218
- }
219
- if(this.componentConfig["type"] == "pie"){
220
- this.drawPieChart(chartElement);
221
- }
222
-
223
- },
224
-
225
- created: function() {
226
-
227
- },
228
-
229
- beforeDestroy: function() {
230
-
231
- },
232
- });