@ditojs/admin 2.2.7-debug.4 → 2.2.7
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 +731 -740
- package/dist/dito-admin.umd.js +4 -4
- package/package.json +2 -2
- package/src/mixins/DitoMixin.js +15 -7
- package/src/mixins/SourceMixin.js +2 -9
- package/src/mixins/TypeMixin.js +3 -6
- package/src/types/DitoTypeList.vue +0 -7
- package/src/utils/filter.js +0 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/admin",
|
|
3
|
-
"version": "2.2.7
|
|
3
|
+
"version": "2.2.7",
|
|
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",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"vite": "^4.3.1"
|
|
83
83
|
},
|
|
84
84
|
"types": "types",
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "9636ab2adc6d813af39097fe8d92ce7a00020f93",
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build": "vite build",
|
|
88
88
|
"watch": "yarn build --mode 'development' --watch",
|
package/src/mixins/DitoMixin.js
CHANGED
|
@@ -15,7 +15,7 @@ import DitoContext from '../DitoContext.js'
|
|
|
15
15
|
import EmitterMixin from './EmitterMixin.js'
|
|
16
16
|
import { isMatchingType, convertType } from '../utils/type.js'
|
|
17
17
|
import { getResource, getMemberResource } from '../utils/resource.js'
|
|
18
|
-
import { reactive } from 'vue'
|
|
18
|
+
import { computed, reactive } from 'vue'
|
|
19
19
|
|
|
20
20
|
// @vue/component
|
|
21
21
|
export default {
|
|
@@ -433,17 +433,25 @@ export default {
|
|
|
433
433
|
},
|
|
434
434
|
|
|
435
435
|
setupComputed() {
|
|
436
|
-
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
:
|
|
440
|
-
|
|
436
|
+
const getComputedAccessor = ({ get, set }) => {
|
|
437
|
+
const getter = computed(() => get.call(this))
|
|
438
|
+
return {
|
|
439
|
+
get: () => getter.value,
|
|
440
|
+
set: set ? value => set.call(this, value) : undefined
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
for (const [key, item] of Object.entries(this.schema.computed || {})) {
|
|
445
|
+
const accessor = isFunction(item)
|
|
446
|
+
? getComputedAccessor({ get: item })
|
|
447
|
+
: isObject(item) && isFunction(item.get)
|
|
448
|
+
? getComputedAccessor(item)
|
|
441
449
|
: null
|
|
442
450
|
if (accessor) {
|
|
443
451
|
Object.defineProperty(this, key, accessor)
|
|
444
452
|
} else {
|
|
445
453
|
console.error(
|
|
446
|
-
`Invalid computed property definition: ${key}: ${
|
|
454
|
+
`Invalid computed property definition: ${key}: ${item}`
|
|
447
455
|
)
|
|
448
456
|
}
|
|
449
457
|
}
|
|
@@ -3,6 +3,7 @@ import ResourceMixin from './ResourceMixin.js'
|
|
|
3
3
|
import SchemaParentMixin from '../mixins/SchemaParentMixin.js'
|
|
4
4
|
import { getSchemaAccessor, getStoreAccessor } from '../utils/accessor.js'
|
|
5
5
|
import { getMemberResource } from '../utils/resource.js'
|
|
6
|
+
import { replaceRoute } from '../utils/route.js'
|
|
6
7
|
import {
|
|
7
8
|
processRouteSchema,
|
|
8
9
|
processForms,
|
|
@@ -43,7 +44,6 @@ export default {
|
|
|
43
44
|
data() {
|
|
44
45
|
return {
|
|
45
46
|
wrappedPrimitives: null,
|
|
46
|
-
ignoreRouteChange: false,
|
|
47
47
|
unwrappingPrimitives: false
|
|
48
48
|
}
|
|
49
49
|
},
|
|
@@ -177,12 +177,9 @@ export default {
|
|
|
177
177
|
...query
|
|
178
178
|
}
|
|
179
179
|
if (!equals(query, this.$route.query)) {
|
|
180
|
-
// Tell the `$route` watcher to ignore the changed triggered here:
|
|
181
|
-
this.ignoreRouteChange = true
|
|
182
|
-
this.$router.replace({ query, hash: this.$route.hash })
|
|
183
180
|
// Change the route query parameters, but don't trigger a route
|
|
184
181
|
// change, as that would cause the list to reload.
|
|
185
|
-
|
|
182
|
+
replaceRoute({ query })
|
|
186
183
|
}
|
|
187
184
|
return query // Let getStoreAccessor() do the actual setting
|
|
188
185
|
}
|
|
@@ -317,10 +314,6 @@ export default {
|
|
|
317
314
|
|
|
318
315
|
watch: {
|
|
319
316
|
$route(to, from) {
|
|
320
|
-
if (this.ignoreRouteChange) {
|
|
321
|
-
this.ignoreRouteChange = false
|
|
322
|
-
return
|
|
323
|
-
}
|
|
324
317
|
if (from.path === to.path && from.hash === to.hash) {
|
|
325
318
|
// Paths and hashes remain the same, so only queries have changed.
|
|
326
319
|
// Update filter and reload data without clearing.
|
package/src/mixins/TypeMixin.js
CHANGED
|
@@ -69,6 +69,7 @@ export default {
|
|
|
69
69
|
: value
|
|
70
70
|
// eslint-disable-next-line vue/no-mutating-props
|
|
71
71
|
this.data[this.name] = this.parsedValue
|
|
72
|
+
this.changedValue = undefined
|
|
72
73
|
}
|
|
73
74
|
},
|
|
74
75
|
|
|
@@ -277,6 +278,7 @@ export default {
|
|
|
277
278
|
|
|
278
279
|
clear() {
|
|
279
280
|
this.value = null
|
|
281
|
+
this.changedValue = undefined
|
|
280
282
|
this.onChange()
|
|
281
283
|
},
|
|
282
284
|
|
|
@@ -293,7 +295,6 @@ export default {
|
|
|
293
295
|
},
|
|
294
296
|
|
|
295
297
|
onInput() {
|
|
296
|
-
console.log('onInput()', this.name)
|
|
297
298
|
this.markDirty()
|
|
298
299
|
this.emitEvent('input')
|
|
299
300
|
},
|
|
@@ -306,14 +307,10 @@ export default {
|
|
|
306
307
|
// For some odd reason, the native change event now sometimes fires
|
|
307
308
|
// twice on Vue3. Filter out second call.
|
|
308
309
|
// TODO: Investigate why this happens, and if it's a bug in Vue3.
|
|
309
|
-
if (value === this.changedValue)
|
|
310
|
-
console.log('onChange() double', this.name)
|
|
311
|
-
return
|
|
312
|
-
}
|
|
310
|
+
if (value === this.changedValue) return
|
|
313
311
|
this.changedValue = value
|
|
314
312
|
}
|
|
315
313
|
|
|
316
|
-
console.log('onChange()', this.name, value)
|
|
317
314
|
this.markDirty()
|
|
318
315
|
this.emitEvent('change', {
|
|
319
316
|
// Prevent endless parse recursion:
|
|
@@ -195,17 +195,10 @@ export default DitoTypeComponent.register('list', {
|
|
|
195
195
|
},
|
|
196
196
|
set query(query) {
|
|
197
197
|
const component = getListComponent()
|
|
198
|
-
console.log('set query', !!component)
|
|
199
198
|
if (component) {
|
|
200
199
|
// Filter out undefined values for comparing with equals()
|
|
201
200
|
const filter = obj => pickBy(obj, value => value !== undefined)
|
|
202
|
-
console.log(
|
|
203
|
-
'set query',
|
|
204
|
-
JSON.stringify(filter(query)),
|
|
205
|
-
JSON.stringify(filter(component.query))
|
|
206
|
-
)
|
|
207
201
|
if (!equals(filter(query), filter(component.query))) {
|
|
208
|
-
console.log('load data')
|
|
209
202
|
component.query = query
|
|
210
203
|
component.loadData(false)
|
|
211
204
|
}
|
package/src/utils/filter.js
CHANGED
|
@@ -109,13 +109,6 @@ export function createFiltersPanel(api, filters, dataPath, proxy) {
|
|
|
109
109
|
|
|
110
110
|
methods: {
|
|
111
111
|
applyFilters() {
|
|
112
|
-
console.log(
|
|
113
|
-
'applyFilters()',
|
|
114
|
-
JSON.stringify({
|
|
115
|
-
data: this.data,
|
|
116
|
-
filters: this.filters
|
|
117
|
-
})
|
|
118
|
-
)
|
|
119
112
|
proxy.query = {
|
|
120
113
|
...proxy.query,
|
|
121
114
|
filter: this.filters,
|
|
@@ -125,7 +118,6 @@ export function createFiltersPanel(api, filters, dataPath, proxy) {
|
|
|
125
118
|
},
|
|
126
119
|
|
|
127
120
|
clearFilters() {
|
|
128
|
-
console.log('clearFilters()')
|
|
129
121
|
this.resetData()
|
|
130
122
|
this.applyFilters()
|
|
131
123
|
}
|
|
@@ -211,13 +203,6 @@ function getComponentsForFilter(schema, name) {
|
|
|
211
203
|
}
|
|
212
204
|
|
|
213
205
|
function formatFiltersData(schema, data) {
|
|
214
|
-
console.log(
|
|
215
|
-
'formatFiltersData()',
|
|
216
|
-
JSON.stringify({
|
|
217
|
-
data,
|
|
218
|
-
schema: Object.keys(schema?.components || {})
|
|
219
|
-
})
|
|
220
|
-
)
|
|
221
206
|
const filters = []
|
|
222
207
|
for (const name in data) {
|
|
223
208
|
const entry = data[name]
|