@ditojs/admin 2.7.3 → 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.3",
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",
@@ -83,7 +83,7 @@
83
83
  "vite": "^4.3.5"
84
84
  },
85
85
  "types": "types",
86
- "gitHead": "13bec1eda290997bdc10d110652180cdc9d3653b",
86
+ "gitHead": "6f35889443fbf18b1853dfaeb801766d197f0b87",
87
87
  "scripts": {
88
88
  "build": "vite build",
89
89
  "watch": "yarn build --mode 'development' --watch",
@@ -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() {
@@ -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() {