mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-24 07:14:04 +00:00
9c9a086788
* made sure that the ActionSelect'or has correct accessibiltiy tags * fixed linting error * improved the ActionInputs accessibility
93 lines
2.2 KiB
Vue
93 lines
2.2 KiB
Vue
<template>
|
|
<div class="input-group mb-3">
|
|
<input
|
|
ref="input"
|
|
v-model="model"
|
|
class="form-control"
|
|
:type="type"
|
|
:placeholder="placeholder"
|
|
:disabled="!enabled"
|
|
>
|
|
<button class="btn btn-outline-primary" @click="action()" :aria-label="actionAriaLabel">
|
|
<font-awesome-icon :icon="icon" />
|
|
</button>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
/**
|
|
* Generic input field with a customizable action on the right.
|
|
* Action is passed in as a function.
|
|
*/
|
|
export default {
|
|
props: {
|
|
/**
|
|
* The value of the input field.
|
|
*/
|
|
modelValue: {
|
|
type: String,
|
|
default: ""
|
|
},
|
|
/**
|
|
* Whether the input field is enabled / disabled.
|
|
*/
|
|
enabled: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
/**
|
|
* Placeholder text for the input field.
|
|
*/
|
|
placeholder: {
|
|
type: String,
|
|
default: ""
|
|
},
|
|
/**
|
|
* The icon displayed in the right button of the input field.
|
|
* Accepts a Font Awesome icon string identifier.
|
|
* @example "plus"
|
|
*/
|
|
icon: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
/**
|
|
* The input type of the input field.
|
|
* @example "email"
|
|
*/
|
|
type: {
|
|
type: String,
|
|
default: "text",
|
|
},
|
|
/**
|
|
* The action to be performed when the button is clicked.
|
|
* Action is passed in as a function.
|
|
*/
|
|
action: {
|
|
type: Function,
|
|
default: () => {},
|
|
},
|
|
/**
|
|
* The aria-label of the action button
|
|
*/
|
|
actionAriaLabel: {
|
|
type: String,
|
|
required: true,
|
|
}
|
|
},
|
|
emits: [ "update:modelValue" ],
|
|
computed: {
|
|
/**
|
|
* Send value update to parent on change.
|
|
*/
|
|
model: {
|
|
get() {
|
|
return this.modelValue;
|
|
},
|
|
set(value) {
|
|
this.$emit("update:modelValue", value);
|
|
}
|
|
}
|
|
},
|
|
};
|
|
</script>
|