Skip to content

Commit 558f5ac

Browse files
authored
Merge branch 'master' into mkirova/fix-5102-master
2 parents d1b0dda + cc4e334 commit 558f5ac

23 files changed

+320
-151
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ All notable changes for each version of this project will be documented in this
1414
- `IgxGrid`
1515
- `IgxColumnGroup`
1616
- Re-templating the column group header is now possible using the `headerTemplate` input property or the `igxHeader` directive.
17+
- `IgxCombo`
18+
- Input `[overlaySettings]` - allows an object of type `OverlaySettings` to be passed. These custom overlay settings control how the drop-down list displays.
1719

1820
## 8.0.2
1921
- `igx-list-theme` now have some new parameters for styling.

projects/igniteui-angular/src/lib/combo/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ Setting `[displayDensity]` affects the control's items' and inputs' css properti
265265
| `ariaLabelledBy` | defines label ID related to combo | boolean |
266266
| `type` | Combo style. - "line", "box", "border", "search" | string |
267267
| `valid` | gets if control is valid, when used in a form | boolean |
268+
| `overlaySettings` | gets/sets the custom overlay settings that control how the drop-down list displays | OverlaySettings |
268269

269270
### Getters
270271
| Name | Description | Type |

projects/igniteui-angular/src/lib/combo/combo.component.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { DefaultSortingStrategy } from '../data-operations/sorting-strategy';
1616
import { configureTestSuite } from '../test-utils/configure-suite';
1717
import { IgxDropDownItemBase } from '../drop-down/drop-down-item.base';
1818
import { DisplayDensity, DisplayDensityToken } from '../core/density';
19+
import { AbsoluteScrollStrategy, ConnectedPositioningStrategy } from '../services/index';
1920

2021
const CSS_CLASS_COMBO = 'igx-combo';
2122
const CSS_CLASS_COMBO_DROPDOWN = 'igx-combo__drop-down';
@@ -185,6 +186,23 @@ describe('igxCombo', () => {
185186
expect(combo.displayKey).toEqual('region');
186187
expect(combo.displayKey === combo.valueKey).toBeFalsy();
187188
});
189+
it('Should properly get/set overlaySettings', () => {
190+
const fixture = TestBed.createComponent(IgxComboTestComponent);
191+
fixture.detectChanges();
192+
const combo = fixture.componentInstance.combo;
193+
const defaultSettings = (combo as any)._overlaySettings;
194+
spyOn(combo.dropdown, 'toggle');
195+
combo.toggle();
196+
expect(combo.dropdown.toggle).toHaveBeenCalledWith(defaultSettings);
197+
const newSettings = {
198+
positionStrategy: new ConnectedPositioningStrategy({ target: fixture.elementRef.nativeElement}),
199+
scrollStrategy: new AbsoluteScrollStrategy(fixture.elementRef.nativeElement)
200+
};
201+
combo.overlaySettings = newSettings;
202+
const expectedSettings = Object.assign({}, defaultSettings, newSettings);
203+
combo.toggle();
204+
expect(combo.dropdown.toggle).toHaveBeenCalledWith(expectedSettings);
205+
});
188206

