matestack-ui-bootstrap 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +65 -7
  3. data/app/concepts/matestack/ui/bootstrap/components/accordion.rb +17 -14
  4. data/app/concepts/matestack/ui/bootstrap/components/alert.rb +1 -1
  5. data/app/concepts/matestack/ui/bootstrap/components/badge.rb +4 -4
  6. data/app/concepts/matestack/ui/bootstrap/components/breadcrumb.rb +8 -6
  7. data/app/concepts/matestack/ui/bootstrap/components/button.rb +18 -3
  8. data/app/concepts/matestack/ui/bootstrap/components/carousel.rb +15 -14
  9. data/app/concepts/matestack/ui/bootstrap/components/close.rb +1 -1
  10. data/app/concepts/matestack/ui/bootstrap/components/collapse.rb +6 -6
  11. data/app/concepts/matestack/ui/bootstrap/components/dropdown.rb +3 -2
  12. data/app/concepts/matestack/ui/bootstrap/components/list_group.rb +87 -25
  13. data/app/concepts/matestack/ui/bootstrap/components/modal.rb +1 -1
  14. data/app/concepts/matestack/ui/bootstrap/components/navbar.rb +54 -20
  15. data/app/concepts/matestack/ui/bootstrap/components/pagination.rb +5 -5
  16. data/app/concepts/matestack/ui/bootstrap/components/popover.rb +1 -1
  17. data/app/concepts/matestack/ui/bootstrap/components/progress.rb +7 -7
  18. data/app/concepts/matestack/ui/bootstrap/components/scrollspy.rb +15 -0
  19. data/app/concepts/matestack/ui/bootstrap/components/spinner.rb +1 -1
  20. data/app/concepts/matestack/ui/bootstrap/components/tab_nav.rb +4 -2
  21. data/app/concepts/matestack/ui/bootstrap/components/toast.js +7 -1
  22. data/app/concepts/matestack/ui/bootstrap/components/tooltip.rb +8 -26
  23. data/app/concepts/matestack/ui/bootstrap/content/{collection → smart_collection}/collection.rb +18 -16
  24. data/app/concepts/matestack/ui/bootstrap/content/{collection → smart_collection}/collection.scss +0 -0
  25. data/app/concepts/matestack/ui/bootstrap/content/{collection → smart_collection}/content.rb +3 -3
  26. data/app/concepts/matestack/ui/bootstrap/content/{collection → smart_collection}/filter.rb +3 -3
  27. data/app/concepts/matestack/ui/bootstrap/content/{collection → smart_collection}/paginate.rb +3 -3
  28. data/app/concepts/matestack/ui/bootstrap/form/checkbox.rb +55 -46
  29. data/app/concepts/matestack/ui/bootstrap/form/input.rb +5 -16
  30. data/app/concepts/matestack/ui/bootstrap/form/radio.rb +22 -30
  31. data/app/concepts/matestack/ui/bootstrap/form/select.rb +12 -33
  32. data/app/concepts/matestack/ui/bootstrap/form/submit.rb +3 -2
  33. data/app/concepts/matestack/ui/bootstrap/form/switch.rb +80 -71
  34. data/app/concepts/matestack/ui/bootstrap/registry.rb +2 -4
  35. data/app/helpers/matestack/ui/bootstrap/application_helper.rb +9 -5
  36. data/app/javascript/matestack-ui-bootstrap/index.js +1 -3
  37. data/app/matestack/bootstrap/form/submit.rb +20 -0
  38. data/lib/matestack/ui/bootstrap/engine.rb +2 -2
  39. data/lib/matestack/ui/bootstrap/version.rb +1 -1
  40. data/lib/tasks/matestack/ui/bootstrap_tasks.rake +25 -25
  41. metadata +8 -12
  42. data/app/concepts/matestack/ui/bootstrap/components/chart.js +0 -232
  43. data/app/concepts/matestack/ui/bootstrap/components/chart.rb +0 -71
  44. data/app/concepts/matestack/ui/bootstrap/form/date.js +0 -38
  45. data/app/concepts/matestack/ui/bootstrap/form/date.rb +0 -98
  46. data/app/concepts/matestack/ui/bootstrap/form/select.haml +0 -11
