2023-08-21 01:51:35 -04:00
|
|
|
<script setup lang="ts">
|
2023-10-17 16:32:59 -04:00
|
|
|
import TooltippedLabel from "@/components/common/pv-tooltipped-label.vue";
|
2023-08-21 01:51:35 -04:00
|
|
|
import { computed } from "vue";
|
|
|
|
|
|
2023-08-31 16:56:58 -04:00
|
|
|
const props = withDefaults(
|
|
|
|
|
defineProps<{
|
|
|
|
|
label?: string;
|
|
|
|
|
tooltip?: string;
|
|
|
|
|
// TODO fully update v-model usage in custom components on Vue3 update
|
|
|
|
|
value: boolean;
|
|
|
|
|
disabled?: boolean;
|
|
|
|
|
labelCols?: number;
|
|
|
|
|
switchCols?: number;
|
2025-01-07 08:45:39 -05:00
|
|
|
dense?: boolean;
|
2023-08-31 16:56:58 -04:00
|
|
|
}>(),
|
|
|
|
|
{
|
|
|
|
|
disabled: false,
|
2025-01-01 03:04:20 -05:00
|
|
|
labelCols: 2,
|
2025-01-07 08:45:39 -05:00
|
|
|
switchCols: 8,
|
|
|
|
|
dense: false
|
2023-08-31 16:56:58 -04:00
|
|
|
}
|
|
|
|
|
);
|
2023-08-21 01:51:35 -04:00
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
2023-08-31 16:56:58 -04:00
|
|
|
(e: "input", value: boolean): void;
|
2023-08-21 01:51:35 -04:00
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
const localValue = computed({
|
|
|
|
|
get: () => props.value,
|
2023-08-31 16:56:58 -04:00
|
|
|
set: (v) => emit("input", v)
|
2023-08-21 01:51:35 -04:00
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
2019-09-28 02:17:18 +03:00
|
|
|
<template>
|
2025-01-07 08:45:39 -05:00
|
|
|
<div class="d-flex">
|
|
|
|
|
<v-col :cols="12 - switchCols || labelCols" class="d-flex align-center pl-0">
|
|
|
|
|
<tooltipped-label :tooltip="tooltip" :label="label" />
|
|
|
|
|
</v-col>
|
|
|
|
|
<v-col :cols="switchCols || 12 - labelCols" class="d-flex align-center pr-0">
|
|
|
|
|
<v-switch v-model="localValue" dark :disabled="disabled" color="#ffd843" hide-details="auto" class="pb-1" />
|
|
|
|
|
</v-col>
|
2020-06-26 04:39:14 -07:00
|
|
|
</div>
|
2019-09-28 02:17:18 +03:00
|
|
|
</template>
|
2025-01-08 16:46:31 -05:00
|
|
|
<style scoped>
|
2025-01-07 08:45:39 -05:00
|
|
|
.v-input--selection-controls {
|
|
|
|
|
margin-top: 0px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|