@ditojs/admin 2.2.16 → 2.3.0
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 +32 -19
- package/dist/dito-admin.umd.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +5 -5
- package/src/components/DitoContainer.vue +36 -22
- package/src/components/DitoLabel.vue +5 -3
- package/src/components/DitoRoot.vue +10 -1
- package/src/mixins/OptionsMixin.js +2 -2
- package/src/mixins/TypeMixin.js +2 -6
- package/src/styles/_info.scss +3 -0
- package/src/types/DitoTypeButton.vue +11 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/admin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
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.3.0",
|
|
37
|
+
"@ditojs/utils": "^2.3.0",
|
|
38
38
|
"@kyvg/vue3-notification": "^2.9.0",
|
|
39
39
|
"@lk77/vue3-color": "^3.0.6",
|
|
40
40
|
"@tiptap/core": "^2.0.3",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"vue-upload-component": "^3.1.8"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@ditojs/build": "^2.
|
|
77
|
+
"@ditojs/build": "^2.3.0",
|
|
78
78
|
"@vitejs/plugin-vue": "^4.1.0",
|
|
79
79
|
"@vue/compiler-sfc": "^3.2.47",
|
|
80
80
|
"pug": "^3.0.2",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"vite": "^4.3.1"
|
|
84
84
|
},
|
|
85
85
|
"types": "types",
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "81398b333e755f30b2c3c1998c8879a3e87f7873",
|
|
87
87
|
"scripts": {
|
|
88
88
|
"build": "vite build",
|
|
89
89
|
"watch": "yarn build --mode 'development' --watch",
|
|
@@ -131,6 +131,32 @@ export default DitoComponent.component('DitoContainer', {
|
|
|
131
131
|
}
|
|
132
132
|
}),
|
|
133
133
|
|
|
134
|
+
flexGrow() {
|
|
135
|
+
// Interpret '>50%' as '50%, flex-grow: 1`
|
|
136
|
+
return (
|
|
137
|
+
this.widthOperator === '>' ||
|
|
138
|
+
this.width === 'fill'
|
|
139
|
+
)
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
flexShrink() {
|
|
143
|
+
// Interpret '<50%' as '50%, flex-shrink: 1`
|
|
144
|
+
return this.widthOperator === '<'
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
flexBasis() {
|
|
148
|
+
const width = this.width
|
|
149
|
+
// 'auto' = no fitting:
|
|
150
|
+
const basis = [null, 'auto', 'fill'].includes(width)
|
|
151
|
+
? 'auto'
|
|
152
|
+
: /%$/.test(width)
|
|
153
|
+
? parseFloat(width) // percentage
|
|
154
|
+
: /[a-z]/.test(width)
|
|
155
|
+
? width // native units
|
|
156
|
+
: parseFraction(width) * 100 // fraction
|
|
157
|
+
return isNumber(basis) ? `${basis}%` : basis
|
|
158
|
+
},
|
|
159
|
+
|
|
134
160
|
containerClass() {
|
|
135
161
|
const { class: containerClass } = this.schema
|
|
136
162
|
const prefix = 'dito-container'
|
|
@@ -150,39 +176,27 @@ export default DitoComponent.component('DitoContainer', {
|
|
|
150
176
|
}
|
|
151
177
|
},
|
|
152
178
|
|
|
153
|
-
componentBasis() {
|
|
154
|
-
const width = this.width
|
|
155
|
-
// 'auto' = no fitting:
|
|
156
|
-
const basis = [null, 'auto', 'fill'].includes(width)
|
|
157
|
-
? 'auto'
|
|
158
|
-
: /%$/.test(width)
|
|
159
|
-
? parseFloat(width) // percentage
|
|
160
|
-
: /[a-z]/.test(width)
|
|
161
|
-
? width // native units
|
|
162
|
-
: parseFraction(width) * 100 // fraction
|
|
163
|
-
return isNumber(basis) ? `${basis}%` : basis
|
|
164
|
-
},
|
|
165
|
-
|
|
166
179
|
containerStyle() {
|
|
167
|
-
// Interpret '>50%' as '50%, flex-grow: 1`
|
|
168
|
-
const grow = (
|
|
169
|
-
this.widthOperator === '>' ||
|
|
170
|
-
this.width === 'fill'
|
|
171
|
-
)
|
|
172
|
-
// Interpret '<50%' as '50%, flex-shrink: 1`
|
|
173
|
-
const shrink = this.widthOperator === '<'
|
|
174
180
|
return {
|
|
175
|
-
flex: `${
|
|
181
|
+
flex: `${
|
|
182
|
+
this.flexGrow ? 1 : 0
|
|
183
|
+
} ${
|
|
184
|
+
this.flexShrink ? 1 : 0
|
|
185
|
+
} ${
|
|
186
|
+
this.flexBasis
|
|
187
|
+
}`
|
|
176
188
|
}
|
|
177
189
|
},
|
|
178
190
|
|
|
179
191
|
componentClass() {
|
|
180
|
-
const basisIsAuto = this.
|
|
192
|
+
const basisIsAuto = this.flexBasis === 'auto'
|
|
181
193
|
return {
|
|
182
194
|
// TODO: BEM?
|
|
183
195
|
'dito-single': this.single,
|
|
184
196
|
'dito-disabled': this.componentDisabled,
|
|
185
197
|
'dito-width-fill': !basisIsAuto || this.width === 'fill',
|
|
198
|
+
'dito-width-grow': this.flexGrow,
|
|
199
|
+
'dito-width-shrink': this.flexShrink,
|
|
186
200
|
'dito-has-errors': !!this.errors
|
|
187
201
|
}
|
|
188
202
|
}
|
|
@@ -28,8 +28,7 @@ component.dito-label(
|
|
|
28
28
|
)
|
|
29
29
|
.dito-info(
|
|
30
30
|
v-if="info"
|
|
31
|
-
:data-
|
|
32
|
-
data-tippy-theme="info"
|
|
31
|
+
:data-info="info"
|
|
33
32
|
)
|
|
34
33
|
slot(name="edit-buttons")
|
|
35
34
|
</template>
|
|
@@ -118,8 +117,11 @@ export default DitoComponent.component('DitoLabel', {
|
|
|
118
117
|
.dito-label-suffix {
|
|
119
118
|
@include user-select(none);
|
|
120
119
|
@include ellipsis;
|
|
120
|
+
}
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
.dito-label-prefix + label,
|
|
123
|
+
label + .dito-label-suffix {
|
|
124
|
+
&::before {
|
|
123
125
|
content: '\a0'; //
|
|
124
126
|
}
|
|
125
127
|
}
|
|
@@ -92,7 +92,16 @@ export default DitoComponent.component('DitoRoot', {
|
|
|
92
92
|
|
|
93
93
|
async mounted() {
|
|
94
94
|
tippyDelegate(this.$el, {
|
|
95
|
-
target: '
|
|
95
|
+
target: '.dito-info',
|
|
96
|
+
onCreate(instance) {
|
|
97
|
+
instance.setContent(instance.reference.dataset.info)
|
|
98
|
+
instance.setProps({
|
|
99
|
+
theme: 'info',
|
|
100
|
+
interactive: true,
|
|
101
|
+
animation: 'shift-away-subtle',
|
|
102
|
+
delay: 250
|
|
103
|
+
})
|
|
104
|
+
}
|
|
96
105
|
})
|
|
97
106
|
// Clear the label marked as active on all mouse and keyboard events, except
|
|
98
107
|
// the ones that DitoLabel itself intercepts.
|
|
@@ -227,7 +227,7 @@ export default {
|
|
|
227
227
|
return isString(optionValue)
|
|
228
228
|
? option?.[optionValue]
|
|
229
229
|
: isFunction(optionValue)
|
|
230
|
-
? optionValue
|
|
230
|
+
? optionValue(new DitoContext(this, { option }))
|
|
231
231
|
: option
|
|
232
232
|
},
|
|
233
233
|
|
|
@@ -236,7 +236,7 @@ export default {
|
|
|
236
236
|
return isString(optionLabel)
|
|
237
237
|
? option?.[optionLabel]
|
|
238
238
|
: isFunction(optionLabel)
|
|
239
|
-
? optionLabel
|
|
239
|
+
? optionLabel(new DitoContext(this, { option }))
|
|
240
240
|
: labelize(`${option}`)
|
|
241
241
|
}
|
|
242
242
|
},
|
package/src/mixins/TypeMixin.js
CHANGED
|
@@ -55,19 +55,15 @@ export default {
|
|
|
55
55
|
{ component: this }
|
|
56
56
|
)
|
|
57
57
|
const { format } = this.schema
|
|
58
|
-
// `schema.format` is only ever called in the life-cycle
|
|
59
|
-
// of the component and thus it's ok to bind it to `this`
|
|
60
58
|
return format
|
|
61
|
-
? format
|
|
59
|
+
? format(new DitoContext(this, { value }))
|
|
62
60
|
: value
|
|
63
61
|
},
|
|
64
62
|
|
|
65
63
|
set(value) {
|
|
66
64
|
const { parse } = this.schema
|
|
67
|
-
// `schema.parse` is only ever called in the life-cycle
|
|
68
|
-
// of the component and thus it's ok to bind it to `this`
|
|
69
65
|
this.parsedValue = parse
|
|
70
|
-
? parse
|
|
66
|
+
? parse(new DitoContext(this, { value }))
|
|
71
67
|
: value
|
|
72
68
|
// eslint-disable-next-line vue/no-mutating-props
|
|
73
69
|
this.data[this.name] = this.parsedValue
|
package/src/styles/_info.scss
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import 'tippy.js/animations/shift-away-subtle.css';
|
|
2
|
+
|
|
1
3
|
.dito-info {
|
|
2
4
|
--size: calc(1em * var(--line-height));
|
|
3
5
|
|
|
@@ -21,6 +23,7 @@
|
|
|
21
23
|
.tippy-box[data-theme~='info'] {
|
|
22
24
|
background-color: $color-active;
|
|
23
25
|
color: $color-white;
|
|
26
|
+
filter: drop-shadow(0 2px 4px $color-shadow);
|
|
24
27
|
|
|
25
28
|
> .tippy-arrow::before {
|
|
26
29
|
color: $color-active;
|
|
@@ -14,8 +14,7 @@ button.dito-button(
|
|
|
14
14
|
span {{ text }}
|
|
15
15
|
.dito-info(
|
|
16
16
|
v-if="!label && info"
|
|
17
|
-
:data-
|
|
18
|
-
data-tippy-theme="info"
|
|
17
|
+
:data-info="info"
|
|
19
18
|
)
|
|
20
19
|
template(
|
|
21
20
|
v-else
|
|
@@ -97,19 +96,26 @@ export default DitoTypeComponent.register(
|
|
|
97
96
|
@import '../styles/_imports';
|
|
98
97
|
|
|
99
98
|
.dito-button {
|
|
99
|
+
$self: &;
|
|
100
|
+
|
|
100
101
|
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
101
104
|
|
|
102
105
|
&__text {
|
|
103
106
|
position: relative;
|
|
104
|
-
width: 100%;
|
|
105
107
|
min-width: min-content;
|
|
106
108
|
height: calc(1em * var(--line-height));
|
|
107
109
|
|
|
108
110
|
span {
|
|
109
111
|
@include ellipsis;
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
#{$self}:not(.dito-width-grow) & {
|
|
114
|
+
// Use `position: absolute` to prevent the text from growing over the
|
|
115
|
+
// button's width, which would cause the button to grow as well.
|
|
116
|
+
position: absolute;
|
|
117
|
+
inset: 0;
|
|
118
|
+
}
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
121
|
}
|