@@ -10,7 +10,6 @@ module Matestack::Ui::Bootstrap::Registry
10
10
  bs_btn_group: Matestack::Ui::Bootstrap::Components::ButtonGroup,
11
11
  bs_card: Matestack::Ui::Bootstrap::Components::Card,
12
12
  bs_carousel: Matestack::Ui::Bootstrap::Components::Carousel,
13
- bs_chart: Matestack::Ui::Bootstrap::Components::Chart,
14
13
  bs_close: Matestack::Ui::Bootstrap::Components::Close,
15
14
  bs_collapse: Matestack::Ui::Bootstrap::Components::Collapse,
16
15
  bs_dropdown: Matestack::Ui::Bootstrap::Components::Dropdown,
@@ -37,13 +36,12 @@ module Matestack::Ui::Bootstrap::Registry
37
36
  bs_form_checkbox: Matestack::Ui::Bootstrap::Form::Checkbox,
38
37
  bs_form_radio: Matestack::Ui::Bootstrap::Form::Radio,
39
38
  bs_form_switch: Matestack::Ui::Bootstrap::Form::Switch,
40
- bs_form_submit: Matestack::Ui::Bootstrap::Form::Submit,
41
- bs_form_date: Matestack::Ui::Bootstrap::Form::Date,
39
+ bs_form_submit: Matestack::Ui::Bootstrap::Form::Submit
42
40
  }
43
41
 
44
42
  CONTENT = {
45
43
  bs_figure: Matestack::Ui::Bootstrap::Content::Figure,
46
- bs_smart_collection: Matestack::Ui::Bootstrap::Content::Collection::Collection,
44
+ bs_smart_collection: Matestack::Ui::Bootstrap::Content::SmartCollection::Collection,
47
45
  }
48
46
 
