Skip to content

Commit 58ff212

Browse files
committed
refactor!: Remove deprecated props
1 parent 2447bd7 commit 58ff212

File tree

10 files changed

+19
-118
lines changed

10 files changed

+19
-118
lines changed

index.d.ts

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,6 @@ export interface VueDatePickerProps {
147147
required?: boolean;
148148
format?: string | ((date: Date) => string) | ((dates: Date[]) => string);
149149
previewFormat?: string | ((date: Date) => string) | ((dates: Date[]) => string);
150-
/**
151-
* @deprecated
152-
*/
153-
inputClassName?: string;
154-
/**
155-
* @deprecated
156-
*/
157-
menuClassName?: string;
158-
/**
159-
* @deprecated
160-
*/
161-
calendarClassName?: string;
162-
/**
163-
* @deprecated
164-
*/
165-
calendarCellClassName?: string;
166150
hideInputIcon?: boolean;
167151
state?: boolean;
168152
clearable?: boolean;
@@ -196,10 +180,6 @@ export interface VueDatePickerProps {
196180
startDate?: string | Date;
197181
startTime?: PartialTimeObj | PartialTimeObj[];
198182
hideOffsetDates?: boolean;
199-
/**
200-
* @deprecated
201-
*/
202-
autoRange?: number | string;
203183
noToday?: boolean;
204184
noHoursOverlay?: boolean;
205185
noMinutesOverlay?: boolean;
@@ -208,10 +188,6 @@ export interface VueDatePickerProps {
208188
disabledWeekDays?: number[] | string[];
209189
allowedDates?: string[] | Date[];
210190
nowButtonLabel?: string;
211-
/**
212-
* @deprecated
213-
*/
214-
partialRange?: boolean;
215191
monthChangeOnScroll?: boolean | 'inverse';
216192
markers?: DatePickerMarker[];
217193
transitions?:
@@ -244,27 +220,7 @@ export interface VueDatePickerProps {
244220
flow?: ('month' | 'year' | 'calendar' | 'time' | 'minutes' | 'hours' | 'seconds')[];
245221
partialFlow?: boolean;
246222
preventMinMaxNavigation?: boolean;
247-
/**
248-
* @deprecated
249-
*/
250-
minRange?: number | string;
251-
/**
252-
* @deprecated
253-
*/
254-
maxRange?: number | string;
255-
/**
256-
* @deprecated
257-
*/
258-
fixedStart?: boolean;
259-
/**
260-
* @deprecated
261-
*/
262-
fixedEnd?: boolean;
263223
utc?: boolean | 'preserve';
264-
/**
265-
* @deprecated
266-
*/
267-
multiDatesLimit?: number | string;
268224
reverseYears?: boolean;
269225
weekPicker?: boolean;
270226
vertical?: boolean;
@@ -291,10 +247,6 @@ export interface VueDatePickerProps {
291247
};
292248
arrowNavigation?: boolean;
293249
yearPicker?: boolean;
294-
/**
295-
* @deprecated
296-
*/
297-
disableTimeRangeValidation?: boolean;
298250
dayNames?: ((lang: string, weekStart: number) => string[]) | string[];
299251
modelType?: 'timestamp' | 'iso' | 'format' | string;
300252
modelAuto?: boolean;
@@ -310,28 +262,16 @@ export interface VueDatePickerProps {
310262
ignoreTimeValidation?: boolean;
311263
dayClass?: (date: Date, internalModelValue: InternalTime) => string;
312264
hideNavigation?: ('month' | 'year' | 'calendar' | 'time' | 'minutes' | 'hours' | 'seconds')[];
313-
/**
314-
* @deprecated
315-
*/
316-
noDisabledRange?: boolean;
317265
sixWeeks?: boolean | 'append' | 'prepend' | 'center' | 'fair';
318266
timezone?:
319267
| string
320268
| { timezone?: string; exactMatch?: boolean; dateInTz?: string; emitTimezone?: string; convertModel?: boolean };
321-
/**
322-
* @deprecated
323-
*/
324-
emitTimezone?: string;
325269
disableYearSelect?: boolean;
326270
focusStartDate?: boolean;
327271
disabledTimes?:
328272
| ((time: TimeObj | TimeObj[] | (TimeObj | undefined)[]) => boolean)
329273
| DisabledTime[]
330274
| [DisabledTime[], DisabledTime[]];
331-
/**
332-
* @deprecated
333-
*/
334-
showLastInRange?: boolean;
335275
timePickerInline?: boolean;
336276
calendar?: (weeks: CalendarWeek[]) => CalendarWeek[];
337277
config?: {

src/VueDatePicker/components/DatePicker/DpCalendar.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@
229229
// Class object for calendar wrapper
230230
const calendarWrapClass = computed(
231231
(): DynamicClass => ({
232-
[props.calendarClassName]: !!props.calendarClassName,
233232
...(defaultedUI.value.calendar ?? {}),
234233
}),
235234
);

src/VueDatePicker/components/DatepickerInput.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@
151151
dp__input_invalid: props.state === false,
152152
dp__input_focus: isFocused.value || props.isMenuOpen,
153153
dp__input_reg: !defaultedTextInput.value.enabled,
154-
[props.inputClassName]: !!props.inputClassName,
155154
...(defaultedUI.value.input ?? {}),
156155
}),
157156
);

src/VueDatePicker/components/DatepickerMenu.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@
293293
dp__menu: true,
294294
dp__menu_index: !defaultedInline.value.enabled,
295295
dp__relative: defaultedInline.value.enabled,
296-
[props.menuClassName]: !!props.menuClassName,
297296
...(defaultedUI.value.menu ?? {}),
298297
}),
299298
);

