Label support for DatePicker

pull/6449/head
Cagatay Civici 2024-09-20 13:47:24 +03:00
parent 927d156df6
commit 8e3a20d2c6
4 changed files with 96 additions and 8 deletions

View File

@ -2,10 +2,20 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>A floating label appears on top of the input field when focused. Visit <PrimeVueNuxtLink to="/floatlabel">FloatLabel</PrimeVueNuxtLink> documentation for more information.</p> <p>A floating label appears on top of the input field when focused. Visit <PrimeVueNuxtLink to="/floatlabel">FloatLabel</PrimeVueNuxtLink> documentation for more information.</p>
</DocSectionText> </DocSectionText>
<div class="card flex justify-center"> <div class="card flex flex-wrap justify-center items-end gap-4">
<FloatLabel> <FloatLabel>
<DatePicker v-model="date" inputId="birth_date" /> <DatePicker v-model="value1" inputId="over_label" />
<label for="birth_date">Birth Date</label> <label for="over_label">Over Label</label>
</FloatLabel>
<FloatLabel variant="in">
<DatePicker v-model="value2" inputId="in_label" />
<label for="in_label">In Label</label>
</FloatLabel>
<FloatLabel variant="on">
<DatePicker v-model="value3" inputId="on_label" />
<label for="on_label">On Label</label>
</FloatLabel> </FloatLabel>
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
@ -15,7 +25,9 @@
export default { export default {
data() { data() {
return { return {
date: null, value1: null,
value2: null,
value3: null,
code: { code: {
basic: ` basic: `
<FloatLabel> <FloatLabel>
@ -37,8 +49,10 @@ export default {
export default { export default {
data() { data() {
return { return {
date: null value1: null,
}; value2: null,
value3: null,
}
} }
}; };
<\/script> <\/script>
@ -56,7 +70,9 @@ export default {
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
const date = ref(); const value1 = ref(null);
const value2 = ref(null);
const value3 = ref(null);
<\/script> <\/script>
` `
} }

View File

@ -0,0 +1,66 @@
<template>
<DocSectionText v-bind="$attrs">
<p>IftaLabel is used to create infield top aligned labels. Visit <PrimeVueNuxtLink to="/iftalabel">IftaLabel</PrimeVueNuxtLink> documentation for more information.</p>
</DocSectionText>
<div class="card flex justify-center">
<IftaLabel>
<DatePicker v-model="value" inputId="date" />
<label for="date">Date</label>
</IftaLabel>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
value: null,
code: {
basic: `
<IftaLabel>
<DatePicker v-model="value" inputId="date" />
<label for="date">Date</label>
</IftaLabel>
`,
options: `
<template>
<div class="card flex justify-center">
<IftaLabel>
<DatePicker v-model="value" inputId="date" />
<label for="date">Date</label>
</IftaLabel>
</div>
</template>
<script setup>
export default {
data() {
return {
value: null
}
}
}
<\/script>
`,
composition: `
<template>
<div class="card flex justify-center">
<IftaLabel>
<DatePicker v-model="value" inputId="date" />
<label for="date">Date</label>
</IftaLabel>
</div>
</template>
<script setup>
import { ref } from 'vue';
const value = ref(null);
<\/script>
`
}
};
}
};
</script>

View File

@ -12,6 +12,7 @@ import FilledDoc from '@/doc/datepicker/FilledDoc.vue';
import FloatLabelDoc from '@/doc/datepicker/FloatLabelDoc.vue'; import FloatLabelDoc from '@/doc/datepicker/FloatLabelDoc.vue';
import FormatDoc from '@/doc/datepicker/FormatDoc.vue'; import FormatDoc from '@/doc/datepicker/FormatDoc.vue';
import IconDoc from '@/doc/datepicker/IconDoc.vue'; import IconDoc from '@/doc/datepicker/IconDoc.vue';
import IftaLabelDoc from '@/doc/datepicker/IftaLabelDoc.vue';
import ImportDoc from '@/doc/datepicker/ImportDoc.vue'; import ImportDoc from '@/doc/datepicker/ImportDoc.vue';
import InlineDoc from '@/doc/datepicker/InlineDoc.vue'; import InlineDoc from '@/doc/datepicker/InlineDoc.vue';
import InvalidDoc from '@/doc/datepicker/InvalidDoc.vue'; import InvalidDoc from '@/doc/datepicker/InvalidDoc.vue';
@ -110,6 +111,11 @@ export default {
label: 'Float Label', label: 'Float Label',
component: FloatLabelDoc component: FloatLabelDoc
}, },
{
id: 'iftalabel',
label: 'Ifta Label',
component: IftaLabelDoc
},
{ {
id: 'filled', id: 'filled',
label: 'Filled', label: 'Filled',

View File

@ -375,7 +375,7 @@ const classes = {
{ {
'p-invalid': props.invalid, 'p-invalid': props.invalid,
'p-inputwrapper-filled': props.modelValue, 'p-inputwrapper-filled': props.modelValue,
'p-inputwrapper-focus': state.focused, 'p-inputwrapper-focus': state.focused || state.overlayVisible,
'p-focus': state.focused || state.overlayVisible, 'p-focus': state.focused || state.overlayVisible,
'p-datepicker-fluid': instance.hasFluid 'p-datepicker-fluid': instance.hasFluid
} }