[ADF-4755][CardViewDate&SelectItemComponent] Provide a way to reset date and none option as default. (#4955)

* [ADF-4755] [CardViewDateItemComponent] Provide a way to reset date.

* Added clear icon to reset date to empty.
* Added Translation key to the new icon.

* * Added displayClearAction flag to toggle clear action.* Added None as default for the selectItem components.* Added displayNoneOption flag to toggle the default none option.

* * Fixed comments.

* * Added translation key for 'none'  option.

* * Updated dateItem css to the match recent changes.

* * Fixed failing unit tests* Updated TaskHeader components with the displayClearAction.

* * Updated demo shell card-view component to test the latest changes
This commit is contained in:
siva kumar
2019-07-26 16:52:45 +05:30
committed by Maurizio Vitale
parent 525f0a06db
commit 05e73a8aa1
18 changed files with 161 additions and 8 deletions

View File

@@ -119,13 +119,17 @@ describe('CardViewItemDispatcherComponent', () => {
const expectedEditable = false,
expectedDisplayEmpty = true,
expectedProperty = <CardViewItem> {},
expectedCustomInput = 1;
expectedCustomInput = 1,
expectedDisplayNoneOption = false,
expectedDisplayClearAction = false;
component.ngOnChanges({
editable: new SimpleChange(true, expectedEditable, false),
displayEmpty: new SimpleChange(false, expectedDisplayEmpty, false),
property: new SimpleChange(null, expectedProperty, false),
customInput: new SimpleChange(0, expectedCustomInput, false)
customInput: new SimpleChange(0, expectedCustomInput, false),
displayNoneOption: new SimpleChange(true, expectedDisplayNoneOption, false),
displayClearAction: new SimpleChange(true, expectedDisplayClearAction, false)
});
const shinyCustomElementItemComponent = fixture.debugElement.query(By.css('whatever-you-want-to-have')).componentInstance;
@@ -133,6 +137,8 @@ describe('CardViewItemDispatcherComponent', () => {
expect(shinyCustomElementItemComponent.editable).toBe(expectedEditable);
expect(shinyCustomElementItemComponent.displayEmpty).toBe(expectedDisplayEmpty);
expect(shinyCustomElementItemComponent.customInput).toBe(expectedCustomInput);
expect(shinyCustomElementItemComponent.displayNoneOption).toBe(expectedDisplayNoneOption);
expect(shinyCustomElementItemComponent.displayClearAction).toBe(expectedDisplayClearAction);
});
});

View File

@@ -42,6 +42,12 @@ export class CardViewItemDispatcherComponent implements OnChanges {
@Input()
displayEmpty: boolean = true;
@Input()
displayNoneOption: boolean = true;
@Input()
displayClearAction: boolean = true;
@ViewChild(CardViewContentProxyDirective)
private content: CardViewContentProxyDirective;
@@ -92,6 +98,8 @@ export class CardViewItemDispatcherComponent implements OnChanges {
this.componentReference.instance.editable = this.editable;
this.componentReference.instance.property = this.property;
this.componentReference.instance.displayEmpty = this.displayEmpty;
this.componentReference.instance.displayNoneOption = this.displayNoneOption;
this.componentReference.instance.displayClearAction = this.displayClearAction;
}
private proxy(methodName, ...args) {