mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-02 02:51:40 +00:00
UI patches (#905)
- Show 0 clients when NT server props are undefined - Add Prettier --------- Co-authored-by: Matthew Morley <matthew.morley.ca@gmail.com>
This commit is contained in:
@@ -2,38 +2,40 @@
|
||||
import { computed } from "vue";
|
||||
import TooltippedLabel from "@/components/common/cv-tooltipped-label.vue";
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
label?: string,
|
||||
tooltip?: string,
|
||||
// TODO fully update v-model usage in custom components on Vue3 update
|
||||
value: string,
|
||||
disabled?: boolean,
|
||||
errorMessage?: string,
|
||||
placeholder?: string,
|
||||
labelCols?: number,
|
||||
inputCols?: number,
|
||||
rules?: ((v: string) => boolean | string)[]
|
||||
}>(), {
|
||||
disabled: false,
|
||||
inputCols: 8
|
||||
});
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
label?: string;
|
||||
tooltip?: string;
|
||||
// TODO fully update v-model usage in custom components on Vue3 update
|
||||
value: string;
|
||||
disabled?: boolean;
|
||||
errorMessage?: string;
|
||||
placeholder?: string;
|
||||
labelCols?: number;
|
||||
inputCols?: number;
|
||||
rules?: ((v: string) => boolean | string)[];
|
||||
}>(),
|
||||
{
|
||||
disabled: false,
|
||||
inputCols: 8
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "input", value: string): void
|
||||
(e: "onEnter", value: string): void
|
||||
(e: "onEscape"): void
|
||||
(e: "input", value: string): void;
|
||||
(e: "onEnter", value: string): void;
|
||||
(e: "onEscape"): void;
|
||||
}>();
|
||||
|
||||
const localValue = computed({
|
||||
get: () => props.value,
|
||||
set: v => emit("input", v)
|
||||
set: (v) => emit("input", v)
|
||||
});
|
||||
|
||||
|
||||
const handleKeydown = ({ key }) => {
|
||||
switch (key) {
|
||||
case "Enter":
|
||||
if(!(props.rules || []).some(v => v(localValue.value) === false || typeof v(localValue.value) === "string")) {
|
||||
if (!(props.rules || []).some((v) => v(localValue.value) === false || typeof v(localValue.value) === "string")) {
|
||||
emit("onEnter", localValue.value);
|
||||
}
|
||||
break;
|
||||
@@ -42,20 +44,13 @@ const handleKeydown = ({ key }) => {
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-row
|
||||
dense
|
||||
align="center"
|
||||
>
|
||||
<v-col :cols="labelCols || (12 - inputCols)">
|
||||
<tooltipped-label
|
||||
:tooltip="tooltip"
|
||||
:label="label"
|
||||
/>
|
||||
<v-row dense align="center">
|
||||
<v-col :cols="labelCols || 12 - inputCols">
|
||||
<tooltipped-label :tooltip="tooltip" :label="label" />
|
||||
</v-col>
|
||||
|
||||
<v-col :cols="inputCols">
|
||||
|
||||
Reference in New Issue
Block a user