@ditojs/admin 2.70.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/admin",
3
- "version": "2.70.0",
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",
@@ -42,8 +42,8 @@
42
42
  "not ie_mob > 0"
43
43
  ],
44
44
  "dependencies": {
45
- "@ditojs/ui": "^2.70.0",
46
- "@ditojs/utils": "^2.70.0",
45
+ "@ditojs/ui": "^2.71.0",
46
+ "@ditojs/utils": "^2.71.0",
47
47
  "@kyvg/vue3-notification": "^3.4.2",
48
48
  "@lk77/vue3-color": "^3.0.6",
49
49
  "@tiptap/core": "^3.14.0",
@@ -89,9 +89,9 @@
89
89
  "vue-upload-component": "^3.1.17"
90
90
  },
91
91
  "devDependencies": {
92
- "@ditojs/build": "^2.70.0",
92
+ "@ditojs/build": "^2.71.0",
93
93
  "typescript": "^5.9.3",
94
94
  "vite": "^7.3.0"
95
95
  },
96
- "gitHead": "2010c0695b5a7296e10c2b6bf2539d552c576fd9"
96
+ "gitHead": "852e9e0490d019c946eff537856157c7064ee3a5"
97
97
  }
@@ -7,7 +7,7 @@ ul.dito-menu(
7
7
  v-for="item in items"
8
8
  )
9
9
  template(
10
- v-if="shouldRenderSchema(item)"
10
+ v-if="shouldShowItem(item)"
11
11
  )
12
12
  a.dito-link(
13
13
  :href="getItemHref(item)"
@@ -45,6 +45,15 @@ export default DitoComponent.component('DitoMenu', {
45
45
  },
46
46
 
47
47
  methods: {
48
+ shouldShowItem(item) {
49
+ return (
50
+ this.shouldRenderSchema(item) && (
51
+ !item.items ||
52
+ Object.values(item.items).some(this.shouldRenderSchema)
53
+ )
54
+ )
55
+ },
56
+
48
57
  onResize({ contentRect: { width } }) {
49
58
  if (width) {
50
59
  this.width = width
@@ -432,8 +432,9 @@ let dialogId = 0
432
432
  function addRoutes(router, routes) {
433
433
  const removers = []
434
434
  for (const route of routes) {
435
- const remove = router.addRoute(route)
436
- removers.push(remove)
435
+ removers.push(
436
+ router.addRoute(route)
437
+ )
437
438
  }
438
439
 
439
440
  return () => {
@@ -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-if="shouldRenderSchema(viewSchema)"
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