Skip to content

refactor(*): removing redundant implementation #15846

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

Draft
wants to merge 1 commit into
base: 19.2.x
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions projects/igniteui-angular/migrations/common/util.ts
Original file line number Diff line number Diff line change
@@ -188,7 +188,7 @@ export const parseFile = (parser: HtmlParser, host: Tree, filePath: string, enco

export const findElementNodes = (root: Node[], tag: string | string[]): Node[] => {
const tags = new Set(Array.isArray(tag) ? tag : [tag]);
return flatten(Array.isArray(root) ? root : [root])
return (Array.isArray(root) ? root : [root]).flat()
.filter((node: Element) => tags.has(node.name));
};

@@ -232,7 +232,7 @@ export const flatten = (list: Node[]) => {
r.push(node);

if (isElement(node)) {
r = r.concat(flatten((node as Element).children));
r = r.concat((node as Element).children.flat());
}
}
return r;
16 changes: 0 additions & 16 deletions projects/igniteui-angular/src/lib/core/utils.ts
Original file line number Diff line number Diff line change
@@ -375,22 +375,6 @@ export class PlatformUtil {
}
}

/**
* @hidden
*/
export const flatten = (arr: any[]) => {
let result = [];

arr.forEach(el => {
result.push(el);
if (el.children) {
const children = Array.isArray(el.children) ? el.children : el.children.toArray();
result = result.concat(flatten(children));
}
});
return result;
};

export interface CancelableEventArgs {
/**
* Provides the ability to cancel the event.
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ import {
import { takeUntil } from 'rxjs/operators';

import { IgxColumnComponent } from './column.component';
import { flatten } from '../../core/utils';
import { CellType, ColumnType, IgxColumnTemplateContext } from '../common/grid.interface';

/* blazorElement */
@@ -351,7 +350,7 @@ export class IgxColumnGroupComponent extends IgxColumnComponent implements After

/** @hidden @internal **/
public override get allChildren(): IgxColumnComponent[] {
return flatten(this.children.toArray());
return this.children.toArray().flat();
}
/**
* Returns a boolean indicating if the column is a `ColumnGroup`.
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ import {
ViewChildren,
booleanAttribute
} from '@angular/core';
import { flatten, trackByIdentity } from '../../core/utils';
import { trackByIdentity } from '../../core/utils';
import { IgxGridForOfDirective } from '../../directives/for-of/for_of.directive';
import { ColumnType, GridType, IgxHeadSelectorTemplateContext } from '../common/grid.interface';
import { IgxGridFilteringCellComponent } from '../filtering/base/grid-filtering-cell.component';
@@ -80,7 +80,7 @@ export class IgxGridHeaderRowComponent implements DoCheck {
* @hidden @internal
*/
public get groups(): IgxGridHeaderGroupComponent[] {
return flatten(this._groups?.toArray() ?? []);
return (this._groups?.toArray() ?? []).flat();
}

/** Header components in the header row. */
Original file line number Diff line number Diff line change
@@ -66,7 +66,6 @@ import { IgxGridDragSelectDirective } from '../selection/drag-select.directive';
import { IgxGridBodyDirective } from '../grid.common';
import { IgxGridHeaderRowComponent } from '../headers/grid-header-row.component';
import { IgxActionStripToken } from '../../action-strip/token';
import { flatten } from '../../core/utils';
import { IFilteringExpressionsTree } from '../../data-operations/filtering-expressions-tree';

let NEXT_ID = 0;
@@ -1269,7 +1268,7 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
let fields = [];
let childEntities;
if (!rowIsland.autoGenerate) {
fields = flatten(rowIsland.childColumns.toArray()).filter(col => col.field)
fields = rowIsland.childColumns.toArray().flat().filter(col => col.field)
.map(f => ({ field: f.field, dataType: f.dataType })) as FieldType[];
} else if (firstRowData) {
const rowIslandFields = Object.keys(firstRowData).map(key => {

Unchanged files with check annotations Beta

this.colsWidth = event.target.value;
}
public onColEnter(event: IDropBaseEventArgs, rowIndex, colIndex) {

Check warning on line 170 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (20.x)

'event' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 170 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (22.x)

'event' is defined but never used. Allowed unused args must match /^_/u
this.collection[rowIndex][colIndex].hovered = true;
}
public onColLeave(event: IDropBaseEventArgs, rowIndex, colIndex) {

Check warning on line 174 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (20.x)

'event' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 174 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (22.x)

'event' is defined but never used. Allowed unused args must match /^_/u
this.collection[rowIndex][colIndex].hovered = false;
}
this.resizeVisible = true;
}
public onBlur(event, rowIndex, colIndex) {

Check warning on line 235 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (20.x)

'event' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 235 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (22.x)

'event' is defined but never used. Allowed unused args must match /^_/u
this.cellSelected = null;
this.collection[rowIndex][colIndex].selected = false;
this.resizeVisible = false;
event.target.setPointerCapture(event.pointerId);
}
public pointerMoveResizeLeft(event, cellRef, rowIndex, colIndex) {

Check warning on line 250 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (20.x)

'rowIndex' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 250 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (22.x)

'rowIndex' is defined but never used. Allowed unused args must match /^_/u
if (this.dragStarted) {
const curDistance = this.dragStartX - event.pageX;
const minIncrease = -this.curResizedCell.colSpan;
}
}
public pointerMoveResizeRight(event, cellRef, rowIndex, colIndex) {

Check warning on line 262 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (20.x)

'rowIndex' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 262 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (20.x)

'cellRef' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 262 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (22.x)

'rowIndex' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 262 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (22.x)

'cellRef' is defined but never used. Allowed unused args must match /^_/u
if (this.dragStarted) {
const curDistance = event.pageX - this.dragStartX;
const maxIncrease = this.colsCount - (colIndex + this.curResizedCell.colSpan);
}
}
public pointerUpResizeRight(event, cellRef, rowIndex, colIndex) {

Check warning on line 271 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (20.x)

'cellRef' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 271 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (20.x)

'event' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 271 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (22.x)

'cellRef' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 271 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (22.x)

'event' is defined but never used. Allowed unused args must match /^_/u
this.dragStarted = false;
this.resizeVisible = false;
this.colSpanIncrease = 0;
}
public pointerUpResizeLeft(event, cellRef, targetRowIndex, targetColIndex) {

Check warning on line 351 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (20.x)

'event' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 351 in src/app/grid-multi-row-layout-config/grid-mrl-config.sample.ts

GitHub Actions / run-tests (22.x)

'event' is defined but never used. Allowed unused args must match /^_/u
this.dragStarted = false;
this.resizeVisible = false;
return `${this.remoteService.url}?$count=true&$skip=${state.startIndex}&$top=${chunkSize}`;
};
// eslint-disable-next-line prefer-spread
this.localItems = Array.apply(null, { length: 2000 }).map((e, i) => ({

Check warning on line 41 in src/app/drop-down/drop-down-virtual/drop-down-virtual.component.ts

GitHub Actions / run-tests (20.x)

'e' is defined but never used. Allowed unused args must match /^_/u

Check warning on line 41 in src/app/drop-down/drop-down-virtual/drop-down-virtual.component.ts

GitHub Actions / run-tests (22.x)

'e' is defined but never used. Allowed unused args must match /^_/u
name: `Item ${i + 1}`,
id: i
}));