@ditojs/admin 1.29.0 → 1.30.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": "1.29.0",
3
+ "version": "1.30.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",
@@ -33,9 +33,9 @@
33
33
  "not ie_mob > 0"
34
34
  ],
35
35
  "dependencies": {
36
- "@ditojs/build": "^1.29.0",
37
- "@ditojs/ui": "^1.29.0",
38
- "@ditojs/utils": "^1.29.0",
36
+ "@ditojs/build": "^1.30.0",
37
+ "@ditojs/ui": "^1.30.0",
38
+ "@ditojs/utils": "^1.30.0",
39
39
  "codeflask": "^1.4.1",
40
40
  "filesize": "^10.0.6",
41
41
  "filesize-parser": "^1.5.0",
@@ -66,7 +66,7 @@
66
66
  "vite-plugin-vue2": "^2.0.3"
67
67
  },
68
68
  "types": "types",
69
- "gitHead": "6e93fe59126eab3d5ee1961d9e03f0fbdc297fba",
69
+ "gitHead": "5d09dc24ecb77b511f3c25643275ea1b9514fb52",
70
70
  "scripts": {
71
71
  "build": "vite build",
72
72
  "watch": "yarn build --mode 'development' --watch",
@@ -44,9 +44,12 @@
44
44
  --label-padding: #{$form-spacing}
45
45
  margin: 0
46
46
  width: 100%
47
- box-sizing: border-box
47
+ box-sizing: content-box
48
48
  // Because tables have a funny way of allowing too much width growth:
49
49
  max-width: $content-width
50
+ // Prevent collapsing to min-height when alone in
51
+ // .dito-schema-content, due to grid-template-rows: min-content
52
+ min-height: 2em
50
53
  & +.dito-pane
51
54
  // Needed for transition-height in DitoSchema:
52
55
  min-height: $form-spacing
@@ -88,6 +88,9 @@ export default {
88
88
  }
89
89
  // It's up to `itemLabel()` entirely to produce the label:
90
90
  extended = false
91
+ } else if (isString(itemLabel) && !(itemLabel in item)) {
92
+ // `itemLabel` can be both a key, or simply a label.
93
+ text = itemLabel
91
94
  } else {
92
95
  // Look up the name on the item, by these rules:
93
96
  // 1. If `itemLabel` is a string, use it as the property key
@@ -102,14 +105,13 @@ export default {
102
105
  text = item[key]
103
106
  }
104
107
  const hadLabel = !!text
105
- text ||= ''
106
108
  // If no label was found so far, try to produce one from the index.
107
- if (!text) {
109
+ if (text == null) {
108
110
  // Always use extended style when auto-generating labels from index/id:
109
111
  extended = true
110
- if (isListSource(sourceSchema) && index !== null) {
111
- text = `${index + 1}`
112
- }
112
+ text = (isListSource(sourceSchema) && index !== null)
113
+ ? text = `${index + 1}`
114
+ : ''
113
115
  }
114
116
  if (extended) {
115
117
  const formLabel = getFormLabel()
@@ -11,6 +11,7 @@
11
11
  // Support the same rendering options as TypeList:
12
12
  dito-schema-inlined(
13
13
  v-if="isInlined"
14
+ :label="objectLabel"
14
15
  :schema="getItemFormSchema(schema, objectData, context)"
15
16
  :dataPath="dataPath"
16
17
  :data="objectData"
@@ -83,6 +84,15 @@ export default TypeComponent.register('object', {
83
84
  return type
84
85
  },
85
86
 
87
+ computed: {
88
+ objectLabel() {
89
+ // Only show a label if the object is collapsible.
90
+ return this.collapsible
91
+ ? this.getItemLabel(this.schema, this.objectData, { asObject: true })
92
+ : null
93
+ }
94
+ },
95
+
86
96
  methods: {
87
97
  getContext() {
88
98
  return new DitoContext(this, { data: this.objectData })