49
47
  LAYOUTS = {
@@ -2,12 +2,16 @@
2
2
 
3
3
  require "webpacker/helper"
4
4
 
5
- module MyEngine
6
- module ApplicationHelper
7
- include ::Webpacker::Helper
5
+ module Matestack
6
+ module Ui
7
+ module Bootstrap
8
+ module ApplicationHelper
9
+ include ::Webpacker::Helper
8
10
 
9
- def current_webpacker_instance
10
- MyEngine.webpacker
11
+ def current_webpacker_instance
12
+ Matestack::Ui::Bootstrap::Engine.webpacker
13
+ end
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -7,17 +7,15 @@ import "./stylesheets/matestack-ui-bootstrap.scss";
7
7
 
8
8
  import '../../concepts/matestack/ui/bootstrap/components/alert'
9
9
  import '../../concepts/matestack/ui/bootstrap/components/carousel'
10
- import '../../concepts/matestack/ui/bootstrap/components/chart'
11
10
  import '../../concepts/matestack/ui/bootstrap/components/collapse'
12
11
  import '../../concepts/matestack/ui/bootstrap/components/dropdown'
13
12
  import '../../concepts/matestack/ui/bootstrap/components/modal'
14
13
  import '../../concepts/matestack/ui/bootstrap/components/toast'
15
14
  import '../../concepts/matestack/ui/bootstrap/components/popover'
16
15
  import '../../concepts/matestack/ui/bootstrap/components/tooltip'
17
- import '../../concepts/matestack/ui/bootstrap/form/date'
18
16
  import '../../concepts/matestack/ui/bootstrap/layout/sidebar'
19
17
  import '../../concepts/matestack/ui/bootstrap/layout/sidebar.scss'
20
- import '../../concepts/matestack/ui/bootstrap/content/collection/collection.scss'
18
+ import '../../concepts/matestack/ui/bootstrap/content/smart_collection/collection.scss'
21
19
 
22
20
  const MatestackUiBootstrap = {}
23
21
 
@@ -0,0 +1,20 @@
1
+ class Bootstrap::Form::Submit < Matestack::Ui::Component
2
+
3
+ optional :button_variant
4
+ optional :spinner_variant
5
+ optional :text
6
+ optional :loading_text
7
+
8
+ def response
9
+ form_submit do
10
+ btn size: options[:size], class: "#{options[:class]}", variant: button_variant || :primary, attributes: { "v-if": "!loading" } do
11
+ plain text || "Submit"
12
+ end
13
+ btn size: options[:size], class: "#{options[:class_loading]}", variant: button_variant || :primary, attributes: { disabled: true, "v-if": "loading" } do
14
+ spinner variant: spinner_variant || :light, size: :sm
15
+ plain loading_text || "Loading..."
16
+ end
17
+ end
18
+ end
19
+
20
+ end
@@ -7,7 +7,7 @@ module Matestack
7
7
  # https://github.com/rails/webpacker/blob/5-x-stable/docs/engines.md
8
8
  initializer "webpacker.proxy" do |app|
9
9
  insert_middleware = begin
10
- MyEngine.webpacker.config.dev_server.present?
10
+ Matestack::Ui::Bootstrap::Engine.webpacker.config.dev_server.present?
11
11
  rescue
12
12
  nil
13
13
  end
@@ -16,7 +16,7 @@ module Matestack
16
16
  app.middleware.insert_before(
17
17
  0, Webpacker::DevServerProxy, # "Webpacker::DevServerProxy" if Rails version < 5
18
18
  ssl_verify_none: true,
19
- webpacker: MyEngine.webpacker
19
+ webpacker: Matestack::Ui::Bootstrap::Engine.webpacker
20
20
  )
21
21
  end
22
22
 
@@ -1,7 +1,7 @@
1
1
  module Matestack
2
2
  module Ui
3
3
  module Bootstrap
4
- VERSION = '1.4.0'
4
+ VERSION = '1.5.0'
5
5
  end
6
6
  end
7
7
  end
@@ -39,28 +39,28 @@ namespace :matestack_ui_bootstrap do
39
39
  end
40
40
  end
41
41
 
42
- def yarn_install_available?
43
- rails_major = Rails::VERSION::MAJOR
44
- rails_minor = Rails::VERSION::MINOR
45
-
46
- rails_major > 5 || (rails_major == 5 && rails_minor >= 1)
47
- end
48
-
49
- def enhance_assets_precompile
50
- # yarn:install was added in Rails 5.1
51
- deps = yarn_install_available? ? [] : ["my_engine:webpacker:yarn_install"]
52
- Rake::Task["assets:precompile"].enhance(deps) do
53
- Rake::Task["my_engine:webpacker:compile"].invoke
54
- end
55
- end
56
-
57
- # Compile packs after we've compiled all other assets during precompilation
58
- skip_webpacker_precompile = %w(no false n f).include?(ENV["WEBPACKER_PRECOMPILE"])
59
-
60
- unless skip_webpacker_precompile
61
- if Rake::Task.task_defined?("assets:precompile")
62
- enhance_assets_precompile
63
- else
64
- Rake::Task.define_task("assets:precompile" => "my_engine:webpacker:compile")
65
- end
66
- end
42
+ # def yarn_install_available?
43
+ # rails_major = Rails::VERSION::MAJOR
44
+ # rails_minor = Rails::VERSION::MINOR
45
+ #
46
+ # rails_major > 5 || (rails_major == 5 && rails_minor >= 1)
47
+ # end
48
+ #
49
+ # def enhance_assets_precompile
50
+ # # yarn:install was added in Rails 5.1
51
+ # deps = yarn_install_available? ? [] : ["app:matestack_ui_bootstrap:webpacker:yarn_install"]
52
+ # Rake::Task["assets:precompile"].enhance(deps) do
53
+ # Rake::Task["app:matestack_ui_bootstrap:webpacker:compile"].invoke
54
+ # end
55
+ # end
56
+ #
57
+ # # Compile packs after we've compiled all other assets during precompilation
58
+ # skip_webpacker_precompile = %w(no false n f).include?(ENV["WEBPACKER_PRECOMPILE"])
59
+ #
60
+ # unless skip_webpacker_precompile
61
+ # if Rake::Task.task_defined?("assets:precompile")
62
+ # enhance_assets_precompile
63
+ # else
64
+ # Rake::Task.define_task("assets:precompile" => "app:matestack_ui_bootstrap:webpacker:compile")
65
+ # end
66
+ # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matestack-ui-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Jabari
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-02-11 00:00:00.000000000 Z
12
+ date: 2021-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: matestack-ui-core
@@ -49,8 +49,6 @@ files:
49
49
  - app/concepts/matestack/ui/bootstrap/components/card.rb
50
50
  - app/concepts/matestack/ui/bootstrap/components/carousel.js
51
51
  - app/concepts/matestack/ui/bootstrap/components/carousel.rb
52
- - app/concepts/matestack/ui/bootstrap/components/chart.js
53
- - app/concepts/matestack/ui/bootstrap/components/chart.rb
54
52
  - app/concepts/matestack/ui/bootstrap/components/close.rb
55
53
  - app/concepts/matestack/ui/bootstrap/components/collapse.js
56
54
  - app/concepts/matestack/ui/bootstrap/components/collapse.rb
@@ -75,18 +73,15 @@ files:
75
73
  - app/concepts/matestack/ui/bootstrap/components/toast.rb
76
74
  - app/concepts/matestack/ui/bootstrap/components/tooltip.js
77
75
  - app/concepts/matestack/ui/bootstrap/components/tooltip.rb
78
- - app/concepts/matestack/ui/bootstrap/content/collection/collection.rb
79
- - app/concepts/matestack/ui/bootstrap/content/collection/collection.scss
80
- - app/concepts/matestack/ui/bootstrap/content/collection/content.rb
81
- - app/concepts/matestack/ui/bootstrap/content/collection/filter.rb
82
- - app/concepts/matestack/ui/bootstrap/content/collection/paginate.rb
83
76
  - app/concepts/matestack/ui/bootstrap/content/figure.rb
77
+ - app/concepts/matestack/ui/bootstrap/content/smart_collection/collection.rb
78
+ - app/concepts/matestack/ui/bootstrap/content/smart_collection/collection.scss
79
+ - app/concepts/matestack/ui/bootstrap/content/smart_collection/content.rb
80
+ - app/concepts/matestack/ui/bootstrap/content/smart_collection/filter.rb
81
+ - app/concepts/matestack/ui/bootstrap/content/smart_collection/paginate.rb
84
82
  - app/concepts/matestack/ui/bootstrap/form/checkbox.rb
85
- - app/concepts/matestack/ui/bootstrap/form/date.js
86
- - app/concepts/matestack/ui/bootstrap/form/date.rb
87
83
  - app/concepts/matestack/ui/bootstrap/form/input.rb
88
84
  - app/concepts/matestack/ui/bootstrap/form/radio.rb
89
- - app/concepts/matestack/ui/bootstrap/form/select.haml
90
85
  - app/concepts/matestack/ui/bootstrap/form/select.rb
91
86
  - app/concepts/matestack/ui/bootstrap/form/submit.rb
92
87
  - app/concepts/matestack/ui/bootstrap/form/switch.rb
@@ -102,6 +97,7 @@ files:
102
97
  - app/javascript/matestack-ui-bootstrap/index.js
103
98
  - app/javascript/matestack-ui-bootstrap/stylesheets/matestack-ui-bootstrap.scss
104
99
  - app/javascript/packs/matestack-ui-bootstrap.js
100
+ - app/matestack/bootstrap/form/submit.rb
105
101
  - config/routes.rb
106
102
  - config/webpack/development.js
107
103
  - config/webpack/environment.js
@@ -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
- });