@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/admin",
3
- "version": "2.26.1",
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": "8f2e07e3774d0e03b24ee78cffe60c5edacb93ae",
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-inlined': isInlinedSource }"
3
+ :class="{ 'dito-form-nested': isNestedRoute }"
35
4
  :data-resource="sourceSchema.path"
36
5
  )
37
- template(
38
- v-if="isInlinedSource"
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
- //- Use a <div> for inlined forms, as we shouldn't nest actual <form> tags.
41
- //- NOTE: inlined form components are kept alive by using `v-show` instead
42
- //- of `v-if` here, so event handling and other things still work with
43
- //- inlined editing.
44
- div(
45
- v-show="isActive"
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
- //- Only render a router-view here if this isn't the last data route and not
52
- //- an inlined form route, which will appear elsewhere in its own view.
53
- RouterView(
54
- v-if="!isLastUnnestedRoute"
55
- v-show="!isActive"
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
- form.dito-scroll-parent(
58
- v-show="isActive"
59
- @submit.prevent
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
- ReuseTemplate
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, isInlined, isObjectSource } from '../utils/schema.js'
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('DitoFormInlined', {
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-inlined {
13
- // No scrolling in inlined forms, and prevent open .multiselect from
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
  }
@@ -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 DitoFormInlined } from './DitoFormInlined.vue'
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'
@@ -60,6 +60,10 @@ export default {
60
60
  return false
61
61
  },
62
62
 
63
+ isNestedRoute() {
64
+ return this.meta.nested
65
+ },
66
+
63
67
  isView() {
64
68
  return false
65
69
  },
@@ -617,7 +617,7 @@ export default {
617
617
  isListSource(schema) ? param : null
618
618
  ),
619
619
  component: DitoComponent.component(
620
- nested ? 'DitoFormInlined' : 'DitoForm'
620
+ nested ? 'DitoFormNested' : 'DitoForm'
621
621
  ),
622
622
  meta: formMeta
623
623
  }
@@ -219,6 +219,6 @@ table.dito-table {
219
219
  }
220
220
 
221
221
  table.dito-table table.dito-table,
222
- .dito-form-inlined table.dito-table {
222
+ .dito-form-nested table.dito-table {
223
223
  margin: 0;
224
224
  }