@ditojs/admin 2.26.1 → 2.26.2
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 +883 -878
- package/dist/dito-admin.umd.js +5 -5
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/components/DitoForm.vue +40 -62
- package/src/components/DitoFormInner.vue +26 -0
- package/src/components/{DitoFormInlined.vue → DitoFormNested.vue} +3 -3
- package/src/components/index.js +2 -1
- package/src/mixins/RouteMixin.js +4 -0
- package/src/mixins/SourceMixin.js +1 -1
- package/src/styles/_table.scss +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/admin",
|
|
3
|
-
"version": "2.26.
|
|
3
|
+
"version": "2.26.2",
|
|
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",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"vite": "^5.2.8"
|
|
84
84
|
},
|
|
85
85
|
"types": "types",
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "7fd7a0b9a8727e1a27a8e78e7381f58c95017499",
|
|
87
87
|
"scripts": {
|
|
88
88
|
"build": "vite build",
|
|
89
89
|
"watch": "yarn build --mode 'development' --watch",
|
|
@@ -1,82 +1,64 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
DefineTemplate
|
|
3
|
-
//- Prevent implicit submission of the form, for example when typing enter
|
|
4
|
-
//- in an input field.
|
|
5
|
-
//- https://stackoverflow.com/a/51507806
|
|
6
|
-
button(
|
|
7
|
-
v-show="false"
|
|
8
|
-
type="submit"
|
|
9
|
-
disabled
|
|
10
|
-
)
|
|
11
|
-
DitoSchema(
|
|
12
|
-
:schema="schema"
|
|
13
|
-
:dataPath="dataPath"
|
|
14
|
-
:data="data"
|
|
15
|
-
:meta="meta"
|
|
16
|
-
:store="store"
|
|
17
|
-
:padding="isInlinedSource ? 'nested' : 'root'"
|
|
18
|
-
:disabled="isLoading"
|
|
19
|
-
:scrollable="!isInlinedSource"
|
|
20
|
-
generateLabels
|
|
21
|
-
)
|
|
22
|
-
template(#buttons)
|
|
23
|
-
DitoButtons.dito-buttons-round.dito-buttons-large.dito-buttons-main(
|
|
24
|
-
:class="{ 'dito-buttons-sticky': !isInlinedSource }"
|
|
25
|
-
:buttons="buttonSchemas"
|
|
26
|
-
:dataPath="dataPath"
|
|
27
|
-
:data="data"
|
|
28
|
-
:meta="meta"
|
|
29
|
-
:store="store"
|
|
30
|
-
:disabled="isLoading"
|
|
31
|
-
)
|
|
32
|
-
|
|
33
2
|
.dito-form.dito-scroll-parent(
|
|
34
|
-
:class="{ 'dito-form-
|
|
3
|
+
:class="{ 'dito-form-nested': isNestedRoute }"
|
|
35
4
|
:data-resource="sourceSchema.path"
|
|
36
5
|
)
|
|
37
|
-
|
|
38
|
-
|
|
6
|
+
//- Only render a router-view here if this isn't the last data route and not a
|
|
7
|
+
//- nested form route, which will appear elsewhere in its own view.
|
|
8
|
+
RouterView(
|
|
9
|
+
v-if="!isLastUnnestedRoute && !isNestedRoute"
|
|
10
|
+
v-show="!isActive"
|
|
39
11
|
)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
)
|
|
47
|
-
ReuseTemplate
|
|
48
|
-
template(
|
|
49
|
-
v-else
|
|
12
|
+
//- NOTE: Nested form components are kept alive by using `v-show` instead of
|
|
13
|
+
//- `v-if` here, so event handling and other things still work with nested
|
|
14
|
+
//- editing.
|
|
15
|
+
DitoFormInner(
|
|
16
|
+
v-show="isActive"
|
|
17
|
+
:nested="isNestedRoute"
|
|
50
18
|
)
|
|
51
|
-
//-
|
|
52
|
-
//-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
v-show="
|
|
19
|
+
//- Prevent implicit submission of the form, for example when typing enter
|
|
20
|
+
//- in an input field.
|
|
21
|
+
//- https://stackoverflow.com/a/51507806
|
|
22
|
+
button(
|
|
23
|
+
v-show="false"
|
|
24
|
+
type="submit"
|
|
25
|
+
disabled
|
|
56
26
|
)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
27
|
+
DitoSchema(
|
|
28
|
+
:schema="schema"
|
|
29
|
+
:dataPath="dataPath"
|
|
30
|
+
:data="data"
|
|
31
|
+
:meta="meta"
|
|
32
|
+
:store="store"
|
|
33
|
+
:padding="isNestedRoute ? 'nested' : 'root'"
|
|
34
|
+
:disabled="isLoading"
|
|
35
|
+
:scrollable="!isNestedRoute"
|
|
36
|
+
generateLabels
|
|
60
37
|
)
|
|
61
|
-
|
|
38
|
+
template(#buttons)
|
|
39
|
+
DitoButtons.dito-buttons-round.dito-buttons-large.dito-buttons-main(
|
|
40
|
+
:class="{ 'dito-buttons-sticky': !isNestedRoute }"
|
|
41
|
+
:buttons="buttonSchemas"
|
|
42
|
+
:dataPath="dataPath"
|
|
43
|
+
:data="data"
|
|
44
|
+
:meta="meta"
|
|
45
|
+
:store="store"
|
|
46
|
+
:disabled="isLoading"
|
|
47
|
+
)
|
|
62
48
|
</template>
|
|
63
49
|
|
|
64
50
|
<script>
|
|
65
|
-
import { createReusableTemplate } from '@vueuse/core'
|
|
66
51
|
import { clone, capitalize, parseDataPath, assignDeeply } from '@ditojs/utils'
|
|
67
52
|
import DitoComponent from '../DitoComponent.js'
|
|
68
53
|
import RouteMixin from '../mixins/RouteMixin.js'
|
|
69
54
|
import ResourceMixin from '../mixins/ResourceMixin.js'
|
|
70
55
|
import { getResource, getMemberResource } from '../utils/resource.js'
|
|
71
|
-
import { getButtonSchemas,
|
|
56
|
+
import { getButtonSchemas, isObjectSource } from '../utils/schema.js'
|
|
72
57
|
import { resolvePath } from '../utils/path.js'
|
|
73
58
|
|
|
74
|
-
const [DefineTemplate, ReuseTemplate] = createReusableTemplate()
|
|
75
|
-
|
|
76
59
|
// @vue/component
|
|
77
60
|
export default DitoComponent.component('DitoForm', {
|
|
78
61
|
mixins: [RouteMixin, ResourceMixin],
|
|
79
|
-
components: { DefineTemplate, ReuseTemplate },
|
|
80
62
|
|
|
81
63
|
data() {
|
|
82
64
|
return {
|
|
@@ -143,10 +125,6 @@ export default DitoComponent.component('DitoForm', {
|
|
|
143
125
|
)
|
|
144
126
|
},
|
|
145
127
|
|
|
146
|
-
isInlinedSource() {
|
|
147
|
-
return isInlined(this.sourceSchema)
|
|
148
|
-
},
|
|
149
|
-
|
|
150
128
|
isActive() {
|
|
151
129
|
return this.isLastRoute || this.isLastUnnestedRoute
|
|
152
130
|
},
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
//- Use a <div> for nested forms, as we shouldn't nest actual <form> tags.
|
|
3
|
+
div(
|
|
4
|
+
v-if="nested"
|
|
5
|
+
)
|
|
6
|
+
slot
|
|
7
|
+
form.dito-scroll-parent(
|
|
8
|
+
v-else
|
|
9
|
+
@submit.prevent
|
|
10
|
+
)
|
|
11
|
+
slot
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import DitoComponent from '../DitoComponent.js'
|
|
16
|
+
|
|
17
|
+
// @vue/component
|
|
18
|
+
export default DitoComponent.component('DitoFormInner', {
|
|
19
|
+
props: {
|
|
20
|
+
nested: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
</script>
|
|
@@ -3,14 +3,14 @@ import DitoComponent from '../DitoComponent.js'
|
|
|
3
3
|
import DitoForm from './DitoForm.vue'
|
|
4
4
|
|
|
5
5
|
// @vue/component
|
|
6
|
-
export default DitoComponent.component('
|
|
6
|
+
export default DitoComponent.component('DitoFormNested', {
|
|
7
7
|
extends: DitoForm
|
|
8
8
|
})
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
<style lang="scss">
|
|
12
|
-
.dito-form-
|
|
13
|
-
// No scrolling
|
|
12
|
+
.dito-form-nested {
|
|
13
|
+
// No scrolling inside nested forms, and prevent open .multiselect from
|
|
14
14
|
// being cropped.
|
|
15
15
|
overflow: visible;
|
|
16
16
|
}
|
package/src/components/index.js
CHANGED
|
@@ -27,7 +27,8 @@ export { default as DitoCreateButton } from './DitoCreateButton.vue'
|
|
|
27
27
|
export { default as DitoClipboard } from './DitoClipboard.vue'
|
|
28
28
|
export { default as DitoView } from './DitoView.vue'
|
|
29
29
|
export { default as DitoForm } from './DitoForm.vue'
|
|
30
|
-
export { default as
|
|
30
|
+
export { default as DitoFormInner } from './DitoFormInner.vue'
|
|
31
|
+
export { default as DitoFormNested } from './DitoFormNested.vue'
|
|
31
32
|
export { default as DitoErrors } from './DitoErrors.vue'
|
|
32
33
|
export { default as DitoScopes } from './DitoScopes.vue'
|
|
33
34
|
export { default as DitoPagination } from './DitoPagination.vue'
|
package/src/mixins/RouteMixin.js
CHANGED