@ditojs/admin 2.2.0 → 2.2.1

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.2.0",
3
+ "version": "2.2.1",
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",
@@ -82,7 +82,7 @@
82
82
  "vite": "^4.2.1"
83
83
  },
84
84
  "types": "types",
85
- "gitHead": "fc81c8e9a64e76549d26bd94774a3b1c92afa49f",
85
+ "gitHead": "306d4d9ef2a0c989b026f1d1cd77f6d4fd60430b",
86
86
  "scripts": {
87
87
  "build": "vite build",
88
88
  "watch": "yarn build --mode 'development' --watch",
@@ -190,6 +190,7 @@ export default DitoComponent.component('DitoContainer', {
190
190
  .dito-container {
191
191
  display: flex;
192
192
  flex-flow: column;
193
+ align-items: flex-start;
193
194
  // Needed for better vertical alignment:
194
195
  align-self: stretch;
195
196
  box-sizing: border-box;
@@ -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 { isString, asArray } from '@ditojs/utils'
6
+ import { isString, asArray, camelize } from '@ditojs/utils'
7
7
 
8
8
  // @vue/component
9
9
  export default {
@@ -165,10 +165,18 @@ export default {
165
165
  type: String
166
166
  }),
167
167
 
168
- // @overridable
169
168
  events() {
170
- const { onFocus, onBlur, onInput, onChange } = this
171
- return { onFocus, onBlur, onInput, onChange }
169
+ const events = this.getEvents()
170
+ // Register callbacks for all provides non-recognized events,
171
+ // assuming they are native events.
172
+ // TODO: Move to vue3-style `on[A-Z]` event handlers naming that aren't
173
+ // namespaced in `schema.events` once the transition is complete.
174
+ for (const event of Object.keys(this.schema.events || {})) {
175
+ events[`on${camelize(event, true)}`] ??= () => {
176
+ this.emitEvent(event)
177
+ }
178
+ }
179
+ return events
172
180
  },
173
181
 
174
182
  attributes() {
@@ -233,6 +241,12 @@ export default {
233
241
  }
234
242
  },
235
243
 
244
+ // @overridable
245
+ getEvents() {
246
+ const { onFocus, onBlur, onInput, onChange } = this
247
+ return { onFocus, onBlur, onInput, onChange }
248
+ },
249
+
236
250
  // @overridable
237
251
  getValidations() {
238
252
  return null
@@ -43,16 +43,16 @@ export default DitoTypeComponent.register(
43
43
  closeForm: getSchemaAccessor('closeForm', {
44
44
  type: Boolean,
45
45
  default: false
46
- }),
46
+ })
47
+ },
47
48
 
49
+ methods: {
48
50
  // @override
49
- events() {
51
+ getEvents() {
50
52
  const { onFocus, onBlur, onClick } = this
51
53
  return { onFocus, onBlur, onClick }
52
- }
53
- },
54
+ },
54
55
 
55
- methods: {
56
56
  async submit(options) {
57
57
  return this.resourceComponent?.submit(this, options)
58
58
  },