matestack-ui-core 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/concepts/matestack/ui/core/app/app.js +11 -3
- data/app/concepts/matestack/ui/core/app/location.js +2 -3
- data/app/concepts/matestack/ui/core/app/store.js +11 -4
- data/app/concepts/matestack/ui/core/datalist/datalist.haml +3 -0
- data/app/concepts/matestack/ui/core/datalist/datalist.rb +5 -0
- data/app/concepts/matestack/ui/core/form/form.js +1 -1
- data/app/concepts/matestack/ui/core/form/input/input.haml +29 -18
- data/app/concepts/matestack/ui/core/form/input/input.rb +36 -29
- data/app/concepts/matestack/ui/core/input/input.haml +2 -3
- data/app/concepts/matestack/ui/core/input/input.rb +4 -0
- data/app/concepts/matestack/ui/core/js/core.js +26 -3
- data/app/lib/matestack/ui/core/has_view_context.rb +5 -1
- data/lib/matestack/ui/core/version.rb +1 -1
- data/vendor/assets/javascripts/dist/manifest.json +10 -6
- data/vendor/assets/javascripts/dist/matestack-ui-core.js +111 -29
- data/vendor/assets/javascripts/dist/matestack-ui-core.js.map +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b08e2fe0f19b178aa377ca1cac852e56f5faee7abdf5ec08f0738c1c11c5b59
|
4
|
+
data.tar.gz: b79c9bc5a5609a50b274a83103c23bc659cca9ae582b49c931b34c2921f723f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 668b12bb85128ca1cd306e256fa8e75159f1e1f62edc7af46807fcb2537ea090ac9aeafab3fddfc5f437e76dfcb522c3db4fb01997165795811770e0d16b216d
|
7
|
+
data.tar.gz: 1bac122005918a5c46b5526e3d619ddf9fd1371e15b664e6c5c64293656d1f2c9706f5fbbfb369eb355e875fe38f2e4f68f9165dc788661aa41ae0f1ac47a72c
|
@@ -10,12 +10,20 @@ const componentDef = {
|
|
10
10
|
},
|
11
11
|
computed: Vuex.mapState({
|
12
12
|
asyncTemplate: state => state.pageTemplate,
|
13
|
+
currentPathName: state => state.currentPathName,
|
14
|
+
currentSearch: state => state.currentSearch,
|
15
|
+
currentOrigin: state => state.currentOrigin,
|
13
16
|
}),
|
14
17
|
mounted: function(){
|
18
|
+
const self = this;
|
15
19
|
window.onpopstate = (event) => {
|
16
|
-
if (isNavigatingToAnotherPage(
|
17
|
-
|
18
|
-
|
20
|
+
if (isNavigatingToAnotherPage({
|
21
|
+
origin: self.currentOrigin,
|
22
|
+
pathName: self.currentPathName,
|
23
|
+
search: self.currentSearch
|
24
|
+
}, document.location)){
|
25
|
+
self.$store.dispatch("navigateTo", {url: document.location.pathname, backwards: true} );
|
26
|
+
}
|
19
27
|
}
|
20
28
|
},
|
21
29
|
components: {
|
@@ -1,8 +1,7 @@
|
|
1
|
-
const isNavigatingToAnotherPage = function(currentLocation,
|
2
|
-
const targetLocation = popstateEvent.target.location;
|
1
|
+
const isNavigatingToAnotherPage = function(currentLocation, targetLocation) {
|
3
2
|
|
4
3
|
// omits hash by design
|
5
|
-
return currentLocation.
|
4
|
+
return currentLocation.pathName !== targetLocation.pathname ||
|
6
5
|
currentLocation.origin !== targetLocation.origin ||
|
7
6
|
currentLocation.search !== targetLocation.search
|
8
7
|
}
|
@@ -8,14 +8,21 @@ Vue.use(Vuex)
|
|
8
8
|
const store = new Vuex.Store({
|
9
9
|
state: {
|
10
10
|
pageTemplate: null,
|
11
|
-
|
11
|
+
currentPathName: document.location.pathname,
|
12
|
+
currentSearch: document.location.search,
|
13
|
+
currentOrigin: document.location.origin
|
12
14
|
},
|
13
15
|
mutations: {
|
14
16
|
setPageTemplate (state, serverResponse){
|
15
17
|
state.pageTemplate = serverResponse
|
16
18
|
},
|
17
|
-
|
18
|
-
state.
|
19
|
+
setCurrentLocation (state, current){
|
20
|
+
state.currentPathName = current.path
|
21
|
+
state.currentSearch = current.search
|
22
|
+
state.currentOrigin = current.origin
|
23
|
+
},
|
24
|
+
resetPageTemplate (state) {
|
25
|
+
state.pageTemplate = null;
|
19
26
|
}
|
20
27
|
},
|
21
28
|
actions: {
|
@@ -46,7 +53,7 @@ const store = new Vuex.Store({
|
|
46
53
|
setTimeout(function () {
|
47
54
|
resolve(response["data"])
|
48
55
|
commit('setPageTemplate', response["data"])
|
49
|
-
commit('
|
56
|
+
commit('setCurrentLocation', { path: url, search: document.location.search, origin: document.location.origin })
|
50
57
|
matestackEventHub.$emit("page_loaded", url);
|
51
58
|
if (typeof matestackUiCoreTransitionSuccess !== 'undefined') {
|
52
59
|
matestackUiCoreTransitionSuccess(url);
|
@@ -137,7 +137,7 @@ const componentDef = {
|
|
137
137
|
&& self.componentConfig["success"]["transition"]["follow_response"] === true
|
138
138
|
&& self.$store != undefined
|
139
139
|
) {
|
140
|
-
let path = response.data["transition_to"]
|
140
|
+
let path = response.data["transition_to"] || response.request.responseURL
|
141
141
|
self.$store.dispatch('navigateTo', {url: path, backwards: false})
|
142
142
|
return;
|
143
143
|
}
|
@@ -1,27 +1,38 @@
|
|
1
|
-
- if
|
2
|
-
%label=
|
1
|
+
- if label
|
2
|
+
%label=label
|
3
3
|
|
4
|
-
- if [:text, :number, :email, :date, :password].include?(
|
5
|
-
%input{@tag_attributes,
|
6
|
-
"v-model#{'.number' if
|
7
|
-
type:
|
4
|
+
- if [:text, :number, :email, :date, :password].include?(type)
|
5
|
+
%input{ @tag_attributes,
|
6
|
+
"v-model#{'.number' if type == :number}": input_key,
|
7
|
+
type: type,
|
8
8
|
"@change": "inputChanged(\"#{attr_key}\")",
|
9
9
|
ref: "input.#{attr_key}",
|
10
|
-
placeholder:
|
11
|
-
"init-value": init_value}
|
12
|
-
%span{class: "errors", "v-if": error_key }
|
13
|
-
%span{class: "error", "v-for": "error in #{error_key}"}
|
14
|
-
{{ error }}
|
10
|
+
placeholder: placeholder,
|
11
|
+
"init-value": init_value }
|
15
12
|
|
16
|
-
- if
|
17
|
-
%textarea{@tag_attributes,
|
13
|
+
- if type == :textarea
|
14
|
+
%textarea{ @tag_attributes,
|
18
15
|
"v-model": input_key,
|
19
16
|
"@change": "inputChanged(\"#{attr_key}\")",
|
20
17
|
ref: "input.#{attr_key}",
|
21
|
-
placeholder:
|
18
|
+
placeholder: placeholder,
|
22
19
|
"init-value": init_value,
|
23
20
|
rows: options[:rows],
|
24
|
-
cols: options[:cols]}
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
cols: options[:cols] }
|
22
|
+
|
23
|
+
- if type == :range
|
24
|
+
%input{ @tag_attributes,
|
25
|
+
"v-model": input_key,
|
26
|
+
type: :range,
|
27
|
+
"@change": "inputChanged(\"#{attr_key}\")",
|
28
|
+
ref: "input.#{attr_key}",
|
29
|
+
placeholder: placeholder,
|
30
|
+
"init-value": init_value,
|
31
|
+
min: options[:min],
|
32
|
+
max: options[:max],
|
33
|
+
step: options[:step],
|
34
|
+
list: options[:list] }
|
35
|
+
|
36
|
+
%span{ class: "errors", "v-if": error_key }
|
37
|
+
%span{ class: "error", "v-for": "error in #{error_key}" }
|
38
|
+
{{ error }}
|
@@ -7,21 +7,35 @@ module Matestack::Ui::Core::Form::Input
|
|
7
7
|
raise "included form config is missing, please add ':include' to parent form component" if @included_config.nil?
|
8
8
|
end
|
9
9
|
|
10
|
+
def key
|
11
|
+
options[:key]
|
12
|
+
end
|
13
|
+
|
14
|
+
def label
|
15
|
+
options[:label]
|
16
|
+
end
|
17
|
+
|
18
|
+
def type
|
19
|
+
options[:type]
|
20
|
+
end
|
21
|
+
|
22
|
+
def placeholder
|
23
|
+
options[:placeholder]
|
24
|
+
end
|
25
|
+
|
10
26
|
def input_key
|
11
|
-
|
27
|
+
"data['#{key.to_s}']"
|
12
28
|
end
|
13
29
|
|
14
30
|
def error_key
|
15
|
-
|
31
|
+
"errors['#{key.to_s}']"
|
16
32
|
end
|
17
33
|
|
18
34
|
def input_wrapper
|
19
35
|
case options[:for]
|
20
36
|
when nil
|
21
37
|
return nil
|
22
|
-
when Symbol
|
23
|
-
return options[:for]
|
24
|
-
when String
|
38
|
+
when Symbol, String
|
25
39
|
return options[:for]
|
26
40
|
end
|
27
41
|
if options[:for].respond_to?(:model_name)
|
@@ -31,44 +45,37 @@ module Matestack::Ui::Core::Form::Input
|
|
31
45
|
|
32
46
|
def attr_key
|
33
47
|
if input_wrapper.nil?
|
34
|
-
return
|
48
|
+
return key.to_s
|
35
49
|
else
|
36
|
-
return "#{input_wrapper}.#{
|
50
|
+
return "#{input_wrapper}.#{key.to_s}"
|
37
51
|
end
|
38
52
|
end
|
39
53
|
|
40
54
|
def init_value
|
41
|
-
unless options[:init].nil?
|
42
|
-
return options[:init]
|
43
|
-
end
|
55
|
+
return options[:init] unless options[:init].nil?
|
44
56
|
|
45
57
|
unless options[:for].nil?
|
46
|
-
value = options[:for].send
|
47
|
-
if [true, false].include? value
|
48
|
-
value ? 1 : 0
|
49
|
-
else
|
50
|
-
return value
|
51
|
-
end
|
58
|
+
value = parse_value(options[:for].send key)
|
52
59
|
else
|
53
60
|
unless @included_config.nil? && @included_config[:for].nil?
|
54
|
-
if @included_config[:for].respond_to?(
|
55
|
-
value = @included_config[:for].send
|
56
|
-
if [true, false].include? value
|
57
|
-
value ? 1 : 0
|
58
|
-
else
|
59
|
-
return value
|
60
|
-
end
|
61
|
+
if @included_config[:for].respond_to?(key)
|
62
|
+
value = parse_value(@included_config[:for].send key)
|
61
63
|
else
|
62
|
-
|
63
|
-
return nil
|
64
|
-
end
|
65
|
-
if @included_config[:for].is_a?(Hash)
|
66
|
-
return @included_config[:for][options[:key]]
|
67
|
-
end
|
64
|
+
@included_config[:for][key] if @included_config[:for].is_a?(Hash)
|
68
65
|
end
|
69
66
|
end
|
70
67
|
end
|
71
68
|
end
|
72
69
|
|
70
|
+
private
|
71
|
+
|
72
|
+
def parse_value(value)
|
73
|
+
if [true, false].include? value
|
74
|
+
value ? 1 : 0
|
75
|
+
else
|
76
|
+
return value
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
73
80
|
end
|
74
81
|
end
|
@@ -1,3 +1,2 @@
|
|
1
|
-
%input{@tag_attributes
|
2
|
-
|
3
|
-
= yield
|
1
|
+
%input{ @tag_attributes,
|
2
|
+
type: type }
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import Vue from 'vue/dist/vue.esm'
|
2
|
+
import { turbolinksAdapterMixin } from 'vue-turbolinks';
|
2
3
|
|
3
4
|
// Import from app/concepts/matestack/ui/core:
|
4
5
|
import app from '../app/app'
|
@@ -18,13 +19,35 @@ import collectionOrder from '../collection/order/order'
|
|
18
19
|
|
19
20
|
let matestackUiApp = undefined
|
20
21
|
|
22
|
+
// this event fires first and always
|
21
23
|
document.addEventListener('DOMContentLoaded', () => {
|
22
|
-
|
23
|
-
|
24
|
+
// somehow we need to inject the turbolinks mixin even
|
25
|
+
// if the turbolinks:load event will recreate the vue instance
|
26
|
+
// skipping the injection here caused errors when submitting forms or action
|
27
|
+
// if they were present on the first page, which was loaded and activated turbolinks
|
28
|
+
// the mixin does not impact the app when turbolinks is disabled
|
29
|
+
matestackUiApp = new Vue({
|
24
30
|
el: "#matestack_ui",
|
31
|
+
mixins: [turbolinksAdapterMixin],
|
25
32
|
store: store
|
26
|
-
|
33
|
+
})
|
34
|
+
})
|
27
35
|
|
36
|
+
// this event fires after DOMContentLoaded and only if turbolinks are enabled
|
37
|
+
document.addEventListener('turbolinks:load', () => {
|
38
|
+
// we need to empty the currently stored pageTemplate state variable
|
39
|
+
// otherwise the matestack page will jump back to the latest pageTemplate
|
40
|
+
// fetched during the last matestack transition as the turbolinks powered
|
41
|
+
// page transition does not write the matestack store pageTemplate state variable
|
42
|
+
store.commit('resetPageTemplate')
|
43
|
+
// we need to destroy the vue app instance
|
44
|
+
matestackUiApp.$destroy();
|
45
|
+
// and recreate it right afterwards in order to work when used with turbolinks
|
46
|
+
matestackUiApp = new Vue({
|
47
|
+
el: "#matestack_ui",
|
48
|
+
mixins: [turbolinksAdapterMixin],
|
49
|
+
store: store
|
50
|
+
})
|
28
51
|
})
|
29
52
|
|
30
53
|
export default Vue
|
@@ -2,17 +2,21 @@
|
|
2
2
|
"entrypoints": {
|
3
3
|
"matestack-ui-core": {
|
4
4
|
"css": [
|
5
|
-
"/dist/matestack-ui-core.
|
5
|
+
"/dist/matestack-ui-core.css"
|
6
6
|
],
|
7
7
|
"js": [
|
8
|
-
"/dist/matestack-ui-core.
|
8
|
+
"/dist/matestack-ui-core.js"
|
9
|
+
],
|
10
|
+
"css.map": [
|
11
|
+
"/dist/matestack-ui-core.css.map"
|
9
12
|
],
|
10
13
|
"js.map": [
|
11
|
-
"/dist/matestack-ui-core.
|
14
|
+
"/dist/matestack-ui-core.js.map"
|
12
15
|
]
|
13
16
|
}
|
14
17
|
},
|
15
|
-
"matestack-ui-core.css": "/dist/matestack-ui-core.
|
16
|
-
"matestack-ui-core.
|
17
|
-
"matestack-ui-core.js
|
18
|
+
"matestack-ui-core.css": "/dist/matestack-ui-core.css",
|
19
|
+
"matestack-ui-core.css.map": "/dist/matestack-ui-core.css.map",
|
20
|
+
"matestack-ui-core.js": "/dist/matestack-ui-core.js",
|
21
|
+
"matestack-ui-core.js.map": "/dist/matestack-ui-core.js.map"
|
18
22
|
}
|
@@ -201,12 +201,20 @@ const componentDef = {
|
|
201
201
|
},
|
202
202
|
computed: vuex__WEBPACK_IMPORTED_MODULE_2__["default"].mapState({
|
203
203
|
asyncTemplate: state => state.pageTemplate,
|
204
|
+
currentPathName: state => state.currentPathName,
|
205
|
+
currentSearch: state => state.currentSearch,
|
206
|
+
currentOrigin: state => state.currentOrigin,
|
204
207
|
}),
|
205
208
|
mounted: function(){
|
209
|
+
const self = this;
|
206
210
|
window.onpopstate = (event) => {
|
207
|
-
if (Object(_location__WEBPACK_IMPORTED_MODULE_3__["default"])(
|
208
|
-
|
209
|
-
|
211
|
+
if (Object(_location__WEBPACK_IMPORTED_MODULE_3__["default"])({
|
212
|
+
origin: self.currentOrigin,
|
213
|
+
pathName: self.currentPathName,
|
214
|
+
search: self.currentSearch
|
215
|
+
}, document.location)){
|
216
|
+
self.$store.dispatch("navigateTo", {url: document.location.pathname, backwards: true} );
|
217
|
+
}
|
210
218
|
}
|
211
219
|
},
|
212
220
|
components: {
|
@@ -232,11 +240,10 @@ let component = vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__["default"].compone
|
|
232
240
|
|
233
241
|
"use strict";
|
234
242
|
__webpack_require__.r(__webpack_exports__);
|
235
|
-
const isNavigatingToAnotherPage = function(currentLocation,
|
236
|
-
const targetLocation = popstateEvent.target.location;
|
243
|
+
const isNavigatingToAnotherPage = function(currentLocation, targetLocation) {
|
237
244
|
|
238
245
|
// omits hash by design
|
239
|
-
return currentLocation.
|
246
|
+
return currentLocation.pathName !== targetLocation.pathname ||
|
240
247
|
currentLocation.origin !== targetLocation.origin ||
|
241
248
|
currentLocation.search !== targetLocation.search
|
242
249
|
}
|
@@ -270,14 +277,21 @@ vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__["default"].use(vuex__WEBPACK_IMPOR
|
|
270
277
|
const store = new vuex__WEBPACK_IMPORTED_MODULE_1__["default"].Store({
|
271
278
|
state: {
|
272
279
|
pageTemplate: null,
|
273
|
-
|
280
|
+
currentPathName: document.location.pathname,
|
281
|
+
currentSearch: document.location.search,
|
282
|
+
currentOrigin: document.location.origin
|
274
283
|
},
|
275
284
|
mutations: {
|
276
285
|
setPageTemplate (state, serverResponse){
|
277
286
|
state.pageTemplate = serverResponse
|
278
287
|
},
|
279
|
-
|
280
|
-
state.
|
288
|
+
setCurrentLocation (state, current){
|
289
|
+
state.currentPathName = current.path
|
290
|
+
state.currentSearch = current.search
|
291
|
+
state.currentOrigin = current.origin
|
292
|
+
},
|
293
|
+
resetPageTemplate (state) {
|
294
|
+
state.pageTemplate = null;
|
281
295
|
}
|
282
296
|
},
|
283
297
|
actions: {
|
@@ -308,7 +322,7 @@ const store = new vuex__WEBPACK_IMPORTED_MODULE_1__["default"].Store({
|
|
308
322
|
setTimeout(function () {
|
309
323
|
resolve(response["data"])
|
310
324
|
commit('setPageTemplate', response["data"])
|
311
|
-
commit('
|
325
|
+
commit('setCurrentLocation', { path: url, search: document.location.search, origin: document.location.origin })
|
312
326
|
_js_event_hub__WEBPACK_IMPORTED_MODULE_3__["default"].$emit("page_loaded", url);
|
313
327
|
if (typeof matestackUiCoreTransitionSuccess !== 'undefined') {
|
314
328
|
matestackUiCoreTransitionSuccess(url);
|
@@ -936,7 +950,7 @@ const componentDef = {
|
|
936
950
|
&& self.componentConfig["success"]["transition"]["follow_response"] === true
|
937
951
|
&& self.$store != undefined
|
938
952
|
) {
|
939
|
-
let path = response.data["transition_to"]
|
953
|
+
let path = response.data["transition_to"] || response.request.responseURL
|
940
954
|
self.$store.dispatch('navigateTo', {url: path, backwards: false})
|
941
955
|
return;
|
942
956
|
}
|
@@ -1008,20 +1022,22 @@ let component = vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__["default"].compone
|
|
1008
1022
|
"use strict";
|
1009
1023
|
__webpack_require__.r(__webpack_exports__);
|
1010
1024
|
/* harmony import */ var vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue/dist/vue.esm */ "../node_modules/vue/dist/vue.esm.js");
|
1011
|
-
/* harmony import */ var
|
1012
|
-
/* harmony import */ var
|
1013
|
-
/* harmony import */ var
|
1014
|
-
/* harmony import */ var
|
1015
|
-
/* harmony import */ var
|
1016
|
-
/* harmony import */ var
|
1017
|
-
/* harmony import */ var
|
1018
|
-
/* harmony import */ var
|
1019
|
-
/* harmony import */ var
|
1020
|
-
/* harmony import */ var
|
1021
|
-
/* harmony import */ var
|
1022
|
-
/* harmony import */ var
|
1023
|
-
/* harmony import */ var
|
1024
|
-
/* harmony import */ var
|
1025
|
+
/* harmony import */ var vue_turbolinks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-turbolinks */ "../node_modules/vue-turbolinks/index.js");
|
1026
|
+
/* harmony import */ var _app_app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../app/app */ "../app/concepts/matestack/ui/core/app/app.js");
|
1027
|
+
/* harmony import */ var _async_async__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../async/async */ "../app/concepts/matestack/ui/core/async/async.js");
|
1028
|
+
/* harmony import */ var _page_content__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../page/content */ "../app/concepts/matestack/ui/core/page/content.js");
|
1029
|
+
/* harmony import */ var _app_store__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../app/store */ "../app/concepts/matestack/ui/core/app/store.js");
|
1030
|
+
/* harmony import */ var _component_component__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../component/component */ "../app/concepts/matestack/ui/core/component/component.js");
|
1031
|
+
/* harmony import */ var _component_anonym_dynamic_component__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../component/anonym-dynamic-component */ "../app/concepts/matestack/ui/core/component/anonym-dynamic-component.js");
|
1032
|
+
/* harmony import */ var _html_html__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../html/html */ "../app/concepts/matestack/ui/core/html/html.js");
|
1033
|
+
/* harmony import */ var _transition_transition__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../transition/transition */ "../app/concepts/matestack/ui/core/transition/transition.js");
|
1034
|
+
/* harmony import */ var _action_action__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../action/action */ "../app/concepts/matestack/ui/core/action/action.js");
|
1035
|
+
/* harmony import */ var _form_form__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../form/form */ "../app/concepts/matestack/ui/core/form/form.js");
|
1036
|
+
/* harmony import */ var _onclick_onclick__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../onclick/onclick */ "../app/concepts/matestack/ui/core/onclick/onclick.js");
|
1037
|
+
/* harmony import */ var _collection_content_content__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../collection/content/content */ "../app/concepts/matestack/ui/core/collection/content/content.js");
|
1038
|
+
/* harmony import */ var _collection_filter_filter__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../collection/filter/filter */ "../app/concepts/matestack/ui/core/collection/filter/filter.js");
|
1039
|
+
/* harmony import */ var _collection_order_order__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../collection/order/order */ "../app/concepts/matestack/ui/core/collection/order/order.js");
|
1040
|
+
|
1025
1041
|
|
1026
1042
|
|
1027
1043
|
// Import from app/concepts/matestack/ui/core:
|
@@ -1042,13 +1058,35 @@ __webpack_require__.r(__webpack_exports__);
|
|
1042
1058
|
|
1043
1059
|
let matestackUiApp = undefined
|
1044
1060
|
|
1061
|
+
// this event fires first and always
|
1045
1062
|
document.addEventListener('DOMContentLoaded', () => {
|
1046
|
-
|
1047
|
-
|
1063
|
+
// somehow we need to inject the turbolinks mixin even
|
1064
|
+
// if the turbolinks:load event will recreate the vue instance
|
1065
|
+
// skipping the injection here caused errors when submitting forms or action
|
1066
|
+
// if they were present on the first page, which was loaded and activated turbolinks
|
1067
|
+
// the mixin does not impact the app when turbolinks is disabled
|
1068
|
+
matestackUiApp = new vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__["default"]({
|
1048
1069
|
el: "#matestack_ui",
|
1049
|
-
|
1050
|
-
|
1070
|
+
mixins: [vue_turbolinks__WEBPACK_IMPORTED_MODULE_1__["turbolinksAdapterMixin"]],
|
1071
|
+
store: _app_store__WEBPACK_IMPORTED_MODULE_5__["default"]
|
1072
|
+
})
|
1073
|
+
})
|
1051
1074
|
|
1075
|
+
// this event fires after DOMContentLoaded and only if turbolinks are enabled
|
1076
|
+
document.addEventListener('turbolinks:load', () => {
|
1077
|
+
// we need to empty the currently stored pageTemplate state variable
|
1078
|
+
// otherwise the matestack page will jump back to the latest pageTemplate
|
1079
|
+
// fetched during the last matestack transition as the turbolinks powered
|
1080
|
+
// page transition does not write the matestack store pageTemplate state variable
|
1081
|
+
_app_store__WEBPACK_IMPORTED_MODULE_5__["default"].commit('resetPageTemplate')
|
1082
|
+
// we need to destroy the vue app instance
|
1083
|
+
matestackUiApp.$destroy();
|
1084
|
+
// and recreate it right afterwards in order to work when used with turbolinks
|
1085
|
+
matestackUiApp = new vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__["default"]({
|
1086
|
+
el: "#matestack_ui",
|
1087
|
+
mixins: [vue_turbolinks__WEBPACK_IMPORTED_MODULE_1__["turbolinksAdapterMixin"]],
|
1088
|
+
store: _app_store__WEBPACK_IMPORTED_MODULE_5__["default"]
|
1089
|
+
})
|
1052
1090
|
})
|
1053
1091
|
|
1054
1092
|
/* harmony default export */ __webpack_exports__["default"] = (vue_dist_vue_esm__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
@@ -2981,6 +3019,50 @@ var t = function t(_t, o, e) {
|
|
2981
3019
|
|
2982
3020
|
/***/ }),
|
2983
3021
|
|
3022
|
+
/***/ "../node_modules/vue-turbolinks/index.js":
|
3023
|
+
/*!***********************************************!*\
|
3024
|
+
!*** ../node_modules/vue-turbolinks/index.js ***!
|
3025
|
+
\***********************************************/
|
3026
|
+
/*! exports provided: turbolinksAdapterMixin, default */
|
3027
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
3028
|
+
|
3029
|
+
"use strict";
|
3030
|
+
__webpack_require__.r(__webpack_exports__);
|
3031
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "turbolinksAdapterMixin", function() { return turbolinksAdapterMixin; });
|
3032
|
+
function handleVueDestruction(vue) {
|
3033
|
+
var turbolinksEvent = vue.$options.turbolinksDestroyEvent || 'turbolinks:visit';
|
3034
|
+
document.addEventListener(turbolinksEvent, function teardown() {
|
3035
|
+
vue.$destroy();
|
3036
|
+
document.removeEventListener(turbolinksEvent, teardown);
|
3037
|
+
});
|
3038
|
+
}
|
3039
|
+
|
3040
|
+
var turbolinksAdapterMixin = {
|
3041
|
+
beforeMount: function beforeMount() {
|
3042
|
+
// If this is the root component, we want to cache the original element contents to replace later
|
3043
|
+
// We don't care about sub-components, just the root
|
3044
|
+
if (this === this.$root && this.$el) {
|
3045
|
+
handleVueDestruction(this); // cache original element
|
3046
|
+
|
3047
|
+
this.$turbolinksCachedHTML = this.$el.outerHTML; // register root hook to restore original element on destroy
|
3048
|
+
|
3049
|
+
this.$once('hook:destroyed', function () {
|
3050
|
+
this.$el.outerHTML = this.$turbolinksCachedHTML;
|
3051
|
+
});
|
3052
|
+
}
|
3053
|
+
}
|
3054
|
+
};
|
3055
|
+
|
3056
|
+
function plugin(Vue, options) {
|
3057
|
+
// Install a global mixin
|
3058
|
+
Vue.mixin(turbolinksAdapterMixin);
|
3059
|
+
}
|
3060
|
+
|
3061
|
+
|
3062
|
+
/* harmony default export */ __webpack_exports__["default"] = (plugin);
|
3063
|
+
|
3064
|
+
/***/ }),
|
3065
|
+
|
2984
3066
|
/***/ "../node_modules/vue/dist/vue.esm.js":
|
2985
3067
|
/*!*******************************************!*\
|
2986
3068
|
!*** ../node_modules/vue/dist/vue.esm.js ***!
|