-
Notifications
You must be signed in to change notification settings - Fork 133
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
fix: button fiori3 fixes and documentation improvements #2221
Changes from 1 commit
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 |
---|---|---|
|
@@ -17,5 +17,5 @@ | |
</div> | ||
</fd-split-button> | ||
|
||
<button fd-button (click)="isOpen=true">Open</button> | ||
<button fd-button (click)="isOpen=false">Close</button> | ||
<button class="programmable-button" fd-button (click)="isOpen=true">Open</button> | ||
<button class="programmable-button" fd-button (click)="isOpen=false">Close</button> | ||
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 have mixed feelings about this :D 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 changed the class to docs-button |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,4 @@ export class ButtonSplitTypesExampleComponent { | |
primaryButtonClicked() { | ||
alert('Primary Button Clicked!'); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
import { ChangeDetectionStrategy, Component, ElementRef, Input, ViewEncapsulation, OnInit } from '@angular/core'; | ||
import { applyCssClass, CssClassBuilder } from '../utils/public_api'; | ||
|
||
export type ButtonType = '' | 'standard' | 'positive' | 'negative' | 'attention' | 'half' | 'ghost' | 'transparent' | 'emphasized' | 'menu'; | ||
export type ButtonType = | ||
| '' | ||
| 'standard' | ||
| 'positive' | ||
| 'negative' | ||
| 'attention' | ||
| 'half' | ||
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. Are we keeping the half button? @droshev 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 don't want to keep something that is not part of Fiori 3. At least not in the API 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 removed |
||
| 'ghost' | ||
| 'transparent' | ||
| 'emphasized' | ||
| 'menu'; | ||
export type ButtonOptions = 'light' | 'emphasized' | 'menu'; | ||
|
||
|
||
// TODO remove in 0.9.0 | ||
// TODO remove in 0.17.0 | ||
function replaceLightWithTransparent(option: string): string { | ||
return option.replace('light', 'transparent'); | ||
} | ||
|
||
// TODO remove in 0.9.0 | ||
// TODO remove in 0.17.0 | ||
export function getOptionCssClass(options: ButtonOptions | ButtonOptions[]): string { | ||
if (Array.isArray(options)) { | ||
return options.map(option => `fd-button--${this.replaceLightWithTransparent(option)}`).join(' '); | ||
} | ||
return `fd-button--${this.replaceLightWithTransparent(options)}` | ||
return `fd-button--${this.replaceLightWithTransparent(options)}`; | ||
} | ||
|
||
/** | ||
|
@@ -29,7 +38,9 @@ export function getOptionCssClass(options: ButtonOptions | ButtonOptions[]): str | |
// tslint:disable-next-line:component-selector | ||
selector: `button[fd-button], a[fd-button]`, | ||
exportAs: 'fd-button', | ||
template: `<ng-content></ng-content>`, | ||
template: ` | ||
<ng-content></ng-content> | ||
`, | ||
styleUrls: ['./button.component.scss'], | ||
encapsulation: ViewEncapsulation.None, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
|
@@ -41,50 +52,58 @@ export class ButtonComponent implements OnInit, CssClassBuilder { | |
this._change(); | ||
} // user's custom classes | ||
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. This comment should be TypeDocs 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. Changes applied |
||
|
||
private _glyph: string; | ||
/** The icon to include in the button. See the icon page for the list of icons. | ||
* setter is used to control when css class have to be rebuilded | ||
* Setter is used to control when css class have to be rebuilded. | ||
* Default value is set to ''. | ||
*/ | ||
private _glyph: string | ||
@Input() set glyph(icon: string) { | ||
this._glyph = icon; | ||
this._change(); | ||
}; | ||
} | ||
|
||
/** Whether to apply compact mode to the button. */ | ||
private _compact: boolean = false; | ||
/** Whether to apply compact mode to the button. | ||
* Default value is set to false | ||
*/ | ||
@Input() set compact(isComact: boolean) { | ||
this._compact = isComact; | ||
this._change(); | ||
} | ||
|
||
private _type: ButtonType; | ||
/** The type of the button. Types include: | ||
* 'standard' | 'positive' | 'negative' | 'attention' | 'half' | 'ghost' | 'transparent' | 'emphasized' | 'menu'. | ||
* Leave empty for default (Action button).'*/ | ||
private _type: ButtonType; | ||
* Leave empty for default (Standard button).' | ||
*/ | ||
@Input() set fdType(type: ButtonType) { | ||
this._type = type; | ||
this._change(); | ||
} | ||
|
||
/** Whether to apply menu mode to the button.*/ | ||
private _menu: boolean = false; | ||
/** Whether to apply menu mode to the button. | ||
* Default value is set to false | ||
*/ | ||
@Input() set fdMenu(menu: boolean) { | ||
this._menu = menu; | ||
this._change(); | ||
} | ||
|
||
/** Button options. Options include 'emphasized' and 'light'. Leave empty for default.' */ | ||
private _options: ButtonOptions | ButtonOptions[] | ||
private _options: ButtonOptions | ButtonOptions[]; | ||
/** Button options. Options include 'emphasized' and 'light'. Leave empty for default.' | ||
* @deprecated | ||
* Will be removed in 0.17.0. | ||
*/ | ||
@Input() options(opt: ButtonOptions | ButtonOptions[]) { | ||
console.warn(`fd-button options property is deprecated and will be removed in 0.17.0. | ||
Please follow the breaking changes.`) | ||
Please follow the breaking changes.`); | ||
this._options = opt; | ||
this._change(); | ||
}; | ||
} | ||
|
||
/** @hidden */ | ||
constructor(private _elementRef: ElementRef) { | ||
} | ||
constructor(private _elementRef: ElementRef) { } | ||
|
||
/** Function runs when component is initialized | ||
* function should build component css class | ||
|
@@ -108,11 +127,13 @@ export class ButtonComponent implements OnInit, CssClassBuilder { | |
this._options ? getOptionCssClass(this._options) : '', | ||
this._glyph ? `sap-icon--${this._glyph}` : '', | ||
this._class | ||
].filter(x => x !== '').join(' '); | ||
] | ||
.filter(x => x !== '') | ||
.join(' '); | ||
} | ||
|
||
/** HasElementRef interface implementation | ||
* function used by applyCssClass and applyCssStyle decorators | ||
* function used by applyCssClass and applyCssStyle decorators | ||
*/ | ||
elementRef(): ElementRef<any> { | ||
return this._elementRef; | ||
|
@@ -121,6 +142,4 @@ export class ButtonComponent implements OnInit, CssClassBuilder { | |
private _change(): void { | ||
this.buildComponentCssClass(); | ||
} | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,5 +23,5 @@ export class SegmentedButtonComponent { | |
|
||
/** @hidden */ | ||
@HostBinding('class.fd-segmented-button') | ||
fdButtonGroupClass: boolean = true; | ||
fdsegmentedButtonClass: boolean = true; | ||
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. maybe fdSegmentedButtonClass? 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. Thats the reason for using 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. variable name changed |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Vanessa-Cusmich