@ditojs/admin 2.5.1 → 2.6.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.
Files changed (40) hide show
  1. package/dist/dito-admin.es.js +1380 -1374
  2. package/dist/dito-admin.umd.js +6 -6
  3. package/dist/style.css +1 -1
  4. package/package.json +4 -4
  5. package/src/DitoTypeComponent.js +0 -1
  6. package/src/components/DitoAccount.vue +1 -0
  7. package/src/components/DitoContainer.vue +15 -36
  8. package/src/components/DitoDialog.vue +3 -1
  9. package/src/components/DitoHeader.vue +11 -14
  10. package/src/components/DitoNavigation.vue +40 -0
  11. package/src/components/DitoPane.vue +64 -37
  12. package/src/components/DitoPanels.vue +3 -2
  13. package/src/components/DitoRoot.vue +37 -13
  14. package/src/components/DitoSchema.vue +21 -16
  15. package/src/components/DitoSchemaInlined.vue +1 -3
  16. package/src/components/DitoSidebar.vue +6 -24
  17. package/src/components/DitoView.vue +1 -0
  18. package/src/components/index.js +2 -1
  19. package/src/mixins/TextMixin.js +1 -1
  20. package/src/mixins/TypeMixin.js +6 -12
  21. package/src/styles/_layout.scss +11 -14
  22. package/src/styles/_scroll.scss +1 -2
  23. package/src/styles/_settings.scss +5 -1
  24. package/src/styles/_tippy.scss +1 -0
  25. package/src/types/DitoTypeButton.vue +8 -17
  26. package/src/types/DitoTypeCode.vue +0 -1
  27. package/src/types/DitoTypeColor.vue +0 -13
  28. package/src/types/DitoTypeComponent.vue +0 -1
  29. package/src/types/DitoTypeLabel.vue +1 -2
  30. package/src/types/DitoTypeList.vue +0 -1
  31. package/src/types/DitoTypeMarkup.vue +14 -16
  32. package/src/types/DitoTypeMultiselect.vue +2 -0
  33. package/src/types/DitoTypeObject.vue +0 -2
  34. package/src/types/DitoTypePanel.vue +0 -1
  35. package/src/types/DitoTypeSection.vue +0 -1
  36. package/src/types/DitoTypeTextarea.vue +0 -1
  37. package/src/types/DitoTypeTreeList.vue +0 -2
  38. package/src/types/DitoTypeUpload.vue +0 -2
  39. package/src/utils/options.js +0 -1
  40. package/src/utils/schema.js +10 -4
