@ditojs/admin 2.34.2 → 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 +1089 -1077
- package/dist/dito-admin.umd.js +5 -5
- package/package.json +2 -2
- package/src/components/DitoTreeItem.vue +19 -2
- package/src/mixins/DitoMixin.js +6 -4
- package/src/mixins/OptionsMixin.js +17 -14
- package/src/types/DitoTypeMarkup.vue +4 -4
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
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
'dito-active': active
|
|
7
7
|
}`
|
|
8
8
|
:style="level > 0 && { '--level': level }"
|
|
9
|
+
:data-path="path"
|
|
9
10
|
)
|
|
10
11
|
.dito-tree-header(
|
|
11
12
|
v-if="label"
|
|
@@ -271,22 +272,38 @@ export default DitoComponent.component('DitoTreeItem', {
|
|
|
271
272
|
return appendDataPath(this.dataPath, property.name)
|
|
272
273
|
},
|
|
273
274
|
|
|
274
|
-
|
|
275
|
+
editPath(path) {
|
|
275
276
|
// All we got to do is push the right edit path to the router, the rest
|
|
276
277
|
// is handled by our routes, allowing reloads as well.
|
|
277
278
|
this.$router.push({
|
|
278
|
-
path: `${this.container.path}${
|
|
279
|
+
path: `${this.container.path}${path}`,
|
|
279
280
|
// Preserve current query
|
|
280
281
|
query: this.$route.query
|
|
281
282
|
})
|
|
282
283
|
},
|
|
283
284
|
|
|
285
|
+
onEdit() {
|
|
286
|
+
this.editPath(this.path)
|
|
287
|
+
},
|
|
288
|
+
|
|
284
289
|
onDelete() {
|
|
285
290
|
// TODO: Implement!
|
|
286
291
|
},
|
|
287
292
|
|
|
288
293
|
onChange() {
|
|
289
294
|
this.container.onChange()
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
// @override
|
|
298
|
+
onEndDrag(event) {
|
|
299
|
+
SortableMixin.methods.onEndDrag.call(this, event)
|
|
300
|
+
const { item } = event
|
|
301
|
+
// Preserve active state of edited sub-items, by editing their new path.
|
|
302
|
+
if (item.classList.contains('dito-active')) {
|
|
303
|
+
this.$nextTick(() => {
|
|
304
|
+
this.editPath(event.item.dataset.path)
|
|
305
|
+
})
|
|
306
|
+
}
|
|
290
307
|
}
|
|
291
308
|
}
|
|
292
309
|
})
|
package/src/mixins/DitoMixin.js
CHANGED
|
@@ -234,9 +234,11 @@ export default {
|
|
|
234
234
|
}
|
|
235
235
|
if (!store) {
|
|
236
236
|
store = this.setStore(key, reactive({}))
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
}
|
|
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.
|
|
241
|
+
this.setStoreKeyByIndex(index, key)
|
|
240
242
|
}
|
|
241
243
|
return store
|
|
242
244
|
},
|
|
@@ -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
|
|
@@ -373,11 +373,11 @@ export default DitoTypeComponent.register('markup', {
|
|
|
373
373
|
|
|
374
374
|
HardBreak.extend({
|
|
375
375
|
addKeyboardShortcuts: () => {
|
|
376
|
-
const
|
|
376
|
+
const setHardBreak = () => this.editor.commands.setHardBreak()
|
|
377
377
|
return {
|
|
378
|
-
'Mod-Enter':
|
|
379
|
-
'Shift-Enter':
|
|
380
|
-
...(this.hardBreak ? { Enter:
|
|
378
|
+
'Mod-Enter': setHardBreak,
|
|
379
|
+
'Shift-Enter': setHardBreak,
|
|
380
|
+
...(this.hardBreak ? { Enter: setHardBreak } : null)
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
})
|