@radio-garden/ditojs-admin 2.85.2-0.5067ad799
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/README.md +180 -0
- package/dist/dito-admin.css +1 -0
- package/dist/dito-admin.es.js +12106 -0
- package/dist/dito-admin.umd.js +7 -0
- package/package.json +96 -0
- package/src/DitoAdmin.js +293 -0
- package/src/DitoComponent.js +34 -0
- package/src/DitoContext.js +318 -0
- package/src/DitoTypeComponent.js +42 -0
- package/src/DitoUser.js +12 -0
- package/src/appState.js +12 -0
- package/src/components/DitoAccount.vue +60 -0
- package/src/components/DitoAffix.vue +68 -0
- package/src/components/DitoAffixes.vue +200 -0
- package/src/components/DitoButtons.vue +80 -0
- package/src/components/DitoClipboard.vue +186 -0
- package/src/components/DitoContainer.vue +374 -0
- package/src/components/DitoCreateButton.vue +146 -0
- package/src/components/DitoDialog.vue +242 -0
- package/src/components/DitoDraggable.vue +117 -0
- package/src/components/DitoEditButtons.vue +135 -0
- package/src/components/DitoErrors.vue +83 -0
- package/src/components/DitoForm.vue +521 -0
- package/src/components/DitoFormInner.vue +26 -0
- package/src/components/DitoFormNested.vue +17 -0
- package/src/components/DitoHeader.vue +84 -0
- package/src/components/DitoLabel.vue +200 -0
- package/src/components/DitoMenu.vue +186 -0
- package/src/components/DitoNavigation.vue +40 -0
- package/src/components/DitoNotifications.vue +170 -0
- package/src/components/DitoPagination.vue +42 -0
- package/src/components/DitoPane.vue +334 -0
- package/src/components/DitoPanel.vue +256 -0
- package/src/components/DitoPanels.vue +61 -0
- package/src/components/DitoRoot.vue +524 -0
- package/src/components/DitoSchema.vue +846 -0
- package/src/components/DitoSchemaInlined.vue +97 -0
- package/src/components/DitoScopes.vue +76 -0
- package/src/components/DitoSidebar.vue +50 -0
- package/src/components/DitoSpinner.vue +95 -0
- package/src/components/DitoTableCell.vue +64 -0
- package/src/components/DitoTableHead.vue +121 -0
- package/src/components/DitoTabs.vue +103 -0
- package/src/components/DitoTrail.vue +124 -0
- package/src/components/DitoTreeItem.vue +420 -0
- package/src/components/DitoUploadFile.vue +199 -0
- package/src/components/DitoVNode.vue +14 -0
- package/src/components/DitoView.vue +143 -0
- package/src/components/index.js +42 -0
- package/src/directives/resize.js +83 -0
- package/src/index.js +1 -0
- package/src/mixins/ContextMixin.js +68 -0
- package/src/mixins/DataMixin.js +131 -0
- package/src/mixins/DitoMixin.js +591 -0
- package/src/mixins/DomMixin.js +29 -0
- package/src/mixins/EmitterMixin.js +158 -0
- package/src/mixins/ItemMixin.js +144 -0
- package/src/mixins/LoadingMixin.js +23 -0
- package/src/mixins/NumberMixin.js +118 -0
- package/src/mixins/OptionsMixin.js +304 -0
- package/src/mixins/PulldownMixin.js +63 -0
- package/src/mixins/ResourceMixin.js +398 -0
- package/src/mixins/RouteMixin.js +190 -0
- package/src/mixins/SchemaParentMixin.js +33 -0
- package/src/mixins/SortableMixin.js +49 -0
- package/src/mixins/SourceMixin.js +734 -0
- package/src/mixins/TextMixin.js +26 -0
- package/src/mixins/TypeMixin.js +280 -0
- package/src/mixins/ValidationMixin.js +119 -0
- package/src/mixins/ValidatorMixin.js +57 -0
- package/src/mixins/ValueMixin.js +31 -0
- package/src/styles/_base.scss +17 -0
- package/src/styles/_button.scss +191 -0
- package/src/styles/_imports.scss +3 -0
- package/src/styles/_info.scss +19 -0
- package/src/styles/_layout.scss +19 -0
- package/src/styles/_pulldown.scss +38 -0
- package/src/styles/_scroll.scss +13 -0
- package/src/styles/_settings.scss +88 -0
- package/src/styles/_table.scss +223 -0
- package/src/styles/_tippy.scss +45 -0
- package/src/styles/style.scss +9 -0
- package/src/types/DitoTypeButton.vue +143 -0
- package/src/types/DitoTypeCheckbox.vue +27 -0
- package/src/types/DitoTypeCheckboxes.vue +65 -0
- package/src/types/DitoTypeCode.vue +199 -0
- package/src/types/DitoTypeColor.vue +272 -0
- package/src/types/DitoTypeComponent.vue +31 -0
- package/src/types/DitoTypeComputed.vue +50 -0
- package/src/types/DitoTypeDate.vue +99 -0
- package/src/types/DitoTypeLabel.vue +23 -0
- package/src/types/DitoTypeList.vue +364 -0
- package/src/types/DitoTypeMarkup.vue +700 -0
- package/src/types/DitoTypeMultiselect.vue +522 -0
- package/src/types/DitoTypeNumber.vue +66 -0
- package/src/types/DitoTypeObject.vue +136 -0
- package/src/types/DitoTypePanel.vue +18 -0
- package/src/types/DitoTypeProgress.vue +40 -0
- package/src/types/DitoTypeRadio.vue +45 -0
- package/src/types/DitoTypeSection.vue +80 -0
- package/src/types/DitoTypeSelect.vue +133 -0
- package/src/types/DitoTypeSlider.vue +66 -0
- package/src/types/DitoTypeSpacer.vue +11 -0
- package/src/types/DitoTypeSwitch.vue +40 -0
- package/src/types/DitoTypeText.vue +101 -0
- package/src/types/DitoTypeTextarea.vue +48 -0
- package/src/types/DitoTypeTreeList.vue +193 -0
- package/src/types/DitoTypeUpload.vue +503 -0
- package/src/types/index.js +30 -0
- package/src/utils/SchemaGraph.js +147 -0
- package/src/utils/accessor.js +75 -0
- package/src/utils/agent.js +47 -0
- package/src/utils/data.js +92 -0
- package/src/utils/filter.js +266 -0
- package/src/utils/math.js +14 -0
- package/src/utils/options.js +48 -0
- package/src/utils/path.js +5 -0
- package/src/utils/resource.js +44 -0
- package/src/utils/route.js +53 -0
- package/src/utils/schema.js +1121 -0
- package/src/utils/type.js +81 -0
- package/src/utils/uid.js +15 -0
- package/src/utils/units.js +5 -0
- package/src/validators/_creditcard.js +6 -0
- package/src/validators/_decimals.js +11 -0
- package/src/validators/_domain.js +6 -0
- package/src/validators/_email.js +6 -0
- package/src/validators/_hostname.js +6 -0
- package/src/validators/_integer.js +6 -0
- package/src/validators/_max.js +6 -0
- package/src/validators/_min.js +6 -0
- package/src/validators/_password.js +5 -0
- package/src/validators/_range.js +6 -0
- package/src/validators/_required.js +9 -0
- package/src/validators/_url.js +6 -0
- package/src/validators/index.js +12 -0
- package/src/verbs.js +17 -0
- package/types/index.d.ts +3298 -0
- package/types/tests/admin.test-d.ts +27 -0
- package/types/tests/component-buttons.test-d.ts +44 -0
- package/types/tests/component-list.test-d.ts +159 -0
- package/types/tests/component-misc.test-d.ts +137 -0
- package/types/tests/component-object.test-d.ts +69 -0
- package/types/tests/component-section.test-d.ts +174 -0
- package/types/tests/component-select.test-d.ts +107 -0
- package/types/tests/components.test-d.ts +81 -0
- package/types/tests/context.test-d.ts +31 -0
- package/types/tests/fixtures.ts +24 -0
- package/types/tests/form.test-d.ts +109 -0
- package/types/tests/instance.test-d.ts +20 -0
- package/types/tests/schema-features.test-d.ts +402 -0
- package/types/tests/variance.test-d.ts +125 -0
- package/types/tests/view.test-d.ts +146 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
3
|
+
|
|
4
|
+
// @vue/component
|
|
5
|
+
export default DitoTypeComponent.register('panel', {
|
|
6
|
+
defaultValue: () => undefined, // Callback to override `defaultValue: null`
|
|
7
|
+
excludeValue: true,
|
|
8
|
+
generateLabel: false,
|
|
9
|
+
omitSpacing: true,
|
|
10
|
+
|
|
11
|
+
getPanelSchema(api, schema) {
|
|
12
|
+
// For a TypePanel, the component schema is also the panel schema, but
|
|
13
|
+
// remove the added name, so it doesn't get appended twice to data-path.
|
|
14
|
+
const { name, ...panel } = schema
|
|
15
|
+
return panel
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
progress.dito-progress(
|
|
3
|
+
:id="dataPath"
|
|
4
|
+
ref="element"
|
|
5
|
+
:value="progressValue"
|
|
6
|
+
:max="progressMax"
|
|
7
|
+
v-bind="attributes"
|
|
8
|
+
)
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
13
|
+
import NumberMixin from '../mixins/NumberMixin.js'
|
|
14
|
+
|
|
15
|
+
// @vue/component
|
|
16
|
+
export default DitoTypeComponent.register('progress', {
|
|
17
|
+
mixins: [NumberMixin],
|
|
18
|
+
computed: {
|
|
19
|
+
progressValue() {
|
|
20
|
+
let { value, range, step } = this
|
|
21
|
+
if (value !== null) {
|
|
22
|
+
if (range) {
|
|
23
|
+
value -= range[0]
|
|
24
|
+
}
|
|
25
|
+
if (step) {
|
|
26
|
+
value = Math.round(value / step) * step
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
value = ''
|
|
30
|
+
}
|
|
31
|
+
return value
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
progressMax() {
|
|
35
|
+
const { range } = this
|
|
36
|
+
return range ? range[1] - range[0] : null
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
ul.dito-radio-buttons(
|
|
3
|
+
:id="dataPath"
|
|
4
|
+
:class="`dito-layout--${schema.layout || 'vertical'}`"
|
|
5
|
+
)
|
|
6
|
+
li(
|
|
7
|
+
v-for="option in options"
|
|
8
|
+
)
|
|
9
|
+
label
|
|
10
|
+
input.dito-radio-button(
|
|
11
|
+
ref="element"
|
|
12
|
+
v-model="selectedValue"
|
|
13
|
+
type="radio"
|
|
14
|
+
:value="getValueForOption(option)"
|
|
15
|
+
v-bind="attributes"
|
|
16
|
+
)
|
|
17
|
+
| {{ getLabelForOption(option) }}
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
22
|
+
import OptionsMixin from '../mixins/OptionsMixin.js'
|
|
23
|
+
|
|
24
|
+
// @vue/component
|
|
25
|
+
export default DitoTypeComponent.register('radio', {
|
|
26
|
+
mixins: [OptionsMixin],
|
|
27
|
+
|
|
28
|
+
nativeField: true,
|
|
29
|
+
defaultWidth: 'auto'
|
|
30
|
+
})
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<style lang="scss">
|
|
34
|
+
@import '../styles/_imports';
|
|
35
|
+
|
|
36
|
+
.dito-radio-buttons {
|
|
37
|
+
label {
|
|
38
|
+
@extend %input-borderless;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.dito-radio-button {
|
|
42
|
+
margin-right: $form-spacing;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
.dito-section(:class="{ 'dito-section--labelled': hasLabel }")
|
|
3
|
+
DitoSchemaInlined.dito-section__schema(
|
|
4
|
+
:schema="getItemFormSchema(schema, item, context)"
|
|
5
|
+
:dataPath="dataPath"
|
|
6
|
+
:data="item"
|
|
7
|
+
:meta="meta"
|
|
8
|
+
:store="store"
|
|
9
|
+
:label="label"
|
|
10
|
+
:info="info"
|
|
11
|
+
:padding="hasLabel ? 'nested' : 'inlined'"
|
|
12
|
+
:disabled="disabled"
|
|
13
|
+
:collapsed="collapsed"
|
|
14
|
+
:collapsible="collapsible"
|
|
15
|
+
:labelNode="labelNode"
|
|
16
|
+
)
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
21
|
+
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
22
|
+
import { getItemFormSchema, processSchemaComponents } from '../utils/schema.js'
|
|
23
|
+
|
|
24
|
+
// @vue/component
|
|
25
|
+
export default DitoTypeComponent.register('section', {
|
|
26
|
+
defaultValue: () => undefined, // Callback to override `defaultValue: null`
|
|
27
|
+
ignoreMissingValue: ({ schema }) => !schema.nested && !('default' in schema),
|
|
28
|
+
defaultNested: false,
|
|
29
|
+
generateLabel: false,
|
|
30
|
+
|
|
31
|
+
computed: {
|
|
32
|
+
item() {
|
|
33
|
+
return this.nested ? this.value : this.data
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
hasLabel() {
|
|
37
|
+
return !!this.schema.label
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
collapsible: getSchemaAccessor('collapsible', {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
}),
|
|
44
|
+
|
|
45
|
+
collapsed: getSchemaAccessor('collapsed', {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false,
|
|
48
|
+
get(collapsed) {
|
|
49
|
+
return collapsed && this.collapsible
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
methods: {
|
|
55
|
+
getItemFormSchema
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
async processSchema(api, schema, name, routes, level) {
|
|
59
|
+
// Process section components so their forms get resolved too.
|
|
60
|
+
await processSchemaComponents(api, schema, routes, level)
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<style lang="scss">
|
|
66
|
+
@import '../styles/_imports';
|
|
67
|
+
|
|
68
|
+
.dito-section {
|
|
69
|
+
&--labelled {
|
|
70
|
+
border: $border-width solid transparent;
|
|
71
|
+
border-radius: $border-radius;
|
|
72
|
+
transition: border-color 0.2s $ease-out-quart;
|
|
73
|
+
margin-top: $form-spacing-half;
|
|
74
|
+
|
|
75
|
+
&:has(.dito-schema--open) {
|
|
76
|
+
border-color: $border-color;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
//- Nesting is needed to make an arrow appear over the select item:
|
|
3
|
+
.dito-select
|
|
4
|
+
.dito-select__inner
|
|
5
|
+
DitoAffixes(
|
|
6
|
+
:items="schema.prefix"
|
|
7
|
+
position="prefix"
|
|
8
|
+
mode="input"
|
|
9
|
+
absolute
|
|
10
|
+
:disabled="disabled"
|
|
11
|
+
:parentContext="context"
|
|
12
|
+
)
|
|
13
|
+
select(
|
|
14
|
+
:id="dataPath"
|
|
15
|
+
ref="element"
|
|
16
|
+
v-model="selectedValue"
|
|
17
|
+
v-bind="attributes"
|
|
18
|
+
@mousedown="populate = true"
|
|
19
|
+
@focus="populate = true"
|
|
20
|
+
)
|
|
21
|
+
template(
|
|
22
|
+
v-if="populate"
|
|
23
|
+
)
|
|
24
|
+
template(
|
|
25
|
+
v-for="option in options"
|
|
26
|
+
)
|
|
27
|
+
optgroup(
|
|
28
|
+
v-if="groupBy"
|
|
29
|
+
:label="option[groupByLabel]"
|
|
30
|
+
)
|
|
31
|
+
option(
|
|
32
|
+
v-for="opt in option[groupByOptions]"
|
|
33
|
+
:value="getValueForOption(opt)"
|
|
34
|
+
) {{ getLabelForOption(opt) }}
|
|
35
|
+
option(
|
|
36
|
+
v-else
|
|
37
|
+
:value="getValueForOption(option)"
|
|
38
|
+
) {{ getLabelForOption(option) }}
|
|
39
|
+
template(
|
|
40
|
+
v-else-if="selectedOption"
|
|
41
|
+
)
|
|
42
|
+
option(:value="selectedValue") {{ getLabelForOption(selectedOption) }}
|
|
43
|
+
DitoAffixes(
|
|
44
|
+
:items="schema.suffix"
|
|
45
|
+
position="suffix"
|
|
46
|
+
mode="input"
|
|
47
|
+
absolute
|
|
48
|
+
:clearable="showClearButton"
|
|
49
|
+
:disabled="disabled"
|
|
50
|
+
:inlineInfo="inlineInfo"
|
|
51
|
+
:parentContext="context"
|
|
52
|
+
@clear="clear"
|
|
53
|
+
)
|
|
54
|
+
//- Edit button is never disabled, even if the field is disabled.
|
|
55
|
+
DitoEditButtons(
|
|
56
|
+
v-if="editable"
|
|
57
|
+
:schema="schema"
|
|
58
|
+
:dataPath="dataPath"
|
|
59
|
+
:data="data"
|
|
60
|
+
:meta="meta"
|
|
61
|
+
:store="store"
|
|
62
|
+
:disabled="false"
|
|
63
|
+
:editable="editable"
|
|
64
|
+
:editPath="editPath"
|
|
65
|
+
)
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<script>
|
|
69
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
70
|
+
import OptionsMixin from '../mixins/OptionsMixin.js'
|
|
71
|
+
import DitoAffixes from '../components/DitoAffixes.vue'
|
|
72
|
+
|
|
73
|
+
// @vue/component
|
|
74
|
+
export default DitoTypeComponent.register('select', {
|
|
75
|
+
mixins: [OptionsMixin],
|
|
76
|
+
components: { DitoAffixes },
|
|
77
|
+
|
|
78
|
+
nativeField: true,
|
|
79
|
+
|
|
80
|
+
data() {
|
|
81
|
+
return {
|
|
82
|
+
// Disable lazy-population for now.
|
|
83
|
+
// TODO: Set to `false` Once lineto e2e tests address their issues.
|
|
84
|
+
populate: true
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<style lang="scss">
|
|
91
|
+
@import '../styles/_imports';
|
|
92
|
+
|
|
93
|
+
.dito-select {
|
|
94
|
+
display: inline-flex;
|
|
95
|
+
position: relative;
|
|
96
|
+
|
|
97
|
+
select {
|
|
98
|
+
@extend %input;
|
|
99
|
+
|
|
100
|
+
padding-right: $select-arrow-width;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// `&___inner` is needed to make the edit buttons appear to the right of the
|
|
104
|
+
// select:
|
|
105
|
+
&__inner {
|
|
106
|
+
flex: 1;
|
|
107
|
+
position: relative;
|
|
108
|
+
|
|
109
|
+
&::before {
|
|
110
|
+
@include arrow($select-arrow-size);
|
|
111
|
+
|
|
112
|
+
position: absolute;
|
|
113
|
+
bottom: $select-arrow-bottom;
|
|
114
|
+
right: $select-arrow-right;
|
|
115
|
+
|
|
116
|
+
.dito-container--disabled & {
|
|
117
|
+
border-color: $color-disabled;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.dito-edit-buttons {
|
|
123
|
+
margin-left: $form-spacing-half;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Handle width fill separately due to required nesting of select:
|
|
127
|
+
&.dito-component--fill {
|
|
128
|
+
select {
|
|
129
|
+
width: 100%;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
</style>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
.dito-slider
|
|
3
|
+
input.dito-range(
|
|
4
|
+
:id="dataPath"
|
|
5
|
+
ref="element"
|
|
6
|
+
v-model="inputValue"
|
|
7
|
+
type="range"
|
|
8
|
+
v-bind="attributes"
|
|
9
|
+
:min="min"
|
|
10
|
+
:max="max"
|
|
11
|
+
:step="stepValue"
|
|
12
|
+
)
|
|
13
|
+
DitoInput.dito-number(
|
|
14
|
+
v-if="input"
|
|
15
|
+
v-model="inputValue"
|
|
16
|
+
type="number"
|
|
17
|
+
v-bind="attributes"
|
|
18
|
+
:min="min"
|
|
19
|
+
:max="max"
|
|
20
|
+
:step="stepValue"
|
|
21
|
+
)
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
26
|
+
import NumberMixin from '../mixins/NumberMixin.js'
|
|
27
|
+
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
28
|
+
import { DitoInput } from '@ditojs/ui/src'
|
|
29
|
+
|
|
30
|
+
// @vue/component
|
|
31
|
+
export default DitoTypeComponent.register('slider', {
|
|
32
|
+
mixins: [NumberMixin],
|
|
33
|
+
components: { DitoInput },
|
|
34
|
+
nativeField: true,
|
|
35
|
+
|
|
36
|
+
computed: {
|
|
37
|
+
// TODO: Rename to `showInput`?
|
|
38
|
+
input: getSchemaAccessor('input', {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: true
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style lang="scss">
|
|
47
|
+
@import '../styles/_imports';
|
|
48
|
+
|
|
49
|
+
.dito-slider {
|
|
50
|
+
@extend %input;
|
|
51
|
+
|
|
52
|
+
display: flex;
|
|
53
|
+
|
|
54
|
+
.dito-range {
|
|
55
|
+
flex: auto;
|
|
56
|
+
height: calc(1em * var(--line-height));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.dito-number {
|
|
60
|
+
border: 0;
|
|
61
|
+
padding: 0;
|
|
62
|
+
text-align: right;
|
|
63
|
+
font-variant-numeric: tabular-nums;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!-- eslint-disable vue/valid-template-root -->
|
|
2
|
+
<template lang="pug"></template>
|
|
3
|
+
<script>
|
|
4
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
5
|
+
// @vue/component
|
|
6
|
+
export default DitoTypeComponent.register('spacer', {
|
|
7
|
+
defaultValue: () => undefined, // Callback to override `defaultValue: null`
|
|
8
|
+
excludeValue: true,
|
|
9
|
+
generateLabel: false
|
|
10
|
+
})
|
|
11
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
DitoSwitch.dito-switch(
|
|
3
|
+
:id="dataPath"
|
|
4
|
+
ref="element"
|
|
5
|
+
v-model="value"
|
|
6
|
+
:labels="labels"
|
|
7
|
+
v-bind="attributes"
|
|
8
|
+
)
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
13
|
+
import { DitoSwitch } from '@ditojs/ui/src'
|
|
14
|
+
|
|
15
|
+
// @vue/component
|
|
16
|
+
export default DitoTypeComponent.register('switch', {
|
|
17
|
+
defaultValue: false,
|
|
18
|
+
defaultWidth: 'auto',
|
|
19
|
+
|
|
20
|
+
components: {
|
|
21
|
+
DitoSwitch
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
computed: {
|
|
25
|
+
labels() {
|
|
26
|
+
return this.schema.labels
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<style lang="scss">
|
|
33
|
+
@import '../styles/_imports';
|
|
34
|
+
|
|
35
|
+
.dito-switch {
|
|
36
|
+
.dito-switch-label {
|
|
37
|
+
font-size: $font-size-small;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
DitoInput.dito-text(
|
|
3
|
+
:id="dataPath"
|
|
4
|
+
ref="element"
|
|
5
|
+
v-model="inputValue"
|
|
6
|
+
:type="inputType"
|
|
7
|
+
v-bind="attributes"
|
|
8
|
+
)
|
|
9
|
+
template(#prefix)
|
|
10
|
+
DitoAffixes(
|
|
11
|
+
:items="schema.prefix"
|
|
12
|
+
position="prefix"
|
|
13
|
+
mode="input"
|
|
14
|
+
:disabled="disabled"
|
|
15
|
+
:parentContext="context"
|
|
16
|
+
)
|
|
17
|
+
template(#suffix)
|
|
18
|
+
DitoAffixes(
|
|
19
|
+
:items="schema.suffix"
|
|
20
|
+
position="suffix"
|
|
21
|
+
mode="input"
|
|
22
|
+
:clearable="showClearButton"
|
|
23
|
+
:disabled="disabled"
|
|
24
|
+
:inlineInfo="inlineInfo"
|
|
25
|
+
:parentContext="context"
|
|
26
|
+
@clear="clear"
|
|
27
|
+
)
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
32
|
+
import TextMixin from '../mixins/TextMixin'
|
|
33
|
+
import DitoAffixes from '../components/DitoAffixes.vue'
|
|
34
|
+
import { DitoInput } from '@ditojs/ui/src'
|
|
35
|
+
|
|
36
|
+
const maskedPassword = '****************'
|
|
37
|
+
|
|
38
|
+
export default DitoTypeComponent.register(
|
|
39
|
+
[
|
|
40
|
+
'text',
|
|
41
|
+
'email',
|
|
42
|
+
'url',
|
|
43
|
+
'hostname',
|
|
44
|
+
'domain',
|
|
45
|
+
'tel',
|
|
46
|
+
'password',
|
|
47
|
+
'creditcard'
|
|
48
|
+
],
|
|
49
|
+
// @vue/component
|
|
50
|
+
{
|
|
51
|
+
mixins: [TextMixin],
|
|
52
|
+
components: { DitoInput, DitoAffixes },
|
|
53
|
+
nativeField: true,
|
|
54
|
+
textField: true,
|
|
55
|
+
ignoreMissingValue: ({ schema }) => schema.type === 'password',
|
|
56
|
+
|
|
57
|
+
computed: {
|
|
58
|
+
inputType() {
|
|
59
|
+
return (
|
|
60
|
+
{
|
|
61
|
+
creditcard: 'text',
|
|
62
|
+
hostname: 'text',
|
|
63
|
+
domain: 'text'
|
|
64
|
+
}[this.type] ||
|
|
65
|
+
this.type
|
|
66
|
+
)
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
inputValue: {
|
|
70
|
+
get() {
|
|
71
|
+
return (
|
|
72
|
+
this.type === 'password' &&
|
|
73
|
+
this.value === undefined &&
|
|
74
|
+
!this.focused
|
|
75
|
+
)
|
|
76
|
+
? maskedPassword
|
|
77
|
+
: this.value
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
set(value) {
|
|
81
|
+
this.value = value
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
methods: {
|
|
87
|
+
getValidations() {
|
|
88
|
+
const rule = {
|
|
89
|
+
email: 'email',
|
|
90
|
+
url: 'url',
|
|
91
|
+
hostname: 'hostname',
|
|
92
|
+
domain: 'domain',
|
|
93
|
+
password: 'password',
|
|
94
|
+
creditcard: 'creditcard'
|
|
95
|
+
}[this.type]
|
|
96
|
+
return rule ? { [rule]: true } : {}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
</script>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
textarea.dito-textarea.dito-input(
|
|
3
|
+
:id="dataPath"
|
|
4
|
+
ref="element"
|
|
5
|
+
v-model="value"
|
|
6
|
+
v-bind="attributes"
|
|
7
|
+
:rows="lines"
|
|
8
|
+
:class="{ 'dito-textarea--resizable': resizable }"
|
|
9
|
+
)
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
14
|
+
import TextMixin from '../mixins/TextMixin'
|
|
15
|
+
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
16
|
+
|
|
17
|
+
// @vue/component
|
|
18
|
+
export default DitoTypeComponent.register('textarea', {
|
|
19
|
+
mixins: [TextMixin],
|
|
20
|
+
nativeField: true,
|
|
21
|
+
textField: true,
|
|
22
|
+
|
|
23
|
+
computed: {
|
|
24
|
+
lines() {
|
|
25
|
+
return this.schema.lines || 4
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
resizable: getSchemaAccessor('resizable', {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<style lang="scss">
|
|
37
|
+
@import '../styles/_imports';
|
|
38
|
+
|
|
39
|
+
.dito-textarea {
|
|
40
|
+
display: block;
|
|
41
|
+
resize: none;
|
|
42
|
+
min-height: calc(1em * var(--line-height) + #{2 * $input-padding-ver});
|
|
43
|
+
|
|
44
|
+
&--resizable {
|
|
45
|
+
resize: vertical;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
</style>
|