@ditojs/admin 2.0.5 → 2.1.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 +1511 -1435
- package/dist/dito-admin.umd.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +31 -31
- package/src/DitoAdmin.js +66 -31
- package/src/DitoComponent.js +4 -1
- package/src/DitoContext.js +13 -5
- package/src/{TypeComponent.js → DitoTypeComponent.js} +8 -5
- package/src/components/DitoAccount.vue +20 -19
- package/src/components/DitoButtons.vue +14 -12
- package/src/components/DitoClipboard.vue +16 -8
- package/src/components/DitoContainer.vue +56 -43
- package/src/components/DitoCreateButton.vue +20 -15
- package/src/components/DitoDialog.vue +69 -48
- package/src/components/DitoEditButtons.vue +16 -14
- package/src/components/DitoElement.vue +2 -3
- package/src/components/DitoErrors.vue +18 -13
- package/src/components/DitoForm.vue +41 -24
- package/src/components/DitoFormNested.vue +12 -10
- package/src/components/DitoHeader.vue +103 -69
- package/src/components/DitoLabel.vue +108 -81
- package/src/components/DitoMenu.vue +52 -36
- package/src/components/DitoPagination.vue +9 -7
- package/src/components/DitoPane.vue +53 -45
- package/src/components/DitoPanel.vue +62 -42
- package/src/components/DitoPanels.vue +11 -10
- package/src/components/DitoRoot.vue +57 -46
- package/src/components/DitoSchema.vue +179 -131
- package/src/components/DitoSchemaInlined.vue +39 -28
- package/src/components/DitoScopes.vue +41 -31
- package/src/components/DitoSpinner.vue +31 -40
- package/src/components/DitoTableCell.vue +9 -9
- package/src/components/DitoTableHead.vue +52 -37
- package/src/components/DitoTabs.vue +39 -29
- package/src/components/DitoTreeItem.vue +140 -86
- package/src/components/DitoVNode.vue +1 -1
- package/src/components/DitoView.vue +13 -11
- package/src/mixins/DataMixin.js +11 -9
- package/src/mixins/DitoMixin.js +47 -25
- package/src/mixins/EmitterMixin.js +2 -1
- package/src/mixins/ItemMixin.js +15 -10
- package/src/mixins/LoadingMixin.js +2 -1
- package/src/mixins/NumberMixin.js +15 -10
- package/src/mixins/OptionsMixin.js +24 -12
- package/src/mixins/ResourceMixin.js +42 -34
- package/src/mixins/RouteMixin.js +8 -8
- package/src/mixins/SortableMixin.js +1 -1
- package/src/mixins/SourceMixin.js +68 -34
- package/src/mixins/TypeMixin.js +5 -4
- package/src/mixins/ValidationMixin.js +3 -0
- package/src/styles/_base.scss +17 -0
- package/src/styles/_button.scss +212 -0
- package/src/styles/_imports.scss +2 -0
- package/src/styles/_layout.scss +22 -0
- package/src/styles/_notifications.scss +54 -0
- package/src/styles/_pulldown.scss +39 -0
- package/src/styles/_scroll.scss +15 -0
- package/src/styles/_settings.scss +68 -0
- package/src/styles/_sortable.scss +13 -0
- package/src/styles/_table.scss +224 -0
- package/src/styles/style.scss +9 -0
- package/src/types/DitoTypeButton.vue +72 -0
- package/src/types/{TypeCheckbox.vue → DitoTypeCheckbox.vue} +12 -11
- package/src/types/{TypeCheckboxes.vue → DitoTypeCheckboxes.vue} +21 -15
- package/src/types/{TypeCode.vue → DitoTypeCode.vue} +46 -34
- package/src/types/{TypeColor.vue → DitoTypeColor.vue} +71 -52
- package/src/types/{TypeComponent.vue → DitoTypeComponent.vue} +2 -2
- package/src/types/DitoTypeComputed.vue +54 -0
- package/src/types/DitoTypeDate.vue +64 -0
- package/src/types/DitoTypeLabel.vue +23 -0
- package/src/types/{TypeList.vue → DitoTypeList.vue} +83 -61
- package/src/types/{TypeMarkup.vue → DitoTypeMarkup.vue} +172 -122
- package/src/types/DitoTypeMultiselect.vue +434 -0
- package/src/types/DitoTypeNumber.vue +46 -0
- package/src/types/{TypeObject.vue → DitoTypeObject.vue} +41 -26
- package/src/types/{TypePanel.vue → DitoTypePanel.vue} +2 -2
- package/src/types/{TypeProgress.vue → DitoTypeProgress.vue} +4 -6
- package/src/types/{TypeRadio.vue → DitoTypeRadio.vue} +17 -13
- package/src/types/{TypeSection.vue → DitoTypeSection.vue} +17 -17
- package/src/types/{TypeSelect.vue → DitoTypeSelect.vue} +39 -35
- package/src/types/{TypeSlider.vue → DitoTypeSlider.vue} +29 -23
- package/src/types/{TypeSwitch.vue → DitoTypeSwitch.vue} +15 -13
- package/src/types/DitoTypeText.vue +77 -0
- package/src/types/{TypeTextarea.vue → DitoTypeTextarea.vue} +17 -14
- package/src/types/DitoTypeTreeList.vue +191 -0
- package/src/types/{TypeUpload.vue → DitoTypeUpload.vue} +92 -65
- package/src/types/index.js +26 -26
- package/src/utils/SchemaGraph.js +21 -13
- package/src/utils/accessor.js +17 -9
- package/src/utils/data.js +4 -1
- package/src/utils/filter.js +8 -10
- package/src/utils/options.js +3 -3
- package/src/utils/resource.js +12 -10
- package/src/utils/schema.js +190 -125
- package/src/utils/type.js +31 -20
- package/src/validations/_decimals.js +1 -2
- package/types/index.d.ts +27 -23
- package/src/styles/_base.sass +0 -15
- package/src/styles/_button.sass +0 -127
- package/src/styles/_imports.sass +0 -2
- package/src/styles/_layout.sass +0 -13
- package/src/styles/_notifications.sass +0 -33
- package/src/styles/_pulldown.sass +0 -26
- package/src/styles/_scroll.sass +0 -13
- package/src/styles/_settings.sass +0 -55
- package/src/styles/_sortable.sass +0 -9
- package/src/styles/_table.sass +0 -153
- package/src/styles/style.sass +0 -10
- package/src/types/TypeButton.vue +0 -73
- package/src/types/TypeComputed.vue +0 -53
- package/src/types/TypeDate.vue +0 -64
- package/src/types/TypeLabel.vue +0 -19
- package/src/types/TypeMultiselect.vue +0 -376
- package/src/types/TypeNumber.vue +0 -44
- package/src/types/TypeText.vue +0 -67
- package/src/types/TypeTreeList.vue +0 -164
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
.dito-multiselect(
|
|
3
|
+
:class=`{
|
|
4
|
+
'dito-multiselect-single': !multiple,
|
|
5
|
+
'dito-multiselect-multiple': multiple
|
|
6
|
+
}`
|
|
7
|
+
)
|
|
8
|
+
VueMultiselect(
|
|
9
|
+
ref="element"
|
|
10
|
+
v-model="selectedOptions"
|
|
11
|
+
:showLabels="false"
|
|
12
|
+
:placeholder="placeholder"
|
|
13
|
+
tagPlaceholder="Press enter to add new tag"
|
|
14
|
+
:options="populate && activeOptions || []"
|
|
15
|
+
:customLabel="getLabelForOption"
|
|
16
|
+
:trackBy="optionValue"
|
|
17
|
+
:groupLabel="groupByLabel"
|
|
18
|
+
:groupValues="groupByOptions"
|
|
19
|
+
:multiple="multiple"
|
|
20
|
+
:taggable="taggable"
|
|
21
|
+
:searchable="searchable"
|
|
22
|
+
:internalSearch="!searchFilter"
|
|
23
|
+
:preserveSearch="!!searchFilter"
|
|
24
|
+
:clearOnSelect="!searchFilter"
|
|
25
|
+
:closeOnSelect="!stayOpen"
|
|
26
|
+
:loading="isLoading"
|
|
27
|
+
v-bind="attributes"
|
|
28
|
+
@open="onOpen"
|
|
29
|
+
@close="onClose"
|
|
30
|
+
@tag="onAddTag"
|
|
31
|
+
@search-change="onSearchChange"
|
|
32
|
+
)
|
|
33
|
+
button.dito-button-clear.dito-button-overlay(
|
|
34
|
+
v-if="showClearButton"
|
|
35
|
+
type="button"
|
|
36
|
+
:disabled="disabled"
|
|
37
|
+
@click="clear"
|
|
38
|
+
)
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
43
|
+
import DitoContext from '../DitoContext.js'
|
|
44
|
+
import TypeMixin from '../mixins/TypeMixin.js'
|
|
45
|
+
import OptionsMixin from '../mixins/OptionsMixin.js'
|
|
46
|
+
import VueMultiselect from 'vue-multiselect'
|
|
47
|
+
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
48
|
+
|
|
49
|
+
// @vue/component
|
|
50
|
+
export default DitoTypeComponent.register('multiselect', {
|
|
51
|
+
mixins: [OptionsMixin],
|
|
52
|
+
components: { VueMultiselect },
|
|
53
|
+
|
|
54
|
+
data() {
|
|
55
|
+
return {
|
|
56
|
+
searchedOptions: null,
|
|
57
|
+
populate: false
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
computed: {
|
|
62
|
+
selectedOptions: {
|
|
63
|
+
get() {
|
|
64
|
+
return this.multiple
|
|
65
|
+
? (this.selectedValue || [])
|
|
66
|
+
.map(
|
|
67
|
+
// If an option cannot be found, we may be in taggable mode and
|
|
68
|
+
// can add it.
|
|
69
|
+
value => (
|
|
70
|
+
this.getOptionForValue(value) || this.addTagOption(value)
|
|
71
|
+
)
|
|
72
|
+
)
|
|
73
|
+
// Filter out options that we couldn't match.
|
|
74
|
+
// TODO: We really should display an error instead
|
|
75
|
+
.filter(value => value)
|
|
76
|
+
: this.selectedOption
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
set(option) {
|
|
80
|
+
// Convert value to options object, since vue-multiselect can't map that
|
|
81
|
+
// itself unfortunately. `track-by` is used for :key mapping it seems.
|
|
82
|
+
this.selectedValue = this.multiple
|
|
83
|
+
? (option || []).map(value => this.getValueForOption(value))
|
|
84
|
+
: this.getValueForOption(option)
|
|
85
|
+
this.onChange()
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
activeOptions() {
|
|
90
|
+
return this.searchedOptions || this.options
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
multiple: getSchemaAccessor('multiple', {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: false
|
|
96
|
+
}),
|
|
97
|
+
|
|
98
|
+
searchable: getSchemaAccessor('searchable', {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: false
|
|
101
|
+
}),
|
|
102
|
+
|
|
103
|
+
taggable: getSchemaAccessor('taggable', {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: false
|
|
106
|
+
}),
|
|
107
|
+
|
|
108
|
+
stayOpen: getSchemaAccessor('stayOpen', {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
default: false
|
|
111
|
+
}),
|
|
112
|
+
|
|
113
|
+
placeholder() {
|
|
114
|
+
const { placeholder, searchable, taggable } = this.schema
|
|
115
|
+
return (
|
|
116
|
+
placeholder || (
|
|
117
|
+
searchable && taggable
|
|
118
|
+
? `Search or add a ${this.label}`
|
|
119
|
+
: searchable
|
|
120
|
+
? `Select or search ${this.label}`
|
|
121
|
+
: undefined
|
|
122
|
+
)
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
mounted() {
|
|
128
|
+
if (this.autofocus) {
|
|
129
|
+
// vue-multiselect doesn't support the autofocus attribute. We need to
|
|
130
|
+
// handle it here.
|
|
131
|
+
this.focus()
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
methods: {
|
|
136
|
+
addTagOption(tag) {
|
|
137
|
+
if (this.taggable) {
|
|
138
|
+
const { optionLabel, optionValue } = this
|
|
139
|
+
const option =
|
|
140
|
+
optionLabel && optionValue
|
|
141
|
+
? {
|
|
142
|
+
[optionLabel]: tag,
|
|
143
|
+
// TODO: Define a simple schema option to convert the tag value
|
|
144
|
+
// to something else, e.g. `toTag: tag => underscore(tag)`
|
|
145
|
+
[optionValue]: tag
|
|
146
|
+
}
|
|
147
|
+
: tag
|
|
148
|
+
this.options.push(option)
|
|
149
|
+
return option
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
focusElement() {
|
|
154
|
+
this.$refs.element.activate()
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
onOpen() {
|
|
158
|
+
this.populate = true
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
onClose() {
|
|
162
|
+
// Since we don't fire blur events while the multiselect is open (see
|
|
163
|
+
// below), we need to do it here, when it's actually closed.
|
|
164
|
+
if (this.focused) {
|
|
165
|
+
this.onBlur()
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
onBlur() {
|
|
170
|
+
if (!this.$refs.element.isOpen) {
|
|
171
|
+
TypeMixin.methods.onBlur.call(this)
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
onAddTag(tag) {
|
|
176
|
+
const option = this.addTagOption(tag)
|
|
177
|
+
if (option) {
|
|
178
|
+
this.value.push(this.getValueForOption(option))
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
async onSearchChange(query) {
|
|
183
|
+
if (this.searchFilter) {
|
|
184
|
+
if (query) {
|
|
185
|
+
// Set `searchedOptions` to an empty array, before it will be
|
|
186
|
+
// populated asynchronously with the actual results.
|
|
187
|
+
this.searchedOptions = []
|
|
188
|
+
this.searchedOptions = await this.resolveData(
|
|
189
|
+
() => this.searchFilter(new DitoContext(this, { query }))
|
|
190
|
+
)
|
|
191
|
+
} else {
|
|
192
|
+
// Clear `searchedOptions` when the query is cleared.
|
|
193
|
+
this.searchedOptions = null
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
</script>
|
|
200
|
+
|
|
201
|
+
<style lang="scss">
|
|
202
|
+
@import '../styles/_imports';
|
|
203
|
+
@import 'vue-multiselect/dist/vue-multiselect.css';
|
|
204
|
+
|
|
205
|
+
$spinner-width: $select-arrow-width;
|
|
206
|
+
$tag-icon-width: 1.8em;
|
|
207
|
+
$tag-margin: 2px;
|
|
208
|
+
$tag-padding: 3px;
|
|
209
|
+
$tag-line-height: 1em;
|
|
210
|
+
|
|
211
|
+
.dito-multiselect {
|
|
212
|
+
position: relative;
|
|
213
|
+
|
|
214
|
+
.multiselect {
|
|
215
|
+
font-size: inherit;
|
|
216
|
+
min-height: inherit;
|
|
217
|
+
color: $color-black;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.multiselect__tags {
|
|
221
|
+
font-size: inherit;
|
|
222
|
+
overflow: auto;
|
|
223
|
+
min-height: inherit;
|
|
224
|
+
padding: 0 $spinner-width 0 0;
|
|
225
|
+
// So tags can float on multiple lines and have proper margins:
|
|
226
|
+
padding-bottom: $tag-margin;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.multiselect__tag {
|
|
230
|
+
float: left;
|
|
231
|
+
margin: $tag-margin 0 0 $tag-margin;
|
|
232
|
+
border-radius: 1em;
|
|
233
|
+
padding: $tag-padding $tag-icon-width $tag-padding 0.8em;
|
|
234
|
+
line-height: $tag-line-height;
|
|
235
|
+
height: calc($input-height - 2 * $tag-padding);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.multiselect__tags-wrap {
|
|
239
|
+
overflow: auto;
|
|
240
|
+
line-height: 0;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.multiselect__single,
|
|
244
|
+
.multiselect__placeholder,
|
|
245
|
+
.multiselect__input {
|
|
246
|
+
font-size: inherit;
|
|
247
|
+
line-height: inherit;
|
|
248
|
+
min-height: 0;
|
|
249
|
+
margin: 0 0 1px 0;
|
|
250
|
+
// Sadly, vue-select sets style="padding: ...;" in addition to using
|
|
251
|
+
// classes, so `!important` is necessary:
|
|
252
|
+
padding: $input-padding !important;
|
|
253
|
+
// So input can float next to tags and have proper margins with
|
|
254
|
+
// .multiselect__tags:
|
|
255
|
+
padding-bottom: 0 !important;
|
|
256
|
+
background: none;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.multiselect__placeholder,
|
|
260
|
+
.multiselect__input::placeholder {
|
|
261
|
+
color: $color-placeholder;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.multiselect--active {
|
|
265
|
+
.multiselect__placeholder {
|
|
266
|
+
// Don't use `display: none` to hide place-holder, as the layout would
|
|
267
|
+
// collapse.
|
|
268
|
+
display: inline-block;
|
|
269
|
+
visibility: hidden;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.multiselect__select,
|
|
274
|
+
.multiselect__spinner {
|
|
275
|
+
padding: 0;
|
|
276
|
+
// $border-width to prevent masking border with .multiselect__spinner
|
|
277
|
+
top: $border-width;
|
|
278
|
+
right: $border-width;
|
|
279
|
+
bottom: $border-width;
|
|
280
|
+
height: inherit;
|
|
281
|
+
border-radius: $border-radius;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.multiselect__select {
|
|
285
|
+
width: 0;
|
|
286
|
+
margin-right: calc($select-arrow-width / 2);
|
|
287
|
+
|
|
288
|
+
&::before {
|
|
289
|
+
@include arrow($select-arrow-size);
|
|
290
|
+
|
|
291
|
+
bottom: $select-arrow-bottom;
|
|
292
|
+
right: calc(-1 * $select-arrow-size / 2);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.multiselect__spinner {
|
|
297
|
+
width: $spinner-width;
|
|
298
|
+
|
|
299
|
+
&::before,
|
|
300
|
+
&::after {
|
|
301
|
+
// Change the width of the loading spinner
|
|
302
|
+
border-width: 3px;
|
|
303
|
+
border-top-color: $color-active;
|
|
304
|
+
inset: 0;
|
|
305
|
+
margin: auto;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.multiselect__option {
|
|
310
|
+
min-height: unset;
|
|
311
|
+
height: unset;
|
|
312
|
+
line-height: $tag-line-height;
|
|
313
|
+
padding: $input-padding;
|
|
314
|
+
|
|
315
|
+
&::after {
|
|
316
|
+
// Instruction text for options
|
|
317
|
+
padding: $input-padding;
|
|
318
|
+
line-height: $tag-line-height;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.multiselect__option--highlight {
|
|
323
|
+
&::after {
|
|
324
|
+
display: block;
|
|
325
|
+
position: absolute;
|
|
326
|
+
background: transparent;
|
|
327
|
+
color: $color-white;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.multiselect__option--disabled {
|
|
332
|
+
background: none;
|
|
333
|
+
color: $color-disabled;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.multiselect__tag-icon {
|
|
337
|
+
background: none;
|
|
338
|
+
border-radius: 1em;
|
|
339
|
+
width: $tag-icon-width;
|
|
340
|
+
margin: 0;
|
|
341
|
+
|
|
342
|
+
&::after {
|
|
343
|
+
@extend %icon-clear;
|
|
344
|
+
|
|
345
|
+
font-size: 0.9em;
|
|
346
|
+
color: $color-text-inverted;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
&:hover::after {
|
|
350
|
+
color: $color-text;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.multiselect__option--selected {
|
|
355
|
+
background: $color-highlight;
|
|
356
|
+
color: $color-text;
|
|
357
|
+
font-weight: normal;
|
|
358
|
+
|
|
359
|
+
&.multiselect__option--highlight {
|
|
360
|
+
color: $color-text-inverted;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.multiselect__tag,
|
|
365
|
+
.multiselect__option--highlight {
|
|
366
|
+
background: $color-active;
|
|
367
|
+
color: $color-text-inverted;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.multiselect__tags,
|
|
371
|
+
.multiselect__content-wrapper {
|
|
372
|
+
border: $border-style;
|
|
373
|
+
border-radius: $border-radius;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
&.dito-multiselect-single {
|
|
377
|
+
--input-width: 100%;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
&.dito-multiselect-multiple {
|
|
381
|
+
--input-width: auto;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.multiselect--active {
|
|
385
|
+
.multiselect__single,
|
|
386
|
+
.multiselect__input {
|
|
387
|
+
// Sadly, vue-select sets `style="width"` in addition to using classes
|
|
388
|
+
// so `!important` is necessary:
|
|
389
|
+
width: var(--input-width) !important;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.multiselect__tags {
|
|
393
|
+
border-color: $color-active;
|
|
394
|
+
border-bottom-left-radius: 0;
|
|
395
|
+
border-bottom-right-radius: 0;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.multiselect__content-wrapper {
|
|
399
|
+
border: $border-width solid $color-active;
|
|
400
|
+
border-top-color: $border-color;
|
|
401
|
+
margin: -1px 0 0;
|
|
402
|
+
border-top-left-radius: 0;
|
|
403
|
+
border-top-right-radius: 0;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
&.multiselect--above {
|
|
407
|
+
.multiselect__tags {
|
|
408
|
+
border-radius: $border-radius;
|
|
409
|
+
border-top-left-radius: 0;
|
|
410
|
+
border-top-right-radius: 0;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.multiselect__content-wrapper {
|
|
414
|
+
border: $border-width solid $color-active;
|
|
415
|
+
border-bottom-color: $border-color;
|
|
416
|
+
margin: 0 0 -1px;
|
|
417
|
+
border-radius: $border-radius;
|
|
418
|
+
border-bottom-left-radius: 0;
|
|
419
|
+
border-bottom-right-radius: 0;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
&.dito-has-errors {
|
|
425
|
+
.multiselect__tags {
|
|
426
|
+
border-color: $color-error;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.dito-button-clear {
|
|
431
|
+
width: $spinner-width;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
InputField.dito-number(
|
|
3
|
+
:id="dataPath"
|
|
4
|
+
ref="element"
|
|
5
|
+
v-model="inputValue"
|
|
6
|
+
type="number"
|
|
7
|
+
v-bind="attributes"
|
|
8
|
+
:min="min"
|
|
9
|
+
:max="max"
|
|
10
|
+
:step="stepValue"
|
|
11
|
+
)
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
16
|
+
import NumberMixin from '../mixins/NumberMixin.js'
|
|
17
|
+
import { InputField } from '@ditojs/ui/src'
|
|
18
|
+
|
|
19
|
+
export default DitoTypeComponent.register(
|
|
20
|
+
['number', 'integer'],
|
|
21
|
+
// @vue/component
|
|
22
|
+
{
|
|
23
|
+
mixins: [NumberMixin],
|
|
24
|
+
components: { InputField },
|
|
25
|
+
nativeField: true,
|
|
26
|
+
textField: true,
|
|
27
|
+
|
|
28
|
+
computed: {
|
|
29
|
+
isInteger() {
|
|
30
|
+
return this.type === 'integer'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<style lang="scss">
|
|
38
|
+
// Only show spin buttons if the number component defines a step size.
|
|
39
|
+
input[type='number']:not([step]) {
|
|
40
|
+
&::-webkit-inner-spin-button,
|
|
41
|
+
&::-webkit-outer-spin-button {
|
|
42
|
+
-webkit-appearance: none;
|
|
43
|
+
margin: 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
v-if="objectData"
|
|
10
10
|
)
|
|
11
11
|
//- Support the same rendering options as TypeList:
|
|
12
|
-
|
|
12
|
+
DitoSchemaInlined(
|
|
13
13
|
v-if="isInlined"
|
|
14
|
-
|
|
14
|
+
:label="objectLabel"
|
|
15
15
|
:schema="getItemFormSchema(schema, objectData, context)"
|
|
16
16
|
:dataPath="dataPath"
|
|
17
17
|
:data="objectData"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
v-else
|
|
37
37
|
v-html="getItemLabel(schema, objectData)"
|
|
38
38
|
)
|
|
39
|
-
|
|
39
|
+
DitoEditButtons(
|
|
40
40
|
:creatable="creatable"
|
|
41
41
|
:deletable="objectData && deletable"
|
|
42
42
|
:editable="objectData && editable"
|
|
@@ -53,31 +53,14 @@
|
|
|
53
53
|
)
|
|
54
54
|
</template>
|
|
55
55
|
|
|
56
|
-
<style lang="sass">
|
|
57
|
-
@import '../styles/_imports'
|
|
58
|
-
|
|
59
|
-
.dito-object
|
|
60
|
-
display: flex
|
|
61
|
-
border: $border-style
|
|
62
|
-
border-radius: $border-radius
|
|
63
|
-
margin: 0
|
|
64
|
-
padding: $form-spacing
|
|
65
|
-
box-sizing: border-box
|
|
66
|
-
.dito-object-content
|
|
67
|
-
flex: 0 1 100%
|
|
68
|
-
> .dito-buttons
|
|
69
|
-
flex: 1 0 0%
|
|
70
|
-
margin-left: $form-spacing
|
|
71
|
-
</style>
|
|
72
|
-
|
|
73
56
|
<script>
|
|
74
|
-
import
|
|
57
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
75
58
|
import DitoContext from '../DitoContext.js'
|
|
76
59
|
import SourceMixin from '../mixins/SourceMixin.js'
|
|
77
60
|
import { resolveSchemaComponent } from '../utils/schema.js'
|
|
78
61
|
|
|
79
62
|
// @vue/component
|
|
80
|
-
export default
|
|
63
|
+
export default DitoTypeComponent.register('object', {
|
|
81
64
|
mixins: [SourceMixin],
|
|
82
65
|
|
|
83
66
|
getSourceType(type) {
|
|
@@ -101,18 +84,50 @@ export default TypeComponent.register('object', {
|
|
|
101
84
|
},
|
|
102
85
|
|
|
103
86
|
async processSchema(
|
|
104
|
-
api,
|
|
105
|
-
|
|
87
|
+
api,
|
|
88
|
+
schema,
|
|
89
|
+
name,
|
|
90
|
+
routes,
|
|
91
|
+
level,
|
|
92
|
+
nested = false,
|
|
93
|
+
flatten = false,
|
|
106
94
|
process = null
|
|
107
95
|
) {
|
|
108
96
|
await Promise.all([
|
|
109
97
|
resolveSchemaComponent(schema),
|
|
110
98
|
SourceMixin.processSchema(
|
|
111
|
-
api,
|
|
112
|
-
|
|
99
|
+
api,
|
|
100
|
+
schema,
|
|
101
|
+
name,
|
|
102
|
+
routes,
|
|
103
|
+
level,
|
|
104
|
+
nested,
|
|
105
|
+
flatten,
|
|
113
106
|
process
|
|
114
107
|
)
|
|
115
108
|
])
|
|
116
109
|
}
|
|
117
110
|
})
|
|
118
111
|
</script>
|
|
112
|
+
|
|
113
|
+
<style lang="scss">
|
|
114
|
+
@import '../styles/_imports';
|
|
115
|
+
|
|
116
|
+
.dito-object {
|
|
117
|
+
display: flex;
|
|
118
|
+
border: $border-style;
|
|
119
|
+
border-radius: $border-radius;
|
|
120
|
+
margin: 0;
|
|
121
|
+
padding: $form-spacing;
|
|
122
|
+
box-sizing: border-box;
|
|
123
|
+
|
|
124
|
+
.dito-object-content {
|
|
125
|
+
flex: 0 1 100%;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
> .dito-buttons {
|
|
129
|
+
flex: 1 0 0%;
|
|
130
|
+
margin-left: $form-spacing;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</style>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import
|
|
2
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
3
3
|
|
|
4
4
|
// @vue/component
|
|
5
|
-
export default
|
|
5
|
+
export default DitoTypeComponent.register('panel', {
|
|
6
6
|
defaultValue: () => undefined, // Callback to override `defaultValue: null`
|
|
7
7
|
excludeValue: true,
|
|
8
8
|
generateLabel: false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
progress.dito-progress(
|
|
3
|
-
ref="element"
|
|
4
3
|
:id="dataPath"
|
|
4
|
+
ref="element"
|
|
5
5
|
:value="progressValue"
|
|
6
6
|
:max="progressMax"
|
|
7
7
|
v-bind="attributes"
|
|
@@ -9,11 +9,11 @@ progress.dito-progress(
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script>
|
|
12
|
-
import
|
|
12
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
13
13
|
import NumberMixin from '../mixins/NumberMixin.js'
|
|
14
14
|
|
|
15
15
|
// @vue/component
|
|
16
|
-
export default
|
|
16
|
+
export default DitoTypeComponent.register('progress', {
|
|
17
17
|
mixins: [NumberMixin],
|
|
18
18
|
computed: {
|
|
19
19
|
progressValue() {
|
|
@@ -33,9 +33,7 @@ export default TypeComponent.register('progress', {
|
|
|
33
33
|
|
|
34
34
|
progressMax() {
|
|
35
35
|
const { range } = this
|
|
36
|
-
|
|
37
|
-
return range[1] - range[0]
|
|
38
|
-
}
|
|
36
|
+
return range ? range[1] - range[0] : null
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
})
|
|
@@ -9,32 +9,36 @@ ul.dito-radio-buttons(
|
|
|
9
9
|
label
|
|
10
10
|
input.dito-radio-button(
|
|
11
11
|
ref="element"
|
|
12
|
+
v-model="selectedValue"
|
|
12
13
|
type="radio"
|
|
13
14
|
:value="getValueForOption(option)"
|
|
14
|
-
v-model="selectedValue"
|
|
15
15
|
v-bind="attributes"
|
|
16
16
|
)
|
|
17
17
|
| {{ getLabelForOption(option) }}
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
|
-
<style lang="sass">
|
|
21
|
-
@import '../styles/_imports'
|
|
22
|
-
|
|
23
|
-
.dito-radio-buttons
|
|
24
|
-
label
|
|
25
|
-
@extend %input-borderless
|
|
26
|
-
.dito-radio-button
|
|
27
|
-
margin-right: $form-spacing
|
|
28
|
-
</style>
|
|
29
|
-
|
|
30
20
|
<script>
|
|
31
|
-
import
|
|
21
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
32
22
|
import OptionsMixin from '../mixins/OptionsMixin.js'
|
|
33
23
|
|
|
34
24
|
// @vue/component
|
|
35
|
-
export default
|
|
25
|
+
export default DitoTypeComponent.register('radio', {
|
|
36
26
|
mixins: [OptionsMixin],
|
|
37
27
|
|
|
38
28
|
nativeField: true
|
|
39
29
|
})
|
|
40
30
|
</script>
|
|
31
|
+
|
|
32
|
+
<style lang="scss">
|
|
33
|
+
@import '../styles/_imports';
|
|
34
|
+
|
|
35
|
+
.dito-radio-buttons {
|
|
36
|
+
label {
|
|
37
|
+
@extend %input-borderless;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dito-radio-button {
|
|
41
|
+
margin-right: $form-spacing;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</style>
|