@ditojs/admin 2.7.2 → 2.7.4

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.7.2",
3
+ "version": "2.7.4",
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",
@@ -33,7 +33,7 @@
33
33
  "not ie_mob > 0"
34
34
  ],
35
35
  "dependencies": {
36
- "@ditojs/ui": "^2.7.2",
36
+ "@ditojs/ui": "^2.7.3",
37
37
  "@ditojs/utils": "^2.7.1",
38
38
  "@kyvg/vue3-notification": "^2.9.0",
39
39
  "@lk77/vue3-color": "^3.0.6",
@@ -67,7 +67,7 @@
67
67
  "sortablejs": "^1.15.0",
68
68
  "tinycolor2": "^1.6.0",
69
69
  "tippy.js": "^6.3.7",
70
- "type-fest": "^3.9.0",
70
+ "type-fest": "^3.10.0",
71
71
  "vue": "^3.2.47",
72
72
  "vue-multiselect": "^3.0.0-beta.1",
73
73
  "vue-router": "^4.1.6",
@@ -80,10 +80,10 @@
80
80
  "pug": "^3.0.2",
81
81
  "sass": "1.62.1",
82
82
  "typescript": "^5.0.4",
83
- "vite": "^4.3.4"
83
+ "vite": "^4.3.5"
84
84
  },
85
85
  "types": "types",
