@ditojs/admin 2.71.0 → 2.71.1
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/dist/dito-admin.es.js +812 -821
- package/dist/dito-admin.umd.js +5 -5
- package/package.json +2 -2
- package/src/components/DitoRoot.vue +10 -27
- package/src/components/DitoView.vue +10 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/admin",
|
|
3
|
-
"version": "2.71.
|
|
3
|
+
"version": "2.71.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Dito.js Admin is a schema based admin interface for Dito.js Server, featuring auto-generated views and forms and built with Vue.js",
|
|
6
6
|
"repository": "https://github.com/ditojs/dito/tree/master/packages/admin",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"typescript": "^5.9.3",
|
|
94
94
|
"vite": "^7.3.0"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "852e9e0490d019c946eff537856157c7064ee3a5"
|
|
97
97
|
}
|
|
@@ -52,8 +52,7 @@ import DitoDialog from './DitoDialog.vue'
|
|
|
52
52
|
import {
|
|
53
53
|
processView,
|
|
54
54
|
resolveViews,
|
|
55
|
-
processSchemaComponents
|
|
56
|
-
shouldRenderSchema
|
|
55
|
+
processSchemaComponents
|
|
57
56
|
} from '../utils/schema.js'
|
|
58
57
|
|
|
59
58
|
// @vue/component
|
|
@@ -411,18 +410,14 @@ export default DitoComponent.component('DitoRoot', {
|
|
|
411
410
|
// new routes, and restore the current path.
|
|
412
411
|
const { fullPath } = this.$route
|
|
413
412
|
this.removeRoutes?.()
|
|
414
|
-
this.removeRoutes = addRoutes(
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
...routes.flat()
|
|
423
|
-
],
|
|
424
|
-
this.context
|
|
425
|
-
)
|
|
413
|
+
this.removeRoutes = addRoutes(this.$router, [
|
|
414
|
+
{
|
|
415
|
+
name: 'root',
|
|
416
|
+
path: '/',
|
|
417
|
+
components: {}
|
|
418
|
+
},
|
|
419
|
+
...routes.flat()
|
|
420
|
+
])
|
|
426
421
|
this.$router.replace(fullPath)
|
|
427
422
|
},
|
|
428
423
|
|
|
@@ -434,7 +429,7 @@ export default DitoComponent.component('DitoRoot', {
|
|
|
434
429
|
|
|
435
430
|
let dialogId = 0
|
|
436
431
|
|
|
437
|
-
function addRoutes(router, routes
|
|
432
|
+
function addRoutes(router, routes) {
|
|
438
433
|
const removers = []
|
|
439
434
|
for (const route of routes) {
|
|
440
435
|
removers.push(
|
|
@@ -442,18 +437,6 @@ function addRoutes(router, routes, context) {
|
|
|
442
437
|
)
|
|
443
438
|
}
|
|
444
439
|
|
|
445
|
-
removers.push(
|
|
446
|
-
// Add navigation guard to check if: conditions
|
|
447
|
-
router.beforeEach((to, from, next) => {
|
|
448
|
-
for (const record of to.matched) {
|
|
449
|
-
if (!shouldRenderSchema(record.meta.schema, context)) {
|
|
450
|
-
return next('/')
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
next()
|
|
454
|
-
})
|
|
455
|
-
)
|
|
456
|
-
|
|
457
440
|
return () => {
|
|
458
441
|
for (const remove of removers) {
|
|
459
442
|
remove()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
template(
|
|
3
|
-
v-if="user"
|
|
3
|
+
v-if="user && shouldRenderSchema(viewSchema)"
|
|
4
4
|
)
|
|
5
5
|
//- Only render DitoView when it is active, otherwise a normal router-view
|
|
6
6
|
//- instead, to nest further route components.
|
|
@@ -11,7 +11,7 @@ template(
|
|
|
11
11
|
:key="name"
|
|
12
12
|
)
|
|
13
13
|
.dito-view.dito-scroll-parent(
|
|
14
|
-
v-else
|
|
14
|
+
v-else
|
|
15
15
|
:data-resource="sourceSchema.path"
|
|
16
16
|
)
|
|
17
17
|
DitoSchema(
|
|
@@ -59,7 +59,7 @@ export default DitoComponent.component('DitoView', {
|
|
|
59
59
|
|
|
60
60
|
computed: {
|
|
61
61
|
schema() {
|
|
62
|
-
return this.meta.schema
|
|
62
|
+
return this.meta.schema ?? {}
|
|
63
63
|
},
|
|
64
64
|
|
|
65
65
|
name() {
|
|
@@ -115,6 +115,13 @@ export default DitoComponent.component('DitoView', {
|
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
117
|
|
|
118
|
+
mounted() {
|
|
119
|
+
// Prevent bypassing of if-condition by direct URL access.
|
|
120
|
+
if (!this.shouldRenderSchema(this.viewSchema)) {
|
|
121
|
+
this.$router.replace({ path: '/' })
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
|
|
118
125
|
methods: {
|
|
119
126
|
setData(data) {
|
|
120
127
|
this.data = data
|