-
Notifications
You must be signed in to change notification settings - Fork 71
Update combobox and calendar with directives #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d61f630
14f22af
b4c73b3
27e0930
cfcfb8c
1f271b9
3dae474
3dea863
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import { Directive, Input } from '@angular/core'; | ||
| import { ICalendarStrings } from 'office-ui-fabric-react'; | ||
|
|
||
| /** | ||
| * Wrapper directive for calendar strings | ||
| */ | ||
| @Directive({ selector: 'fab-calendar > fab-calendar-strings' }) | ||
| export class CalendarStringsDirective { | ||
bengry marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| @Input() months: ICalendarStrings['months']; | ||
| @Input() shortMonths: ICalendarStrings['shortMonths']; | ||
| @Input() days: ICalendarStrings['days']; | ||
| @Input() shortDays: ICalendarStrings['shortDays']; | ||
| @Input() goToToday: ICalendarStrings['goToToday']; | ||
| @Input() weekNumberFormatString: ICalendarStrings['weekNumberFormatString']; | ||
|
|
||
|
|
||
| get strings(): ICalendarStrings { | ||
| return { | ||
| months: this.months, | ||
| shortMonths: this.shortMonths, | ||
| days: this.days, | ||
| shortDays: this.shortDays, | ||
| goToToday: this.goToToday, | ||
| weekNumberFormatString: this.weekNumberFormatString | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import { Directive, Input } from '@angular/core'; | ||
| import { IComboBoxOption } from 'office-ui-fabric-react'; | ||
|
|
||
| /** | ||
| * Wrapper directive for creating a ComboBoxOption | ||
| * @paramName optionKey Binds to React 'key' property. | ||
| * Name change necessary because key is a reserved attribute in the wrapper component. | ||
| */ | ||
| @Directive({ selector: 'fab-combo-box-option' }) | ||
| export class ComboBoxOptionDirective { | ||
| @Input() optionKey: IComboBoxOption['key']; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not call it
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I concur, but that runs foul of the wrapper-component _isForbiddenAttribute method. This causes the ComboBox to misbehave (it ignores the key attribute binding and triggers a console warning).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, makes sense, let's keep it like that then. Please do add some JDoc on this to make a note of this. |
||
| @Input() text: IComboBoxOption['text']; | ||
| @Input() title?: IComboBoxOption['title']; | ||
| @Input() itemType: IComboBoxOption['itemType']; | ||
| @Input() index?: IComboBoxOption['index']; | ||
| @Input() ariaLabel?: IComboBoxOption['ariaLabel']; | ||
| @Input() selected?: IComboBoxOption['selected']; | ||
| @Input() disabled?: IComboBoxOption['disabled']; | ||
| @Input() data?: IComboBoxOption['data']; | ||
| @Input() styles?: IComboBoxOption['styles']; | ||
| @Input() useAriaLabelAsText?: IComboBoxOption['useAriaLabelAsText']; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.