@ditojs/admin 2.29.0 → 2.30.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/dist/dito-admin.es.js +1132 -1098
- package/dist/dito-admin.umd.js +5 -5
- package/dist/style.css +1 -1
- package/package.json +7 -7
- package/src/components/DitoContainer.vue +5 -7
- package/src/components/DitoPane.vue +2 -0
- package/src/mixins/TypeMixin.js +1 -1
- package/src/types/DitoTypeColor.vue +80 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/admin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.30.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",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"not ie_mob > 0"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@ditojs/ui": "^2.
|
|
37
|
-
"@ditojs/utils": "^2.
|
|
36
|
+
"@ditojs/ui": "^2.30.0",
|
|
37
|
+
"@ditojs/utils": "^2.30.0",
|
|
38
38
|
"@kyvg/vue3-notification": "^3.2.1",
|
|
39
39
|
"@lk77/vue3-color": "^3.0.6",
|
|
40
40
|
"@tiptap/core": "^2.3.0",
|
|
@@ -67,23 +67,23 @@
|
|
|
67
67
|
"sortablejs": "^1.15.2",
|
|
68
68
|
"tinycolor2": "^1.6.0",
|
|
69
69
|
"tippy.js": "^6.3.7",
|
|
70
|
-
"type-fest": "^4.
|
|
70
|
+
"type-fest": "^4.17.0",
|
|
71
71
|
"vue": "3.4.10",
|
|
72
72
|
"vue-multiselect": "^3.0.0",
|
|
73
73
|
"vue-router": "^4.3.2",
|
|
74
74
|
"vue-upload-component": "^3.1.15"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@ditojs/build": "^2.
|
|
77
|
+
"@ditojs/build": "^2.30.0",
|
|
78
78
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
79
|
-
"@vue/compiler-sfc": "3.4.
|
|
79
|
+
"@vue/compiler-sfc": "3.4.25",
|
|
80
80
|
"pug": "^3.0.2",
|
|
81
81
|
"sass": "1.75.0",
|
|
82
82
|
"typescript": "^5.4.5",
|
|
83
83
|
"vite": "^5.2.10"
|
|
84
84
|
},
|
|
85
85
|
"types": "types",
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "39fbb6da77e7d90265fce7cd7cd7e92b3b034803",
|
|
87
87
|
"scripts": {
|
|
88
88
|
"build": "vite build",
|
|
89
89
|
"watch": "yarn build --mode 'development' --watch",
|
|
@@ -253,7 +253,7 @@ export default DitoComponent.component('DitoContainer', {
|
|
|
253
253
|
max-width: 100%;
|
|
254
254
|
// Cannot use margin here as it needs to be part of box-sizing for
|
|
255
255
|
// percentages in flex-basis to work.
|
|
256
|
-
padding:
|
|
256
|
+
padding: var(--container-padding);
|
|
257
257
|
|
|
258
258
|
> .dito-label:only-child {
|
|
259
259
|
// Used e.g. when sources hide themselves due to maxDepth, but the label
|
|
@@ -261,6 +261,10 @@ export default DitoComponent.component('DitoContainer', {
|
|
|
261
261
|
display: none;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
+
&:empty {
|
|
265
|
+
padding: 0;
|
|
266
|
+
}
|
|
267
|
+
|
|
264
268
|
.dito-pane > & {
|
|
265
269
|
.dito-page--width-80 & {
|
|
266
270
|
flex-grow: 1;
|
|
@@ -284,14 +288,8 @@ export default DitoComponent.component('DitoContainer', {
|
|
|
284
288
|
}
|
|
285
289
|
}
|
|
286
290
|
|
|
287
|
-
&:empty {
|
|
288
|
-
padding: 0;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
291
|
&--single {
|
|
292
292
|
height: 100%; // So that list buttons can be sticky at the bottom;
|
|
293
|
-
// Just like on DitoPane, clear settings from above.
|
|
294
|
-
padding: 0;
|
|
295
293
|
}
|
|
296
294
|
|
|
297
295
|
&--label-vertical {
|
|
@@ -241,6 +241,7 @@ export default DitoComponent.component('DitoPane', {
|
|
|
241
241
|
$root-padding: $content-padding - $form-spacing-half;
|
|
242
242
|
|
|
243
243
|
--pane-padding: 0px;
|
|
244
|
+
--container-padding: #{$form-spacing-half};
|
|
244
245
|
|
|
245
246
|
display: flex;
|
|
246
247
|
position: relative;
|
|
@@ -267,6 +268,7 @@ export default DitoComponent.component('DitoPane', {
|
|
|
267
268
|
|
|
268
269
|
&#{$self}--single {
|
|
269
270
|
--pane-padding: #{$content-padding};
|
|
271
|
+
--container-padding: 0px;
|
|
270
272
|
}
|
|
271
273
|
|
|
272
274
|
&:has(> .dito-container--label-vertical:first-of-type) {
|
package/src/mixins/TypeMixin.js
CHANGED
|
@@ -34,8 +34,9 @@ Trigger.dito-color(
|
|
|
34
34
|
<script>
|
|
35
35
|
import tinycolor from 'tinycolor2'
|
|
36
36
|
import { Sketch as SketchPicker } from '@lk77/vue3-color'
|
|
37
|
-
import
|
|
37
|
+
import { isObject } from '@ditojs/utils'
|
|
38
38
|
import { Trigger } from '@ditojs/ui/src'
|
|
39
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
39
40
|
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
40
41
|
|
|
41
42
|
// @vue/component
|
|
@@ -45,61 +46,53 @@ export default DitoTypeComponent.register('color', {
|
|
|
45
46
|
data() {
|
|
46
47
|
return {
|
|
47
48
|
showPopup: false,
|
|
48
|
-
|
|
49
|
+
convertedValue: null
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
|
|
52
53
|
computed: {
|
|
54
|
+
canUpdateValue() {
|
|
55
|
+
return !this.focused || this.readonly
|
|
56
|
+
},
|
|
57
|
+
|
|
53
58
|
colorValue: {
|
|
54
59
|
get() {
|
|
55
|
-
return
|
|
60
|
+
return (
|
|
61
|
+
this.convertedValue ||
|
|
62
|
+
this.value ||
|
|
63
|
+
(this.colorFormat === 'hex' ? '' : {})
|
|
64
|
+
)
|
|
56
65
|
},
|
|
57
66
|
|
|
58
67
|
set(value) {
|
|
59
|
-
|
|
60
|
-
const key = (
|
|
61
|
-
{
|
|
62
|
-
// NOTE: vue3-color calls it 'hex', while tinycolor calls it 'hex6'
|
|
63
|
-
hex: value?.a < 1 ? 'hex8' : 'hex',
|
|
64
|
-
rgb: 'rgba'
|
|
65
|
-
}[format] ||
|
|
66
|
-
format
|
|
67
|
-
)
|
|
68
|
-
if (key) {
|
|
69
|
-
this.value = value[key]
|
|
70
|
-
} else {
|
|
71
|
-
this.value = tinycolor(value).toString(format)
|
|
72
|
-
}
|
|
68
|
+
this.value = convertColor(value, this.colorFormat)
|
|
73
69
|
this.onChange()
|
|
74
70
|
}
|
|
75
71
|
},
|
|
76
72
|
|
|
77
73
|
hexValue: {
|
|
78
74
|
get() {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
this.convertedHexValue = null
|
|
83
|
-
} else if (
|
|
84
|
-
!this.focused ||
|
|
85
|
-
this.$refs.element.hasAttribute('readonly')
|
|
86
|
-
) {
|
|
87
|
-
const color = tinycolor(this.value)
|
|
88
|
-
if (color.isValid()) {
|
|
89
|
-
// TODO: Fix side-effects
|
|
90
|
-
// eslint-disable-next-line max-len
|
|
91
|
-
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
92
|
-
this.convertedHexValue = color
|
|
75
|
+
const color = tinycolor(this.value)
|
|
76
|
+
return color.isValid()
|
|
77
|
+
? color
|
|
93
78
|
.toString(color.getAlpha() < 1 ? 'hex8' : 'hex6')
|
|
94
79
|
.slice(1)
|
|
95
80
|
.toUpperCase()
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
return this.convertedHexValue
|
|
81
|
+
: null
|
|
99
82
|
},
|
|
100
83
|
|
|
101
84
|
set(value) {
|
|
102
|
-
|
|
85
|
+
const color = tinycolor(value)
|
|
86
|
+
if (color.isValid()) {
|
|
87
|
+
const convertedValue = convertColor(value, this.colorFormat)
|
|
88
|
+
if (this.canUpdateValue) {
|
|
89
|
+
this.value = convertedValue
|
|
90
|
+
} else {
|
|
91
|
+
// Store to change later, once `canUpdateValue` is true again.
|
|
92
|
+
// See `watch` below.
|
|
93
|
+
this.convertedValue = convertedValue
|
|
94
|
+
}
|
|
95
|
+
}
|
|
103
96
|
}
|
|
104
97
|
},
|
|
105
98
|
|
|
@@ -144,8 +137,59 @@ export default DitoTypeComponent.register('color', {
|
|
|
144
137
|
'#00000000'
|
|
145
138
|
]
|
|
146
139
|
})
|
|
147
|
-
}
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
watch: {
|
|
143
|
+
canUpdateValue(canUpdateValue) {
|
|
144
|
+
if (canUpdateValue && this.convertedValue !== null) {
|
|
145
|
+
this.value = this.convertedValue
|
|
146
|
+
this.convertedValue = null
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
methods: {}
|
|
148
152
|
})
|
|
153
|
+
|
|
154
|
+
function convertColor(color, format) {
|
|
155
|
+
return isObject(color) // a vue3-color color object
|
|
156
|
+
? color[
|
|
157
|
+
{
|
|
158
|
+
hex: color?.a < 1 ? 'hex8' : 'hex',
|
|
159
|
+
rgb: 'rgba'
|
|
160
|
+
}[format] ||
|
|
161
|
+
format
|
|
162
|
+
]
|
|
163
|
+
: toColorFormat(tinycolor(color), format)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// This should really be in tinycolor, but it only has the string equivalent
|
|
167
|
+
// of it.
|
|
168
|
+
function toColorFormat(color, format) {
|
|
169
|
+
switch (format) {
|
|
170
|
+
case 'rgb':
|
|
171
|
+
return color.toRgb()
|
|
172
|
+
case 'prgb':
|
|
173
|
+
return color.toPercentageRgb()
|
|
174
|
+
case 'hex':
|
|
175
|
+
case 'hex6':
|
|
176
|
+
return color.toHex()
|
|
177
|
+
case 'hex3':
|
|
178
|
+
return color.toHex(true)
|
|
179
|
+
case 'hex4':
|
|
180
|
+
return color.toHex8(true)
|
|
181
|
+
case 'hex8':
|
|
182
|
+
return color.toHex8()
|
|
183
|
+
case 'name':
|
|
184
|
+
return color.toName()
|
|
185
|
+
case 'hsl':
|
|
186
|
+
return color.toHsl()
|
|
187
|
+
case 'hsv':
|
|
188
|
+
return color.toHsv()
|
|
189
|
+
default:
|
|
190
|
+
return color.toHex()
|
|
191
|
+
}
|
|
192
|
+
}
|
|
149
193
|
</script>
|
|
150
194
|
|
|
151
195
|
<style lang="scss">
|