@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.
@@ -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
- .dito-scroll > &:not(:empty) {
138
- position: sticky;
139
- bottom: 0;
140
- width: 100%;
141
- align-self: flex-end;
142
- z-index: $z-index-main-buttons;
143
- margin-bottom: -$content-padding;
144
- margin-top: 2 * $content-padding;
145
- box-shadow: 0 (-$content-padding) $content-padding (-$content-padding)
146
- $color-shadow;
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: 6px;
60
- $tab-padding-hor: 12px;
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-large(
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
- omitPadding: true,
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-labelled': !!schema.label }")
3
- DitoPane.dito-section__pane(
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
- &.dito-section-labelled {
46
- border: $border-style;
63
+ &--labelled {
64
+ border: $border-width solid transparent;
47
65
  border-radius: $border-radius;
48
- padding: $form-spacing;
49
- box-sizing: border-box;
50
- }
66
+ transition: border-color 0.2s $ease-out-quart;
67
+ margin-top: $form-spacing-half;
51
68
 
52
- .dito-section__pane {
53
- padding: 0;
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>
@@ -481,9 +481,9 @@ function asFiles(value) {
481
481
  white-space: nowrap;
482
482
  }
483
483
 
484
- &__input {
484
+ & &__input {
485
485
  // See `onClickUpload()` method for details.
486
- position: absolute;
486
+ display: block;
487
487
  pointer-events: none;
488
488
  }
489
489
 
@@ -36,7 +36,7 @@ const ditoOptionKeys = [
36
36
  'generateLabel',
37
37
  'excludeValue',
38
38
  'ignoreMissingValue',
39
- 'omitPadding',
39
+ 'omitSpacing',
40
40
  'formatValue',
41
41
  'parseValue',
42
42
  'processValue',
@@ -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, components, compact } = schema
486
+ let { form, forms } = schema
487
487
  if (!form && !forms) {
488
- if (components) {
489
- // Convert inlined components to forms, supporting `compact` setting.
490
- form = { components, compact }
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 omitPadding(schema) {
542
- return !!getTypeOptions(schema)?.omitPadding
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
- omitPadding?: boolean
174
+ omitSpacing?: boolean
175
175
  break?: 'before' | 'after'
176
176
  }
177
177