ivue 0.0.32 → 0.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.
- package/.babelrc.json +14 -0
- package/.eslintrc.cjs +24 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/compiler.xml +7 -0
- package/.idea/infinite-vue.iml +10 -0
- package/.idea/inspectionProfiles/Project_Default.xml +11 -0
- package/.idea/modules.xml +8 -0
- package/.idea/php.xml +20 -0
- package/.idea/vcs.xml +6 -0
- package/.vscode/extensions.json +3 -0
- package/LICENSE +19 -0
- package/README.md +31 -0
- package/demo/App.vue +72 -0
- package/demo/components/IVueTest.vue +298 -0
- package/demo/components/PreComponent.vue +13 -0
- package/demo/components/SubComponent2.vue +45 -0
- package/demo/components/TraitsComponent.vue +120 -0
- package/demo/components/useIVueTest.vue +136 -0
- package/demo/main.ts +21 -0
- package/demo/router/index.ts +14 -0
- package/demo/tests/IVueTests.ts +255 -0
- package/demo/tests/Mouse.ts +79 -0
- package/demo/tests/ParentIVueTests.ts +36 -0
- package/demo/tests/TApp.ts +15 -0
- package/demo/tests/TAuth.ts +23 -0
- package/demo/tests/TField.ts +84 -0
- package/demo/tests/TMessage.ts +52 -0
- package/demo/tests/TRouter.ts +18 -0
- package/demo/tests/TUser.ts +19 -0
- package/demo/tests/Test.ts +86 -0
- package/demo/tests/useField.ts +82 -0
- package/demo/tests/useIVueTests.ts +57 -0
- package/demo/vite.config.ts +13 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.es.js +518 -0
- package/dist/index.umd.js +1 -0
- package/dist/src/behavior.d.ts +72 -0
- package/dist/src/config.d.ts +6 -0
- package/dist/src/index.d.ts +21 -0
- package/dist/src/ivue.d.ts +35 -0
- package/dist/src/kernel.d.ts +182 -0
- package/dist/src/traits/UseCapsule.d.ts +9 -0
- package/dist/src/traits/UseEmit.d.ts +3 -0
- package/dist/src/traits/UseInstance.d.ts +6 -0
- package/dist/src/traits/UseMounting.d.ts +11 -0
- package/dist/src/traits/UseRefs.d.ts +8 -0
- package/dist/src/traits/UseRoute.d.ts +3 -0
- package/dist/src/traits/UseRouter.d.ts +3 -0
- package/dist/src/traits/UseRouting.d.ts +6 -0
- package/dist/src/traits/UseTick.d.ts +4 -0
- package/dist/src/traits/UseVue.d.ts +13 -0
- package/dist/src/types/core.d.ts +46 -0
- package/dist/src/utils/dispose-garbage.d.ts +12 -0
- package/dist/src/utils/extend.d.ts +12 -0
- package/dist/src/utils/getters.d.ts +21 -0
- package/dist/src/utils/index.d.ts +7 -0
- package/dist/src/utils/is.d.ts +14 -0
- package/dist/src/utils/pre.d.ts +9 -0
- package/dist/src/utils/raw.d.ts +12 -0
- package/dist/src/utils/safe-class-name.d.ts +7 -0
- package/dist/src/utils/traits.d.ts +41 -0
- package/env.d.ts +1 -0
- package/index.html +13 -0
- package/package-lock.json +14305 -0
- package/package.json +89 -10
- package/public/favicon.ico +0 -0
- package/src/App/App.ts +27 -0
- package/src/App/Auth/Auth.ts +105 -0
- package/src/App/Auth/Auth.vue +98 -0
- package/src/App/Auth/Logout.vue +14 -0
- package/src/App/Auth/User.ts +6 -0
- package/src/App/BlackBox.ts +75 -0
- package/src/App/Config.ts +6 -0
- package/src/App/Generators/generators.ts +47 -0
- package/src/App/Home/Home.vue +16 -0
- package/src/App/Services/Http/FakeHttp.ts +8 -0
- package/src/App/Services/Http/Http.ts +51 -0
- package/src/App/Services/Message/Message.ts +49 -0
- package/src/App/Services/Message/Message.vue +15 -0
- package/src/App/Services/Navigation/Navigation.ts +83 -0
- package/src/App/Services/Navigation/Navigation.vue +59 -0
- package/src/App/Services/Routing/FakeRouter.ts +7 -0
- package/src/App/Services/Routing/NotFoundRoute.vue +13 -0
- package/src/App/Services/Routing/Router.ts +262 -0
- package/src/App/Services/Routing/Routes.ts +49 -0
- package/src/App/Stubs/SingleBookResultStub.ts +13 -0
- package/src/App/Traits/UseApp.ts +6 -0
- package/src/App/Traits/UseBlackline.ts +0 -0
- package/src/App/Traits/UseQuasar.ts +8 -0
- package/src/behavior.ts +269 -0
- package/src/config.ts +15 -0
- package/src/dev/dev-utils.ts +78 -0
- package/src/index.ts +83 -0
- package/src/ivue.ts +296 -0
- package/src/kernel.ts +810 -0
- package/src/tests/auth.spec.ts +48 -0
- package/src/traits/UseCapsule.ts +28 -0
- package/src/traits/UseEmit.ts +3 -0
- package/src/traits/UseInstance.ts +17 -0
- package/src/traits/UseMounting.ts +23 -0
- package/src/traits/UseRefs.ts +17 -0
- package/src/traits/UseRoute.ts +6 -0
- package/src/traits/UseRouter.ts +5 -0
- package/src/traits/UseRouting.ts +7 -0
- package/src/traits/UseTick.ts +5 -0
- package/src/traits/UseVue.ts +38 -0
- package/src/types/core.ts +64 -0
- package/src/utils/dispose-garbage.ts +34 -0
- package/src/utils/extend.ts +85 -0
- package/src/utils/getters.ts +62 -0
- package/src/utils/index.ts +16 -0
- package/src/utils/is.ts +22 -0
- package/src/utils/pre.ts +29 -0
- package/src/utils/raw.ts +19 -0
- package/src/utils/safe-class-name.ts +15 -0
- package/src/utils/traits.ts +121 -0
- package/tsconfig.app.json +47 -0
- package/tsconfig.json +14 -0
- package/tsconfig.node.json +14 -0
- package/tsconfig.vitest.json +9 -0
- package/vite.config.ts +55 -0
- package/vitest.config.ts +18 -0
- package/dist/index.js +0 -218
- package/docs/index.html +0 -195
- package/docs/index.json +0 -3
- package/docs/input.html +0 -41
- package/docs/items.html +0 -42
- package/gulpfile.js +0 -5
- package/src/components/checkbox.js +0 -47
- package/src/components/data.js +0 -6
- package/src/components/file.js +0 -40
- package/src/components/form.js +0 -7
- package/src/components/index.js +0 -15
- package/src/components/input.js +0 -80
- package/src/components/items.js +0 -65
- package/src/components/modal.js +0 -42
- package/src/components/paginate-old.js +0 -88
- package/src/components/paginate.js +0 -35
- package/src/components/select-search.js +0 -152
- package/src/components/select.js +0 -62
- package/src/components/submit.js +0 -10
- package/src/components/textarea.js +0 -72
- package/src/components/upload.js +0 -49
- package/src/directives/href.js +0 -10
- package/src/directives/index.js +0 -1
- package/src/filters/date.js +0 -3
- package/src/filters/datetime.js +0 -3
- package/src/filters/index.js +0 -4
- package/src/filters/json.js +0 -3
- package/src/filters/money.js +0 -3
- package/src/index.js +0 -4
- package/src/mixins/data.js +0 -13
- package/src/mixins/form.js +0 -85
- package/src/mixins/resource.js +0 -31
- package/src/services/client.js +0 -32
- package/src/services/flash.js +0 -17
- package/src/services/index.js +0 -2
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import TreeModel from 'tree-model'
|
|
2
|
+
import { Router } from '../Routing/Router'
|
|
3
|
+
import { Traits, UseCapsule, UseRoute, UseRouter, use } from '@/index'
|
|
4
|
+
|
|
5
|
+
export class $Navigation {
|
|
6
|
+
|
|
7
|
+
get router () { return use(Router) }
|
|
8
|
+
|
|
9
|
+
get active () {
|
|
10
|
+
return this.tree().all((node) => node.model.id === this.router.active.name)[0]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
constructor(self, arg1: string) {
|
|
14
|
+
console.log('arg1', arg1)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
tree () {
|
|
18
|
+
const tree = new TreeModel()
|
|
19
|
+
|
|
20
|
+
const root = tree.parse({
|
|
21
|
+
id: 'home',
|
|
22
|
+
type: 'root',
|
|
23
|
+
text: 'Home',
|
|
24
|
+
children: [],
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
return root
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
back () {
|
|
31
|
+
this.router.push({ name: this.active.parent.model.id })
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export class Navigation {
|
|
37
|
+
|
|
38
|
+
$!: $Navigation
|
|
39
|
+
constructor(arg1: string) {
|
|
40
|
+
this.$ = use($Navigation, this, ...arguments)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get menu () {
|
|
44
|
+
|
|
45
|
+
const v = {
|
|
46
|
+
showBack: false,
|
|
47
|
+
activeName: '',
|
|
48
|
+
backTarget: { visible: false, id: null },
|
|
49
|
+
items: [],
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const active = this.$.active
|
|
53
|
+
|
|
54
|
+
if (active) {
|
|
55
|
+
|
|
56
|
+
v.activeName = this.activeName(active)
|
|
57
|
+
|
|
58
|
+
v.items = active.children.map((node: any) => {
|
|
59
|
+
return { id: node.model.id, activeName: node.model.text }
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
if (active.parent) {
|
|
63
|
+
v.backTarget = {
|
|
64
|
+
visible: true,
|
|
65
|
+
id: active.parent.model.id,
|
|
66
|
+
}
|
|
67
|
+
v.showBack = true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return v
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private activeName (node: any) {
|
|
75
|
+
return node.model.text + ' > ' + node.model.id
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
back () {
|
|
79
|
+
this.$.back()
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
Traits(Navigation, [UseRoute, UseRouter])
|
|
83
|
+
export interface Navigation extends UseRoute, UseRouter {}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// import { withInjection } from '../Services/Providers/Injection'
|
|
3
|
+
import Logout from '@/App/Auth/Logout.vue'
|
|
4
|
+
import { Router } from '@/App/Services/Routing/Router'
|
|
5
|
+
import { Navigation } from './Navigation'
|
|
6
|
+
import { use } from '@/index'
|
|
7
|
+
|
|
8
|
+
const v = use(Navigation, 'test')
|
|
9
|
+
const router = use(Router)
|
|
10
|
+
</script>
|
|
11
|
+
<template>
|
|
12
|
+
<br />
|
|
13
|
+
Route:
|
|
14
|
+
{{ v.route?.name }}
|
|
15
|
+
|
|
16
|
+
<br />
|
|
17
|
+
Router:
|
|
18
|
+
|
|
19
|
+
{{ router.currentRoute.name }}
|
|
20
|
+
<br />
|
|
21
|
+
<button @click="router.push({ name: 'login' })">Login</button>
|
|
22
|
+
<br />
|
|
23
|
+
<button @click="router.push({ name: 'ivue', query:{test:1} })">ivue</button>
|
|
24
|
+
|
|
25
|
+
<br />
|
|
26
|
+
<button @click="router.push({ name: 'use-test', query:{test:1} })">composable test</button>
|
|
27
|
+
|
|
28
|
+
<div class="navigation-container">
|
|
29
|
+
<div
|
|
30
|
+
class="navigation-item-header"
|
|
31
|
+
:style="{ backgroundColor: '#5BCA06' }"
|
|
32
|
+
>
|
|
33
|
+
{{ v.menu.activeName }}
|
|
34
|
+
</div>
|
|
35
|
+
<div
|
|
36
|
+
v-for="item in v.menu.items"
|
|
37
|
+
class="navigation-item"
|
|
38
|
+
:style="{
|
|
39
|
+
backgroundColor: '#3DE7CF',
|
|
40
|
+
}"
|
|
41
|
+
@click="() => router.push({ name: item.id })"
|
|
42
|
+
>
|
|
43
|
+
{{ item.activeName }}
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<router-link to="/">Go Home</router-link>
|
|
47
|
+
|
|
48
|
+
<div
|
|
49
|
+
v-if="v.menu.showBack"
|
|
50
|
+
class="navigation-item"
|
|
51
|
+
@click="() => v.back()"
|
|
52
|
+
:style="{ backgroundColor: '#2e91fc' }"
|
|
53
|
+
>
|
|
54
|
+
<span>⬅ </span>Back
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<Logout />
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { unref } from 'vue';
|
|
2
|
+
import { createRouter, createWebHistory } from 'vue-router'
|
|
3
|
+
import { Traits, UseCapsule, use } from '@/index'
|
|
4
|
+
import { $Message } from '../Message/Message'
|
|
5
|
+
import { User } from '../../Auth/User'
|
|
6
|
+
import type { RouteLocationNormalized } from 'vue-router';
|
|
7
|
+
import type { Null, AnyObj, Params } from '@/types/core';
|
|
8
|
+
import type { Router as VueRouter } from 'vue-router'
|
|
9
|
+
|
|
10
|
+
const __$Router__ = ($ = $Router.prototype) => ([
|
|
11
|
+
// Other
|
|
12
|
+
$.user,
|
|
13
|
+
$.$message,
|
|
14
|
+
// Data
|
|
15
|
+
$.router,
|
|
16
|
+
$.active,
|
|
17
|
+
$.routes,
|
|
18
|
+
$.routeConfig,
|
|
19
|
+
// Methods
|
|
20
|
+
$.register,
|
|
21
|
+
$.flatten,
|
|
22
|
+
$.setup,
|
|
23
|
+
$.find,
|
|
24
|
+
// Router state change tracking
|
|
25
|
+
$.onRouteChanged,
|
|
26
|
+
$.beforeRoute,
|
|
27
|
+
$.afterRoute,
|
|
28
|
+
// Extensions upon Router
|
|
29
|
+
$.push,
|
|
30
|
+
$.replace,
|
|
31
|
+
$.forward,
|
|
32
|
+
$.back,
|
|
33
|
+
// Loaded state promise
|
|
34
|
+
$.isLoaded
|
|
35
|
+
])
|
|
36
|
+
|
|
37
|
+
export class $Router {
|
|
38
|
+
|
|
39
|
+
get user () { return use(User) }
|
|
40
|
+
|
|
41
|
+
get $message () { return use($Message) }
|
|
42
|
+
|
|
43
|
+
loading = false
|
|
44
|
+
|
|
45
|
+
router!: VueRouter
|
|
46
|
+
|
|
47
|
+
active = { name: null }
|
|
48
|
+
|
|
49
|
+
routes = []
|
|
50
|
+
|
|
51
|
+
routeConfig: any[] = []
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Register routes with the router.
|
|
55
|
+
*
|
|
56
|
+
* @param routes
|
|
57
|
+
*/
|
|
58
|
+
register (routes: any) {
|
|
59
|
+
|
|
60
|
+
this.routes = routes
|
|
61
|
+
|
|
62
|
+
this.flatRoutes = this.flatten(this.routes)
|
|
63
|
+
// console.log('this.flatRoutes', this.flatRoutes)
|
|
64
|
+
|
|
65
|
+
this.routeConfig = this.setup(this.routes)
|
|
66
|
+
console.log('routeConfig', this.routeConfig)
|
|
67
|
+
|
|
68
|
+
this.router = createRouter({ history: createWebHistory(), routes: this.routes })
|
|
69
|
+
|
|
70
|
+
this.router.beforeEach(async to => await this.beforeRoute(to))
|
|
71
|
+
|
|
72
|
+
this.router.afterEach(async (to, from, failure) => await this.afterRoute(/*to, from, failure*/))
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private flatRoutes: AnyObj = {}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Flatten the routes into a flat array.
|
|
79
|
+
*
|
|
80
|
+
* @param routes routes to flaten
|
|
81
|
+
* @param flatRoutes recursion storage
|
|
82
|
+
* @returns flat array of routes
|
|
83
|
+
*/
|
|
84
|
+
flatten (routes: any, flatRoutes: AnyObj = {}) {
|
|
85
|
+
routes.forEach((route: AnyObj) => {
|
|
86
|
+
flatRoutes[route.name] = route
|
|
87
|
+
if ('children' in route) {
|
|
88
|
+
this.flatten(route.children, flatRoutes)
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
return flatRoutes
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
setup (routes: any) {
|
|
95
|
+
|
|
96
|
+
const routeConfig: any[] = []
|
|
97
|
+
|
|
98
|
+
routes.forEach((routeArg: AnyObj) => {
|
|
99
|
+
// console.log('routeArg', routeArg)
|
|
100
|
+
const route = this.find(routeArg.name)
|
|
101
|
+
|
|
102
|
+
const routeDefinition: any = {
|
|
103
|
+
name: route.name,
|
|
104
|
+
path: route.path,
|
|
105
|
+
meta: {
|
|
106
|
+
secure: route.secure
|
|
107
|
+
},
|
|
108
|
+
component: route.component
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if ('children' in route) {
|
|
112
|
+
routeDefinition.children = this.setup(route.children)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
routeConfig.push(routeDefinition)
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
return routeConfig
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
find (name: Null<string | symbol | undefined>) {
|
|
122
|
+
return name && name in this.flatRoutes ? this.flatRoutes[name] : this.routes[this.routes.length - 1]
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
onRouteChanged () {
|
|
126
|
+
this.$message.appMessages = []
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async beforeRoute (to: RouteLocationNormalized) {
|
|
130
|
+
|
|
131
|
+
this.loading = true
|
|
132
|
+
|
|
133
|
+
const old = this.find(this.active.name)
|
|
134
|
+
const fresh = this.find(to.name)
|
|
135
|
+
|
|
136
|
+
const routeChanged = old.name !== fresh.name
|
|
137
|
+
const token = !!this.user.token
|
|
138
|
+
|
|
139
|
+
const notAllowed = fresh.secure && !token || fresh.name === '*'
|
|
140
|
+
const allowed = fresh.secure && token || !fresh.secure
|
|
141
|
+
|
|
142
|
+
// console.log('fresh', fresh, 'old', old, 'routeChanged', routeChanged, 'notAllowed', notAllowed, 'allowed', allowed)
|
|
143
|
+
|
|
144
|
+
if (routeChanged) {
|
|
145
|
+
|
|
146
|
+
this.onRouteChanged()
|
|
147
|
+
|
|
148
|
+
if (notAllowed) {
|
|
149
|
+
|
|
150
|
+
await this.push({ name: 'login' })
|
|
151
|
+
|
|
152
|
+
return false
|
|
153
|
+
|
|
154
|
+
} else if (allowed) {
|
|
155
|
+
|
|
156
|
+
if (old.onLeave) old.onLeave()
|
|
157
|
+
if (fresh.onEnter) fresh.onEnter()
|
|
158
|
+
|
|
159
|
+
this.active = fresh
|
|
160
|
+
this.active.params = to.params
|
|
161
|
+
this.active.query = to.query
|
|
162
|
+
|
|
163
|
+
return true
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return true
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async afterRoute () {
|
|
170
|
+
this.loading = false
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
push (...args: Params<VueRouter['push']>) {
|
|
174
|
+
this.loading = true;
|
|
175
|
+
return run(this.router, this.router.push, arguments)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
replace (...args: Params<VueRouter['replace']>) {
|
|
179
|
+
this.loading = true;
|
|
180
|
+
return run(this.router, this.router.replace, arguments)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
back (...args: Params<VueRouter['back']>) {
|
|
184
|
+
this.loading = true;
|
|
185
|
+
return run(this.router, this.router.back, arguments)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
forward (...args: Params<VueRouter['forward']>) {
|
|
189
|
+
this.loading = true;
|
|
190
|
+
return run(this.router, this.router.forward, arguments)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
go (...args: Params<VueRouter['go']>) {
|
|
194
|
+
this.loading = true;
|
|
195
|
+
return run(this.router, this.router.go, arguments)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async isLoaded () {
|
|
199
|
+
return new Promise((resolve, reject) => {
|
|
200
|
+
let interval: string | number | NodeJS.Timeout | undefined;
|
|
201
|
+
if (this.loading) {
|
|
202
|
+
interval = setInterval(() => {
|
|
203
|
+
if (!this.loading) {
|
|
204
|
+
clearInterval(interval)
|
|
205
|
+
resolve(!this.loading)
|
|
206
|
+
}
|
|
207
|
+
}, 10)
|
|
208
|
+
} else {
|
|
209
|
+
resolve(!this.loading)
|
|
210
|
+
}
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
__$Router__
|
|
216
|
+
|
|
217
|
+
function run<T extends Function> (bind: any, fn: T, args: any = []): T {
|
|
218
|
+
return fn.apply(bind, args)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export class Router {
|
|
222
|
+
|
|
223
|
+
capsule = $Router
|
|
224
|
+
constructor () {
|
|
225
|
+
this.useCapsule(arguments)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Extended functions
|
|
229
|
+
get active () { return this.$.active }
|
|
230
|
+
async isLoaded () { return run(this.$, this.$.isLoaded) }
|
|
231
|
+
|
|
232
|
+
// Vue Router API
|
|
233
|
+
get currentRoute () { return unref(this.$.router.currentRoute) }
|
|
234
|
+
get options () { return this.$.router.options }
|
|
235
|
+
|
|
236
|
+
get listening () { return this.$.router.listening }
|
|
237
|
+
set listening (v: boolean) { this.$.router.listening = v }
|
|
238
|
+
|
|
239
|
+
addRoute (...args: Params<VueRouter['addRoute']>) { return run(this.$.router, this.$.router.addRoute, arguments) }
|
|
240
|
+
removeRoute (...args: Params<VueRouter['removeRoute']>) { return run(this.$.router, this.$.router.removeRoute, arguments) }
|
|
241
|
+
hasRoute (...args: Params<VueRouter['hasRoute']>) { return run(this.$.router, this.$.router.hasRoute, arguments) }
|
|
242
|
+
getRoutes (...args: Params<VueRouter['getRoutes']>) { return run(this.$.router, this.$.router.getRoutes) }
|
|
243
|
+
resolve (...args: Params<VueRouter['resolve']>) { return run(this.$.router, this.$.router.resolve, arguments) }
|
|
244
|
+
|
|
245
|
+
/* Extended functionality of these methods */
|
|
246
|
+
push (...args: Params<VueRouter['push']>) { return run(this.$, this.$.push, arguments) }
|
|
247
|
+
replace (...args: Params<VueRouter['replace']>) { return run(this.$, this.$.replace, arguments) }
|
|
248
|
+
back (...args: Params<VueRouter['back']>) { return run(this.$, this.$.back) }
|
|
249
|
+
forward (...args: Params<VueRouter['forward']>) { return run(this.$, this.$.forward) }
|
|
250
|
+
go (...args: Params<VueRouter['go']>) { return run(this.$, this.$.go, arguments) }
|
|
251
|
+
/* Extensions end */
|
|
252
|
+
|
|
253
|
+
beforeEach (...args: Params<VueRouter['beforeEach']>) { return run(this.$.router, this.$.router.beforeEach, arguments) }
|
|
254
|
+
beforeResolve (...args: Params<VueRouter['beforeResolve']>) { return run(this.$.router, this.$.router.beforeResolve, arguments) }
|
|
255
|
+
afterEach (...args: Params<VueRouter['afterEach']>) { return run(this.$.router, this.$.router.afterEach, arguments) }
|
|
256
|
+
onError (...args: Params<VueRouter['onError']>) { return run(this.$.router, this.$.router.onError, arguments) }
|
|
257
|
+
isReady (...args: Params<VueRouter['isReady']>) { return run(this.$.router, this.$.router.isReady) }
|
|
258
|
+
install (...args: Params<VueRouter['install']>) { return run(this.$.router, this.$.router.install, arguments) }
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
Traits(Router, [UseCapsule])
|
|
262
|
+
export interface Router extends UseCapsule {}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
name: 'root',
|
|
4
|
+
path: '/',
|
|
5
|
+
secure: true,
|
|
6
|
+
component: () => import('@/App/Home/Home.vue'),
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: 'login',
|
|
10
|
+
path: '/app/login',
|
|
11
|
+
secure: false,
|
|
12
|
+
component: () => import('@/App/Auth/Auth.vue'),
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'home',
|
|
16
|
+
path: '/app/home',
|
|
17
|
+
secure: true,
|
|
18
|
+
component: () => import('@/App/Home/Home.vue'),
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'authorPolicy',
|
|
22
|
+
path: '/app/author-policy',
|
|
23
|
+
secure: false,
|
|
24
|
+
component: () => import('@/App/Home/Home.vue'),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
path: '/ivue',
|
|
28
|
+
secure: false,
|
|
29
|
+
component: () => import('../../../../demo/components/IVueTest.vue'),
|
|
30
|
+
children: [{
|
|
31
|
+
name: 'ivue',
|
|
32
|
+
path: '',
|
|
33
|
+
secure: false,
|
|
34
|
+
component:() => import('../../../../demo/components/SubComponent2.vue'),
|
|
35
|
+
}]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
path: '/use-test',
|
|
39
|
+
name: 'use-test',
|
|
40
|
+
secure: false,
|
|
41
|
+
component: () => import('../../../../demo/components/useIVueTest.vue'),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: '*',
|
|
45
|
+
path: '/:catchAll(.*)*',
|
|
46
|
+
secure: true,
|
|
47
|
+
component: () => import('@/App/Services/Routing/NotFoundRoute.vue')
|
|
48
|
+
}
|
|
49
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function SingleBookResultStub(dynamicBookName) {
|
|
2
|
+
return {
|
|
3
|
+
success: true,
|
|
4
|
+
result: [
|
|
5
|
+
{
|
|
6
|
+
bookId: 1,
|
|
7
|
+
name: dynamicBookName !== undefined ? dynamicBookName : 'I, Robot',
|
|
8
|
+
emailOwnerId: 'g@b.com',
|
|
9
|
+
devOwnerId: 'pete+dnd@logicroom.co'
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
File without changes
|