Skip to content

Commit caa394b

Browse files
committed
Add @autofocus parameter and implement
1 parent 3a98071 commit caa394b

8 files changed

Lines changed: 9 additions & 3 deletions

File tree

docs/app/components/snippets/datepicker-1.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
@selected={{this.selected}}
2222
@onSelect={{this.onSelect}}
2323
@isDatePicker={{true}}
24+
@autofocus={{true}}
2425
as |calendar|
2526
>
2627
<calendar.Nav />

ember-power-calendar/src/components/power-calendar-multiple.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
(ensure-safe-component (or @daysComponent this.daysComponent))
1212
calendar=(readonly this.publicAPI)
1313
isDatePicker=@isDatePicker
14+
autofocus=@autofocus
1415
)
1516
)
1617
)

ember-power-calendar/src/components/power-calendar-multiple/days.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export default class PowerCalendarMultipleDaysComponent extends Component<PowerC
221221

222222
this.didSetup = true;
223223

224-
if (this.args.isDatePicker) {
224+
if (this.args.autofocus) {
225225
scheduleOnce('afterRender', this, this.initialFocus.bind(this));
226226
}
227227
},

ember-power-calendar/src/components/power-calendar-range.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
(ensure-safe-component (or @daysComponent this.daysComponent))
1212
calendar=(readonly this.publicAPI)
1313
isDatePicker=@isDatePicker
14+
autofocus=@autofocus
1415
)
1516
)
1617
)

ember-power-calendar/src/components/power-calendar-range/days.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export default class PowerCalendarRangeDaysComponent extends Component<PowerCale
230230

231231
this.didSetup = true;
232232

233-
if (this.args.isDatePicker) {
233+
if (this.args.autofocus) {
234234
scheduleOnce('afterRender', this, this.initialFocus.bind(this));
235235
}
236236
},

ember-power-calendar/src/components/power-calendar.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
(ensure-safe-component (or @daysComponent this.daysComponent))
1212
calendar=(readonly this.publicAPI)
1313
isDatePicker=@isDatePicker
14+
autofocus=@autofocus
1415
)
1516
)
1617
)

ember-power-calendar/src/components/power-calendar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export interface PowerCalendarArgs {
8989
ariaLabel?: boolean;
9090
ariaLabeledBy?: boolean;
9191
isDatePicker?: boolean;
92+
autofocus?: boolean;
9293
}
9394

9495
export interface PowerCalendarDefaultBlock extends PowerCalendarAPI {

ember-power-calendar/src/components/power-calendar/days.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export interface PowerCalendarDaysArgs {
4444
startOfWeek?: string;
4545
center?: Date;
4646
weekdayFormat?: TWeekdayFormat;
47+
autofocus?: boolean;
4748
isDatePicker?: boolean;
4849
}
4950

@@ -219,7 +220,7 @@ export default class PowerCalendarDaysComponent extends Component<PowerCalendarD
219220

220221
this.didSetup = true;
221222

222-
if (this.args.isDatePicker) {
223+
if (this.args.autofocus) {
223224
scheduleOnce('afterRender', this, this.initialFocus.bind(this));
224225
}
225226
},

0 commit comments

Comments
 (0)