matestack-ui-core 1.0.1 → 1.1.0
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/app/concepts/matestack/ui/core/async/async.js +6 -28
- data/app/concepts/matestack/ui/core/async/async.rb +7 -10
- data/app/concepts/matestack/ui/core/cable/cable.haml +4 -0
- data/app/concepts/matestack/ui/core/cable/cable.js +100 -0
- data/app/concepts/matestack/ui/core/cable/cable.rb +28 -0
- data/app/concepts/matestack/ui/core/cable/children_wrapper.haml +2 -0
- data/app/concepts/matestack/ui/core/collection/content/content.js +2 -2
- data/app/concepts/matestack/ui/core/collection/content/content.rb +1 -1
- data/app/concepts/matestack/ui/core/component/base.rb +9 -3
- data/app/concepts/matestack/ui/core/component/component.js +18 -1
- data/app/concepts/matestack/ui/core/component/dynamic.rb +1 -1
- data/app/concepts/matestack/ui/core/js/core.js +1 -0
- data/app/helpers/matestack/ui/core/application_helper.rb +6 -3
- data/lib/matestack/ui/core/components.rb +2 -1
- data/lib/matestack/ui/core/version.rb +1 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.js +162 -48
- data/vendor/assets/javascripts/dist/matestack-ui-core.js.map +1 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js +1 -1
- 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 -1
- 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
- metadata +6 -3
- data/app/concepts/matestack/ui/core/component/rerender.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c8fd9950cf73a636c47c170d627b635886af1ef77cb59ded7829013ba2910fe
|
4
|
+
data.tar.gz: b4820552310262280b493560262a53cf7db44e883bbcd55ee79d6b4a691ddcbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4115ea15f05c3740e0d5673db4d86c443483fbcc20140ba8a2b8706dcbe0921ab10b8e4f393c3ffc6e4cf27ac3a79b5ad10adfceabcbb041a3bf21b69044b3ad
|
7
|
+
data.tar.gz: cb3cc79771d0ea3b4a28795a48baa43f8c94d2cfeabf25c8aec4ef7ca9be45e91bf92d89ae34cf7c31066e9f2a5a4b5c4c469c83078fc75a957d14542ff491c2
|
@@ -76,19 +76,9 @@ const componentDef = {
|
|
76
76
|
},
|
77
77
|
created: function () {
|
78
78
|
const self = this
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
show_events.forEach(show_event => matestackEventHub.$on(show_event.trim(), self.show));
|
83
|
-
}
|
84
|
-
if(this.componentConfig["hide_on"] != undefined){
|
85
|
-
var hide_events = this.componentConfig["hide_on"].split(",")
|
86
|
-
hide_events.forEach(hide_event => matestackEventHub.$on(hide_event.trim(), self.hide));
|
87
|
-
}
|
88
|
-
if(this.componentConfig["rerender_on"] != undefined){
|
89
|
-
var rerender_events = this.componentConfig["rerender_on"].split(",")
|
90
|
-
rerender_events.forEach(rerender_event => matestackEventHub.$on(rerender_event.trim(), self.rerender));
|
91
|
-
}
|
79
|
+
self.registerEvents(this.componentConfig['show_on'], self.show)
|
80
|
+
self.registerEvents(this.componentConfig['hide_on'], self.hide)
|
81
|
+
self.registerEvents(this.componentConfig['rerender_on'], self.rerender)
|
92
82
|
if(this.componentConfig["show_on"] != undefined){
|
93
83
|
this.showing = false
|
94
84
|
}
|
@@ -106,21 +96,9 @@ const componentDef = {
|
|
106
96
|
beforeDestroy: function() {
|
107
97
|
const self = this
|
108
98
|
clearTimeout(self.hideAfterTimeout)
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
if(this.componentConfig["show_on"] != undefined){
|
113
|
-
var shown_events = this.componentConfig["show_on"].split(",")
|
114
|
-
shown_events.forEach(show_event => matestackEventHub.$off(show_event.trim(), self.show));
|
115
|
-
}
|
116
|
-
if(this.componentConfig["hide_on"] != undefined){
|
117
|
-
var hiden_events = this.componentConfig["hide_on"].split(",")
|
118
|
-
hiden_events.forEach(hide_event => matestackEventHub.$off(hide_event.trim(), self.hide));
|
119
|
-
}
|
120
|
-
if(this.componentConfig["rerender_on"] != undefined){
|
121
|
-
var rerender_events = this.componentConfig["rerender_on"].split(",")
|
122
|
-
rerender_events.forEach(rerender_event => matestackEventHub.$off(rerender_event.trim(), self.rerender));
|
123
|
-
}
|
99
|
+
self.removeEvents(this.componentConfig["show_on"], self.show)
|
100
|
+
self.removeEvents(this.componentConfig["hide_on"], self.hide)
|
101
|
+
self.removeEvents(this.componentConfig["rerender_on"], self.rerender)
|
124
102
|
},
|
125
103
|
components: {
|
126
104
|
VRuntimeTemplate: VRuntimeTemplate
|
@@ -1,24 +1,21 @@
|
|
1
1
|
module Matestack::Ui::Core::Async
|
2
|
-
class Async < Matestack::Ui::Core::Component::
|
2
|
+
class Async < Matestack::Ui::Core::Component::Dynamic
|
3
3
|
vue_js_component_name "matestack-ui-core-async"
|
4
4
|
|
5
|
-
|
5
|
+
requires :id # required since 1.1.0
|
6
6
|
|
7
7
|
def initialize(*args)
|
8
8
|
super
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
@component_config[:component_key] = id || "async_#{Digest::SHA256.hexdigest(caller[3])}"
|
13
|
-
if @included_config.present? && @included_config[:isolated_parent_class].present?
|
14
|
-
@component_config[:parent_class] = @included_config[:isolated_parent_class]
|
9
|
+
component_config[:component_key] = id
|
10
|
+
if included_config.present? && included_config[:isolated_parent_class].present?
|
11
|
+
component_config[:parent_class] = included_config[:isolated_parent_class]
|
15
12
|
end
|
16
13
|
end
|
17
14
|
|
18
15
|
def children_wrapper_attributes
|
19
16
|
html_attributes.merge({
|
20
17
|
"v-if": "showing",
|
21
|
-
id:
|
18
|
+
id: component_config[:component_key]
|
22
19
|
})
|
23
20
|
end
|
24
21
|
|
@@ -33,7 +30,7 @@ module Matestack::Ui::Core::Async
|
|
33
30
|
end
|
34
31
|
|
35
32
|
def get_component_key
|
36
|
-
|
33
|
+
component_config[:component_key]
|
37
34
|
end
|
38
35
|
|
39
36
|
end
|
@@ -0,0 +1,4 @@
|
|
1
|
+
%component{dynamic_tag_attributes.merge('initial-template': "#{render_content}")}
|
2
|
+
%div{class: "matestack-cable-component-container", "v-bind:class": "{ 'loading': loading === true }"}
|
3
|
+
%div{class: "matestack-cable-component-wrapper", "v-if": "cableTemplate != null", "v-bind:class": "{ 'loading': loading === true }"}
|
4
|
+
%v-runtime-template{":template":"cableTemplate"}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
import Vue from 'vue/dist/vue.esm'
|
2
|
+
import VRuntimeTemplate from "v-runtime-template"
|
3
|
+
import matestackEventHub from '../js/event-hub'
|
4
|
+
import componentMixin from '../component/component'
|
5
|
+
|
6
|
+
const componentDef = {
|
7
|
+
mixins: [componentMixin],
|
8
|
+
props: {
|
9
|
+
initialTemplate: String,
|
10
|
+
},
|
11
|
+
data: function(){
|
12
|
+
return {
|
13
|
+
cableTemplate: null,
|
14
|
+
cableTemplateDomElement: null,
|
15
|
+
loading: false,
|
16
|
+
event: {
|
17
|
+
data: {}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
},
|
21
|
+
methods: {
|
22
|
+
append: function(payload){
|
23
|
+
var html = this.formatPayload(payload)
|
24
|
+
this.cableTemplateDomElement.insertAdjacentHTML(
|
25
|
+
'beforeend',
|
26
|
+
html.join('')
|
27
|
+
)
|
28
|
+
this.updateCableTemplate()
|
29
|
+
},
|
30
|
+
prepend: function(payload){
|
31
|
+
var html = this.formatPayload(payload)
|
32
|
+
this.cableTemplateDomElement.insertAdjacentHTML(
|
33
|
+
'afterbegin',
|
34
|
+
html.join('')
|
35
|
+
)
|
36
|
+
this.updateCableTemplate()
|
37
|
+
},
|
38
|
+
delete: function(payload){
|
39
|
+
var ids = this.formatPayload(payload)
|
40
|
+
ids.forEach(id =>
|
41
|
+
this.cableTemplateDomElement.querySelector('#' + id).remove()
|
42
|
+
)
|
43
|
+
this.updateCableTemplate()
|
44
|
+
},
|
45
|
+
update: function(payload){
|
46
|
+
const self = this
|
47
|
+
var html = this.formatPayload(payload)
|
48
|
+
html.forEach(function(elem){
|
49
|
+
var dom_elem = document.createElement('div')
|
50
|
+
dom_elem.innerHTML = elem
|
51
|
+
var id = dom_elem.firstChild.id
|
52
|
+
var old_elem = self.cableTemplateDomElement.querySelector('#' + id)
|
53
|
+
old_elem.parentNode.replaceChild(dom_elem.firstChild, old_elem)
|
54
|
+
})
|
55
|
+
this.updateCableTemplate()
|
56
|
+
},
|
57
|
+
replace: function(payload){
|
58
|
+
var html = this.formatPayload(payload)
|
59
|
+
this.cableTemplateDomElement.innerHTML = html.join('')
|
60
|
+
this.updateCableTemplate()
|
61
|
+
},
|
62
|
+
updateCableTemplate: function(){
|
63
|
+
this.cableTemplate = this.cableTemplateDomElement.outerHTML
|
64
|
+
},
|
65
|
+
formatPayload: function(payload){
|
66
|
+
if(!Array.isArray(payload.data)){
|
67
|
+
return [payload.data]
|
68
|
+
}
|
69
|
+
return payload.data
|
70
|
+
},
|
71
|
+
},
|
72
|
+
mounted: function() {
|
73
|
+
const self = this
|
74
|
+
var dom_elem = document.createElement('div')
|
75
|
+
dom_elem.innerHTML = this.initialTemplate
|
76
|
+
this.cableTemplateDomElement = dom_elem.querySelector("#" + this.componentConfig["id"])
|
77
|
+
this.cableTemplate = this.cableTemplateDomElement.outerHTML
|
78
|
+
this.registerEvents(this.componentConfig['append_on'], self.append)
|
79
|
+
this.registerEvents(this.componentConfig['prepend_on'], self.prepend)
|
80
|
+
this.registerEvents(this.componentConfig['delete_on'], self.delete)
|
81
|
+
this.registerEvents(this.componentConfig['update_on'], self.update)
|
82
|
+
this.registerEvents(this.componentConfig['replace_on'], self.replace)
|
83
|
+
},
|
84
|
+
beforeDestroy: function() {
|
85
|
+
const self = this
|
86
|
+
this.cableTemplate = null
|
87
|
+
this.removeEvents(this.componentConfig['append_on'], self.append)
|
88
|
+
this.removeEvents(this.componentConfig['prepend_on'], self.prepend)
|
89
|
+
this.removeEvents(this.componentConfig['delete_on'], self.delete)
|
90
|
+
this.removeEvents(this.componentConfig['update_on'], self.update)
|
91
|
+
this.removeEvents(this.componentConfig['replace_on'], self.replace)
|
92
|
+
},
|
93
|
+
components: {
|
94
|
+
VRuntimeTemplate: VRuntimeTemplate
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
let component = Vue.component('matestack-ui-core-cable', componentDef)
|
99
|
+
|
100
|
+
export default componentDef
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Matestack::Ui::Core::Cable
|
2
|
+
class Cable < Matestack::Ui::Core::Component::Dynamic
|
3
|
+
vue_js_component_name 'matestack-ui-core-cable'
|
4
|
+
|
5
|
+
requires :id
|
6
|
+
|
7
|
+
def setup
|
8
|
+
component_config[:component_key] = id
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
render :cable
|
13
|
+
end
|
14
|
+
|
15
|
+
def render_content
|
16
|
+
render :children_wrapper do
|
17
|
+
render :children
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def children_wrapper_attributes
|
22
|
+
html_attributes.merge({
|
23
|
+
id: component_config[:component_key]
|
24
|
+
})
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -2,10 +2,10 @@ import Vue from 'vue/dist/vue.esm'
|
|
2
2
|
import matestackEventHub from '../../js/event-hub'
|
3
3
|
import queryParamsHelper from '../../js/helpers/query-params-helper'
|
4
4
|
import componentMixin from '../../component/component'
|
5
|
-
import asyncMixin from '../../async/async'
|
5
|
+
// import asyncMixin from '../../async/async'
|
6
6
|
|
7
7
|
const componentDef = {
|
8
|
-
mixins: [componentMixin
|
8
|
+
mixins: [componentMixin],
|
9
9
|
data: function(){
|
10
10
|
return {
|
11
11
|
currentLimit: null,
|
@@ -4,12 +4,11 @@ module Matestack::Ui::Core::Component
|
|
4
4
|
include Matestack::Ui::Core::HasViewContext
|
5
5
|
include Matestack::Ui::Core::HtmlAttributes
|
6
6
|
include Matestack::Ui::Core::Properties
|
7
|
+
include Matestack::Ui::Core::DSL
|
7
8
|
|
8
9
|
# define html global attributes
|
9
10
|
html_attributes *HTML_GLOBAL_ATTRIBUTES, *HTML_EVENT_ATTRIBUTES
|
10
11
|
|
11
|
-
# probably need to remove for other tests to be green again
|
12
|
-
include Matestack::Ui::Core::DSL
|
13
12
|
|
14
13
|
view_paths << "#{Matestack::Ui::Core::Engine.root}/app/concepts"
|
15
14
|
view_paths << "#{::Rails.root}#{'/' unless ::Rails.root.nil?}app/matestack"
|
@@ -99,6 +98,11 @@ module Matestack::Ui::Core::Component
|
|
99
98
|
def get_included_config
|
100
99
|
@included_config
|
101
100
|
end
|
101
|
+
alias :included_config :get_included_config
|
102
|
+
|
103
|
+
def component_config
|
104
|
+
@component_config
|
105
|
+
end
|
102
106
|
|
103
107
|
# TODO: modifies/recreates view lookup paths on every invocation?!
|
104
108
|
# At least memoize it I guess...
|
@@ -161,8 +165,10 @@ module Matestack::Ui::Core::Component
|
|
161
165
|
def params
|
162
166
|
if @matestack_context.present? && @matestack_context[:controller].present?
|
163
167
|
@matestack_context[:controller].params
|
164
|
-
|
168
|
+
elsif context.present? && context[:params]
|
165
169
|
context[:params]
|
170
|
+
else
|
171
|
+
ActionController::Parameters.new({})
|
166
172
|
end
|
167
173
|
end
|
168
174
|
|
@@ -1,5 +1,22 @@
|
|
1
|
+
import matestackEventHub from '../js/event-hub'
|
2
|
+
|
1
3
|
const componentMixin = {
|
2
|
-
props: ['componentConfig', 'params']
|
4
|
+
props: ['componentConfig', 'params'],
|
5
|
+
methods: {
|
6
|
+
registerEvents: function(events, callback){
|
7
|
+
if(events != undefined){
|
8
|
+
var event_names = events.split(",")
|
9
|
+
event_names.forEach(event_name => matestackEventHub.$on(event_name.trim(), callback));
|
10
|
+
}
|
11
|
+
},
|
12
|
+
removeEvents: function(events, callback){
|
13
|
+
if(events != undefined){
|
14
|
+
var event_names = events.split(",")
|
15
|
+
event_names.forEach(event_name => matestackEventHub.$off(event_name.trim(), callback));
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
3
20
|
}
|
4
21
|
|
5
22
|
export default componentMixin
|
@@ -16,7 +16,7 @@ module Matestack::Ui::Core::Component
|
|
16
16
|
"is": get_vue_js_name,
|
17
17
|
"ref": component_id,
|
18
18
|
":params": params.except(:controller, :action).to_json,
|
19
|
-
":component-config":
|
19
|
+
":component-config": component_config.to_json,
|
20
20
|
"inline-template": true,
|
21
21
|
}
|
22
22
|
attrs.merge!(options[:attributes]) unless options[:attributes].nil?
|
@@ -4,6 +4,7 @@ import { turbolinksAdapterMixin } from 'vue-turbolinks';
|
|
4
4
|
// Import from app/concepts/matestack/ui/core:
|
5
5
|
import app from '../app/app'
|
6
6
|
import async from '../async/async'
|
7
|
+
import cable from '../cable/cable'
|
7
8
|
import pageContent from '../page/content/content'
|
8
9
|
import toggle from '../toggle/toggle'
|
9
10
|
import store from '../app/store'
|
@@ -14,7 +14,7 @@ module Matestack
|
|
14
14
|
def self.included(base)
|
15
15
|
base.extend(ClassMethods)
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
module ClassMethods
|
19
19
|
def matestack_app _class
|
20
20
|
@matestack_app_class = _class
|
@@ -99,8 +99,11 @@ module Matestack
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def matestack_component(component, options = {}, &block)
|
102
|
-
|
103
|
-
|
102
|
+
controller = (self.class <= ActionController::Base) ? self : @_controller
|
103
|
+
context = (options[:matestack_context] ||= {}).merge(controller: controller)
|
104
|
+
Matestack::Ui::Core::Component::Base
|
105
|
+
.new(options.merge(matestack_context: context))
|
106
|
+
.send(component, options.merge(matestack_context: context), &block).to_s
|
104
107
|
end
|
105
108
|
end
|
106
109
|
end
|
@@ -25,7 +25,6 @@ module Matestack::Ui::Core::Components
|
|
25
25
|
|
26
26
|
require_app_path "concepts/matestack/ui/core/component/base"
|
27
27
|
require_app_path "concepts/matestack/ui/core/component/dynamic"
|
28
|
-
require_app_path "concepts/matestack/ui/core/component/rerender"
|
29
28
|
require_app_path "concepts/matestack/ui/core/component/static"
|
30
29
|
|
31
30
|
require_core_component "abbr"
|
@@ -41,6 +40,7 @@ module Matestack::Ui::Core::Components
|
|
41
40
|
require_core_component "blockquote"
|
42
41
|
require_core_component "br"
|
43
42
|
require_core_component "button"
|
43
|
+
require_core_component "cable"
|
44
44
|
require_core_component "caption"
|
45
45
|
require_core_component "cite"
|
46
46
|
require_core_component "code"
|
@@ -162,6 +162,7 @@ Matestack::Ui::Core::Component::Registry.register_components(
|
|
162
162
|
blockquote: Matestack::Ui::Core::Blockquote::Blockquote,
|
163
163
|
br: Matestack::Ui::Core::Br::Br,
|
164
164
|
button: Matestack::Ui::Core::Button::Button,
|
165
|
+
cable: Matestack::Ui::Core::Cable::Cable,
|
165
166
|
caption: Matestack::Ui::Core::Caption::Caption,
|
166
167
|
cite: Matestack::Ui::Core::Cite::Cite,
|
167
168
|
code: Matestack::Ui::Core::Code::Code,
|
@@ -552,19 +552,9 @@ const componentDef = {
|
|
552
552
|
},
|
553
553
|
created: function () {
|
554
554
|
const self = this
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
show_events.forEach(show_event => _js_event_hub__WEBPACK_IMPORTED_MODULE_3__["default"].$on(show_event.trim(), self.show));
|
559
|
-
}
|
560
|
-
if(this.componentConfig["hide_on"] != undefined){
|
561
|
-
var hide_events = this.componentConfig["hide_on"].split(",")
|
562
|
-
hide_events.forEach(hide_event => _js_event_hub__WEBPACK_IMPORTED_MODULE_3__["default"].$on(hide_event.trim(), self.hide));
|
563
|
-
}
|
564
|
-
if(this.componentConfig["rerender_on"] != undefined){
|
565
|
-
var rerender_events = this.componentConfig["rerender_on"].split(",")
|
566
|
-
rerender_events.forEach(rerender_event => _js_event_hub__WEBPACK_IMPORTED_MODULE_3__["default"].$on(rerender_event.trim(), self.rerender));
|
567
|
-
}
|
555
|
+
self.registerEvents(this.componentConfig['show_on'], self.show)
|
556
|
+
self.registerEvents(this.componentConfig['hide_on'], self.hide)
|
557
|
+
self.registerEvents(this.componentConfig['rerender_on'], self.rerender)
|
568
558
|
if(this.componentConfig["show_on"] != undefined){
|
569
559
|
this.showing = false
|
570
560
|
}
|
@@ -582,21 +572,9 @@ const componentDef = {
|
|
582
572
|
beforeDestroy: function() {
|
583
573
|
const self = this
|
584
574
|
clearTimeout(self.hideAfterTimeout)
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
if(this.componentConfig["show_on"] != undefined){
|
589
|
-
var shown_events = this.componentConfig["show_on"].split(",")
|
590
|
-
shown_events.forEach(show_event => _js_event_hub__WEBPACK_IMPORTED_MODULE_3__["default"].$off(show_event.trim(), self.show));
|
591
|
-
}
|
592
|
-
if(this.componentConfig["hide_on"] != undefined){
|
593
|
-
var hiden_events = this.componentConfig["hide_on"].split(",")
|
594
|
-
hiden_events.forEach(hide_event => _js_event_hub__WEBPACK_IMPORTED_MODULE_3__["default"].$off(hide_event.trim(), self.hide));
|
595
|
-
}
|
596
|
-
if(this.componentConfig["rerender_on"] != undefined){
|
597
|
-
var rerender_events = this.componentConfig["rerender_on"].split(",")
|
598
|
-
rerender_events.forEach(rerender_event => _js_event_hub__WEBPACK_IMPORTED_MODULE_3__["default"].$off(rerender_event.trim(), self.rerender));
|
599
|
-
}
|
575
|
+
self.removeEvents(this.componentConfig["show_on"], self.show)
|
576
|
+
self.removeEvents(this.componentConfig["hide_on"], self.hide)
|
577
|
+
self.removeEvents(this.componentConfig["rerender_on"], self.rerender)
|
600
578
|
},
|
601
579
|
components: {
|
602
580
|
VRuntimeTemplate: v_runtime_template__WEBPACK_IMPORTED_MODULE_2__["default"]
|
@@ -608,6 +586,123 @@ let component = vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__["default"].compone
|
|
608
586
|
/* harmony default export */ __webpack_exports__["default"] = (componentDef);
|
609
587
|
|
610
588
|
|
589
|
+
/***/ }),
|
590
|
+
|
591
|
+
/***/ "../app/concepts/matestack/ui/core/cable/cable.js":
|
592
|
+
/*!********************************************************!*\
|
593
|
+
!*** ../app/concepts/matestack/ui/core/cable/cable.js ***!
|
594
|
+
\********************************************************/
|
595
|
+
/*! exports provided: default */
|
596
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
597
|
+
|
598
|
+
"use strict";
|
599
|
+
__webpack_require__.r(__webpack_exports__);
|
600
|
+
/* harmony import */ var vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue/dist/vue.esm */ "../node_modules/vue/dist/vue.esm.js");
|
601
|
+
/* harmony import */ var v_runtime_template__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! v-runtime-template */ "../node_modules/v-runtime-template/dist/v-runtime-template.es.js");
|
602
|
+
/* harmony import */ var _js_event_hub__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../js/event-hub */ "../app/concepts/matestack/ui/core/js/event-hub.js");
|
603
|
+
/* harmony import */ var _component_component__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../component/component */ "../app/concepts/matestack/ui/core/component/component.js");
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
const componentDef = {
|
610
|
+
mixins: [_component_component__WEBPACK_IMPORTED_MODULE_3__["default"]],
|
611
|
+
props: {
|
612
|
+
initialTemplate: String,
|
613
|
+
},
|
614
|
+
data: function(){
|
615
|
+
return {
|
616
|
+
cableTemplate: null,
|
617
|
+
cableTemplateDomElement: null,
|
618
|
+
loading: false,
|
619
|
+
event: {
|
620
|
+
data: {}
|
621
|
+
}
|
622
|
+
}
|
623
|
+
},
|
624
|
+
methods: {
|
625
|
+
append: function(payload){
|
626
|
+
var html = this.formatPayload(payload)
|
627
|
+
this.cableTemplateDomElement.insertAdjacentHTML(
|
628
|
+
'beforeend',
|
629
|
+
html.join('')
|
630
|
+
)
|
631
|
+
this.updateCableTemplate()
|
632
|
+
},
|
633
|
+
prepend: function(payload){
|
634
|
+
var html = this.formatPayload(payload)
|
635
|
+
this.cableTemplateDomElement.insertAdjacentHTML(
|
636
|
+
'afterbegin',
|
637
|
+
html.join('')
|
638
|
+
)
|
639
|
+
this.updateCableTemplate()
|
640
|
+
},
|
641
|
+
delete: function(payload){
|
642
|
+
var ids = this.formatPayload(payload)
|
643
|
+
ids.forEach(id =>
|
644
|
+
this.cableTemplateDomElement.querySelector('#' + id).remove()
|
645
|
+
)
|
646
|
+
this.updateCableTemplate()
|
647
|
+
},
|
648
|
+
update: function(payload){
|
649
|
+
const self = this
|
650
|
+
var html = this.formatPayload(payload)
|
651
|
+
html.forEach(function(elem){
|
652
|
+
var dom_elem = document.createElement('div')
|
653
|
+
dom_elem.innerHTML = elem
|
654
|
+
var id = dom_elem.firstChild.id
|
655
|
+
var old_elem = self.cableTemplateDomElement.querySelector('#' + id)
|
656
|
+
old_elem.parentNode.replaceChild(dom_elem.firstChild, old_elem)
|
657
|
+
})
|
658
|
+
this.updateCableTemplate()
|
659
|
+
},
|
660
|
+
replace: function(payload){
|
661
|
+
var html = this.formatPayload(payload)
|
662
|
+
this.cableTemplateDomElement.innerHTML = html.join('')
|
663
|
+
this.updateCableTemplate()
|
664
|
+
},
|
665
|
+
updateCableTemplate: function(){
|
666
|
+
this.cableTemplate = this.cableTemplateDomElement.outerHTML
|
667
|
+
},
|
668
|
+
formatPayload: function(payload){
|
669
|
+
if(!Array.isArray(payload.data)){
|
670
|
+
return [payload.data]
|
671
|
+
}
|
672
|
+
return payload.data
|
673
|
+
},
|
674
|
+
},
|
675
|
+
mounted: function() {
|
676
|
+
const self = this
|
677
|
+
var dom_elem = document.createElement('div')
|
678
|
+
dom_elem.innerHTML = this.initialTemplate
|
679
|
+
this.cableTemplateDomElement = dom_elem.querySelector("#" + this.componentConfig["id"])
|
680
|
+
this.cableTemplate = this.cableTemplateDomElement.outerHTML
|
681
|
+
this.registerEvents(this.componentConfig['append_on'], self.append)
|
682
|
+
this.registerEvents(this.componentConfig['prepend_on'], self.prepend)
|
683
|
+
this.registerEvents(this.componentConfig['delete_on'], self.delete)
|
684
|
+
this.registerEvents(this.componentConfig['update_on'], self.update)
|
685
|
+
this.registerEvents(this.componentConfig['replace_on'], self.replace)
|
686
|
+
},
|
687
|
+
beforeDestroy: function() {
|
688
|
+
const self = this
|
689
|
+
this.cableTemplate = null
|
690
|
+
this.removeEvents(this.componentConfig['append_on'], self.append)
|
691
|
+
this.removeEvents(this.componentConfig['prepend_on'], self.prepend)
|
692
|
+
this.removeEvents(this.componentConfig['delete_on'], self.delete)
|
693
|
+
this.removeEvents(this.componentConfig['update_on'], self.update)
|
694
|
+
this.removeEvents(this.componentConfig['replace_on'], self.replace)
|
695
|
+
},
|
696
|
+
components: {
|
697
|
+
VRuntimeTemplate: v_runtime_template__WEBPACK_IMPORTED_MODULE_1__["default"]
|
698
|
+
}
|
699
|
+
}
|
700
|
+
|
701
|
+
let component = vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__["default"].component('matestack-ui-core-cable', componentDef)
|
702
|
+
|
703
|
+
/* harmony default export */ __webpack_exports__["default"] = (componentDef);
|
704
|
+
|
705
|
+
|
611
706
|
/***/ }),
|
612
707
|
|
613
708
|
/***/ "../app/concepts/matestack/ui/core/collection/content/content.js":
|
@@ -623,15 +718,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
623
718
|
/* harmony import */ var _js_event_hub__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../js/event-hub */ "../app/concepts/matestack/ui/core/js/event-hub.js");
|
624
719
|
/* harmony import */ var _js_helpers_query_params_helper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../js/helpers/query-params-helper */ "../app/concepts/matestack/ui/core/js/helpers/query-params-helper.js");
|
625
720
|
/* harmony import */ var _component_component__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../component/component */ "../app/concepts/matestack/ui/core/component/component.js");
|
626
|
-
/* harmony import */ var _async_async__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../async/async */ "../app/concepts/matestack/ui/core/async/async.js");
|
627
|
-
|
628
721
|
|
629
722
|
|
630
723
|
|
631
724
|
|
725
|
+
// import asyncMixin from '../../async/async'
|
632
726
|
|
633
727
|
const componentDef = {
|
634
|
-
mixins: [_component_component__WEBPACK_IMPORTED_MODULE_3__["default"]
|
728
|
+
mixins: [_component_component__WEBPACK_IMPORTED_MODULE_3__["default"]],
|
635
729
|
data: function(){
|
636
730
|
return {
|
637
731
|
currentLimit: null,
|
@@ -898,8 +992,26 @@ let component = vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__["default"].compone
|
|
898
992
|
|
899
993
|
"use strict";
|
900
994
|
__webpack_require__.r(__webpack_exports__);
|
995
|
+
/* harmony import */ var _js_event_hub__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../js/event-hub */ "../app/concepts/matestack/ui/core/js/event-hub.js");
|
996
|
+
|
997
|
+
|
901
998
|
const componentMixin = {
|
902
|
-
props: ['componentConfig', 'params']
|
999
|
+
props: ['componentConfig', 'params'],
|
1000
|
+
methods: {
|
1001
|
+
registerEvents: function(events, callback){
|
1002
|
+
if(events != undefined){
|
1003
|
+
var event_names = events.split(",")
|
1004
|
+
event_names.forEach(event_name => _js_event_hub__WEBPACK_IMPORTED_MODULE_0__["default"].$on(event_name.trim(), callback));
|
1005
|
+
}
|
1006
|
+
},
|
1007
|
+
removeEvents: function(events, callback){
|
1008
|
+
if(events != undefined){
|
1009
|
+
var event_names = events.split(",")
|
1010
|
+
event_names.forEach(event_name => _js_event_hub__WEBPACK_IMPORTED_MODULE_0__["default"].$off(event_name.trim(), callback));
|
1011
|
+
}
|
1012
|
+
}
|
1013
|
+
}
|
1014
|
+
|
903
1015
|
}
|
904
1016
|
|
905
1017
|
/* harmony default export */ __webpack_exports__["default"] = (componentMixin);
|
@@ -1371,19 +1483,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
1371
1483
|
/* harmony import */ var vue_turbolinks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-turbolinks */ "../node_modules/vue-turbolinks/index.js");
|
1372
1484
|
/* harmony import */ var _app_app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../app/app */ "../app/concepts/matestack/ui/core/app/app.js");
|
1373
1485
|
/* harmony import */ var _async_async__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../async/async */ "../app/concepts/matestack/ui/core/async/async.js");
|
1374
|
-
/* harmony import */ var
|
1375
|
-
/* harmony import */ var
|
1376
|
-
/* harmony import */ var
|
1377
|
-
/* harmony import */ var
|
1378
|
-
/* harmony import */ var
|
1379
|
-
/* harmony import */ var
|
1380
|
-
/* harmony import */ var
|
1381
|
-
/* harmony import */ var
|
1382
|
-
/* harmony import */ var
|
1383
|
-
/* harmony import */ var
|
1384
|
-
/* harmony import */ var
|
1385
|
-
/* harmony import */ var
|
1386
|
-
/* harmony import */ var
|
1486
|
+
/* harmony import */ var _cable_cable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../cable/cable */ "../app/concepts/matestack/ui/core/cable/cable.js");
|
1487
|
+
/* harmony import */ var _page_content_content__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../page/content/content */ "../app/concepts/matestack/ui/core/page/content/content.js");
|
1488
|
+
/* harmony import */ var _toggle_toggle__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../toggle/toggle */ "../app/concepts/matestack/ui/core/toggle/toggle.js");
|
1489
|
+
/* harmony import */ var _app_store__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../app/store */ "../app/concepts/matestack/ui/core/app/store.js");
|
1490
|
+
/* harmony import */ var _component_component__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../component/component */ "../app/concepts/matestack/ui/core/component/component.js");
|
1491
|
+
/* harmony import */ var _component_anonym_dynamic_component__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../component/anonym-dynamic-component */ "../app/concepts/matestack/ui/core/component/anonym-dynamic-component.js");
|
1492
|
+
/* harmony import */ var _transition_transition__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../transition/transition */ "../app/concepts/matestack/ui/core/transition/transition.js");
|
1493
|
+
/* harmony import */ var _action_action__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../action/action */ "../app/concepts/matestack/ui/core/action/action.js");
|
1494
|
+
/* harmony import */ var _form_form__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../form/form */ "../app/concepts/matestack/ui/core/form/form.js");
|
1495
|
+
/* harmony import */ var _onclick_onclick__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../onclick/onclick */ "../app/concepts/matestack/ui/core/onclick/onclick.js");
|
1496
|
+
/* harmony import */ var _collection_content_content__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../collection/content/content */ "../app/concepts/matestack/ui/core/collection/content/content.js");
|
1497
|
+
/* harmony import */ var _collection_filter_filter__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../collection/filter/filter */ "../app/concepts/matestack/ui/core/collection/filter/filter.js");
|
1498
|
+
/* harmony import */ var _collection_order_order__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../collection/order/order */ "../app/concepts/matestack/ui/core/collection/order/order.js");
|
1499
|
+
/* harmony import */ var _isolated_isolated__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../isolated/isolated */ "../app/concepts/matestack/ui/core/isolated/isolated.js");
|
1387
1500
|
|
1388
1501
|
|
1389
1502
|
|
@@ -1404,6 +1517,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
1404
1517
|
|
1405
1518
|
|
1406
1519
|
|
1520
|
+
|
1407
1521
|
let matestackUiApp = undefined
|
1408
1522
|
|
1409
1523
|
// this event fires first and always
|
@@ -1416,7 +1530,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
1416
1530
|
matestackUiApp = new vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__["default"]({
|
1417
1531
|
el: "#matestack-ui",
|
1418
1532
|
mixins: [vue_turbolinks__WEBPACK_IMPORTED_MODULE_1__["turbolinksAdapterMixin"]],
|
1419
|
-
store:
|
1533
|
+
store: _app_store__WEBPACK_IMPORTED_MODULE_7__["default"]
|
1420
1534
|
})
|
1421
1535
|
})
|
1422
1536
|
|
@@ -1426,14 +1540,14 @@ document.addEventListener('turbolinks:load', () => {
|
|
1426
1540
|
// otherwise the matestack page will jump back to the latest pageTemplate
|
1427
1541
|
// fetched during the last matestack transition as the turbolinks powered
|
1428
1542
|
// page transition does not write the matestack store pageTemplate state variable
|
1429
|
-
|
1543
|
+
_app_store__WEBPACK_IMPORTED_MODULE_7__["default"].commit('resetPageTemplate')
|
1430
1544
|
// we need to destroy the vue app instance
|
1431
1545
|
matestackUiApp.$destroy();
|
1432
1546
|
// and recreate it right afterwards in order to work when used with turbolinks
|
1433
1547
|
matestackUiApp = new vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__["default"]({
|
1434
1548
|
el: "#matestack-ui",
|
1435
1549
|
mixins: [vue_turbolinks__WEBPACK_IMPORTED_MODULE_1__["turbolinksAdapterMixin"]],
|
1436
|
-
store:
|
1550
|
+
store: _app_store__WEBPACK_IMPORTED_MODULE_7__["default"]
|
1437
1551
|
})
|
1438
1552
|
})
|
1439
1553
|
|