Skip to content

Commit

Permalink
Refactor #5426 - For Calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Mar 25, 2024
1 parent 4f9fe24 commit 9622a2b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
12 changes: 12 additions & 0 deletions components/lib/calendar/BaseCalendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,18 @@ export default {
type: Object,
default: null
},
todayButtonProps: {
type: Object,
default() {
return { severity: 'secondary', text: true };
}
},
clearButtonProps: {
type: Object,
default() {
return { severity: 'secondary', text: true };
}
},
ariaLabelledby: {
type: String,
default: null
Expand Down
19 changes: 17 additions & 2 deletions components/lib/calendar/Calendar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
import { TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { ButtonPassThroughOptions, ButtonProps } from '../button';
import { InputTextPassThroughOptions } from '../inputtext';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, HintedString, PassThrough } from '../ts-helpers';
Expand Down Expand Up @@ -308,12 +309,14 @@ export interface CalendarPassThroughOptions {
buttonbar?: CalendarPassThroughOptionType;
/**
* Used to pass attributes to the today button's DOM element.
* @see {@link ButtonPassThroughOptions}
*/
todayButton?: CalendarPassThroughOptionType;
todayButton?: ButtonPassThroughOptions<CalendarSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the clear button's DOM element.
* @see {@link ButtonPassThroughOptions}
*/
clearButton?: CalendarPassThroughOptionType;
clearButton?: ButtonPassThroughOptions<CalendarSharedPassThroughMethodOptions>;
/**
* Used to pass attributes to the aria selected day's DOM element.
*/
Expand Down Expand Up @@ -750,6 +753,18 @@ interface BaseCalendarProps {
* Style class of the overlay panel.
*/
panelClass?: string | object | undefined;
/**
* Used to pass all properties of the ButtonProps to the today button component.
* @type {ButtonProps}
* @defaultValue { severity: 'secondary', text: true }
*/
todayButtonProps?: object | undefined;
/**
* Used to pass all properties of the ButtonProps to the clear button component.
* @type {ButtonProps}
* @defaultValue { severity: 'secondary', text: true }
*/
clearButtonProps?: object | undefined;
/**
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
*/
Expand Down
8 changes: 2 additions & 6 deletions components/lib/calendar/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,8 @@
</div>
</div>
<div v-if="showButtonBar" :class="cx('buttonbar')" v-bind="ptm('buttonbar')">
<button type="button" @click="onTodayButtonClick($event)" :class="cx('todayButton')" @keydown="onContainerButtonKeydown" v-bind="ptm('todayButton')" data-pc-group-section="button">
{{ todayLabel }}
</button>
<button type="button" @click="onClearButtonClick($event)" :class="cx('clearButton')" @keydown="onContainerButtonKeydown" v-bind="ptm('clearButton')" data-pc-group-section="button">
{{ clearLabel }}
</button>
<Button :label="todayLabel" @click="onTodayButtonClick($event)" :class="cx('todayButton')" @keydown="onContainerButtonKeydown" v-bind="todayButtonProps" :pt="ptm('todayButton')" data-pc-group-section="button" />
<Button :label="clearLabel" @click="onClearButtonClick($event)" :class="cx('clearButton')" @keydown="onContainerButtonKeydown" v-bind="clearButtonProps" :pt="ptm('clearButton')" data-pc-group-section="button" />
</div>
<slot name="footer"></slot>
</div>
Expand Down

0 comments on commit 9622a2b

Please sign in to comment.