@ditojs/admin 2.45.0 → 2.45.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.45.0",
3
+ "version": "2.45.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",
@@ -89,5 +89,5 @@
89
89
  "vite": "^6.2.3"
90
90
  },
91
91
  "types": "types",
92
- "gitHead": "dfcb589d51438ee3d7ef0c34017cd7090e691653"
92
+ "gitHead": "6de5398fb812c9cbc030761e3ef82cac9a030117"
93
93
  }
@@ -109,6 +109,7 @@ import { getNamedSchemas, hasFormSchema } from '../utils/schema.js'
109
109
  // @vue/component
110
110
  export default DitoComponent.component('DitoTreeItem', {
111
111
  mixins: [ItemMixin, SortableMixin],
112
+ emits: ['update:data'],
112
113
  inject: ['container'],
113
114
 
114
115
  props: {
@@ -160,24 +161,17 @@ export default DitoComponent.component('DitoTreeItem', {
160
161
 
161
162
  childrenList: {
162
163
  get() {
163
- const { name, orderKey } = this.childrenSchema ?? {}
164
- const value = name && this.data[name]
165
- // In order to fix reactivity for `updateOrder()` at root level of tree
166
- // views, we need to access all order keys once, in order to track them
167
- // for reactivity.
168
- // TODO: Find a proper fix.
169
- value?.map(child => child[orderKey])
170
- return value
164
+ const name = this.childrenSchema?.name
165
+ return name && this.data[name]
171
166
  },
172
167
 
173
168
  set(value) {
174
169
  const name = this.childrenSchema?.name
175
170
  if (name) {
171
+ this.updateOrder(this.childrenSchema, value)
176
172
  // eslint-disable-next-line vue/no-mutating-props
177
- this.data[name] = this.updateOrder(
178
- this.childrenSchema,
179
- value
180
- )
173
+ this.data[name] = value
174
+ this.$emit('update:data', value)
181
175
  }
182
176
  }
183
177
  },
@@ -12,6 +12,7 @@
12
12
  :data="treeData"
13
13
  :draggable="draggable"
14
14
  :open="true"
15
+ @update:data="data => (value = data)"
15
16
  )
16
17
  .dito-tree-form-container(
17
18
  v-if="hasEditableForms"
package/src/utils/uid.js CHANGED
@@ -7,7 +7,7 @@ let uid = 0
7
7
  export function getUid(item, getItemId = null) {
8
8
  const raw = toRaw(item)
9
9
  let id = uidMap.get(raw)
10
- if (!id) {
10
+ if (!id && item) {
11
11
  id = getItemId?.(item) || `@${++uid}`
12
12
  uidMap.set(raw, id)
13
13
  }