@afeefa/vue-app 0.0.63 → 0.0.64
Sign up to get free protection for your applications and to get access to all the features.
- package/.afeefa/package/release/version.txt +1 -1
- package/package.json +1 -1
- package/src/components/AModal.vue +21 -3
- package/src/components/ATableRow.vue +4 -0
- package/src/components/flying-context/FlyingContextEvent.js +5 -0
- package/src/components/form/EditForm.vue +4 -3
- package/src/components/form/EditModal.vue +50 -35
- package/src/events.js +1 -0
- package/src-admin/bootstrap.js +1 -0
- package/src-admin/components/App.vue +5 -1
- package/src-admin/components/FlyingContext.vue +77 -0
- package/src-admin/components/FlyingContextContainer.vue +85 -0
- package/src-admin/components/form/EditFormButtons.vue +4 -2
- package/src-admin/components/index.js +2 -7
- package/src-admin/components/list/ListView.vue +19 -5
- package/src-admin/components/pages/EditPage.vue +8 -3
- package/src-admin/components/routes/DataRouteMixin.js +23 -14
- package/src-admin/config/routing.js +0 -11
- package/src-admin/directives/index.js +26 -0
- package/src-admin/components/pages/CreatePage.vue +0 -114
- package/src-admin/components/pages/DetailPage.vue +0 -143
- package/src-admin/components/pages/EditPageMixin.js +0 -96
- package/src-admin/components/pages/ListPage.vue +0 -55
- package/src-admin/components/routes/CreateRoute.vue +0 -15
- package/src-admin/components/routes/DetailRoute.vue +0 -85
- package/src-admin/components/routes/EditRoute.vue +0 -78
- package/src-admin/components/routes/ListRoute.vue +0 -110
@@ -1,110 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<component
|
3
|
-
:is="Component"
|
4
|
-
v-if="isLoaded"
|
5
|
-
:models="models"
|
6
|
-
:meta="meta"
|
7
|
-
/>
|
8
|
-
</template>
|
9
|
-
|
10
|
-
<script>
|
11
|
-
import { Component, Vue, Watch } from '@a-vue'
|
12
|
-
import { ListAction } from '@a-vue/api-resources/ApiActions'
|
13
|
-
import { NextRouteFilterSource } from '@a-vue/components/list/NextRouteFilterSource'
|
14
|
-
import { ListViewModel } from '@afeefa/api-resources-client'
|
15
|
-
|
16
|
-
Component.registerHooks([
|
17
|
-
'beforeRouteEnter',
|
18
|
-
'beforeRouteUpdate'
|
19
|
-
])
|
20
|
-
|
21
|
-
/**
|
22
|
-
* keep track 'this' in beforeRouteEnter
|
23
|
-
* in order to avoid rendering list pages with a stale set
|
24
|
-
* of models because next(vm => ...) will first create the
|
25
|
-
* list page with the existing set of models and update the
|
26
|
-
* models afterwards.
|
27
|
-
*/
|
28
|
-
let lastVm = null
|
29
|
-
|
30
|
-
function load (route) {
|
31
|
-
const routeDefinition = route.meta.routeDefinition
|
32
|
-
const Component = routeDefinition.config.list
|
33
|
-
|
34
|
-
if (!Component.getListRouteConfig) {
|
35
|
-
console.warn('A list route component must implement a static getListRouteConfig property.')
|
36
|
-
}
|
37
|
-
|
38
|
-
const request = new ListViewModel(Component.getListRouteConfig(route))
|
39
|
-
// read from next route query string, but do not push
|
40
|
-
// list component will be init with used_filters
|
41
|
-
.filterSource(new NextRouteFilterSource(route), false)
|
42
|
-
// read from history, but do not push
|
43
|
-
// list component will be init with used_filters
|
44
|
-
.historyKey(route.path, false)
|
45
|
-
.initFilters({
|
46
|
-
source: true,
|
47
|
-
history: true
|
48
|
-
})
|
49
|
-
.getApiRequest()
|
50
|
-
|
51
|
-
return new ListAction()
|
52
|
-
.setRequest(request)
|
53
|
-
.load()
|
54
|
-
}
|
55
|
-
|
56
|
-
let routerHookCalled = false
|
57
|
-
|
58
|
-
@Component
|
59
|
-
export default class ListRoute extends Vue {
|
60
|
-
models = null
|
61
|
-
meta = null
|
62
|
-
isLoaded = false
|
63
|
-
|
64
|
-
async beforeRouteEnter (to, from, next) {
|
65
|
-
routerHookCalled = true
|
66
|
-
const result = await load(to)
|
67
|
-
|
68
|
-
if (lastVm) {
|
69
|
-
lastVm.isLoaded = false
|
70
|
-
}
|
71
|
-
|
72
|
-
next(vm => {
|
73
|
-
if (result !== false) {
|
74
|
-
const {models, meta} = result
|
75
|
-
vm.models = models
|
76
|
-
vm.meta = meta
|
77
|
-
vm.isLoaded = true
|
78
|
-
}
|
79
|
-
|
80
|
-
lastVm = vm
|
81
|
-
routerHookCalled = false
|
82
|
-
})
|
83
|
-
}
|
84
|
-
|
85
|
-
/**
|
86
|
-
* triggered both, if route name or route params change
|
87
|
-
*/
|
88
|
-
@Watch('$route.params')
|
89
|
-
async routeParamsChanged () {
|
90
|
-
if (routerHookCalled) {
|
91
|
-
return
|
92
|
-
}
|
93
|
-
|
94
|
-
if (!this.isLoaded) {
|
95
|
-
const result = await load(this.$route)
|
96
|
-
|
97
|
-
if (result !== false) {
|
98
|
-
const {models, meta} = result
|
99
|
-
this.models = models
|
100
|
-
this.meta = meta
|
101
|
-
this.isLoaded = true
|
102
|
-
}
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
|
-
get Component () {
|
107
|
-
return this.$routeDefinition.config.list
|
108
|
-
}
|
109
|
-
}
|
110
|
-
</script>
|