@ditojs/admin 2.5.0 → 2.5.2

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.5.0",
3
+ "version": "2.5.2",
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.5.0",
36
+ "@ditojs/ui": "^2.5.2",
37
37
  "@ditojs/utils": "^2.5.0",
38
38
  "@kyvg/vue3-notification": "^2.9.0",
39
39
  "@lk77/vue3-color": "^3.0.6",
@@ -58,7 +58,7 @@
58
58
  "@tiptap/extension-underline": "^2.0.3",
59
59
  "@tiptap/pm": "^2.0.3",
60
60
  "@tiptap/vue-3": "^2.0.3",
61
- "@vueuse/integrations": "^10.0.2",
61
+ "@vueuse/integrations": "^10.1.2",
62
62
  "codeflask": "^1.4.1",
63
63
  "filesize": "^10.0.7",
64
64
  "filesize-parser": "^1.5.0",
@@ -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.8.0",
70
+ "type-fest": "^3.9.0",
71
71
  "vue": "^3.2.47",
72
72
  "vue-multiselect": "^3.0.0-beta.1",
73
73
  "vue-router": "^4.1.6",
@@ -75,15 +75,15 @@
75
75
  },
76
76
  "devDependencies": {
77
77
  "@ditojs/build": "^2.5.0",
78
- "@vitejs/plugin-vue": "^4.1.0",
78
+ "@vitejs/plugin-vue": "^4.2.1",
79
79
  "@vue/compiler-sfc": "^3.2.47",
80
80
  "pug": "^3.0.2",
81
- "sass": "1.62.0",
81
+ "sass": "1.62.1",
82
82
  "typescript": "^5.0.4",
83
- "vite": "^4.3.1"
83
+ "vite": "^4.3.4"
84
84
  },
85
85
  "types": "types",
86
- "gitHead": "1339a92f8adbfabee89d516ccfca84e13b48833b",
86
+ "gitHead": "8c5737b77ba43617cd95ba65fbabcdc2941542a8",
87
87
  "scripts": {
88
88
  "build": "vite build",
89
89
  "watch": "yarn build --mode 'development' --watch",
@@ -559,7 +559,13 @@ export default {
559
559
  const inlined = isInlined(schema)
560
560
  if (inlined && schema.resource) {
561
561
  throw new Error(
562
- 'Lists with nested forms cannot load data from their own resources'
562
+ `Nested ${
563
+ this.isListSource
564
+ ? 'lists'
565
+ : this.isObjectSource
566
+ ? 'objects'
567
+ : 'schema'
568
+ } cannot load data from their own resources`
563
569
  )
564
570
  }
565
571
  // Use differently named url parameters on each nested level for id as
@@ -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() {
@@ -191,17 +191,13 @@
191
191
  cursor: pointer;
192
192
 
193
193
  &.dito-button-clear {
194
- $self: &;
195
-
196
194
  width: 2em;
197
195
  z-index: 1;
198
196
  background: $color-white;
199
197
  display: none;
200
198
 
201
- @at-root .dito-component:hover {
202
- & :not(.dito-component) #{$self} {
203
- display: block;
204
- }
199
+ @at-root .dito-component:hover:not(:has(.dito-component)) & {
200
+ display: block;
205
201
  }
206
202
 
207
203
  &::before {
@@ -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,7 @@
22
22
  import DitoTypeComponent from '../DitoTypeComponent.js'
23
23
  import { getSchemaAccessor } from '../utils/accessor.js'
24
24
  import { DatePicker, TimePicker, DateTimePicker } from '@ditojs/ui/src'
25
- import { isDate } from '@ditojs/utils'
25
+ import { isDate, merge } from '@ditojs/utils'
26
26
 
27
27
  export default DitoTypeComponent.register(
28
28
  ['date', 'datetime', 'time'],
@@ -53,16 +53,11 @@ export default DitoTypeComponent.register(
53
53
  type: Object,
54
54
  default: null,
55
55
  get(formats) {
56
- return formats
57
- ? {
58
- date: ['date', 'datetime'].includes(this.type)
59
- ? formats.date
60
- : null,
61
- time: ['time', 'datetime'].includes(this.type)
62
- ? formats.time
63
- : null
64
- }
65
- : undefined
56
+ const { date, time } = merge({}, this.api.formats, formats)
57
+ return {
58
+ date: ['date', 'datetime'].includes(this.type) ? date : null,
59
+ time: ['time', 'datetime'].includes(this.type) ? time : null
60
+ }
66
61
  }
67
62
  })
68
63
  },
@@ -43,25 +43,22 @@ export const filterComponents = {
43
43
  },
44
44
 
45
45
  'date-range'() {
46
- // Use shorter date format in date-range filters:
47
- const dateFormat = {
48
- day: '2-digit',
49
- month: '2-digit',
50
- year: 'numeric'
46
+ const datetime = {
47
+ type: 'datetime',
48
+ width: '1/2',
49
+ formats: {
50
+ // Use shorter date format in date-range filters:
51
+ date: {
52
+ day: '2-digit',
53
+ month: '2-digit',
54
+ year: 'numeric'
55
+ }
56
+ },
57
+ clearable: true
51
58
  }
52
59
  return {
53
- from: {
54
- type: 'datetime',
55
- width: '1/2',
56
- dateFormat,
57
- clearable: true
58
- },
59
- to: {
60
- type: 'datetime',
61
- width: '1/2',
62
- dateFormat,
63
- clearable: true
64
- }
60
+ from: datetime,
61
+ to: datetime
65
62
  }
66
63
  }
67
64
  }