189207
describe('EditorProvider', () => {
190208
it('Should return correct edit element', () => {

projects/igniteui-angular/src/lib/combo/combo.component.ts

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,6 @@ import { IgxComboAPIService } from './combo.api';
4242
import { EditorProvider } from '../core/edit-provider';
4343
import { take } from 'rxjs/operators';
4444

45-
/** Custom strategy to provide the combo with callback on initial positioning */
46-
class ComboConnectedPositionStrategy extends ConnectedPositioningStrategy {
47-
private _callback: () => void;
48-
constructor(callback: () => void) {
49-
super();
50-
this._callback = callback;
51-
}
52-
53-
position(contentElement, size, document?, initialCall?) {
54-
if (initialCall) {
55-
this._callback();
56-
}
57-
super.position(contentElement, size);
58-
}
59-
}
60-
6145
/**
6246
* @hidden
6347
*/
@@ -124,7 +108,7 @@ const noop = () => { };
124108
]
125109
})
126110
export class IgxComboComponent extends DisplayDensityBase implements IgxComboBase, AfterViewInit, ControlValueAccessor, OnInit,
127-
OnDestroy, EditorProvider {
111+
OnDestroy, EditorProvider {
128112
/**
129113
* @hidden @internal
130114
*/
@@ -148,10 +132,10 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
148132
private _filteredData = [];
149133
private _itemHeight = null;
150134
private _itemsMaxHeight = null;
151-
private _positionCallback: () => void;
152135
private _onChangeCallback: (_: any) => void = noop;
153-
private overlaySettings: OverlaySettings = {
136+
private _overlaySettings: OverlaySettings = {
154137
scrollStrategy: new AbsoluteScrollStrategy(),
138+
positionStrategy: new ConnectedPositioningStrategy(),
155139
modal: false,
156140
closeOnOutsideClick: true,
157141
excludePositionTarget: true
@@ -171,6 +155,26 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
171155
@ViewChild(IgxForOfDirective, { read: IgxForOfDirective, static: true })
172156
protected virtDir: IgxForOfDirective<any>;
173157

158+
/**
159+
* Set custom overlay settings that control how the combo's list of items is displayed.
160+
* Set:
161+
* ```html
162+
* <igx-combo [overlaySettings] = "customOverlaySettings"></igx-combo>
163+
* ```
164+
*
165+
* ```typescript
166+
* const customSettings = { positionStrategy: { settings: { target: myTarget } } };
167+
* combo.overlaySettings = customSettings;
168+
* ```
169+
* Get any custom overlay settings used by the combo:
170+
* ```typescript
171+
* const comboOverlaySettings: OverlaySettings = myCombo.overlaySettings;
172+
* ```
173+
*/
174+
175+
@Input()
176+
public overlaySettings: OverlaySettings = null;
177+
174178
/**
175179
* @hidden @internal
176180
*/
@@ -1249,9 +1253,7 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
12491253
*/
12501254
public ngOnInit() {
12511255
this.ngControl = this.injector.get(NgControl, null);
1252-
this._positionCallback = () => this.dropdown.updateScrollPosition();
1253-
this.overlaySettings.positionStrategy = new ComboConnectedPositionStrategy(this._positionCallback);
1254-
this.overlaySettings.positionStrategy.settings.target = this.elementRef.nativeElement;
1256+
this._overlaySettings.positionStrategy.settings.target = this.elementRef.nativeElement;
12551257
this.selection.set(this.id, new Set());
12561258
}
12571259

@@ -1263,7 +1265,7 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
12631265

12641266
if (this.ngControl) {
12651267
this.ngControl.statusChanges.pipe(takeUntil(this.destroy$)).subscribe(this.onStatusChanged);
1266-
}
1268+
}
12671269
}
12681270

12691271
/**
@@ -1358,7 +1360,8 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
13581360
*```
13591361
*/
13601362
public toggle(): void {
1361-
this.dropdown.toggle(this.overlaySettings);
1363+
const overlaySettings = Object.assign({}, this._overlaySettings, this.overlaySettings);
1364+
this.dropdown.toggle(overlaySettings);
13621365
}
13631366

13641367
/**
@@ -1370,7 +1373,8 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
13701373
*```
13711374
*/
13721375
public open(): void {
1373-
this.dropdown.open(this.overlaySettings);
1376+
const overlaySettings = Object.assign({}, this._overlaySettings, this.overlaySettings);
1377+
this.dropdown.open(overlaySettings);
13741378
}
13751379

13761380
/**

projects/igniteui-angular/src/lib/core/styles/components/card/_card-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
/// $content-text-color: rgba(0, 0, 0, .8)
3636
/// );
3737
/// // Pass the theme to the igx-card component mixin
38-
/// @include igx-calendar($my-card-theme);
38+
/// @include igx-card($my-card-theme);
3939
@function igx-card-theme(
4040
$palette: $default-palette,
4141
$schema: $light-schema,

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-theme.scss

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
///
2020
/// @param {Color} $sorted-header-icon-color [null] - The sort icon color when sorted.
2121
///
22+
/// @param {Color} $content-background [null] - The table body background color.
23+
/// @param {Color} $content-text-color [null] - The table body text color.
24+
///
2225
/// @param {Color} $ghost-header-text-color [null] - The dragged header text color.
2326
/// @param {Color} $ghost-header-icon-color [null] - The dragged header icon color.
2427
/// @param {Color} $ghost-header-background [null] - The dragged header background color.
25-
/// @param {Color} $content-background [null] - The table body background color.
26-
/// @param {Color} $content-text-color [null] - The table body text color.
28+
///
2729
/// @param {Color} $row-odd-background [null] - The background color of odd rows.
2830
/// @param {Color} $row-even-background [null] - The background color of even rows.
2931
/// @param {Color} $row-odd-text-color [null] - The text color of odd rows.
@@ -33,50 +35,64 @@
3335
/// @param {Color} $row-hover-background [null] - The hover row background color.
3436
/// @param {Color} $row-hover-text-color [null] - The hover row text color.
3537
/// @param {Color} $row-border-color [null] - The row bottom border color.
36-
/// @param {Color} $row-highlight [null] - The grid row highlight indication color.
38+
///
3739
/// @param {String} $pinned-border-width [null] - The border width of the pinned border.
3840
/// @param {String} $pinned-border-style [null] - The CSS border style of the pinned border.
3941
/// @param {Color} $pinned-border-color [null] - The color of the pinned border.
42+
///
4043
/// @param {Color} $cell-active-border-color [null] - The border color for the currently active(focused) cell.
4144
/// @param {Color} $cell-selected-background [null] - The selected cell background color.
4245
/// @param {Color} $cell-selected-text-color [null] - The selected cell text color.
46+
/// @param {Color} $cell-editing-background [null] - The background color of the cell being edited.
47+
/// @param {Color} $cell-edited-value-color [null] - The text color of a sell that has been edited.
48+
///
49+
/// @param {Color} $edit-mode-color [null] - The color applied around the row when in editing mode.
50+
/// @param {Color} $edited-row-indicator [null] - The color applied to the edited row indicator line.
51+
///
4352
/// @param {Color} $resize-line-color [null] - The table header resize line color.
53+
/// @param {Color} $drop-indicator-color [null] - The color applied to the line between the columns when dragging a column.
4454
///
4555
/// @param {Color} $grouparea-background [null] - The grid group area background color.
4656
///
4757
/// @param {Color} $group-row-background [null] - The grid group row background color.
4858
/// @param {Color} $group-row-selected-background [null] - The drop area background on drop color.
49-
/// @param {Color} $active-expand-icon-color [null] - The drop area background on drop color.
50-
/// @param {Color} $active-expand-icon-hover-color [null] - The drop area background on drop color.
5159
/// @param {Color} $group-label-column-name-text [null] - The grid group row column name text color.
5260
/// @param {Color} $group-label-icon [null] - The grid group row icon color.
5361
/// @param {Color} $group-label-text [null] - The grid group row text color.
5462
///
5563
/// @param {Color} $expand-all-icon-color [null] - The grid header expand all group rows icon color.
5664
/// @param {Color} $expand-all-icon-hover-color [null] - The grid header expand all group rows icon hover color.
65+
///
5766
/// @param {Color} $expand-icon-color [null] - The grid row expand icon color.
5867
/// @param {Color} $expand-icon-hover-color [null] - The grid row expand icon hover color.
68+
///
69+
/// @param {Color} $active-expand-icon-color [null] - The drop area background on drop color.
70+
/// @param {Color} $active-expand-icon-hover-color [null] - The drop area background on drop color.
71+
///
5972
/// @param {Color} $group-count-background [null] - The grid group row cont badge background color.
6073
/// @param {Color} $group-count-text-color [null] - The grid group row cont badge text color.
74+
///
6175
/// @param {Color} $drop-area-text-color [null] - The drop area text color.
6276
/// @param {Color} $drop-area-icon-color [null] - The drop area icon color.
6377
/// @param {Color} $drop-area-background [null] - The drop area background color.
6478
/// @param {Color} $drop-area-on-drop-background [null] - The drop area background on drop color.
65-
/// @param {Color} $tree-filtered-text-color [null] - grouping row background color on focus.
6679
///
6780
/// @param {Color} $filtering-header-background [null] - The background color of the filtered column header.
6881
/// @param {Color} $filtering-header-text-color [null] - The text color color of the filtered column header.
6982
/// @param {Color} $filtering-row-background [null] - The background color of the filtering row.
7083
/// @param {Color} $filtering-row-text-color [null] - The text-color color of the filtering row.
84+
/// @param {Color} $tree-filtered-text-color [null] - grouping row background color on focus.
7185
///
7286
/// @param {Color} $body-summaries-background [null] - The background color of the summary groups located the body.
7387
/// @param {Color} $body-summaries-text-color [null] - The text color of the summary results located the body.
7488
/// @param {Color} $root-summaries-background [null] - The background color of the summary groups located the footer.
7589
/// @param {Color} $root-summaries-text-color [null] - The text color of the summary results located the footer.
90+
///
91+
/// @param {Color} $row-highlight [null] - The grid row highlight indication color.
7692
/// @param {box-shadow} $grid-shadow [null] - The shadow of the grid.
7793
/// @param {box-shadow} $drag-shadow [null] - The shadow used for movable elements (ex. column headers).
78-
/// @param {color} $row-drag-color [null] - The row drag handle color.
7994
/// @param {color} $row-ghost-background [null] - The dragged row background color.
95+
/// @param {color} $row-drag-color [null] - The row drag handle color.
8096
/// @param {border-radius} $drop-area-border-radius [null] - The border radius used for column drop area.
8197
///
8298
/// @requires $default-palette
@@ -91,6 +107,7 @@
91107
@function igx-grid-theme(
92108
$palette: $default-palette,
93109
$schema: $light-schema,
110+
$elevations: $elevations,
94111
95112
$header-background: null,
96113
$header-text-color: null,
@@ -125,10 +142,10 @@
125142
$cell-selected-background: null,
126143
$cell-selected-text-color: null,
127144
$cell-editing-background: null,
145+
$cell-edited-value-color: null,
128146
129147
$edit-mode-color: null,
130148
$edited-row-indicator: null,
131-
$cell-edited-value-color: null,
132149
133150
$resize-line-color: null,
134151
$drop-indicator-color: null,

projects/igniteui-angular/src/lib/data-operations/filtering-condition.ts

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,47 @@ export class IgxFilteringOperand {
2323
logic: (target: any) => {
2424
return target !== null;
2525
}
26+
}, {
27+
name: 'in',
28+
isUnary: false,
29+
iconName: 'is_in',
30+
hidden: true,
31+
logic: (target: any, searchVal: Set<any>) => {
32+
return this.findValueInSet(target, searchVal);
33+
}
2634
}];
2735
}
2836

2937
public static instance(): IgxFilteringOperand {
3038
return this._instance || (this._instance = new this());
3139
}
3240

41+
/**
42+
* @hidden
43+
*/
44+
protected findValueInSet(target: any, searchVal: Set<any>) {
45+
return searchVal.has(target);
46+
}
47+
48+
/**
49+
* Returns an array of names of the conditions which are visible in the UI
50+
*/
3351
public conditionList(): string[] {
34-
return this.operations.map((element) => element.name);
52+
return this.operations.filter(f => !f.hidden).map((element) => element.name);
3553
}
3654

55+
/**
56+
* Returns an instance of the condition with the specified name.
57+
* @param name The name of the condition.
58+
*/
3759
public condition(name: string): IFilteringOperation {
3860
return this.operations.find((element) => element.name === name);
3961
}
4062

63+
/**
64+
* Adds a new condition to the filtering operations.
65+
* @param operation The filtering operation.
66+
*/
4167
public append(operation: IFilteringOperation) {
4268
this.operations.push(operation);
4369
}
@@ -362,6 +388,10 @@ export class IgxDateFilteringOperand extends IgxFilteringOperand {
362388
throw new Error('Could not perform filtering on \'date\' column because the datasource object type is not \'Date\'.');
363389
}
364390
}
391+
392+
protected findValueInSet(target: any, searchVal: Set<any>) {
393+
return searchVal.has(new Date(target.getFullYear(), target.getMonth(), target.getDate()).toISOString());
394+
}
365395
}
366396

367397
/**
@@ -532,6 +562,7 @@ export interface IFilteringOperation {
532562
name: string;
533563
isUnary: boolean;
534564
iconName: string;
565+
hidden?: boolean;
535566
logic: (value: any, searchVal?: any, ignoreCase?: boolean) => boolean;
536567
}
537568

@@ -549,27 +580,3 @@ export interface IDateParts {
549580
seconds: number;
550581
milliseconds: number;
551582
}
552-
553-
/**
554-
* @hidden
555-
*/
556-
export class InFilteringOperation implements IFilteringOperation {
557-
name = 'in';
558-
isUnary = false;
559-
iconName = 'is_in';
560-
logic = (target: any, searchVal: Set<any>) => {
561-
return searchVal.has(target);
562-
}
563-
}
564-
565-
/**
566-
* @hidden
567-
*/
568-
export class InDateFilteringOperation extends InFilteringOperation {
569-
logic = (target: any, searchVal: Set<any>) => {
570-
if (target instanceof Date) {
571-
return searchVal.has(new Date(target.getFullYear(), target.getMonth(), target.getDate()).toISOString());
572-
}
573-
return searchVal.has(target);
574-
}
575-
}

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,8 +726,10 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
726726
}
727727
if (scrToBottom && !this._isAtBottomIndex) {
728728
const containerSize = parseInt(this.igxForContainerSize, 10);
729-
const scrollOffset = this.fixedUpdateAllElements(this._virtHeight - containerSize);
730-
this.dc.instance._viewContainer.element.nativeElement.style.top = -(scrollOffset) + 'px';
729+
const maxVirtScrollTop = this._virtHeight - containerSize;
730+
this._bScrollInternal = true;
731+
this._virtScrollTop = maxVirtScrollTop;
732+
this.scrollPosition = maxVirtScrollTop;
731733
return;
732734
}
733735
if (this._adjustToIndex) {

0 commit comments

Comments
 (0)