@ditojs/admin 2.67.0 → 2.68.0

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.67.0",
3
+ "version": "2.68.0",
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.67.0",
46
- "@ditojs/utils": "^2.67.0",
45
+ "@ditojs/ui": "^2.68.0",
46
+ "@ditojs/utils": "^2.68.0",
47
47
  "@kyvg/vue3-notification": "^3.4.2",
48
48
  "@lk77/vue3-color": "^3.0.6",
49
49
  "@tiptap/core": "^3.13.0",
@@ -89,9 +89,9 @@
89
89
  "vue-upload-component": "^3.1.17"
90
90
  },
91
91
  "devDependencies": {
92
- "@ditojs/build": "^2.67.0",
92
+ "@ditojs/build": "^2.68.0",
93
93
  "typescript": "^5.9.3",
94
94
  "vite": "^7.2.6"
95
95
  },
96
- "gitHead": "893f5c0dc46ab7a84a2161a3635405dceb650dad"
96
+ "gitHead": "8dbd4ce3ff84d83e8e4ebd8e90772ae51b25b8ce"
97
97
  }
@@ -18,6 +18,7 @@ export default {
18
18
  defaultValue: null,
19
19
  defaultNested: true,
20
20
  defaultVisible: true,
21
+ defaultMultiple: false,
21
22
  generateLabel: true,
22
23
  excludeValue: false,
23
24
  ignoreMissingValue: null,
@@ -1,6 +1,10 @@
1
1
  import DitoContext from '../DitoContext.js'
2
2
  import DataMixin from './DataMixin.js'
3
- import { hasViewSchema, getViewEditPath } from '../utils/schema.js'
3
+ import {
4
+ hasViewSchema,
5
+ getViewEditPath,
6
+ getMultipleValue
7
+ } from '../utils/schema.js'
4
8
  import { getSchemaAccessor } from '../utils/accessor.js'
5
9
  import { setTemporaryId, isReference } from '../utils/data.js'
6
10
  import {
@@ -20,7 +24,7 @@ export default {
20
24
  computed: {
21
25
  // @overridable
22
26
  multiple() {
23
- return false
27
+ return getMultipleValue(this.schema)
24
28
  },
25
29
 
26
30
  selectedValue: {
@@ -281,7 +285,7 @@ export default {
281
285
  const processRelate = value => (value ? { id: value.id } : value)
282
286
  // Selected options can be both objects & arrays, e.g. 'checkboxes':
283
287
  value =
284
- this.multiple && isArray(value)
288
+ getMultipleValue(schema) && isArray(value)
285
289
  ? value.map(processRelate)
286
290
  : processRelate(value)
287
291
  }
@@ -29,6 +29,7 @@ export default DitoTypeComponent.register('checkboxes', {
29
29
  nativeField: true,
30
30
  defaultValue: [],
31
31
  defaultWidth: 'auto',
32
+ defaultMultiple: true,
32
33
 
33
34
  computed: {
34
35
  // @override
@@ -670,6 +670,10 @@ export function shouldIgnoreMissingValue(schema, context) {
670
670
  return !!getTypeOptions(schema)?.ignoreMissingValue?.(getContext(context))
671
671
  }
672
672
 
673
+ export function getMultipleValue(schema) {
674
+ return schema.multiple ?? !!getTypeOptions(schema)?.defaultMultiple
675
+ }
676
+
673
677
  export function setDefaultValues(schema, data = {}, component) {
674
678
  const options = { component, rootData: data }
675
679