@ditojs/admin 2.1.3 → 2.2.1
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 +1549 -1451
- package/dist/dito-admin.umd.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +5 -5
- package/src/DitoContext.js +10 -10
- package/src/DitoTypeComponent.js +1 -0
- package/src/components/DitoContainer.vue +22 -10
- package/src/components/DitoCreateButton.vue +11 -8
- package/src/components/DitoDraggable.vue +45 -0
- package/src/components/DitoPane.vue +1 -1
- package/src/components/DitoPanel.vue +1 -1
- package/src/components/DitoSchema.vue +11 -6
- package/src/components/DitoSchemaInlined.vue +1 -0
- package/src/components/DitoTreeItem.vue +3 -2
- package/src/components/index.js +1 -0
- package/src/mixins/DataMixin.js +3 -3
- package/src/mixins/DitoMixin.js +23 -10
- package/src/mixins/RouteMixin.js +1 -1
- package/src/mixins/SortableMixin.js +2 -6
- package/src/mixins/SourceMixin.js +0 -5
- package/src/mixins/TypeMixin.js +40 -17
- package/src/styles/_pulldown.scss +9 -12
- package/src/types/DitoTypeButton.vue +12 -9
- 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 +4 -2
- 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 -1
- package/src/types/DitoTypeTextarea.vue +1 -0
- package/src/types/DitoTypeTreeList.vue +2 -0
- package/src/types/DitoTypeUpload.vue +5 -2
- package/src/utils/accessor.js +1 -1
- package/src/utils/options.js +1 -0
- package/src/utils/schema.js +5 -15
- package/types/index.d.ts +3 -24
|
@@ -4,7 +4,7 @@ button.dito-button(
|
|
|
4
4
|
ref="element"
|
|
5
5
|
:type="type"
|
|
6
6
|
:title="text"
|
|
7
|
-
:class="
|
|
7
|
+
:class="buttonClass"
|
|
8
8
|
v-bind="attributes"
|
|
9
9
|
) {{ text }}
|
|
10
10
|
</template>
|
|
@@ -21,13 +21,16 @@ export default DitoTypeComponent.register(
|
|
|
21
21
|
{
|
|
22
22
|
defaultValue: () => undefined, // Callback to override `defaultValue: null`
|
|
23
23
|
excludeValue: true,
|
|
24
|
+
generateLabel: false,
|
|
24
25
|
defaultWidth: 'auto',
|
|
25
|
-
// TODO: Consider making this work nicely:
|
|
26
|
-
// omitFlexGrow: true,
|
|
27
26
|
|
|
28
27
|
computed: {
|
|
29
28
|
verb() {
|
|
30
|
-
return this.verbs[this.name]
|
|
29
|
+
return this.verbs[this.name]
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
buttonClass() {
|
|
33
|
+
return this.verb ? `dito-button-${this.verb}` : null
|
|
31
34
|
},
|
|
32
35
|
|
|
33
36
|
text: getSchemaAccessor('text', {
|
|
@@ -40,16 +43,16 @@ export default DitoTypeComponent.register(
|
|
|
40
43
|
closeForm: getSchemaAccessor('closeForm', {
|
|
41
44
|
type: Boolean,
|
|
42
45
|
default: false
|
|
43
|
-
})
|
|
46
|
+
})
|
|
47
|
+
},
|
|
44
48
|
|
|
49
|
+
methods: {
|
|
45
50
|
// @override
|
|
46
|
-
|
|
51
|
+
getEvents() {
|
|
47
52
|
const { onFocus, onBlur, onClick } = this
|
|
48
53
|
return { onFocus, onBlur, onClick }
|
|
49
|
-
}
|
|
50
|
-
},
|
|
54
|
+
},
|
|
51
55
|
|
|
52
|
-
methods: {
|
|
53
56
|
async submit(options) {
|
|
54
57
|
return this.resourceComponent?.submit(this, options)
|
|
55
58
|
},
|
|
@@ -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
|
+
alignBottom: false,
|
|
25
26
|
ignoreMissingValue: schema => !('default' in schema),
|
|
26
27
|
|
|
27
28
|
async processSchema(api, schema) {
|
|
@@ -38,10 +38,11 @@
|
|
|
38
38
|
:columns="columns"
|
|
39
39
|
:hasEditButtons="hasEditButtons"
|
|
40
40
|
)
|
|
41
|
-
|
|
41
|
+
DitoDraggable(
|
|
42
42
|
tag="tbody"
|
|
43
43
|
:modelValue="updateOrder(sourceSchema, listData, paginationRange)"
|
|
44
|
-
:options="getSortableOptions(
|
|
44
|
+
:options="getSortableOptions(false)"
|
|
45
|
+
:draggable="draggable"
|
|
45
46
|
@update:modelValue="value => (listData = value)"
|
|
46
47
|
)
|
|
47
48
|
tr(
|
|
@@ -167,6 +168,7 @@ import { pickBy, equals, hyphenate } from '@ditojs/utils'
|
|
|
167
168
|
// @vue/component
|
|
168
169
|
export default DitoTypeComponent.register('list', {
|
|
169
170
|
mixins: [SourceMixin, SortableMixin],
|
|
171
|
+
alignBottom: false,
|
|
170
172
|
|
|
171
173
|
getSourceType(type) {
|
|
172
174
|
// 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
|
+
alignBottom: false,
|
|
67
|
+
|
|
66
68
|
getSourceType(type) {
|
|
67
69
|
// No need for transformation here. See TypeTreeList for details.
|
|
68
70
|
return type
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
span Status
|
|
13
13
|
th
|
|
14
14
|
span
|
|
15
|
-
|
|
15
|
+
DitoDraggable(
|
|
16
16
|
v-model="files"
|
|
17
17
|
tag="tbody"
|
|
18
|
-
:options="getSortableOptions(
|
|
18
|
+
:options="getSortableOptions(false)"
|
|
19
|
+
:draggable="draggable"
|
|
19
20
|
)
|
|
20
21
|
tr(
|
|
21
22
|
v-for="(file, index) in files"
|
|
@@ -111,6 +112,8 @@ export default DitoTypeComponent.register('upload', {
|
|
|
111
112
|
mixins: [SortableMixin],
|
|
112
113
|
components: { VueUpload },
|
|
113
114
|
|
|
115
|
+
alignBottom: false,
|
|
116
|
+
|
|
114
117
|
data() {
|
|
115
118
|
return {
|
|
116
119
|
uploads: []
|
package/src/utils/accessor.js
CHANGED
|
@@ -53,7 +53,7 @@ export function getStoreAccessor(name, { default: def, get, set } = {}) {
|
|
|
53
53
|
let value = this.getStore(name)
|
|
54
54
|
if (value === undefined && def !== undefined) {
|
|
55
55
|
// Support `default()` functions:
|
|
56
|
-
value = isFunction(def) ? def.call(this
|
|
56
|
+
value = isFunction(def) ? def.call(this) : def
|
|
57
57
|
// Trigger setter by setting value and accessor to default:
|
|
58
58
|
this[name] = value
|
|
59
59
|
// Now access store again, for reactivity tracking
|
package/src/utils/options.js
CHANGED
package/src/utils/schema.js
CHANGED
|
@@ -432,10 +432,6 @@ export function getItemFormSchema(schema, item, context) {
|
|
|
432
432
|
return getItemFormSchemaFromForms(getFormSchemas(schema, context), item)
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
-
export function hasLabel(schema) {
|
|
436
|
-
return schema.label !== false
|
|
437
|
-
}
|
|
438
|
-
|
|
439
435
|
export function isCompact(schema) {
|
|
440
436
|
return !!schema.compact
|
|
441
437
|
}
|
|
@@ -448,10 +444,14 @@ export function isNested(schema) {
|
|
|
448
444
|
return !!(schema.nested || getTypeOptions(schema)?.defaultNested === true)
|
|
449
445
|
}
|
|
450
446
|
|
|
451
|
-
export function
|
|
447
|
+
export function omitPadding(schema) {
|
|
452
448
|
return !!getTypeOptions(schema)?.omitPadding
|
|
453
449
|
}
|
|
454
450
|
|
|
451
|
+
export function alignBottom(schema) {
|
|
452
|
+
return !!getTypeOptions(schema)?.alignBottom
|
|
453
|
+
}
|
|
454
|
+
|
|
455
455
|
export function getDefaultValue(schema) {
|
|
456
456
|
// Support default values both on schema and on component level.
|
|
457
457
|
// NOTE: At the time of creation, components may not be instantiated, (e.g. if
|
|
@@ -475,16 +475,6 @@ export function ignoreMissingValue(schema) {
|
|
|
475
475
|
)
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
export function hasLabels(schema) {
|
|
479
|
-
const checkComponents = components =>
|
|
480
|
-
Object.values(components || {}).some(hasLabel)
|
|
481
|
-
|
|
482
|
-
return (
|
|
483
|
-
checkComponents(schema.components) ||
|
|
484
|
-
Object.values(schema.tabs || {}).some(checkComponents)
|
|
485
|
-
)
|
|
486
|
-
}
|
|
487
|
-
|
|
488
478
|
export function setDefaultValues(schema, data = {}, component) {
|
|
489
479
|
const options = { component, rootData: data }
|
|
490
480
|
|
package/types/index.d.ts
CHANGED
|
@@ -319,40 +319,19 @@ export interface SchemaSourceMixin<$Item> {
|
|
|
319
319
|
*
|
|
320
320
|
* @defaultValue `false`
|
|
321
321
|
*/
|
|
322
|
-
creatable?: OrItemAccessor
|
|
323
|
-
$Item,
|
|
324
|
-
{},
|
|
325
|
-
| boolean
|
|
326
|
-
| {
|
|
327
|
-
label: string
|
|
328
|
-
}
|
|
329
|
-
>
|
|
322
|
+
creatable?: OrItemAccessor<$Item, {}, boolean | { label: string }>
|
|
330
323
|
/**
|
|
331
324
|
* Whether to add edit buttons next to the list items.
|
|
332
325
|
*
|
|
333
326
|
* @defaultValue `false`
|
|
334
327
|
*/
|
|
335
|
-
editable?: OrItemAccessor
|
|
336
|
-
$Item,
|
|
337
|
-
{},
|
|
338
|
-
| boolean
|
|
339
|
-
| {
|
|
340
|
-
label: string
|
|
341
|
-
}
|
|
342
|
-
>
|
|
328
|
+
editable?: OrItemAccessor<$Item, {}, boolean | { label: string }>
|
|
343
329
|
/**
|
|
344
330
|
* Whether to add delete buttons next to the list items.
|
|
345
331
|
*
|
|
346
332
|
* @defaultValue `false`
|
|
347
333
|
*/
|
|
348
|
-
deletable?: OrItemAccessor
|
|
349
|
-
$Item,
|
|
350
|
-
{},
|
|
351
|
-
| boolean
|
|
352
|
-
| {
|
|
353
|
-
label: string
|
|
354
|
-
}
|
|
355
|
-
>
|
|
334
|
+
deletable?: OrItemAccessor<$Item, {}, boolean | { label: string }>
|
|
356
335
|
/**
|
|
357
336
|
* The column used for the order resulting from dragging around list entries
|
|
358
337
|
* when the `draggable` property of the list schema is set to `true`.
|