misc form items style and linting fixes

This commit is contained in:
axolotle 2022-03-02 19:46:19 +01:00
parent 9d02438348
commit 52c8fad43a
7 changed files with 48 additions and 48 deletions

View file

@ -1,7 +1,7 @@
<template> <template>
<routable-tabs <routable-tabs
:routes="routes_" :routes="routes_"
v-bind="{ panels, forms, v: $v }" v-bind="{ panels, forms, v: $v, ...$attrs }"
v-on="$listeners" v-on="$listeners"
/> />
</template> </template>
@ -49,10 +49,3 @@ export default {
} }
} }
</script> </script>
<style lang="scss" scoped>
.card-title {
margin-bottom: 1em;
border-bottom: solid 1px #aaa;
}
</style>

View file

@ -28,15 +28,18 @@
<!-- Render description --> <!-- Render description -->
<template v-if="description || link"> <template v-if="description || link">
<div class="d-flex"> <div class="d-flex">
<b-link v-if="link" :to="link" :href="link.href" <b-link
class="ml-auto" v-if="link"
:to="link" :href="link.href" class="ml-auto"
> >
{{ link.text }} {{ link.text }}
</b-link> </b-link>
</div> </div>
<vue-showdown :markdown="description" flavor="github" v-if="description" <vue-showdown
:class="{ ['alert p-1 px-2 alert-' + descriptionVariant]: descriptionVariant }" v-if="description"
:markdown="description" flavor="github"
:class="{ ['alert p-1 px-2 alert-' + descriptionVariant]: descriptionVariant }"
/> />
</template> </template>
<!-- Slot available to overwrite the one above --> <!-- Slot available to overwrite the one above -->
@ -76,8 +79,8 @@ export default {
if ('label' in attrs) { if ('label' in attrs) {
const defaultAttrs = { const defaultAttrs = {
'label-cols-md': 4, 'label-cols-md': 4,
'label-cols-lg': 2, 'label-cols-lg': 3,
'label-class': 'font-weight-bold' 'label-class': ['font-weight-bold', 'py-0']
} }
if (!('label-cols' in attrs)) { if (!('label-cols' in attrs)) {
for (const attr in defaultAttrs) { for (const attr in defaultAttrs) {

View file

@ -2,7 +2,6 @@
<b-input <b-input
:value="value" :value="value"
:id="id" :id="id"
v-on="$listeners"
:placeholder="placeholder" :placeholder="placeholder"
:type="type" :type="type"
:state="state" :state="state"
@ -12,6 +11,7 @@
:step="step" :step="step"
:trim="trim" :trim="trim"
:autocomplete="autocomplete_" :autocomplete="autocomplete_"
v-on="$listeners"
@blur="$parent.$emit('touch', name)" @blur="$parent.$emit('touch', name)"
/> />
</template> </template>
@ -21,11 +21,6 @@
export default { export default {
name: 'InputItem', name: 'InputItem',
data () {
return {
autocomplete_: (this.autocomplete) ? this.autocomplete : (this.type === 'password') ? 'new-password' : null
}
},
props: { props: {
value: { type: [String, Number], default: null }, value: { type: [String, Number], default: null },
id: { type: String, default: null }, id: { type: String, default: null },
@ -40,6 +35,12 @@ export default {
autocomplete: { type: String, default: null }, autocomplete: { type: String, default: null },
pattern: { type: Object, default: null }, pattern: { type: Object, default: null },
name: { type: String, default: null } name: { type: String, default: null }
},
data () {
return {
autocomplete_: (this.autocomplete) ? this.autocomplete : (this.type === 'password') ? 'new-password' : null
}
} }
} }
</script> </script>

View file

@ -1,8 +1,10 @@
<template> <template>
<b-alert class="d-flex" :variant="type" show> <b-alert class="d-flex flex-column flex-md-row align-items-center" :variant="type" show>
<icon :iname="icon_" class="mr-1 mt-1" /> <icon :iname="icon_" class="mr-md-3 mb-md-0 mb-2" :variant="type" />
<vue-showdown :markdown="label" flavor="github"
tag="span" class="markdown" <vue-showdown
:markdown="label" flavor="github"
tag="span" class="markdown"
/> />
</b-alert> </b-alert>
</template> </template>
@ -11,29 +13,23 @@
export default { export default {
name: 'ReadOnlyAlertItem', name: 'ReadOnlyAlertItem',
data () {
const icons = {
success: 'thumbs-up',
info: 'info-circle',
warning: 'warning',
danger: 'times'
}
return {
icon_: (this.icon) ? this.icon : icons[this.type]
}
},
props: { props: {
id: { type: String, default: null }, id: { type: String, default: null },
label: { type: String, default: null }, label: { type: String, default: null },
type: { type: String, default: null }, type: { type: String, default: null },
icon: { type: String, default: null } icon: { type: String, default: null }
},
computed: {
icon_ () {
const icons = {
success: 'thumbs-up',
info: 'info',
warning: 'exclamation',
danger: 'times'
}
return this.icon || icons[this.type]
}
} }
} }
</script> </script>
<style lang="scss">
.alert p:last-child {
margin-bottom: 0;
}
</style>

View file

@ -1,6 +1,6 @@
<template> <template>
<b-form-textarea <b-form-textarea
v-model="value" :value="value"
:id="id" :id="id"
:placeholder="placeholder" :placeholder="placeholder"
:required="required" :required="required"

View file

@ -102,6 +102,11 @@ body {
} }
} }
h3.card-title {
margin-bottom: 1em;
border-bottom: solid 1px #aaa;
}
// collapse icon // collapse icon
.not-collapsed > .icon { .not-collapsed > .icon {
transform: rotate(-90deg); transform: rotate(-90deg);
@ -165,6 +170,10 @@ body {
} }
} }
.alert p:last-child {
margin-bottom: 0;
}
code { code {
background: ghostwhite; background: ghostwhite;
} }

View file

@ -126,12 +126,10 @@ export default {
}, },
methods: { methods: {
onSubmit () { async onSubmit () {
const domainType = this.selected const domainType = this.selected
this.$emit('submit', { const domain = await formatFormDataValue(this.form[domainType])
domain: formatFormDataValue(this.form[domainType]), this.$emit('submit', { domain, domainType })
domainType
})
} }
}, },