matestack-ui-core 0.7.2
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +228 -0
- data/Rakefile +34 -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/absolute/absolute.haml +3 -0
- data/app/concepts/matestack/ui/core/absolute/absolute.rb +17 -0
- data/app/concepts/matestack/ui/core/action/action.haml +3 -0
- data/app/concepts/matestack/ui/core/action/action.js +49 -0
- data/app/concepts/matestack/ui/core/action/action.rb +52 -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.haml +4 -0
- data/app/concepts/matestack/ui/core/app/app.js +27 -0
- data/app/concepts/matestack/ui/core/app/app.rb +98 -0
- data/app/concepts/matestack/ui/core/app/store.js +70 -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/async/async.haml +2 -0
- data/app/concepts/matestack/ui/core/async/async.js +76 -0
- data/app/concepts/matestack/ui/core/async/async.rb +12 -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/br/br.haml +5 -0
- data/app/concepts/matestack/ui/core/br/br.rb +5 -0
- data/app/concepts/matestack/ui/core/button/button.haml +5 -0
- data/app/concepts/matestack/ui/core/button/button.rb +11 -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/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 +10 -0
- data/app/concepts/matestack/ui/core/component/children.haml +2 -0
- data/app/concepts/matestack/ui/core/component/component.js +59 -0
- data/app/concepts/matestack/ui/core/component/dynamic.haml +6 -0
- data/app/concepts/matestack/ui/core/component/dynamic.rb +261 -0
- data/app/concepts/matestack/ui/core/component/dynamic_without_rerender.haml +2 -0
- data/app/concepts/matestack/ui/core/component/response.haml +2 -0
- data/app/concepts/matestack/ui/core/component/response_dynamic.haml +7 -0
- data/app/concepts/matestack/ui/core/component/response_dynamic_without_rerender.haml +3 -0
- data/app/concepts/matestack/ui/core/component/static.haml +1 -0
- data/app/concepts/matestack/ui/core/component/static.rb +16 -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/div/div.haml +3 -0
- data/app/concepts/matestack/ui/core/div/div.rb +5 -0
- data/app/concepts/matestack/ui/core/footer/footer.haml +3 -0
- data/app/concepts/matestack/ui/core/footer/footer.rb +5 -0
- data/app/concepts/matestack/ui/core/form/form.haml +2 -0
- data/app/concepts/matestack/ui/core/form/form.js +136 -0
- data/app/concepts/matestack/ui/core/form/form.rb +71 -0
- data/app/concepts/matestack/ui/core/form/inline/inline.haml +6 -0
- data/app/concepts/matestack/ui/core/form/inline/inline.rb +9 -0
- data/app/concepts/matestack/ui/core/form/input/input.haml +27 -0
- data/app/concepts/matestack/ui/core/form/input/input.rb +74 -0
- data/app/concepts/matestack/ui/core/form/select/select.haml +76 -0
- data/app/concepts/matestack/ui/core/form/select/select.rb +73 -0
- data/app/concepts/matestack/ui/core/form/submit/submit.haml +3 -0
- data/app/concepts/matestack/ui/core/form/submit/submit.rb +9 -0
- data/app/concepts/matestack/ui/core/header/header.haml +3 -0
- data/app/concepts/matestack/ui/core/header/header.rb +5 -0
- data/app/concepts/matestack/ui/core/heading/heading.haml +50 -0
- data/app/concepts/matestack/ui/core/heading/heading.rb +5 -0
- data/app/concepts/matestack/ui/core/hr/hr.haml +1 -0
- data/app/concepts/matestack/ui/core/hr/hr.rb +5 -0
- data/app/concepts/matestack/ui/core/html/html.haml +3 -0
- data/app/concepts/matestack/ui/core/html/html.js +10 -0
- data/app/concepts/matestack/ui/core/html/html.rb +17 -0
- data/app/concepts/matestack/ui/core/icon/icon.haml +5 -0
- data/app/concepts/matestack/ui/core/icon/icon.rb +5 -0
- data/app/concepts/matestack/ui/core/img/img.haml +1 -0
- data/app/concepts/matestack/ui/core/img/img.rb +5 -0
- data/app/concepts/matestack/ui/core/input/input.haml +3 -0
- data/app/concepts/matestack/ui/core/input/input.rb +5 -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 +30 -0
- data/app/concepts/matestack/ui/core/js/event-hub.js +5 -0
- data/app/concepts/matestack/ui/core/js/helpers/query-params-helper.js +56 -0
- data/app/concepts/matestack/ui/core/label/label.haml +5 -0
- data/app/concepts/matestack/ui/core/label/label.rb +5 -0
- data/app/concepts/matestack/ui/core/li/li.haml +5 -0
- data/app/concepts/matestack/ui/core/li/li.rb +5 -0
- data/app/concepts/matestack/ui/core/link/link.haml +5 -0
- data/app/concepts/matestack/ui/core/link/link.rb +26 -0
- data/app/concepts/matestack/ui/core/main/main.haml +3 -0
- data/app/concepts/matestack/ui/core/main/main.rb +5 -0
- data/app/concepts/matestack/ui/core/nav/nav.haml +3 -0
- data/app/concepts/matestack/ui/core/nav/nav.rb +5 -0
- data/app/concepts/matestack/ui/core/ol/ol.haml +3 -0
- data/app/concepts/matestack/ui/core/ol/ol.rb +5 -0
- data/app/concepts/matestack/ui/core/onclick/onclick.haml +2 -0
- data/app/concepts/matestack/ui/core/onclick/onclick.js +21 -0
- data/app/concepts/matestack/ui/core/onclick/onclick.rb +5 -0
- data/app/concepts/matestack/ui/core/page/content.haml +7 -0
- data/app/concepts/matestack/ui/core/page/content.js +17 -0
- data/app/concepts/matestack/ui/core/page/content.rb +5 -0
- data/app/concepts/matestack/ui/core/page/page.haml +9 -0
- data/app/concepts/matestack/ui/core/page/page.rb +175 -0
- data/app/concepts/matestack/ui/core/paragraph/paragraph.haml +5 -0
- data/app/concepts/matestack/ui/core/paragraph/paragraph.rb +5 -0
- data/app/concepts/matestack/ui/core/partial/partial.haml +2 -0
- data/app/concepts/matestack/ui/core/partial/partial.rb +5 -0
- data/app/concepts/matestack/ui/core/pg/pg.haml +5 -0
- data/app/concepts/matestack/ui/core/pg/pg.rb +5 -0
- data/app/concepts/matestack/ui/core/plain/plain.rb +9 -0
- data/app/concepts/matestack/ui/core/progress/progress.haml +3 -0
- data/app/concepts/matestack/ui/core/progress/progress.rb +14 -0
- data/app/concepts/matestack/ui/core/section/section.haml +3 -0
- data/app/concepts/matestack/ui/core/section/section.rb +5 -0
- data/app/concepts/matestack/ui/core/slot/slot.haml +2 -0
- data/app/concepts/matestack/ui/core/slot/slot.rb +5 -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 +5 -0
- data/app/concepts/matestack/ui/core/span/span.rb +5 -0
- 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/table/table.haml +3 -0
- data/app/concepts/matestack/ui/core/table/table.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 +5 -0
- data/app/concepts/matestack/ui/core/td/td.rb +5 -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 +5 -0
- data/app/concepts/matestack/ui/core/th/th.rb +5 -0
- 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/time/time.haml +3 -0
- data/app/concepts/matestack/ui/core/time/time.rb +11 -0
- data/app/concepts/matestack/ui/core/tr/tr.haml +3 -0
- data/app/concepts/matestack/ui/core/tr/tr.rb +5 -0
- data/app/concepts/matestack/ui/core/transition/transition.haml +5 -0
- data/app/concepts/matestack/ui/core/transition/transition.js +26 -0
- data/app/concepts/matestack/ui/core/transition/transition.rb +31 -0
- data/app/concepts/matestack/ui/core/ul/ul.haml +3 -0
- data/app/concepts/matestack/ui/core/ul/ul.rb +5 -0
- data/app/concepts/matestack/ui/core/video/video.haml +1 -0
- data/app/concepts/matestack/ui/core/video/video.rb +7 -0
- data/app/concepts/matestack/ui/core/view/view.haml +2 -0
- data/app/concepts/matestack/ui/core/view/view.js +42 -0
- data/app/concepts/matestack/ui/core/view/view.rb +5 -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 +35 -0
- data/app/lib/matestack/ui/app.rb +1 -0
- data/app/lib/matestack/ui/core/app_node.rb +53 -0
- data/app/lib/matestack/ui/core/component_node.rb +73 -0
- data/app/lib/matestack/ui/core/page_node.rb +96 -0
- data/app/lib/matestack/ui/core/to_cell.rb +129 -0
- data/app/lib/matestack/ui/dynamic_component.rb +1 -0
- data/app/lib/matestack/ui/page.rb +1 -0
- data/app/lib/matestack/ui/static_component.rb +1 -0
- data/config/routes.rb +3 -0
- data/lib/generators/matestack_app/USAGE +21 -0
- data/lib/generators/matestack_app/matestack_app_generator.rb +26 -0
- data/lib/generators/matestack_app/templates/matestack_app.erb +26 -0
- data/lib/generators/matestack_app/templates/matestack_app_controller.erb +7 -0
- data/lib/generators/matestack_component/USAGE +20 -0
- data/lib/generators/matestack_component/matestack_component_generator.rb +30 -0
- data/lib/generators/matestack_component/templates/matestack_component.haml.erb +5 -0
- data/lib/generators/matestack_component/templates/matestack_component.js.erb +17 -0
- data/lib/generators/matestack_component/templates/matestack_component.rb.erb +13 -0
- data/lib/generators/matestack_component/templates/matestack_component.scss.erb +1 -0
- data/lib/generators/matestack_page/USAGE +28 -0
- data/lib/generators/matestack_page/matestack_page_generator.rb +41 -0
- data/lib/generators/matestack_page/templates/matestack_page.erb +15 -0
- data/lib/matestack/ui/core.rb +15 -0
- data/lib/matestack/ui/core/engine.rb +19 -0
- data/lib/matestack/ui/core/version.rb +7 -0
- data/lib/tasks/matestack/ui/core_tasks.rake +4 -0
- data/vendor/assets/javascripts/manifest.json +4 -0
- data/vendor/assets/javascripts/matestack-ui-core.js +15309 -0
- data/vendor/assets/javascripts/matestack-ui-core.js.map +1 -0
- metadata +350 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Vue from 'vue/dist/vue.esm'
|
|
2
|
+
import axios from 'axios'
|
|
3
|
+
import VRuntimeTemplate from "v-runtime-template"
|
|
4
|
+
import Vuex from 'vuex'
|
|
5
|
+
|
|
6
|
+
const componentDef = {
|
|
7
|
+
props: ['appConfig', 'params'],
|
|
8
|
+
data: function(){
|
|
9
|
+
return {}
|
|
10
|
+
},
|
|
11
|
+
computed: Vuex.mapState({
|
|
12
|
+
asyncTemplate: state => state.pageTemplate,
|
|
13
|
+
}),
|
|
14
|
+
mounted: function(){
|
|
15
|
+
const self = this;
|
|
16
|
+
window.onpopstate = function(event) {
|
|
17
|
+
self.$store.dispatch("navigateTo", {url: document.location.pathname, backwards: true} );
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
components: {
|
|
21
|
+
VRuntimeTemplate: VRuntimeTemplate
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let component = Vue.component('matestack-ui-core-app', componentDef)
|
|
26
|
+
|
|
27
|
+
export default componentDef
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
module Matestack::Ui::Core::App
|
|
2
|
+
class App < Trailblazer::Cell
|
|
3
|
+
include ActionView::Helpers::ActiveModelHelper
|
|
4
|
+
include ActionView::Helpers::ActiveModelInstanceTag
|
|
5
|
+
include ActionView::Helpers::AssetTagHelper
|
|
6
|
+
include ActionView::Helpers::AssetUrlHelper
|
|
7
|
+
include ActionView::Helpers::AtomFeedHelper
|
|
8
|
+
include ActionView::Helpers::CacheHelper
|
|
9
|
+
include ActionView::Helpers::CaptureHelper
|
|
10
|
+
include ActionView::Helpers::CspHelper
|
|
11
|
+
include ActionView::Helpers::CsrfHelper
|
|
12
|
+
include ActionView::Helpers::DateHelper
|
|
13
|
+
include ActionView::Helpers::DebugHelper
|
|
14
|
+
include ActionView::Helpers::FormHelper
|
|
15
|
+
include ActionView::Helpers::FormOptionsHelper
|
|
16
|
+
include ActionView::Helpers::FormTagHelper
|
|
17
|
+
include ActionView::Helpers::JavaScriptHelper
|
|
18
|
+
include ActionView::Helpers::NumberHelper
|
|
19
|
+
include ActionView::Helpers::OutputSafetyHelper
|
|
20
|
+
include ActionView::Helpers::RecordTagHelper
|
|
21
|
+
# include ActionView::Helpers::RenderingHelper
|
|
22
|
+
include ActionView::Helpers::SanitizeHelper
|
|
23
|
+
include ActionView::Helpers::TagHelper
|
|
24
|
+
include ActionView::Helpers::TextHelper
|
|
25
|
+
include ActionView::Helpers::TranslationHelper
|
|
26
|
+
include ActionView::Helpers::UrlHelper
|
|
27
|
+
include ::Cell::Haml
|
|
28
|
+
include Matestack::Ui::Core::ApplicationHelper
|
|
29
|
+
include Matestack::Ui::Core::ToCell
|
|
30
|
+
# include ::Rails.application.routes.url_helpers
|
|
31
|
+
|
|
32
|
+
view_paths << "#{Matestack::Ui::Core::Engine.root}/app/concepts"
|
|
33
|
+
|
|
34
|
+
extend ViewName::Flat
|
|
35
|
+
|
|
36
|
+
def self.prefixes
|
|
37
|
+
_prefixes = super
|
|
38
|
+
modified_prefixes = _prefixes.map do |prefix|
|
|
39
|
+
prefix_parts = prefix.split("/")
|
|
40
|
+
|
|
41
|
+
if prefix_parts.last.include?(self.name.split("::")[-1].downcase)
|
|
42
|
+
prefix_parts[0..-2].join("/")
|
|
43
|
+
else
|
|
44
|
+
prefix
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
return modified_prefixes
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def self.views_dir
|
|
53
|
+
return ""
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def initialize(model=nil, options={})
|
|
57
|
+
super
|
|
58
|
+
@nodes = {}
|
|
59
|
+
@cells = {}
|
|
60
|
+
@page_block = nil
|
|
61
|
+
@page_id = ""
|
|
62
|
+
setup
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def setup
|
|
66
|
+
true
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def prepare
|
|
70
|
+
true
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def show(page_id, page_nodes, &block)
|
|
74
|
+
@page_id = page_id
|
|
75
|
+
@page_nodes = page_nodes
|
|
76
|
+
prepare
|
|
77
|
+
response
|
|
78
|
+
render(view: :app, &block)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def page_nodes
|
|
82
|
+
@page_nodes
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def components(&block)
|
|
86
|
+
@nodes = Matestack::Ui::Core::AppNode.build(self, &block)
|
|
87
|
+
|
|
88
|
+
@nodes.each do |key, node|
|
|
89
|
+
@cells[key] = to_cell(key, node["component_name"], node["config"], node["argument"], node["components"], nil, node["cached_params"])
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def partial(&block)
|
|
94
|
+
Matestack::Ui::Core::AppNode.build(self, &block)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
end
|
|
98
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import Vue from 'vue/dist/vue.esm'
|
|
2
|
+
import Vuex from 'vuex'
|
|
3
|
+
import axios from 'axios'
|
|
4
|
+
import matestackEventHub from 'js/event-hub'
|
|
5
|
+
|
|
6
|
+
Vue.use(Vuex)
|
|
7
|
+
|
|
8
|
+
const store = new Vuex.Store({
|
|
9
|
+
state: {
|
|
10
|
+
pageTemplate: null,
|
|
11
|
+
currentPath: document.location.pathname
|
|
12
|
+
},
|
|
13
|
+
mutations: {
|
|
14
|
+
setPageTemplate (state, serverResponse){
|
|
15
|
+
state.pageTemplate = serverResponse
|
|
16
|
+
},
|
|
17
|
+
setCurrentPath (state, path){
|
|
18
|
+
state.currentPath = path
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
actions: {
|
|
22
|
+
navigateTo ({ commit, state }, { url, backwards }) {
|
|
23
|
+
matestackEventHub.$emit("page_loading", url);
|
|
24
|
+
if (typeof matestackUiCoreTransitionStart !== 'undefined') {
|
|
25
|
+
matestackUiCoreTransitionStart(url);
|
|
26
|
+
}
|
|
27
|
+
if (!window.history.pushState) {
|
|
28
|
+
document.location.href = url;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
axios({
|
|
33
|
+
method: "get",
|
|
34
|
+
url: url,
|
|
35
|
+
headers: {
|
|
36
|
+
'X-CSRF-Token': document.getElementsByName("csrf-token")[0].getAttribute('content')
|
|
37
|
+
},
|
|
38
|
+
params: {"only_page": true}
|
|
39
|
+
})
|
|
40
|
+
.then(function(response){
|
|
41
|
+
if (backwards){
|
|
42
|
+
window.history.replaceState({matestackApp: true, url: url}, null, url);
|
|
43
|
+
} else {
|
|
44
|
+
window.history.pushState({matestackApp: true, url: url}, null, url);
|
|
45
|
+
}
|
|
46
|
+
setTimeout(function () {
|
|
47
|
+
resolve(response["data"])
|
|
48
|
+
commit('setPageTemplate', response["data"])
|
|
49
|
+
commit('setCurrentPath', url)
|
|
50
|
+
matestackEventHub.$emit("page_loaded", url);
|
|
51
|
+
if (typeof matestackUiCoreTransitionSuccess !== 'undefined') {
|
|
52
|
+
matestackUiCoreTransitionSuccess(url);
|
|
53
|
+
}
|
|
54
|
+
}, 5);
|
|
55
|
+
})
|
|
56
|
+
.catch(function(error){
|
|
57
|
+
setTimeout(function () {
|
|
58
|
+
resolve(error)
|
|
59
|
+
matestackEventHub.$emit("page_loading_error", error);
|
|
60
|
+
if (typeof matestackUiCoreTransitionError !== 'undefined') {
|
|
61
|
+
matestackUiCoreTransitionError(url);
|
|
62
|
+
}
|
|
63
|
+
}, 5);
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
export default store
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import Vue from 'vue/dist/vue.esm'
|
|
2
|
+
import matestackEventHub from 'js/event-hub'
|
|
3
|
+
import componentMixin from 'component/component'
|
|
4
|
+
|
|
5
|
+
const componentDef = {
|
|
6
|
+
mixins: [componentMixin],
|
|
7
|
+
data: function(){
|
|
8
|
+
return {
|
|
9
|
+
showing: true,
|
|
10
|
+
hide_after_timeout: null,
|
|
11
|
+
event: {
|
|
12
|
+
data: {}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
methods: {
|
|
17
|
+
show: function(event_data){
|
|
18
|
+
const self = this
|
|
19
|
+
if (this.showing === true){
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
this.showing = true
|
|
23
|
+
this.event.data = event_data
|
|
24
|
+
if(this.componentConfig["defer"] != undefined){
|
|
25
|
+
if(!isNaN(this.componentConfig["defer"])){
|
|
26
|
+
this.startDefer()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if(this.componentConfig["hide_after"] != undefined){
|
|
30
|
+
self.hide_after_timeout = setTimeout(function () {
|
|
31
|
+
self.hide()
|
|
32
|
+
}, parseInt(this.componentConfig["hide_after"]));
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
hide: function(){
|
|
36
|
+
this.showing = false
|
|
37
|
+
this.event.data = {}
|
|
38
|
+
},
|
|
39
|
+
startDefer: function(){
|
|
40
|
+
const self = this
|
|
41
|
+
setTimeout(function () {
|
|
42
|
+
self.rerender()
|
|
43
|
+
}, parseInt(this.componentConfig["defer"]));
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
created: function () {
|
|
47
|
+
const self = this
|
|
48
|
+
matestackEventHub.$on(this.componentConfig["rerender_on"], self.rerender)
|
|
49
|
+
matestackEventHub.$on(this.componentConfig["show_on"], self.show)
|
|
50
|
+
matestackEventHub.$on(this.componentConfig["hide_on"], self.hide)
|
|
51
|
+
if(this.componentConfig["show_on"] != undefined){
|
|
52
|
+
this.showing = false
|
|
53
|
+
}
|
|
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){
|
|
62
|
+
this.showing = true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
beforeDestroy: function() {
|
|
66
|
+
const self = this
|
|
67
|
+
clearTimeout(self.hide_after_timeout)
|
|
68
|
+
matestackEventHub.$off(this.componentConfig["rerender_on"], self.rerender);
|
|
69
|
+
matestackEventHub.$off(this.componentConfig["show_on"], self.show);
|
|
70
|
+
matestackEventHub.$off(this.componentConfig["hide_on"], self.hide);
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let component = Vue.component('matestack-ui-core-async', componentDef)
|
|
75
|
+
|
|
76
|
+
export default componentDef
|
|
@@ -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
|