86
- "gitHead": "1e84bcce13c988b1d388c128e6adf6ad9cb5517f",
86
+ "gitHead": "6f35889443fbf18b1853dfaeb801766d197f0b87",
87
87
  "scripts": {
88
88
  "build": "vite build",
89
89
  "watch": "yarn build --mode 'development' --watch",
@@ -172,7 +172,7 @@ export default DitoComponent.component('DitoDialog', {
172
172
  position: fixed;
173
173
  display: flex;
174
174
  inset: 0;
175
- z-index: 2000;
175
+ z-index: $z-index-dialog;
176
176
  padding: $content-padding;
177
177
  align-items: center;
178
178
  justify-content: center;
@@ -59,7 +59,7 @@ export default DitoComponent.component('DitoErrors', {
59
59
  interactive: true,
60
60
  hideOnClick: false,
61
61
  offset: [3, 3], // 1/2 form-spacing
62
- zIndex: 1
62
+ zIndex: ''
63
63
  })
64
64
  tip.popper.addEventListener('mousedown', () => tip.hide())
65
65
  tip.show()
@@ -24,7 +24,7 @@
24
24
  :meta="meta"
25
25
  :store="store"
26
26
  :disabled="isLoading"
27
- scrollable
27
+ :scrollable="!isNestedRoute"
28
28
  headerInMenu
29
29
  generateLabels
30
30
  )
@@ -81,7 +81,7 @@ export default DitoComponent.component('DitoHeader', {
81
81
  background: $color-black;
82
82
  font-size: $header-font-size;
83
83
  line-height: $header-line-height;
84
- z-index: $header-z-index;
84
+ z-index: $z-index-header;
85
85
  @include user-select(none);
86
86
 
87
87
  &::after {
@@ -109,7 +109,7 @@ export default DitoComponent.component('DitoMenu', {
109
109
  display: block;
110
110
  position: absolute;
111
111
  width: var(--width);
112
- z-index: $header-z-index;
112
+ z-index: $z-index-header;
113
113
  transform: translateX(calc(var(--width) + 2 * $menu-spacing))
114
114
  translateY(-$item-height);
115
115
 
@@ -104,14 +104,14 @@ export default DitoComponent.component('DitoRoot', {
104
104
 
105
105
  tippyDelegate(this.$el, {
106
106
  target: '.dito-info',
107
+ theme: 'info',
108
+ appendTo: 'parent',
109
+ animation: 'shift-away-subtle',
110
+ interactive: true,
111
+ delay: 250,
112
+ zIndex: '',
107
113
  onCreate(instance) {
108
114
  instance.setContent(instance.reference.dataset.info)
109
- instance.setProps({
110
- theme: 'info',
111
- interactive: true,
112
- animation: 'shift-away-subtle',
113
- delay: 250
114
- })
115
115
  }
116
116
  })
117
117
 
@@ -506,7 +506,7 @@ function addRoutes(router, routes) {
506
506
  position: fixed;
507
507
  top: 0;
508
508
  left: 0;
509
- z-index: $drag-overlay-z-index;
509
+ z-index: $z-index-drag-overlay;
510
510
  width: 100%;
511
511
  height: 100%;
512
512
  background: rgba(0, 0, 0, 0.25);
@@ -519,7 +519,7 @@ function addRoutes(router, routes) {
519
519
 
520
520
  background: $content-color-background;
521
521
  border-radius: $border-radius;
522
- z-index: $drag-overlay-z-index + 1;
522
+ z-index: $z-index-drag-overlay + 1;
523
523
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, var(--shadow-alpha)));
524
524
  }
525
525
 
@@ -475,12 +475,14 @@ export default DitoComponent.component('DitoSchema', {
475
475
  },
476
476
 
477
477
  repositionErrors() {
478
- // Force repositioning of error tooltips, as otherwise they
479
- // sometimes don't show up in the right place initially when
480
- // changing tabs
481
- const scrollParent = this.$refs.content.closest('.dito-scroll')
482
- scrollParent.scrollTop++
483
- scrollParent.scrollTop--
478
+ // Fire a fake scroll event to force the repositioning of error tooltips,
479
+ // as otherwise they sometimes don't show up in the right place initially
480
+ // when changing tabs.
481
+ const scrollContainer = this.$refs.content.closest('.dito-scroll')
482
+ const dispatch = () => scrollContainer.dispatchEvent(new Event('scroll'))
483
+ dispatch()
484
+ // This is required to handle `&--label-vertical` based layout changes.
485
+ setTimeout(dispatch, 0)
484
486
  },
485
487
 
486
488
  focus() {
@@ -811,7 +813,7 @@ export default DitoComponent.component('DitoSchema', {
811
813
  top: 0;
812
814
  left: 0;
813
815
  right: 0;
814
- z-index: $header-z-index;
816
+ z-index: $z-index-header;
815
817
  // Turn off pointer events so that DitoTrail keeps receiving events...
816
818
  pointer-events: none;
817
819
  // ...but allow interaction with the tabs and buttons (e.g. clipboard)
@@ -1,3 +1,5 @@
1
+ import { isString } from '@ditojs/utils'
2
+ import { getDefaultValue } from '../utils/schema.js'
1
3
  import { getSchemaAccessor } from '../utils/accessor.js'
2
4
 
3
5
  // @vue/component
@@ -9,7 +11,15 @@ export default {
9
11
  })
10
12
  },
11
13
 
12
- parseValue(schema, value) {
13
- return schema.trim && value != null ? value.trim() : value
14
+ processValue(schema, value) {
15
+ if (schema.trim && value != null && isString(value)) {
16
+ // Text fields don't necessarily have a `String` value when `format()`
17
+ // without `parse()` is used.
18
+ value = value.trim()
19
+ }
20
+ if (value === '') {
21
+ value = getDefaultValue(schema)
22
+ }
23
+ return value
14
24
  }
15
25
  }
@@ -3,7 +3,7 @@ import ValidationMixin from './ValidationMixin.js'
3
3
  import { getSchemaAccessor } from '../utils/accessor.js'
4
4
  import { computeValue } from '../utils/schema.js'
5
5
  import { getItem, getParentItem } from '../utils/data.js'
6
- import { camelize } from '@ditojs/utils'
6
+ import { asArray, camelize } from '@ditojs/utils'
7
7
 
8
8
  // @vue/component
9
9
  export default {
@@ -251,9 +251,7 @@ export default {
251
251
  // @overridable
252
252
  async scrollIntoView() {
253
253
  await this.focusSchema()
254
- let { element = this } = this.$refs
255
- element = element.scrollIntoView ? element : element.$el
256
- element.scrollIntoView?.({
254
+ this.getFocusElement()?.scrollIntoView?.({
257
255
  behavior: 'smooth',
258
256
  block: 'center'
259
257
  })
@@ -261,16 +259,17 @@ export default {
261
259
 
262
260
  // @overridable
263
261
  focusElement() {
264
- let { element = this } = this.$refs
265
- element = element.focus ? element : element.$el
266
- element.focus?.()
262
+ this.getFocusElement()?.focus?.()
267
263
  },
268
264
 
269
265
  // @overridable
270
266
  blurElement() {
271
- let { element = this } = this.$refs
272
- element = element.blur ? element : element.$el
273
- element.blur?.()
267
+ this.getFocusElement()?.blur?.()
268
+ },
269
+
270
+ getFocusElement() {
271
+ const element = asArray(this.$refs.element)[0] ?? this
272
+ return element.$el ?? element
274
273
  },
275
274
 
276
275
  async focusSchema() {
@@ -131,17 +131,21 @@
131
131
  }
132
132
  }
133
133
 
134
- &.dito-buttons-main:not(:empty) {
135
- position: sticky;
136
- bottom: 0;
137
- width: 100%;
138
- align-self: flex-end;
139
- z-index: 500;
140
- margin-bottom: -$content-padding;
141
- margin-top: 2 * $content-padding;
142
- box-shadow: 0 (-$content-padding) $content-padding (-$content-padding)
143
- $color-shadow;
144
- background: $content-color-background;
134
+ &.dito-buttons-main {
135
+ border-top: $border-style;
136
+
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
+ }
145
149
  }
146
150
 
147
151
  &.dito-buttons-round,
@@ -192,7 +196,6 @@
192
196
 
193
197
  &.dito-button-clear {
194
198
  width: 2em;
195
- z-index: 1;
196
199
  background: $color-white;
197
200
  display: none;
198
201
 
@@ -4,7 +4,7 @@ ul.dito-pulldown {
4
4
  display: none;
5
5
  position: absolute;
6
6
  top: 0;
7
- z-index: 1000;
7
+ z-index: $z-index-popup;
8
8
  border-radius: $pulldown-radius;
9
9
  box-shadow: $shadow-window;
10
10
  overflow: hidden;
@@ -50,7 +50,6 @@ $form-spacing-half: calc($form-spacing / 2);
50
50
  // Header
51
51
  $header-font-size: 14px;
52
52
  $header-line-height: 1;
53
- $header-z-index: 1000;
54
53
  $header-padding-ver: $header-font-size;
55
54
  $header-padding-hor: $content-padding;
56
55
  $header-padding: $header-padding-ver $header-padding-hor;
@@ -70,8 +69,12 @@ $menu-padding-ver: $header-padding-ver - $menu-spacing;
70
69
  $menu-padding-hor: $header-padding-hor - $menu-spacing;
71
70
  $menu-padding: $menu-padding-ver $menu-padding-hor;
72
71
 
73
- // Drag & Drop
74
- $drag-overlay-z-index: 2000;
72
+ // Z-Indices
73
+ $z-index-dialog: 4000;
74
+ $z-index-drag-overlay: 3000;
75
+ $z-index-header: 2000;
76
+ $z-index-tippy: 750;
77
+ $z-index-main-buttons: 500;
75
78
 
76
79
  // Patterns
77
80
  $pattern-transparency-size: ($font-size - $border-width) * $input-height-factor;
@@ -3,6 +3,11 @@
3
3
  @import 'tippy.js/animations/shift-away-subtle.css';
4
4
 
5
5
  .tippy-box {
6
+ .tippy-content,
7
+ .tippy-arrow {
8
+ z-index: $z-index-tippy;
9
+ }
10
+
6
11
  &[data-theme] {
7
12
  --color: #{$color-active};
8
13
 
@@ -443,6 +443,7 @@ $tag-line-height: 1em;
443
443
  }
444
444
 
445
445
  &__content-wrapper {
446
+ z-index: $z-index-popup;
446
447
  border-color: $color-active;
447
448
  }
448
449
 
@@ -91,7 +91,7 @@ $select-arrow-right: calc(($select-arrow-width - $select-arrow-size) / 2);
91
91
  flex: 1;
92
92
  position: relative;
93
93
 
94
- &::after {
94
+ &::before {
95
95
  @include arrow($select-arrow-size);
96
96
 
97
97
  position: absolute;