matestack-ui-core 0.7.0 → 0.7.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.
- checksums.yaml +4 -4
- data/README.md +16 -12
- data/Rakefile +32 -0
- data/app/concepts/matestack/ui/core/abbr/abbr.haml +5 -0
- data/app/concepts/matestack/ui/core/abbr/abbr.rb +12 -0
- data/app/concepts/matestack/ui/core/action/action.js +51 -29
- data/app/concepts/matestack/ui/core/action/action.rb +3 -0
- data/app/concepts/matestack/ui/core/actionview/dynamic.haml +6 -0
- data/app/concepts/matestack/ui/core/actionview/dynamic.rb +28 -0
- data/app/concepts/matestack/ui/core/actionview/static.haml +1 -0
- data/app/concepts/matestack/ui/core/actionview/static.rb +28 -0
- data/app/concepts/matestack/ui/core/address/address.haml +5 -0
- data/app/concepts/matestack/ui/core/address/address.rb +5 -0
- data/app/concepts/matestack/ui/core/app/app.js +7 -4
- data/app/concepts/matestack/ui/core/app/app.rb +3 -28
- data/app/concepts/matestack/ui/core/app/location.js +10 -0
- data/app/concepts/matestack/ui/core/app/store.js +1 -2
- data/app/concepts/matestack/ui/core/area/area.haml +1 -0
- data/app/concepts/matestack/ui/core/area/area.rb +18 -0
- data/app/concepts/matestack/ui/core/article/article.haml +5 -0
- data/app/concepts/matestack/ui/core/article/article.rb +5 -0
- data/app/concepts/matestack/ui/core/aside/aside.haml +3 -0
- data/app/concepts/matestack/ui/core/aside/aside.rb +5 -0
- data/app/concepts/matestack/ui/core/async/async.haml +1 -1
- data/app/concepts/matestack/ui/core/async/async.js +24 -5
- data/app/concepts/matestack/ui/core/async/async.rb +8 -6
- data/app/concepts/matestack/ui/core/b/b.haml +5 -0
- data/app/concepts/matestack/ui/core/b/b.rb +5 -0
- data/app/concepts/matestack/ui/core/bdi/bdi.haml +5 -0
- data/app/concepts/matestack/ui/core/bdi/bdi.rb +4 -0
- data/app/concepts/matestack/ui/core/bdo/bdo.haml +5 -0
- data/app/concepts/matestack/ui/core/bdo/bdo.rb +11 -0
- data/app/concepts/matestack/ui/core/blockquote/blockquote.haml +5 -0
- data/app/concepts/matestack/ui/core/blockquote/blockquote.rb +11 -0
- data/app/concepts/matestack/ui/core/button/button.haml +4 -6
- data/app/concepts/matestack/ui/core/button/button.rb +6 -0
- data/app/concepts/matestack/ui/core/caption/caption.haml +5 -0
- data/app/concepts/matestack/ui/core/caption/caption.rb +5 -0
- data/app/concepts/matestack/ui/core/cite/cite.haml +5 -0
- data/app/concepts/matestack/ui/core/cite/cite.rb +5 -0
- data/app/concepts/matestack/ui/core/code/code.haml +5 -0
- data/app/concepts/matestack/ui/core/code/code.rb +5 -0
- data/app/concepts/matestack/ui/core/collection/content/content.js +98 -0
- data/app/concepts/matestack/ui/core/collection/content/content.rb +18 -0
- data/app/concepts/matestack/ui/core/collection/content/next/next.haml +3 -0
- data/app/concepts/matestack/ui/core/collection/content/next/next.rb +5 -0
- data/app/concepts/matestack/ui/core/collection/content/page/link/link.haml +3 -0
- data/app/concepts/matestack/ui/core/collection/content/page/link/link.rb +5 -0
- data/app/concepts/matestack/ui/core/collection/content/previous/previous.haml +3 -0
- data/app/concepts/matestack/ui/core/collection/content/previous/previous.rb +5 -0
- data/app/concepts/matestack/ui/core/collection/filter/filter.js +48 -0
- data/app/concepts/matestack/ui/core/collection/filter/filter.rb +17 -0
- data/app/concepts/matestack/ui/core/collection/filter/input/input.haml +2 -0
- data/app/concepts/matestack/ui/core/collection/filter/input/input.rb +25 -0
- data/app/concepts/matestack/ui/core/collection/filter/reset/reset.haml +3 -0
- data/app/concepts/matestack/ui/core/collection/filter/reset/reset.rb +5 -0
- data/app/concepts/matestack/ui/core/collection/filter/submit/submit.haml +3 -0
- data/app/concepts/matestack/ui/core/collection/filter/submit/submit.rb +5 -0
- data/app/concepts/matestack/ui/core/collection/helper.rb +113 -0
- data/app/concepts/matestack/ui/core/collection/order/order.js +56 -0
- data/app/concepts/matestack/ui/core/collection/order/order.rb +17 -0
- data/app/concepts/matestack/ui/core/collection/order/toggle/indicator/indicator.rb +13 -0
- data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.haml +3 -0
- data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.rb +5 -0
- data/app/concepts/matestack/ui/core/component/anonym-dynamic-component.js +1 -1
- data/app/concepts/matestack/ui/core/component/component.js +3 -4
- data/app/concepts/matestack/ui/core/component/dynamic.rb +38 -33
- data/app/concepts/matestack/ui/core/data/data.haml +5 -0
- data/app/concepts/matestack/ui/core/data/data.rb +9 -0
- data/app/concepts/matestack/ui/core/dd/dd.haml +5 -0
- data/app/concepts/matestack/ui/core/dd/dd.rb +5 -0
- data/app/concepts/matestack/ui/core/del/del.haml +5 -0
- data/app/concepts/matestack/ui/core/del/del.rb +4 -0
- data/app/concepts/matestack/ui/core/details/details.haml +3 -0
- data/app/concepts/matestack/ui/core/details/details.rb +5 -0
- data/app/concepts/matestack/ui/core/dfn/dfn.haml +5 -0
- data/app/concepts/matestack/ui/core/dfn/dfn.rb +6 -0
- data/app/concepts/matestack/ui/core/dialog/dialog.haml +5 -0
- data/app/concepts/matestack/ui/core/dialog/dialog.rb +9 -0
- data/app/concepts/matestack/ui/core/div/div.rb +0 -1
- data/app/concepts/matestack/ui/core/dl/dl.haml +5 -0
- data/app/concepts/matestack/ui/core/dl/dl.rb +5 -0
- data/app/concepts/matestack/ui/core/dt/dt.haml +5 -0
- data/app/concepts/matestack/ui/core/dt/dt.rb +5 -0
- data/app/concepts/matestack/ui/core/em/em.haml +5 -0
- data/app/concepts/matestack/ui/core/em/em.rb +5 -0
- data/app/concepts/matestack/ui/core/fieldset/fieldset.haml +5 -0
- data/app/concepts/matestack/ui/core/fieldset/fieldset.rb +9 -0
- data/app/concepts/matestack/ui/core/figure/figure.haml +3 -0
- data/app/concepts/matestack/ui/core/figure/figure.rb +5 -0
- data/app/concepts/matestack/ui/core/form/form.js +42 -6
- data/app/concepts/matestack/ui/core/form/input/input.haml +4 -6
- data/app/concepts/matestack/ui/core/form/select/select.haml +10 -6
- data/app/concepts/matestack/ui/core/html/html.js +1 -1
- data/app/concepts/matestack/ui/core/icon/icon.haml +2 -3
- data/app/concepts/matestack/ui/core/iframe/iframe.haml +5 -0
- data/app/concepts/matestack/ui/core/iframe/iframe.rb +14 -0
- data/app/concepts/matestack/ui/core/img/img.haml +1 -1
- data/app/concepts/matestack/ui/core/img/img.rb +10 -0
- data/app/concepts/matestack/ui/core/ins/ins.haml +5 -0
- data/app/concepts/matestack/ui/core/ins/ins.rb +10 -0
- data/app/concepts/matestack/ui/core/isolate/isolate.haml +2 -0
- data/app/concepts/matestack/ui/core/isolate/isolate.rb +11 -0
- data/app/concepts/matestack/ui/core/js/core.js +15 -12
- data/app/concepts/matestack/ui/core/js/helpers/query-params-helper.js +56 -0
- data/app/concepts/matestack/ui/core/kbd/kbd.haml +5 -0
- data/app/concepts/matestack/ui/core/kbd/kbd.rb +4 -0
- data/app/concepts/matestack/ui/core/label/label.haml +4 -6
- data/app/concepts/matestack/ui/core/label/label.rb +6 -1
- data/app/concepts/matestack/ui/core/legend/legend.haml +5 -0
- data/app/concepts/matestack/ui/core/legend/legend.rb +5 -0
- data/app/concepts/matestack/ui/core/li/li.haml +2 -3
- data/app/concepts/matestack/ui/core/link/link.haml +5 -6
- data/app/concepts/matestack/ui/core/link/link.rb +5 -2
- data/app/concepts/matestack/ui/core/map/map.haml +3 -0
- data/app/concepts/matestack/ui/core/map/map.rb +11 -0
- data/app/concepts/matestack/ui/core/mark/mark.haml +5 -0
- data/app/concepts/matestack/ui/core/mark/mark.rb +4 -0
- data/app/concepts/matestack/ui/core/meter/meter.haml +4 -0
- data/app/concepts/matestack/ui/core/meter/meter.rb +14 -0
- data/app/concepts/matestack/ui/core/noscript/noscript.haml +5 -0
- data/app/concepts/matestack/ui/core/noscript/noscript.rb +5 -0
- data/app/concepts/matestack/ui/core/object/object.haml +1 -0
- data/app/concepts/matestack/ui/core/object/object.rb +15 -0
- data/app/concepts/matestack/ui/core/onclick/onclick.haml +1 -1
- data/app/concepts/matestack/ui/core/onclick/onclick.js +2 -3
- data/app/concepts/matestack/ui/core/onclick/onclick.rb +1 -2
- data/app/concepts/matestack/ui/core/optgroup/optgroup.haml +3 -0
- data/app/concepts/matestack/ui/core/optgroup/optgroup.rb +10 -0
- data/app/concepts/matestack/ui/core/option/option.haml +5 -0
- data/app/concepts/matestack/ui/core/option/option.rb +12 -0
- data/app/concepts/matestack/ui/core/output/output.haml +5 -0
- data/app/concepts/matestack/ui/core/output/output.rb +11 -0
- data/app/concepts/matestack/ui/core/page/content.js +1 -1
- data/app/concepts/matestack/ui/core/page/page.rb +63 -23
- data/app/concepts/matestack/ui/core/paragraph/paragraph.haml +4 -7
- data/app/concepts/matestack/ui/core/param/param.haml +1 -0
- data/app/concepts/matestack/ui/core/param/param.rb +10 -0
- data/app/concepts/matestack/ui/core/pg/pg.haml +4 -7
- data/app/concepts/matestack/ui/core/picture/picture.haml +3 -0
- data/app/concepts/matestack/ui/core/picture/picture.rb +4 -0
- data/app/concepts/matestack/ui/core/plain/plain.rb +1 -2
- data/app/concepts/matestack/ui/core/pre/pre.haml +5 -0
- data/app/concepts/matestack/ui/core/pre/pre.rb +5 -0
- data/app/concepts/matestack/ui/core/q/q.haml +5 -0
- data/app/concepts/matestack/ui/core/q/q.rb +11 -0
- data/app/concepts/matestack/ui/core/rp/rp.haml +5 -0
- data/app/concepts/matestack/ui/core/rp/rp.rb +5 -0
- data/app/concepts/matestack/ui/core/rt/rt.haml +5 -0
- data/app/concepts/matestack/ui/core/rt/rt.rb +5 -0
- data/app/concepts/matestack/ui/core/ruby/ruby.haml +5 -0
- data/app/concepts/matestack/ui/core/ruby/ruby.rb +5 -0
- data/app/concepts/matestack/ui/core/s/s.haml +5 -0
- data/app/concepts/matestack/ui/core/s/s.rb +6 -0
- data/app/concepts/matestack/ui/core/samp/samp.haml +5 -0
- data/app/concepts/matestack/ui/core/samp/samp.rb +4 -0
- data/app/concepts/matestack/ui/core/small/small.haml +5 -0
- data/app/concepts/matestack/ui/core/small/small.rb +5 -0
- data/app/concepts/matestack/ui/core/span/span.haml +3 -1
- data/app/concepts/matestack/ui/core/strong/strong.haml +5 -0
- data/app/concepts/matestack/ui/core/strong/strong.rb +5 -0
- data/app/concepts/matestack/ui/core/sub/sub.haml +5 -0
- data/app/concepts/matestack/ui/core/sub/sub.rb +5 -0
- data/app/concepts/matestack/ui/core/summary/summary.haml +5 -0
- data/app/concepts/matestack/ui/core/summary/summary.rb +5 -0
- data/app/concepts/matestack/ui/core/sup/sup.haml +5 -0
- data/app/concepts/matestack/ui/core/sup/sup.rb +5 -0
- data/app/concepts/matestack/ui/core/tbody/tbody.haml +3 -0
- data/app/concepts/matestack/ui/core/tbody/tbody.rb +5 -0
- data/app/concepts/matestack/ui/core/td/td.haml +4 -7
- data/app/concepts/matestack/ui/core/template/template.haml +3 -0
- data/app/concepts/matestack/ui/core/template/template.rb +4 -0
- data/app/concepts/matestack/ui/core/tfoot/tfoot.haml +3 -0
- data/app/concepts/matestack/ui/core/tfoot/tfoot.rb +5 -0
- data/app/concepts/matestack/ui/core/th/th.haml +4 -7
- data/app/concepts/matestack/ui/core/thead/thead.haml +3 -0
- data/app/concepts/matestack/ui/core/thead/thead.rb +5 -0
- data/app/concepts/matestack/ui/core/transition/transition.haml +4 -6
- data/app/concepts/matestack/ui/core/transition/transition.js +1 -1
- data/app/concepts/matestack/ui/core/u/u.haml +5 -0
- data/app/concepts/matestack/ui/core/u/u.rb +6 -0
- data/app/concepts/matestack/ui/core/unescaped/unescaped.rb +7 -0
- data/app/concepts/matestack/ui/core/var/var.haml +5 -0
- data/app/concepts/matestack/ui/core/var/var.rb +4 -0
- data/app/concepts/matestack/ui/core/video/video.haml +3 -0
- data/app/concepts/matestack/ui/core/video/video.rb +23 -0
- data/app/concepts/matestack/ui/core/wbr/wbr.haml +1 -0
- data/app/concepts/matestack/ui/core/wbr/wbr.rb +4 -0
- data/app/concepts/matestack/ui/core/youtube/youtube.haml +1 -0
- data/app/concepts/matestack/ui/core/youtube/youtube.rb +26 -0
- data/app/helpers/matestack/ui/core/application_helper.rb +3 -1
- data/app/javascript/matestack-ui-core/index.js +22 -0
- data/app/javascript/matestack-ui-core/styles/index.scss +5 -0
- data/app/javascript/packs/matestack-ui-core.js +8 -0
- data/app/lib/matestack/ui/core/component_node.rb +30 -12
- data/app/lib/matestack/ui/core/has_view_context.rb +10 -0
- data/app/lib/matestack/ui/core/page_node.rb +40 -6
- data/app/lib/matestack/ui/core/render.rb +89 -0
- data/app/lib/matestack/ui/core/to_cell.rb +3 -1
- data/app/lib/matestack/ui/dynamic_actionview_component.rb +1 -0
- data/app/lib/matestack/ui/static_actionview_component.rb +1 -0
- data/config/routes.rb +0 -1
- data/lib/generators/matestack/app/USAGE +21 -0
- data/lib/generators/matestack/app/app_generator.rb +25 -0
- data/lib/generators/matestack/app/templates/app/controllers/%file_name%_controller.rb.tt +5 -0
- data/lib/generators/matestack/app/templates/app/matestack/apps/%file_name%.rb.tt +28 -0
- data/lib/generators/matestack/component/USAGE +20 -0
- data/lib/generators/matestack/component/component_generator.rb +29 -0
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.haml.tt +5 -0
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.js.tt +17 -0
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.rb.tt +11 -0
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.scss.tt +1 -0
- data/lib/generators/matestack/core/component/USAGE +16 -0
- data/lib/generators/matestack/core/component/component_generator.rb +23 -0
- data/lib/generators/matestack/core/component/templates/app/concepts/matestack/ui/core/%file_name%/%file_name%.haml.tt +5 -0
- data/lib/generators/matestack/core/component/templates/app/concepts/matestack/ui/core/%file_name%/%file_name%.rb.tt +4 -0
- data/lib/generators/matestack/core/component/templates/docs/components/%file_name%.md.tt +45 -0
- data/lib/generators/matestack/core/component/templates/spec/usage/components/%file_name%_spec.rb +31 -0
- data/lib/generators/matestack/page/USAGE +28 -0
- data/lib/generators/matestack/page/page_generator.rb +54 -0
- data/lib/generators/matestack/page/templates/app/matestack/pages/%app_name%/%namespace%/%file_name%.rb.tt +29 -0
- data/lib/matestack/ui/core.rb +1 -0
- data/lib/matestack/ui/core/cell.rb +33 -0
- data/lib/matestack/ui/core/version.rb +1 -1
- data/vendor/assets/javascripts/dist/manifest.json +18 -0
- data/vendor/assets/javascripts/dist/manifest.json.br +0 -0
- data/vendor/assets/javascripts/dist/manifest.json.gz +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.css +3 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.css.map +1 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.js +16523 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.js.map +1 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.css +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js +3 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.LICENSE.txt +18 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.br +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.gz +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map +1 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map.br +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map.gz +0 -0
- data/vendor/assets/javascripts/matestack-ui-core.js.erb +2 -0
- data/vendor/assets/stylesheets/dist +1 -0
- data/vendor/assets/stylesheets/matestack-ui-core.css.erb +2 -0
- metadata +203 -19
- data/app/concepts/matestack/ui/core/view/view.haml +0 -2
- data/app/concepts/matestack/ui/core/view/view.js +0 -42
- data/app/concepts/matestack/ui/core/view/view.rb +0 -7
- data/vendor/assets/javascripts/manifest.json +0 -4
- data/vendor/assets/javascripts/matestack-ui-core.js +0 -15055
- data/vendor/assets/javascripts/matestack-ui-core.js.map +0 -1
@@ -1,2 +1,2 @@
|
|
1
|
-
%div{
|
1
|
+
%div{@tag_attributes}
|
2
2
|
= yield
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import Vue from 'vue/dist/vue.esm'
|
2
|
-
|
3
|
-
import
|
4
|
-
|
5
|
-
import componentMixin from 'component/component'
|
2
|
+
import matestackEventHub from '../js/event-hub'
|
3
|
+
import componentMixin from '../component/component'
|
6
4
|
|
7
5
|
const componentDef = {
|
8
6
|
mixins: [componentMixin],
|
@@ -18,8 +16,16 @@ const componentDef = {
|
|
18
16
|
methods: {
|
19
17
|
show: function(event_data){
|
20
18
|
const self = this
|
19
|
+
if (this.showing === true){
|
20
|
+
return
|
21
|
+
}
|
21
22
|
this.showing = true
|
22
23
|
this.event.data = event_data
|
24
|
+
if(this.componentConfig["defer"] != undefined){
|
25
|
+
if(!isNaN(this.componentConfig["defer"])){
|
26
|
+
this.startDefer()
|
27
|
+
}
|
28
|
+
}
|
23
29
|
if(this.componentConfig["hide_after"] != undefined){
|
24
30
|
self.hide_after_timeout = setTimeout(function () {
|
25
31
|
self.hide()
|
@@ -29,6 +35,12 @@ const componentDef = {
|
|
29
35
|
hide: function(){
|
30
36
|
this.showing = false
|
31
37
|
this.event.data = {}
|
38
|
+
},
|
39
|
+
startDefer: function(){
|
40
|
+
const self = this
|
41
|
+
setTimeout(function () {
|
42
|
+
self.rerender()
|
43
|
+
}, parseInt(this.componentConfig["defer"]));
|
32
44
|
}
|
33
45
|
},
|
34
46
|
created: function () {
|
@@ -39,7 +51,14 @@ const componentDef = {
|
|
39
51
|
if(this.componentConfig["show_on"] != undefined){
|
40
52
|
this.showing = false
|
41
53
|
}
|
42
|
-
if(this.componentConfig["
|
54
|
+
if(this.componentConfig["defer"] != undefined){
|
55
|
+
if(!isNaN(this.componentConfig["defer"])){
|
56
|
+
if (this.componentConfig["show_on"] == undefined){
|
57
|
+
this.startDefer()
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
if(this.componentConfig["init_show"] == true){
|
43
62
|
this.showing = true
|
44
63
|
}
|
45
64
|
},
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module Matestack::Ui::Core::Async
|
2
|
-
|
3
|
-
|
4
|
-
def setup
|
5
|
-
@rerender = true
|
6
|
-
end
|
7
|
-
|
2
|
+
class Async < Matestack::Ui::Core::Component::Dynamic
|
8
3
|
|
4
|
+
def setup
|
5
|
+
@rerender = true
|
6
|
+
@tag_attributes.merge!({
|
7
|
+
"v-if": "showing"
|
8
|
+
})
|
9
9
|
end
|
10
|
+
|
10
11
|
end
|
12
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
import Vue from 'vue/dist/vue.esm'
|
2
|
+
import matestackEventHub from '../../js/event-hub'
|
3
|
+
import queryParamsHelper from '../../js/helpers/query-params-helper'
|
4
|
+
import componentMixin from '../../component/component'
|
5
|
+
import asyncMixin from '../../async/async'
|
6
|
+
|
7
|
+
const componentDef = {
|
8
|
+
mixins: [componentMixin, asyncMixin],
|
9
|
+
data: function(){
|
10
|
+
return {
|
11
|
+
currentLimit: null,
|
12
|
+
currentOffset: null,
|
13
|
+
currentFilteredCount: null,
|
14
|
+
currentBaseCount: null
|
15
|
+
}
|
16
|
+
},
|
17
|
+
methods: {
|
18
|
+
next: function(){
|
19
|
+
if (this.currentTo() < this.currentCount()){
|
20
|
+
this.currentOffset += this.currentLimit
|
21
|
+
var url = queryParamsHelper.updateQueryParams(this.componentConfig["id"] + "-offset", this.currentOffset)
|
22
|
+
window.history.pushState({matestackApp: true, url: url}, null, url);
|
23
|
+
matestackEventHub.$emit(this.componentConfig["id"] + "-update")
|
24
|
+
}
|
25
|
+
},
|
26
|
+
previous: function(){
|
27
|
+
if ((this.currentOffset - this.currentLimit)*-1 != this.currentLimit){
|
28
|
+
if((this.currentOffset - this.currentLimit) < 0){
|
29
|
+
this.currentOffset = 0
|
30
|
+
} else {
|
31
|
+
this.currentOffset -= this.currentLimit
|
32
|
+
}
|
33
|
+
var url = queryParamsHelper.updateQueryParams(this.componentConfig["id"] + "-offset", this.currentOffset)
|
34
|
+
window.history.pushState({matestackApp: true, url: url}, null, url);
|
35
|
+
matestackEventHub.$emit(this.componentConfig["id"] + "-update")
|
36
|
+
}
|
37
|
+
},
|
38
|
+
currentTo: function(){
|
39
|
+
var to = parseInt(this.currentOffset) + parseInt(this.currentLimit)
|
40
|
+
if (to > parseInt(this.currentCount())){
|
41
|
+
return this.currentCount();
|
42
|
+
} else {
|
43
|
+
return to;
|
44
|
+
}
|
45
|
+
},
|
46
|
+
currentCount: function(){
|
47
|
+
if (this.currentFilteredCount != null || this.currentFilteredCount != undefined){
|
48
|
+
return this.currentFilteredCount;
|
49
|
+
} else {
|
50
|
+
return this.currentBaseCount;
|
51
|
+
}
|
52
|
+
},
|
53
|
+
goToPage: function(page){
|
54
|
+
this.currentOffset = parseInt(this.currentLimit) * (parseInt(page)-1)
|
55
|
+
var url = queryParamsHelper.updateQueryParams(this.componentConfig["id"] + "-offset", this.currentOffset)
|
56
|
+
window.history.pushState({matestackApp: true, url: url}, null, url);
|
57
|
+
matestackEventHub.$emit(this.componentConfig["id"] + "-update")
|
58
|
+
}
|
59
|
+
},
|
60
|
+
mounted: function(){
|
61
|
+
if(queryParamsHelper.getQueryParam(this.componentConfig["id"] + "-offset") != null){
|
62
|
+
this.currentOffset = parseInt(queryParamsHelper.getQueryParam(this.componentConfig["id"] + "-offset"))
|
63
|
+
} else {
|
64
|
+
if(this.componentConfig["init_offset"] != undefined){
|
65
|
+
this.currentOffset = this.componentConfig["init_offset"]
|
66
|
+
} else {
|
67
|
+
this.currentOffset = 0
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
if(queryParamsHelper.getQueryParam(this.componentConfig["id"] + "-limit") != null){
|
72
|
+
this.currentOffset = parseInt(queryParamsHelper.getQueryParam(this.componentConfig["id"] + "-limit"))
|
73
|
+
} else {
|
74
|
+
if(this.componentConfig["init_limit"] != undefined){
|
75
|
+
this.currentLimit = this.componentConfig["init_limit"]
|
76
|
+
} else {
|
77
|
+
this.currentLimit = 10
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
if(this.componentConfig["filtered_count"] != undefined){
|
82
|
+
this.currentFilteredCount = this.componentConfig["filtered_count"]
|
83
|
+
if(this.currentOffset >= this.currentFilteredCount){
|
84
|
+
this.previous()
|
85
|
+
}
|
86
|
+
}
|
87
|
+
if(this.componentConfig["base_count"] != undefined){
|
88
|
+
this.currentBaseCount = this.componentConfig["base_count"]
|
89
|
+
if(this.currentOffset >= this.currentBaseCount){
|
90
|
+
this.previous()
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
let component = Vue.component('matestack-ui-core-collection-content', componentDef)
|
97
|
+
|
98
|
+
export default componentDef
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Matestack::Ui::Core::Collection::Content
|
2
|
+
class Content < Matestack::Ui::Core::Component::Dynamic
|
3
|
+
|
4
|
+
def setup
|
5
|
+
@rerender = true
|
6
|
+
@component_config = @component_config.except(:data, :paginated_data)
|
7
|
+
end
|
8
|
+
|
9
|
+
def response
|
10
|
+
components {
|
11
|
+
div @tag_attributes do
|
12
|
+
yield_components
|
13
|
+
end
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import Vue from 'vue/dist/vue.esm'
|
2
|
+
import matestackEventHub from '../../js/event-hub'
|
3
|
+
import queryParamsHelper from '../../js/helpers/query-params-helper'
|
4
|
+
import componentMixin from '../../component/component'
|
5
|
+
|
6
|
+
const componentDef = {
|
7
|
+
mixins: [componentMixin],
|
8
|
+
data: function(){
|
9
|
+
return {
|
10
|
+
filter: {}
|
11
|
+
}
|
12
|
+
},
|
13
|
+
methods: {
|
14
|
+
submitFilter: function(){
|
15
|
+
var url;
|
16
|
+
var filter = this.filter
|
17
|
+
for (var key in this.filter) {
|
18
|
+
url = queryParamsHelper.updateQueryParams(this.componentConfig["id"] + "-filter-" + key, this.filter[key], url)
|
19
|
+
}
|
20
|
+
url = queryParamsHelper.updateQueryParams(this.componentConfig["id"] + "-offset", 0, url)
|
21
|
+
window.history.pushState({matestackApp: true, url: url}, null, url);
|
22
|
+
matestackEventHub.$emit(this.componentConfig["id"] + "-update")
|
23
|
+
},
|
24
|
+
resetFilter: function(){
|
25
|
+
var url;
|
26
|
+
for (var key in this.filter) {
|
27
|
+
url = queryParamsHelper.updateQueryParams(this.componentConfig["id"] + "-filter-" + key, null, url)
|
28
|
+
this.filter[key] = null;
|
29
|
+
this.$forceUpdate();
|
30
|
+
}
|
31
|
+
window.history.pushState({matestackApp: true, url: url}, null, url);
|
32
|
+
matestackEventHub.$emit(this.componentConfig["id"] + "-update")
|
33
|
+
}
|
34
|
+
},
|
35
|
+
created: function(){
|
36
|
+
var self = this;
|
37
|
+
var queryParamsObject = queryParamsHelper.queryParamsToObject()
|
38
|
+
Object.keys(queryParamsObject).forEach(function(key){
|
39
|
+
if (key.startsWith(self.componentConfig["id"] + "-filter-")){
|
40
|
+
self.filter[key.replace(self.componentConfig["id"] + "-filter-", "")] = queryParamsObject[key]
|
41
|
+
}
|
42
|
+
})
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
let component = Vue.component('matestack-ui-core-collection-filter', componentDef)
|
47
|
+
|
48
|
+
export default componentDef
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Matestack::Ui::Core::Collection::Filter
|
2
|
+
class Filter < Matestack::Ui::Core::Component::Dynamic
|
3
|
+
|
4
|
+
def setup
|
5
|
+
@component_config = @component_config.except(:data, :paginated_data)
|
6
|
+
end
|
7
|
+
|
8
|
+
def response
|
9
|
+
components {
|
10
|
+
div @tag_attributes do
|
11
|
+
yield_components
|
12
|
+
end
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|