@@ -249,22 +249,16 @@ export default {
249
249
 
250
250
  // @overridable
251
251
  focusElement() {
252
- const { element = this } = this.$refs
253
- if (element.focus) {
254
- element.focus()
255
- } else {
256
- element.$el?.focus?.()
257
- }
252
+ let { element = this } = this.$refs
253
+ element = element.focus ? element : element.$el
254
+ element?.focus?.()
258
255
  },
259
256
 
260
257
  // @overridable
261
258
  blurElement() {
262
- const { element = this } = this.$refs
263
- if (element.blur) {
264
- element.blur()
265
- } else {
266
- element.$el?.blur?.()
267
- }
259
+ let { element = this } = this.$refs
260
+ element = element.blur ? element : element.$el
261
+ element?.blur?.()
268
262
  },
269
263
 
270
264
  async focusSchema() {
@@ -1,22 +1,19 @@
1
- // TODO: Convert to flexbox
2
-
3
- .dito-layout-vertical {
4
- display: table;
1
+ .dito-layout-vertical,
2
+ .dito-layout-horizontal {
3
+ display: flex;
5
4
 
6
5
  > * {
7
- display: table-row;
6
+ flex: 1;
7
+ display: flex;
8
8
  }
9
9
  }
10
10
 
11
- .dito-layout-horizontal {
12
- display: table-row;
13
-
14
- > * {
15
- display: table-cell;
11
+ .dito-layout-vertical {
12
+ flex-direction: column;
13
+ }
16
14
 
17
- /* stylelint-disable-next-line selector-max-universal */
18
- & + * {
19
- padding-left: $form-spacing;
20
- }
15
+ .dito-layout-horizontal {
16
+ > *:not(:first-child) {
17
+ padding-left: $form-spacing;
21
18
  }
22
19
  }
@@ -1,8 +1,7 @@
1
1
  .dito-scroll {
2
2
  flex: 1;
3
3
  max-height: 100%;
4
- overflow-x: hidden;
5
- overflow-y: auto;
4
+ overflow: auto;
6
5
  }
7
6
 
8
7
  .dito-scroll-parent {
@@ -34,11 +34,15 @@ $pulldown-padding: $pulldown-padding-ver $pulldown-padding-hor;
34
34
 
35
35
  // Content
36
36
  $content-width: 900px;
37
- $content-sidebar-width: 360px;
37
+ $content-width-wide: 1400px;
38
38
  $content-padding: 16px;
39
39
  $content-padding-half: calc($content-padding / 2);
40
40
  $content-color-background: $color-lightest;
41
41
 
42
+ // Sidebar
43
+ $sidebar-max-width: 360px;
44
+ $sidebar-min-width: 200px;
45
+
42
46
  // Form
43
47
  $form-spacing: $input-padding-hor;
44
48
  $form-spacing-half: calc($form-spacing / 2);
@@ -1,4 +1,5 @@
1
1
  @use 'sass:color';
2
+ @import 'tippy.js/dist/tippy.css';
2
3
  @import 'tippy.js/animations/shift-away-subtle.css';
3
4
 
4
5
  .tippy-box {
@@ -7,18 +7,13 @@ button.dito-button(
7
7
  :class="buttonClass"
8
8
  v-bind="attributes"
9
9
  )
10
- template(
11
- v-if="info || width === 'fill'"
12
- )
13
- .dito-button__text
14
- span {{ text }}
15
- .dito-info(
16
- v-if="!label && info"
17
- :data-info="info"
18
- )
19
- template(
20
- v-else
10
+ .dito-button__text(
11
+ v-if="text"
21
12
  ) {{ text }}
13
+ .dito-info(
14
+ v-if="!label && info"
15
+ :data-info="info"
16
+ )
22
17
  </template>
23
18
 
24
19
  <script>
@@ -99,13 +94,9 @@ export default DitoTypeComponent.register(
99
94
  $self: &;
100
95
 
101
96
  &__text {
102
- position: relative;
103
- min-width: min-content;
104
- height: calc(1em * var(--line-height));
97
+ @include ellipsis;
105
98
 
106
- span {
107
- @include ellipsis;
108
- }
99
+ height: calc(1em * var(--line-height));
109
100
  }
110
101
  }
111
102
  </style>
@@ -14,7 +14,6 @@ import CodeFlask from 'codeflask'
14
14
  // @vue/component
15
15
  export default DitoTypeComponent.register('code', {
16
16
  mixins: [DomMixin],
17
- keepAligned: false,
18
17
 
19
18
  computed: {
20
19
  lines() {
@@ -143,19 +143,6 @@ export default DitoTypeComponent.register('color', {
143
143
  '#00000000'
144
144
  ]
145
145
  })
146
- },
147
-
148
- watch: {
149
- focused(focused) {
150
- if (!focused && this.convertedHexValue) {
151
- const color = tinycolor(`#${this.convertedHexValue}`)
152
- if (color?.isValid()) {
153
- this.value = color.toString(this.colorFormat)
154
- // TODO: Emit 'input' here instead, and 'change' in blur, like others.
155
- this.onChange()
156
- }
157
- }
158
- }
159
146
  }
160
147
  })
161
148
  </script>
@@ -22,7 +22,6 @@ 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
- keepAligned: false,
26
25
  ignoreMissingValue: schema => !('default' in schema),
27
26
 
28
27
  async processSchema(api, schema) {
@@ -11,8 +11,7 @@ import DitoTypeComponent from '../DitoTypeComponent.js'
11
11
  // @vue/component
12
12
  export default DitoTypeComponent.register('label', {
13
13
  excludeValue: true,
14
- generateLabel: false,
15
- keepAligned: false
14
+ generateLabel: false
16
15
  })
17
16
  </script>
18
17
 
@@ -167,7 +167,6 @@ import { pickBy, equals, hyphenate } from '@ditojs/utils'
167
167
  // @vue/component
168
168
  export default DitoTypeComponent.register('list', {
169
169
  mixins: [SourceMixin, SortableMixin],
170
- keepAligned: false,
171
170
 
172
171
  getSourceType(type) {
173
172
  // No need for transformation here. See TypeTreeList for details.
@@ -1,19 +1,18 @@
1
1
  <template lang="pug">
2
2
  .dito-markup(:id="dataPath")
3
- .dito-markup-toolbar
4
- .dito-buttons.dito-buttons-toolbar(
5
- v-if="groupedButtons.length > 0"
3
+ .dito-buttons.dito-buttons-toolbar(
4
+ v-if="groupedButtons.length > 0"
5
+ )
6
+ .dito-button-group(
7
+ v-for="buttons in groupedButtons"
6
8
  )
7
- .dito-button-group(
8
- v-for="buttons in groupedButtons"
9
+ button.dito-button(
10
+ v-for="{ name, icon, isActive, onClick } in buttons"
11
+ :key="name"
12
+ :class="{ 'dito-active': isActive }"
13
+ @click="onClick"
9
14
  )
10
- button.dito-button(
11
- v-for="{ name, icon, isActive, onClick } in buttons"
12
- :key="name"
13
- :class="{ 'dito-active': isActive }"
14
- @click="onClick"
15
- )
16
- Icon(:name="icon")
15
+ Icon(:name="icon")
17
16
  EditorContent.dito-markup-editor(
18
17
  ref="editor"
19
18
  :editor="editor"
@@ -76,8 +75,6 @@ export default DitoTypeComponent.register('markup', {
76
75
  Icon
77
76
  },
78
77
 
79
- keepAligned: false,
80
-
81
78
  data() {
82
79
  return {
83
80
  editor: null,
@@ -317,7 +314,7 @@ export default DitoTypeComponent.register('markup', {
317
314
  }
318
315
  }
319
316
  editor.commands.setLink({ href, title })
320
- } else {
317
+ } else if (attributes === null) {
321
318
  editor.commands.unsetLink()
322
319
  }
323
320
  },
@@ -522,13 +519,14 @@ const LinkWithTitle = Link.extend({
522
519
 
523
520
  .dito-markup-editor {
524
521
  overflow-y: scroll;
522
+ margin-top: $input-padding-ver;
525
523
  // Move padding "inside" editor to correctly position scrollbar
526
524
  margin-right: -$input-padding-hor;
527
525
  padding-right: $input-padding-hor;
528
526
  }
529
527
 
530
528
  .dito-buttons-toolbar {
531
- margin: $input-padding-ver 0;
529
+ margin: 0;
532
530
  }
533
531
 
534
532
  h1,
@@ -360,6 +360,8 @@ $tag-line-height: 1em;
360
360
  }
361
361
 
362
362
  &__placeholder {
363
+ white-space: nowrap;
364
+
363
365
  &::after {
364
366
  // Enforce actual line-height for positioning.
365
367
  content: '\200b';
@@ -63,8 +63,6 @@ import { resolveSchemaComponent } from '../utils/schema.js'
63
63
  export default DitoTypeComponent.register('object', {
64
64
  mixins: [SourceMixin],
65
65
 
66
- keepAligned: false,
67
-
68
66
  getSourceType(type) {
69
67
  // No need for transformation here. See TypeTreeList for details.
70
68
  return type
@@ -6,7 +6,6 @@ export default DitoTypeComponent.register('panel', {
6
6
  defaultValue: () => undefined, // Callback to override `defaultValue: null`
7
7
  excludeValue: true,
8
8
  generateLabel: false,
9
- keepAligned: false,
10
9
  omitPadding: true,
11
10
 
12
11
  getPanelSchema(api, schema) {
@@ -20,7 +20,6 @@ export default DitoTypeComponent.register('section', {
20
20
  ignoreMissingValue: schema => !schema.nested && !('default' in schema),
21
21
  defaultNested: false,
22
22
  generateLabel: false,
23
- keepAligned: false,
24
23
 
25
24
  computed: {
26
25
  item() {
@@ -19,7 +19,6 @@ export default DitoTypeComponent.register('textarea', {
19
19
  mixins: [TextMixin],
20
20
  nativeField: true,
21
21
  textField: true,
22
- keepAligned: false,
23
22
 
24
23
  computed: {
25
24
  lines() {
@@ -35,8 +35,6 @@ export default DitoTypeComponent.register(
35
35
  {
36
36
  mixins: [SourceMixin],
37
37
 
38
- keepAligned: false,
39
-
40
38
  provide() {
41
39
  return { container: this }
42
40
  },
@@ -150,8 +150,6 @@ export default DitoTypeComponent.register('upload', {
150
150
  mixins: [SortableMixin],
151
151
  components: { VueUpload },
152
152
 
153
- keepAligned: false,
154
-
155
153
  data() {
156
154
  return {
157
155
  uploads: []
@@ -36,7 +36,6 @@ const ditoOptionKeys = [
36
36
  'generateLabel',
37
37
  'excludeValue',
38
38
  'ignoreMissingValue',
39
- 'keepAligned',
40
39
  'omitPadding',
41
40
  'processValue',
42
41
  'processSchema',
@@ -510,12 +510,18 @@ export function isNested(schema) {
510
510
  return !!(schema.nested || getTypeOptions(schema)?.defaultNested === true)
511
511
  }
512
512
 
513
- export function omitPadding(schema) {
514
- return !!getTypeOptions(schema)?.omitPadding
513
+ export function hasLabel(schema, generateLabels) {
514
+ const { label } = schema
515
+ return (
516
+ label !== false && (
517
+ !!label ||
518
+ generateLabels && getTypeOptions(schema)?.generateLabel
519
+ )
520
+ )
515
521
  }
516
522
 
517
- export function keepAligned(schema) {
518
- return !!getTypeOptions(schema)?.keepAligned
523
+ export function omitPadding(schema) {
524
+ return !!getTypeOptions(schema)?.omitPadding
519
525
  }
520
526
 
521
527
  export function getSchemaValue(