@ditojs/admin 2.34.3 → 2.34.4
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 +9 -9
- package/dist/dito-admin.umd.js +3 -3
- package/package.json +2 -2
- package/src/mixins/DitoMixin.js +3 -1
- package/src/mixins/OptionsMixin.js +17 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/admin",
|
|
3
|
-
"version": "2.34.
|
|
3
|
+
"version": "2.34.4",
|
|
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",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"vite": "^5.4.8"
|
|
92
92
|
},
|
|
93
93
|
"types": "types",
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "1112f28f40e1e95d9301820cc68f787308cbab50"
|
|
95
95
|
}
|
package/src/mixins/DitoMixin.js
CHANGED
|
@@ -236,6 +236,8 @@ export default {
|
|
|
236
236
|
store = this.setStore(key, reactive({}))
|
|
237
237
|
}
|
|
238
238
|
if (index != null) {
|
|
239
|
+
// temporary uid keys will change between persistence, so we need to
|
|
240
|
+
// assign the key to the index even when the store already existed.
|
|
239
241
|
this.setStoreKeyByIndex(index, key)
|
|
240
242
|
}
|
|
241
243
|
return store
|
|
@@ -269,7 +271,7 @@ export default {
|
|
|
269
271
|
|
|
270
272
|
getLabel(schema, name) {
|
|
271
273
|
return schema
|
|
272
|
-
? this.getSchemaValue('label', { type: String,
|
|
274
|
+
? this.getSchemaValue('label', { schema, type: [String, Object] }) ||
|
|
273
275
|
labelize(name || schema.name)
|
|
274
276
|
: labelize(name) || ''
|
|
275
277
|
},
|
|
@@ -26,18 +26,24 @@ export default {
|
|
|
26
26
|
computed: {
|
|
27
27
|
selectedValue: {
|
|
28
28
|
get() {
|
|
29
|
-
const convertValue = value =>
|
|
30
|
-
this.relate
|
|
31
|
-
? this.
|
|
32
|
-
|
|
29
|
+
const convertValue = value => {
|
|
30
|
+
const val = this.relate
|
|
31
|
+
? this.getValueForOption(value)
|
|
32
|
+
: value
|
|
33
|
+
|
|
34
|
+
return this.hasOptions
|
|
35
|
+
? this.getOptionForValue(val)
|
|
36
|
+
? val
|
|
33
37
|
: null
|
|
34
38
|
: value
|
|
39
|
+
}
|
|
40
|
+
|
|
35
41
|
const value = isArray(this.value)
|
|
36
42
|
? this.value.map(convertValue).filter(value => value !== null)
|
|
37
43
|
: convertValue(this.value)
|
|
44
|
+
|
|
38
45
|
if (
|
|
39
|
-
//
|
|
40
|
-
this.relate &&
|
|
46
|
+
// As soon as the options are available, and...
|
|
41
47
|
this.hasOptions && (
|
|
42
48
|
// ...if the value is forced to null because a disappeared option...
|
|
43
49
|
value === null && this.value !== null ||
|
|
@@ -54,13 +60,14 @@ export default {
|
|
|
54
60
|
},
|
|
55
61
|
|
|
56
62
|
set(value) {
|
|
57
|
-
const
|
|
63
|
+
const convertValue = value =>
|
|
58
64
|
this.relate
|
|
59
65
|
? this.getOptionForValue(value)
|
|
60
66
|
: value
|
|
67
|
+
|
|
61
68
|
this.value = isArray(value)
|
|
62
|
-
? value.map(
|
|
63
|
-
:
|
|
69
|
+
? value.map(convertValue)
|
|
70
|
+
: convertValue(value)
|
|
64
71
|
}
|
|
65
72
|
},
|
|
66
73
|
|
|
@@ -216,10 +223,6 @@ export default {
|
|
|
216
223
|
return options
|
|
217
224
|
},
|
|
218
225
|
|
|
219
|
-
hasOption(option) {
|
|
220
|
-
return !!this.getOptionForValue(this.getValueForOption(option))
|
|
221
|
-
},
|
|
222
|
-
|
|
223
226
|
getOptionForValue(value) {
|
|
224
227
|
const findOption = (options, value, groupBy) => {
|
|
225
228
|
// Search for the option object with the given value and return the
|
|
@@ -244,7 +247,7 @@ export default {
|
|
|
244
247
|
getValueForOption(option) {
|
|
245
248
|
const { optionValue } = this
|
|
246
249
|
return isString(optionValue)
|
|
247
|
-
? option?.[optionValue]
|
|
250
|
+
? option?.[optionValue] ?? null
|
|
248
251
|
: isFunction(optionValue)
|
|
249
252
|
? optionValue(new DitoContext(this, { option }))
|
|
250
253
|
: option
|