@ditojs/admin 2.7.5 → 2.8.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/dist/dito-admin.es.js +1463 -1425
- package/dist/dito-admin.umd.js +5 -5
- package/dist/style.css +1 -1
- package/package.json +5 -5
- package/src/DitoContext.js +4 -0
- package/src/DitoTypeComponent.js +1 -1
- package/src/components/DitoClipboard.vue +22 -0
- package/src/components/DitoContainer.vue +7 -12
- package/src/components/DitoCreateButton.vue +4 -0
- package/src/components/DitoDialog.vue +5 -0
- package/src/components/DitoEditButtons.vue +4 -0
- package/src/components/DitoForm.vue +9 -4
- package/src/components/DitoHeader.vue +22 -6
- package/src/components/DitoLabel.vue +39 -22
- package/src/components/DitoPane.vue +43 -35
- package/src/components/DitoRoot.vue +1 -2
- package/src/components/DitoSchema.vue +137 -165
- package/src/components/DitoSchemaInlined.vue +12 -9
- package/src/components/DitoTabs.vue +65 -23
- package/src/components/DitoTreeItem.vue +1 -1
- package/src/components/DitoView.vue +0 -1
- package/src/mixins/DitoMixin.js +6 -5
- package/src/mixins/ItemMixin.js +5 -1
- package/src/mixins/TypeMixin.js +5 -0
- package/src/styles/_button.scss +13 -12
- package/src/styles/_settings.scss +2 -2
- package/src/types/DitoTypeList.vue +1 -1
- package/src/types/DitoTypeMultiselect.vue +0 -2
- package/src/types/DitoTypeObject.vue +6 -4
- package/src/types/DitoTypePanel.vue +1 -1
- package/src/types/DitoTypeSection.vue +38 -10
- package/src/types/DitoTypeUpload.vue +2 -2
- package/src/utils/options.js +1 -1
- package/src/utils/schema.js +8 -6
- package/types/index.d.ts +1 -1
package/src/styles/_button.scss
CHANGED
|
@@ -112,6 +112,8 @@
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
.dito-buttons {
|
|
115
|
+
// TODO: BEM
|
|
116
|
+
|
|
115
117
|
&.dito-buttons-large {
|
|
116
118
|
--button-margin: 3px;
|
|
117
119
|
|
|
@@ -133,19 +135,18 @@
|
|
|
133
135
|
|
|
134
136
|
&.dito-buttons-main {
|
|
135
137
|
border-top: $border-style;
|
|
138
|
+
}
|
|
136
139
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
background: $content-color-background;
|
|
148
|
-
}
|
|
140
|
+
&.dito-buttons-sticky {
|
|
141
|
+
align-self: flex-end;
|
|
142
|
+
position: sticky;
|
|
143
|
+
bottom: 0;
|
|
144
|
+
z-index: $z-index-main-buttons;
|
|
145
|
+
margin-bottom: -$content-padding;
|
|
146
|
+
margin-top: 2 * $content-padding;
|
|
147
|
+
box-shadow: 0 (-$content-padding) $content-padding (-$content-padding)
|
|
148
|
+
$color-shadow;
|
|
149
|
+
background: $content-color-background;
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
&.dito-buttons-round,
|
|
@@ -56,8 +56,8 @@ $header-padding: $header-padding-ver $header-padding-hor;
|
|
|
56
56
|
$header-height: $header-font-size + 2 * $header-padding-ver;
|
|
57
57
|
|
|
58
58
|
// Tabs
|
|
59
|
-
$tab-margin:
|
|
60
|
-
$tab-padding-hor:
|
|
59
|
+
$tab-margin: $form-spacing;
|
|
60
|
+
$tab-padding-hor: 2 * $tab-margin;
|
|
61
61
|
$tab-padding-ver: calc(($header-padding-ver * 2 - $tab-margin) / 2);
|
|
62
62
|
$tab-radius: 4px;
|
|
63
63
|
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
:createPath="path"
|
|
138
138
|
)
|
|
139
139
|
//- Render create buttons outside table when in a single component view:
|
|
140
|
-
DitoEditButtons.dito-buttons-main.dito-buttons-
|
|
140
|
+
DitoEditButtons.dito-buttons-large.dito-buttons-main.dito-buttons-sticky(
|
|
141
141
|
v-if="hasListButtons && single"
|
|
142
142
|
:buttons="buttonSchemas"
|
|
143
143
|
:schema="schema"
|
|
@@ -67,7 +67,6 @@ export default DitoTypeComponent.register('multiselect', {
|
|
|
67
67
|
|
|
68
68
|
data() {
|
|
69
69
|
return {
|
|
70
|
-
isMounted: false,
|
|
71
70
|
searchedOptions: null,
|
|
72
71
|
populate: false
|
|
73
72
|
}
|
|
@@ -145,7 +144,6 @@ export default DitoTypeComponent.register('multiselect', {
|
|
|
145
144
|
},
|
|
146
145
|
|
|
147
146
|
mounted() {
|
|
148
|
-
this.isMounted = true
|
|
149
147
|
if (this.autofocus) {
|
|
150
148
|
// vue-multiselect doesn't support the autofocus attribute. We need to
|
|
151
149
|
// handle it here.
|
|
@@ -18,7 +18,11 @@
|
|
|
18
18
|
:disabled="disabled || isLoading"
|
|
19
19
|
:collapsed="collapsed"
|
|
20
20
|
:collapsible="collapsible"
|
|
21
|
+
:deletable="objectData && deletable"
|
|
22
|
+
:editable="objectData && editable"
|
|
23
|
+
:editPath="path"
|
|
21
24
|
:accumulatedBasis="accumulatedBasis"
|
|
25
|
+
@delete="deleteItem(objectData)"
|
|
22
26
|
)
|
|
23
27
|
component(
|
|
24
28
|
v-else-if="schema.component"
|
|
@@ -35,6 +39,8 @@
|
|
|
35
39
|
v-else
|
|
36
40
|
v-html="getItemLabel(schema, objectData)"
|
|
37
41
|
)
|
|
42
|
+
//- NOTE: `DitoEditButtons` here only handle the create button outside of the
|
|
43
|
+
//- schema, the edit buttons inside are handled by `DitoSchemaInlined`.
|
|
38
44
|
DitoEditButtons(
|
|
39
45
|
:buttons="buttonSchemas"
|
|
40
46
|
:schema="schema"
|
|
@@ -45,11 +51,7 @@
|
|
|
45
51
|
:store="store"
|
|
46
52
|
:disabled="disabled || isLoading"
|
|
47
53
|
:creatable="creatable"
|
|
48
|
-
:deletable="objectData && deletable"
|
|
49
|
-
:editable="objectData && editable"
|
|
50
54
|
:createPath="path"
|
|
51
|
-
:editPath="path"
|
|
52
|
-
@delete="deleteItem(objectData)"
|
|
53
55
|
)
|
|
54
56
|
</template>
|
|
55
57
|
|
|
@@ -6,7 +6,7 @@ export default DitoTypeComponent.register('panel', {
|
|
|
6
6
|
defaultValue: () => undefined, // Callback to override `defaultValue: null`
|
|
7
7
|
excludeValue: true,
|
|
8
8
|
generateLabel: false,
|
|
9
|
-
|
|
9
|
+
omitSpacing: true,
|
|
10
10
|
|
|
11
11
|
getPanelSchema(api, schema) {
|
|
12
12
|
// For a TypePanel, the component schema is also the panel schema, but
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.dito-section(:class="{ 'dito-section
|
|
3
|
-
|
|
2
|
+
.dito-section(:class="{ 'dito-section--labelled': !!schema.label }")
|
|
3
|
+
DitoSchemaInlined.dito-section__schema(
|
|
4
|
+
:label="label"
|
|
4
5
|
:schema="getItemFormSchema(schema, item, context)"
|
|
5
6
|
:dataPath="dataPath"
|
|
6
7
|
:data="item"
|
|
7
8
|
:meta="meta"
|
|
8
9
|
:store="store"
|
|
9
10
|
:disabled="disabled"
|
|
11
|
+
:collapsed="collapsed"
|
|
12
|
+
:collapsible="collapsible"
|
|
13
|
+
:labelNode="labelNode"
|
|
10
14
|
)
|
|
11
15
|
</template>
|
|
12
16
|
|
|
13
17
|
<script>
|
|
14
18
|
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
19
|
+
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
15
20
|
import { getItemFormSchema, processSchemaComponents } from '../utils/schema.js'
|
|
16
21
|
|
|
17
22
|
// @vue/component
|
|
@@ -24,7 +29,20 @@ export default DitoTypeComponent.register('section', {
|
|
|
24
29
|
computed: {
|
|
25
30
|
item() {
|
|
26
31
|
return this.nested ? this.value : this.data
|
|
27
|
-
}
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
collapsible: getSchemaAccessor('collapsible', {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: null, // so that `??` below can do its thing:
|
|
37
|
+
get(collapsible) {
|
|
38
|
+
return !!(collapsible ?? this.collapsed !== null)
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
|
|
42
|
+
collapsed: getSchemaAccessor('collapsed', {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: null
|
|
45
|
+
})
|
|
28
46
|
},
|
|
29
47
|
|
|
30
48
|
methods: {
|
|
@@ -42,15 +60,25 @@ export default DitoTypeComponent.register('section', {
|
|
|
42
60
|
@import '../styles/_imports';
|
|
43
61
|
|
|
44
62
|
.dito-section {
|
|
45
|
-
|
|
46
|
-
border: $border-
|
|
63
|
+
&--labelled {
|
|
64
|
+
border: $border-width solid transparent;
|
|
47
65
|
border-radius: $border-radius;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
66
|
+
transition: border-color 0.2s $ease-out-quart;
|
|
67
|
+
margin-top: $form-spacing-half;
|
|
51
68
|
|
|
52
|
-
|
|
53
|
-
|
|
69
|
+
&:has(.dito-schema--open) {
|
|
70
|
+
border-color: $border-color;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// For animation purposes, move the padding to the contained panes.
|
|
74
|
+
.dito-pane {
|
|
75
|
+
padding: $form-spacing;
|
|
76
|
+
|
|
77
|
+
&:has(> .dito-container--label-vertical:first-of-type) {
|
|
78
|
+
// Reduce top spacing when the first row has labels.
|
|
79
|
+
padding-top: $form-spacing-half;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
54
82
|
}
|
|
55
83
|
}
|
|
56
84
|
</style>
|
package/src/utils/options.js
CHANGED
package/src/utils/schema.js
CHANGED
|
@@ -483,11 +483,13 @@ export function getFormSchemas(schema, context, modifyForm) {
|
|
|
483
483
|
throw new Error(`Unknown view: '${schema.view}'`)
|
|
484
484
|
}
|
|
485
485
|
|
|
486
|
-
let { form, forms
|
|
486
|
+
let { form, forms } = schema
|
|
487
487
|
if (!form && !forms) {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
488
|
+
const { components, tabs, compact, clipboard } = schema
|
|
489
|
+
if (components || tabs) {
|
|
490
|
+
// Convert inlined components to forms, also supporting `tabs`, `compact`
|
|
491
|
+
// and `clipboard` settings.
|
|
492
|
+
form = { components, tabs, compact, clipboard }
|
|
491
493
|
} else {
|
|
492
494
|
// No `forms`, `form` or `components`, return and empty `forms` object.
|
|
493
495
|
return {}
|
|
@@ -538,8 +540,8 @@ export function hasLabel(schema, generateLabels) {
|
|
|
538
540
|
)
|
|
539
541
|
}
|
|
540
542
|
|
|
541
|
-
export function
|
|
542
|
-
return !!getTypeOptions(schema)?.
|
|
543
|
+
export function omitSpacing(schema) {
|
|
544
|
+
return !!getTypeOptions(schema)?.omitSpacing
|
|
543
545
|
}
|
|
544
546
|
|
|
545
547
|
export function getSchemaValue(
|
package/types/index.d.ts
CHANGED
|
@@ -171,7 +171,7 @@ export interface BaseSchema<$Item>
|
|
|
171
171
|
default?: OrItemAccessor<$Item>
|
|
172
172
|
compute?: ItemAccessor<$Item>
|
|
173
173
|
data?: OrItemAccessor<$Item, {}, Record<string, any>>
|
|
174
|
-
|
|
174
|
+
omitSpacing?: boolean
|
|
175
175
|
break?: 'before' | 'after'
|
|
176
176
|
}
|
|
177
177
|
|