@ditojs/admin 2.2.10 → 2.2.11
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 +667 -657
- package/dist/dito-admin.umd.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/DitoTypeComponent.js +1 -0
- package/src/components/DitoContainer.vue +23 -22
- package/src/components/DitoLabel.vue +1 -0
- package/src/mixins/DitoMixin.js +1 -1
- package/src/types/DitoTypeCode.vue +1 -0
- package/src/types/DitoTypeComponent.vue +1 -0
- package/src/types/DitoTypeLabel.vue +2 -1
- package/src/types/DitoTypeList.vue +1 -0
- package/src/types/DitoTypeMarkup.vue +2 -0
- package/src/types/DitoTypeObject.vue +2 -0
- package/src/types/DitoTypePanel.vue +1 -0
- package/src/types/DitoTypeSection.vue +1 -0
- package/src/types/DitoTypeTextarea.vue +1 -0
- package/src/types/DitoTypeTreeList.vue +2 -0
- package/src/types/DitoTypeUpload.vue +2 -0
- package/src/utils/options.js +1 -0
- package/src/utils/schema.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/admin",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.11",
|
|
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": "52aada1f67b13f9b30b745777c64649c6c7b171f",
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build": "vite build",
|
|
88
88
|
"watch": "yarn build --mode 'development' --watch",
|
package/src/DitoTypeComponent.js
CHANGED
|
@@ -31,7 +31,7 @@ import { isString, isNumber } from '@ditojs/utils'
|
|
|
31
31
|
import DitoComponent from '../DitoComponent.js'
|
|
32
32
|
import DitoContext from '../DitoContext.js'
|
|
33
33
|
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
34
|
-
import { getTypeComponent, omitPadding } from '../utils/schema.js'
|
|
34
|
+
import { getTypeComponent, keepAligned, omitPadding } from '../utils/schema.js'
|
|
35
35
|
import { parseFraction } from '../utils/math.js'
|
|
36
36
|
|
|
37
37
|
// @vue/component
|
|
@@ -68,25 +68,13 @@ export default DitoComponent.component('DitoContainer', {
|
|
|
68
68
|
return (
|
|
69
69
|
label !== false && (
|
|
70
70
|
!!label ||
|
|
71
|
-
this.generateLabels &&
|
|
72
|
-
this.typeComponent?.generateLabel ||
|
|
73
|
-
// If the component has no label but isn't full width, render an
|
|
74
|
-
// empty label for alignment with other components:
|
|
75
|
-
!this.isFullWidth
|
|
76
|
-
)
|
|
71
|
+
this.generateLabels && this.typeComponent?.generateLabel
|
|
77
72
|
)
|
|
78
73
|
)
|
|
79
74
|
},
|
|
80
75
|
|
|
81
76
|
label() {
|
|
82
|
-
return this.hasLabel
|
|
83
|
-
? this.getLabel(
|
|
84
|
-
this.schema,
|
|
85
|
-
// Pass an empty string in case we need an empty label, see
|
|
86
|
-
// `hasLabel()`:
|
|
87
|
-
this.typeComponent?.generateLabel ? this.schema.name : ''
|
|
88
|
-
) || ''
|
|
89
|
-
: null
|
|
77
|
+
return this.hasLabel ? this.getLabel(this.schema) : null
|
|
90
78
|
},
|
|
91
79
|
|
|
92
80
|
labelDataPath() {
|
|
@@ -94,13 +82,6 @@ export default DitoComponent.component('DitoContainer', {
|
|
|
94
82
|
return this.nested ? this.dataPath : null
|
|
95
83
|
},
|
|
96
84
|
|
|
97
|
-
isFullWidth() {
|
|
98
|
-
return (
|
|
99
|
-
!this.componentBasis.endsWith('%') ||
|
|
100
|
-
parseFloat(this.componentBasis) === 100
|
|
101
|
-
)
|
|
102
|
-
},
|
|
103
|
-
|
|
104
85
|
componentWidth: getSchemaAccessor('width', {
|
|
105
86
|
type: [String, Number],
|
|
106
87
|
default() {
|
|
@@ -146,6 +127,7 @@ export default DitoComponent.component('DitoContainer', {
|
|
|
146
127
|
return {
|
|
147
128
|
[`${prefix}--single`]: this.single,
|
|
148
129
|
[`${prefix}--has-label`]: this.hasLabel,
|
|
130
|
+
[`${prefix}--aligned`]: keepAligned(this.schema),
|
|
149
131
|
[`${prefix}--omit-padding`]: omitPadding(this.schema),
|
|
150
132
|
...(
|
|
151
133
|
isString(containerClass)
|
|
@@ -205,6 +187,8 @@ export default DitoComponent.component('DitoContainer', {
|
|
|
205
187
|
@import '../styles/_imports';
|
|
206
188
|
|
|
207
189
|
.dito-container {
|
|
190
|
+
$self: &;
|
|
191
|
+
|
|
208
192
|
display: flex;
|
|
209
193
|
flex-flow: column;
|
|
210
194
|
align-items: flex-start;
|
|
@@ -227,6 +211,23 @@ export default DitoComponent.component('DitoContainer', {
|
|
|
227
211
|
padding: 0;
|
|
228
212
|
}
|
|
229
213
|
|
|
214
|
+
&--aligned {
|
|
215
|
+
// To align components with and without labels.
|
|
216
|
+
justify-content: space-between;
|
|
217
|
+
|
|
218
|
+
&:has(> :only-child) {
|
|
219
|
+
justify-content: flex-end;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Don't align if neighbouring components aren't aligned either.
|
|
223
|
+
// Look ahead:
|
|
224
|
+
#{$self}:not(#{&}) + &,
|
|
225
|
+
// Look behind:
|
|
226
|
+
&:has(+ #{$self}:not(#{&})) {
|
|
227
|
+
justify-content: flex-start;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
230
231
|
&--omit-padding {
|
|
231
232
|
padding: 0;
|
|
232
233
|
|
package/src/mixins/DitoMixin.js
CHANGED
|
@@ -22,6 +22,7 @@ export default DitoTypeComponent.register('component', {
|
|
|
22
22
|
// Override the standard `defaultValue: null` to not set any data for custom
|
|
23
23
|
// components, unless they provide a default value.
|
|
24
24
|
defaultValue: () => undefined, // Callback to override `defaultValue: null`
|
|
25
|
+
keepAligned: false,
|
|
25
26
|
ignoreMissingValue: schema => !('default' in schema),
|
|
26
27
|
|
|
27
28
|
async processSchema(api, schema) {
|
|
@@ -167,6 +167,7 @@ import { pickBy, equals, hyphenate } from '@ditojs/utils'
|
|
|
167
167
|
// @vue/component
|
|
168
168
|
export default DitoTypeComponent.register('list', {
|
|
169
169
|
mixins: [SourceMixin, SortableMixin],
|
|
170
|
+
keepAligned: false,
|
|
170
171
|
|
|
171
172
|
getSourceType(type) {
|
|
172
173
|
// No need for transformation here. See TypeTreeList for details.
|
|
@@ -63,6 +63,8 @@ import { resolveSchemaComponent } from '../utils/schema.js'
|
|
|
63
63
|
export default DitoTypeComponent.register('object', {
|
|
64
64
|
mixins: [SourceMixin],
|
|
65
65
|
|
|
66
|
+
keepAligned: false,
|
|
67
|
+
|
|
66
68
|
getSourceType(type) {
|
|
67
69
|
// No need for transformation here. See TypeTreeList for details.
|
|
68
70
|
return type
|
package/src/utils/options.js
CHANGED
package/src/utils/schema.js
CHANGED
|
@@ -474,6 +474,10 @@ export function omitPadding(schema) {
|
|
|
474
474
|
return !!getTypeOptions(schema)?.omitPadding
|
|
475
475
|
}
|
|
476
476
|
|
|
477
|
+
export function keepAligned(schema) {
|
|
478
|
+
return !!getTypeOptions(schema)?.keepAligned
|
|
479
|
+
}
|
|
480
|
+
|
|
477
481
|
export function getDefaultValue(schema) {
|
|
478
482
|
// Support default values both on schema and on component level.
|
|
479
483
|
// NOTE: At the time of creation, components may not be instantiated, (e.g. if
|