src/VueDatePicker/components/TimePicker/TimePicker.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
seconds: tInput.seconds,
6262
closeTimePickerBtn,
6363
disabledTimesConfig,
64-
disabled: index === 0 ? fixedStart : fixedEnd,
64+
disabled: index === 0 ? defaultedRange.fixedStart : defaultedRange.fixedEnd,
6565
}"
6666
ref="timeInputRefs"
6767
:validate-time="

src/VueDatePicker/composables/calendar-class.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ export const useCalendarClass = (modelValue: WritableComputedRef<InternalModuleV
372372
...sharedClasses(day),
373373
...getModeClasses(day),
374374
[props.dayClass ? props.dayClass(day.value, props.internalModelValue) : '']: true,
375-
[props.calendarCellClassName]: !!props.calendarCellClassName,
376375
...(defaultedUI.value.calendarCell ?? {}),
377376
};
378377
};

src/VueDatePicker/composables/defaults.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ export const useDefaults = (props: AllPropsType | PickerBasePropsType) => {
7878

7979
const defaultedWeekNumbers = computed(() => getDefaultWeekNumbers(props.weekNumbers));
8080

81-
const defaultedTz = computed(() => getDefaultTimeZone(props.timezone, props.emitTimezone));
81+
const defaultedTz = computed(() => getDefaultTimeZone(props.timezone));
8282

83-
const defaultedMultiDates = computed(() => getDefaultMultiDates(props.multiDates, props.multiDatesLimit));
83+
const defaultedMultiDates = computed(() => getDefaultMultiDates(props.multiDates));
8484

8585
const propDates = computed(() =>
8686
mapPropDates({
@@ -95,20 +95,7 @@ export const useDefaults = (props: AllPropsType | PickerBasePropsType) => {
9595
}),
9696
);
9797

98-
const defaultedRange = computed(() =>
99-
getDefaultRangeOptions(props.range, {
100-
minMaxRawRange: false,
101-
maxRange: props.maxRange,
102-
minRange: props.minRange,
103-
noDisabledRange: props.noDisabledRange,
104-
showLastInRange: props.showLastInRange,
105-
partialRange: props.partialRange,
106-
disableTimeRangeValidation: props.disableTimeRangeValidation,
107-
autoRange: props.autoRange,
108-
fixedStart: props.fixedStart,
109-
fixedEnd: props.fixedEnd,
110-
}),
111-
);
98+
const defaultedRange = computed(() => getDefaultRangeOptions(props.range));
11299

113100
const defaultedUI = computed(() => getDefaultUI(props.ui));
114101

src/VueDatePicker/props.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,21 @@ export const AllProps = {
5252
offset: { type: [Number, String] as PropType<number | string>, default: 10 },
5353
hideNavigation: { type: Array as PropType<Flow[]>, default: () => [] },
5454
timezone: { type: [String, Object] as PropType<TimeZoneProp>, default: null },
55-
emitTimezone: { type: String as PropType<string>, default: null },
5655
vertical: { type: Boolean as PropType<boolean>, default: false },
5756
disableMonthYearSelect: { type: Boolean as PropType<boolean>, default: false },
5857
disableYearSelect: { type: Boolean as PropType<boolean>, default: false },
59-
menuClassName: { type: String as PropType<string>, default: null },
6058
dayClass: {
6159
type: Function as PropType<(date: Date, internalModelValue: InternalModuleValue) => string>,
6260
default: null,
6361
},
6462
yearRange: { type: Array as PropType<number[]>, default: () => [1900, 2100] },
65-
calendarCellClassName: { type: String as PropType<string>, default: null },
6663
enableTimePicker: { type: Boolean as PropType<boolean>, default: true },
6764
autoApply: { type: Boolean as PropType<boolean>, default: false },
6865
disabledDates: { type: [Array, Function] as PropType<DisabledDatesProp>, default: () => [] },
6966
monthNameFormat: { type: String as PropType<'long' | 'short'>, default: 'short' },
7067
startDate: { type: [Date, String] as PropType<string | Date>, default: null },
7168
startTime: { type: [Object, Array] as PropType<TimeModel | TimeModel[] | null>, default: null },
7269
hideOffsetDates: { type: Boolean as PropType<boolean>, default: false },
73-
autoRange: { type: [Number, String] as PropType<number | string>, default: null },
7470
noToday: { type: Boolean as PropType<boolean>, default: false },
7571
disabledWeekDays: { type: Array as PropType<string[] | number[]>, default: () => [] },
7672
allowedDates: { type: Array as PropType<string[] | Date[]>, default: null },
@@ -83,14 +79,10 @@ export const AllProps = {
8379
flow: { type: Array as PropType<Flow[]>, default: () => [] },
8480
partialFlow: { type: Boolean as PropType<boolean>, default: false },
8581
preventMinMaxNavigation: { type: Boolean as PropType<boolean>, default: false },
86-
minRange: { type: [Number, String] as PropType<number | string>, default: null },
87-
maxRange: { type: [Number, String] as PropType<number | string>, default: null },
88-
multiDatesLimit: { type: [Number, String] as PropType<number | string>, default: null },
8982
reverseYears: { type: Boolean as PropType<boolean>, default: false },
9083
weekPicker: { type: Boolean as PropType<boolean>, default: false },
9184
filters: { type: Object as PropType<Partial<DateFilter>>, default: () => ({}) },
9285
arrowNavigation: { type: Boolean as PropType<boolean>, default: false },
93-
disableTimeRangeValidation: { type: Boolean as PropType<boolean>, default: false },
9486
highlight: {
9587
type: [Function, Object] as PropType<HighlightProp>,
9688
default: null,
@@ -104,7 +96,6 @@ export const AllProps = {
10496
type: [String, Function, Object] as PropType<WeekNumbersProp>,
10597
default: null,
10698
},
107-
calendarClassName: { type: String as PropType<string>, default: null },
10899
monthChangeOnScroll: { type: [Boolean, String] as PropType<boolean | 'inverse'>, default: true },
109100
dayNames: {
110101
type: [Function, Array] as PropType<((lang: string, weekStart: number) => string[]) | string[]>,
@@ -121,7 +112,6 @@ export const AllProps = {
121112
default: () => '',
122113
},
123114
multiDates: { type: [Object, Boolean] as PropType<MultiDatesProp>, default: false },
124-
partialRange: { type: Boolean as PropType<boolean>, default: true },
125115
ignoreTimeValidation: { type: Boolean as PropType<boolean>, default: false },
126116
minDate: { type: [Date, String] as PropType<Date | string>, default: null },
127117
maxDate: { type: [Date, String] as PropType<Date | string>, default: null },
@@ -134,9 +124,6 @@ export const AllProps = {
134124
state: { type: Boolean as PropType<boolean | null>, default: null },
135125
required: { type: Boolean as PropType<boolean>, default: false },
136126
autocomplete: { type: String as PropType<string>, default: 'off' },
137-
inputClassName: { type: String as PropType<string>, default: null },
138-
fixedStart: { type: Boolean as PropType<boolean>, default: false },
139-
fixedEnd: { type: Boolean as PropType<boolean>, default: false },
140127
timePicker: { type: Boolean as PropType<boolean>, default: false },
141128
enableSeconds: { type: Boolean as PropType<boolean>, default: false },
142129
is24: { type: Boolean as PropType<boolean>, default: true },
@@ -155,12 +142,10 @@ export const AllProps = {
155142
readonly: { type: Boolean as PropType<boolean>, default: false },
156143
inline: { type: [Boolean, Object] as PropType<InlineProp>, default: false },
157144
textInput: { type: [Boolean, Object] as PropType<TextInputProp>, default: false },
158-
noDisabledRange: { type: Boolean as PropType<boolean>, default: false },
159145
sixWeeks: { type: [Boolean, String] as PropType<boolean | SixWeekMode>, default: false },
160146
actionRow: { type: Object as PropType<Partial<ActionRowData>>, default: () => ({}) },
161147
focusStartDate: { type: Boolean as PropType<boolean>, default: false },
162148
disabledTimes: { type: [Function, Array] as PropType<DisabledTimeArrProp>, default: undefined },
163-
showLastInRange: { type: Boolean as PropType<boolean>, default: true },
164149
timePickerInline: { type: Boolean as PropType<boolean>, default: false },
165150
calendar: { type: Function as PropType<(month: ICalendarDate[]) => ICalendarDate[]>, default: null },
166151
config: { type: Object as PropType<Partial<Config>>, default: undefined },

src/VueDatePicker/utils/defaults.ts

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import type {
1818
WeekNumbersProp,
1919
WeekNumbersOpts,
2020
RangeProp,
21-
RangeOpts,
2221
RangeConfig,
2322
TimeZoneProp,
2423
TimeZoneConfig,
@@ -207,7 +206,7 @@ export const getDefaultWeekNumbers = (weekNumbers: WeekNumbersProp): WeekNumbers
207206
};
208207
};
209208

210-
export const getDefaultRangeOptions = (config: RangeProp, deprecatedOpts: RangeOpts): RangeConfig => {
209+
export const getDefaultRangeOptions = (config: RangeProp): RangeConfig => {
211210
const defaultOptions = {
212211
noDisabledRange: false,
213212
showLastInRange: true,
@@ -225,29 +224,26 @@ export const getDefaultRangeOptions = (config: RangeProp, deprecatedOpts: RangeO
225224
}
226225
return {
227226
enabled: config,
228-
noDisabledRange: deprecatedOpts.noDisabledRange,
229-
showLastInRange: deprecatedOpts.showLastInRange,
230-
minMaxRawRange: deprecatedOpts.minMaxRawRange,
231-
partialRange: deprecatedOpts.partialRange,
232-
disableTimeRangeValidation: deprecatedOpts.disableTimeRangeValidation,
233-
maxRange: deprecatedOpts.maxRange,
234-
minRange: deprecatedOpts.minRange,
235-
autoRange: deprecatedOpts.autoRange,
236-
fixedStart: deprecatedOpts.fixedStart,
237-
fixedEnd: deprecatedOpts.fixedEnd,
227+
...defaultOptions,
238228
};
239229
};
240230

241-
export const getDefaultTimeZone = (timeZone: TimeZoneProp, emitTimezone?: string) => {
242-
if (!timeZone) return { timezone: undefined, exactMatch: false, emitTimezone };
231+
export const getDefaultTimeZone = (timeZone: TimeZoneProp) => {
232+
if (!timeZone) return { timezone: undefined, exactMatch: false, emitTimezone: undefined };
243233
if (typeof timeZone === 'string') {
244-
return { timezone: timeZone, exactMatch: false, dateInTz: undefined, emitTimezone, convertModel: true };
234+
return {
235+
timezone: timeZone,
236+
exactMatch: false,
237+
dateInTz: undefined,
238+
emitTimezone: undefined,
239+
convertModel: true,
240+
};
245241
}
246242
return {
247243
timezone: timeZone.timezone,
248244
exactMatch: timeZone.exactMatch ?? false,
249245
dateInTz: timeZone.dateInTz ?? undefined,
250-
emitTimezone: emitTimezone ?? timeZone.emitTimezone,
246+
emitTimezone: timeZone.emitTimezone ?? undefined,
251247
convertModel: timeZone.convertModel ?? true,
252248
};
253249
};
@@ -299,12 +295,9 @@ export const mapPropDates = (opts: MapPropDatesOpts): PropDates => {
299295
};
300296
};
301297

302-
export const getDefaultMultiDates = (
303-
multiDates: MultiDatesProp,
304-
multiDatesLimit: number | string,
305-
): MultiDatesDefault => {
298+
export const getDefaultMultiDates = (multiDates: MultiDatesProp): MultiDatesDefault => {
306299
if (typeof multiDates === 'boolean') {
307-
return { enabled: multiDates, dragSelect: true, limit: +multiDatesLimit };
300+
return { enabled: multiDates, dragSelect: true, limit: null };
308301
}
309302
return {
310303
enabled: !!multiDates,

tests/unit/behaviour.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describe('It should validate various picker scenarios', () => {
122122

123123
it('Should emit regular and zoned date value', async () => {
124124
const timezone = 'UTC';
125-
const dp = await openMenu({ emitTimezone: timezone });
125+
const dp = await openMenu({ timezone: { emitTimezone: timezone } });
126126
const today = new Date();
127127
const value = set(today, { seconds: 0, milliseconds: 0 });
128128

0 commit comments

Comments
 (0)