refactor: #7090 for DatePicker

pull/7007/merge
Mert Sincan 2025-01-14 11:43:06 +00:00
parent 7fb5b3985b
commit f061fc1d02
3 changed files with 3 additions and 16 deletions

View File

@ -167,10 +167,6 @@ export default {
type: String, type: String,
default: null default: null
}, },
id: {
type: String,
default: null
},
inputId: { inputId: {
type: String, type: String,
default: null default: null

View File

@ -736,10 +736,6 @@ export interface DatePickerProps {
* @defaultValue body * @defaultValue body
*/ */
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement; appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
/**
* Identifier of the element.
*/
id?: string | undefined;
/** /**
* Identifier of the underlying input element. * Identifier of the underlying input element.
*/ */

View File

@ -1,5 +1,5 @@
<template> <template>
<span ref="container" :id="d_id" :class="cx('root')" :style="sx('root')" v-bind="ptmi('root')"> <span ref="container" :id="$id" :class="cx('root')" :style="sx('root')" v-bind="ptmi('root')">
<InputText <InputText
v-if="!inline" v-if="!inline"
:ref="inputRef" :ref="inputRef"
@ -537,7 +537,7 @@
import { absolutePosition, addStyle, find, findSingle, getAttribute, getFocusableElements, getIndex, getOuterWidth, isTouchDevice, relativePosition, setAttribute } from '@primeuix/utils/dom'; import { absolutePosition, addStyle, find, findSingle, getAttribute, getFocusableElements, getIndex, getOuterWidth, isTouchDevice, relativePosition, setAttribute } from '@primeuix/utils/dom';
import { localeComparator } from '@primeuix/utils/object'; import { localeComparator } from '@primeuix/utils/object';
import { ZIndex } from '@primeuix/utils/zindex'; import { ZIndex } from '@primeuix/utils/zindex';
import { ConnectedOverlayScrollHandler, UniqueComponentId } from '@primevue/core/utils'; import { ConnectedOverlayScrollHandler } from '@primevue/core/utils';
import CalendarIcon from '@primevue/icons/calendar'; import CalendarIcon from '@primevue/icons/calendar';
import ChevronDownIcon from '@primevue/icons/chevrondown'; import ChevronDownIcon from '@primevue/icons/chevrondown';
import ChevronLeftIcon from '@primevue/icons/chevronleft'; import ChevronLeftIcon from '@primevue/icons/chevronleft';
@ -573,7 +573,6 @@ export default {
typeUpdate: false, typeUpdate: false,
data() { data() {
return { return {
d_id: this.id,
currentMonth: null, currentMonth: null,
currentYear: null, currentYear: null,
currentHour: null, currentHour: null,
@ -588,9 +587,6 @@ export default {
}; };
}, },
watch: { watch: {
id: function (newValue) {
this.d_id = newValue || UniqueComponentId();
},
modelValue(newValue) { modelValue(newValue) {
this.updateCurrentMetaData(); this.updateCurrentMetaData();
@ -639,7 +635,6 @@ export default {
this.updateCurrentMetaData(); this.updateCurrentMetaData();
}, },
mounted() { mounted() {
this.d_id = this.d_id || UniqueComponentId();
this.createResponsiveStyle(); this.createResponsiveStyle();
this.bindMatchMediaListener(); this.bindMatchMediaListener();
@ -2961,7 +2956,7 @@ export default {
return this.numberOfMonths > 1 || this.disabled; return this.numberOfMonths > 1 || this.disabled;
}, },
panelId() { panelId() {
return this.d_id + '_panel'; return this.$id + '_panel';
} }
}, },
components: { components: {