Skip to content
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

refactor(icons): remove unnecessary icons and reuse the icon registration logic in Grid Filtering and QueryBuilder #14859

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2393573
refactor(icons): remove unnecessary icons & reuse the logic in Filter…
teodosiah Oct 1, 2024
daee624
fix(icons): resove circular dependency issue
teodosiah Oct 1, 2024
4b38084
Merge branch 'master' into thristodorova/feat-14604
gedinakova Oct 2, 2024
bc6b908
Merge branch 'master' into thristodorova/feat-14604
teodosiah Oct 3, 2024
7396911
Merge branch 'master' into thristodorova/feat-14604
ChronosSF Oct 7, 2024
553434d
Merge branch 'master' into thristodorova/feat-14604
teodosiah Oct 7, 2024
91f709d
Merge branch 'master' into thristodorova/feat-14604
teodosiah Oct 7, 2024
2640343
feat(filtering): address comments and remove injection
teodosiah Oct 8, 2024
489a16c
Merge branch 'master' into thristodorova/feat-14604
gedinakova Oct 9, 2024
439617e
Merge branch 'master' into thristodorova/feat-14604
gedinakova Oct 10, 2024
aeb9257
Merge branch 'master' into thristodorova/feat-14604
teodosiah Oct 11, 2024
dede7ad
Merge branch 'master' into thristodorova/feat-14604
gedinakova Oct 14, 2024
bcb5a15
chore(*): revert filtering icons import
teodosiah Oct 14, 2024
4ce6604
Merge branch 'master' into thristodorova/feat-14604
teodosiah Oct 14, 2024
c296eda
Merge branch 'thristodorova/feat-14604' of https://github.com/IgniteU…
teodosiah Oct 14, 2024
4a2a718
Merge branch 'master' into thristodorova/feat-14604
teodosiah Oct 15, 2024
7f814d5
Merge branch 'master' into thristodorova/feat-14604
teodosiah Oct 17, 2024
f8a1cf8
Merge branch 'master' into thristodorova/feat-14604
teodosiah Oct 18, 2024
04f8fdf
Merge branch 'master' into thristodorova/feat-14604
teodosiah Oct 22, 2024
4117e8a
Merge branch 'master' into thristodorova/feat-14604
teodosiah Nov 21, 2024
57936b6
Merge branch 'master' into thristodorova/feat-14604
gedinakova Dec 3, 2024
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
Injectable,
OnDestroy,
OnDestroy
} from '@angular/core';
import { FilteringExpressionsTree, IFilteringExpressionsTree } from '../../data-operations/filtering-expressions-tree';
import { IFilteringExpression, FilteringLogic } from '../../data-operations/filtering-expression.interface';
Expand All @@ -14,12 +14,13 @@ import { IgxOverlayService } from '../../services/overlay/overlay';
import { useAnimation } from '@angular/animations';
import { AbsoluteScrollStrategy } from '../../services/overlay/scroll/absolute-scroll-strategy';
import { IgxIconService } from '../../icon/icon.service';
import { editor, pinLeft, unpinLeft } from '@igniteui/material-icons-extended';
import { ExpressionUI, generateExpressionsList } from './excel-style/common';
import { ColumnType, GridType } from '../common/grid.interface';
import { formatDate } from '../../core/utils';
import { ExcelStylePositionStrategy } from './excel-style/excel-style-position-strategy';
import { fadeIn } from 'igniteui-angular/animations';
import { pinLeft, unpinLeft } from '@igniteui/material-icons-extended';
import { registerFilteringSVGIcons } from '../../icon/filtering-icons';

/**
* @hidden
Expand Down Expand Up @@ -54,7 +55,7 @@ export class IgxFilteringService implements OnDestroy {

constructor(
private iconService: IgxIconService,
protected _overlayService: IgxOverlayService,
protected _overlayService: IgxOverlayService
) { }

public ngOnDestroy(): void {
Expand Down Expand Up @@ -318,10 +319,8 @@ export class IgxFilteringService implements OnDestroy {
* Register filtering SVG icons in the icon service.
*/
public registerSVGIcons(): void {
const editorIcons = editor as any[];
editorIcons.forEach(icon => {
this.iconService.addSvgIconFromText(icon.name, icon.value, 'imx-icons');
});
registerFilteringSVGIcons(this.iconService);

this.iconService.addSvgIconFromText(pinLeft.name, pinLeft.value, 'imx-icons');
this.iconService.addSvgIconFromText(unpinLeft.name, unpinLeft.value, 'imx-icons');
}
Expand Down
49 changes: 49 additions & 0 deletions projects/igniteui-angular/src/lib/icon/filtering-icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {
contains, doesNotContain, endsWith, equals, greaterThan, greaterThanOrEqual,
isAfter, isBefore, isEmpty, isFalse, isNull, isNotNull, isTrue,
lastMonth, lastYear, lessThan, lessThanOrEqual, nextMonth, nextYear,
notEmpty, notEqual, selectAll, startsWith, thisMonth, thisYear, today, ungroup, yesterday
} from '@igniteui/material-icons-extended/editor';
import { IMXIcon } from '@igniteui/material-icons-extended';
import { IgxIconService } from './icon.service';

/**
* Register filtering SVG icons
* @param iconService
*/
export function registerFilteringSVGIcons(iconService: IgxIconService) {
const filteringIcons: IMXIcon[] = [
contains,
doesNotContain,
endsWith,
equals,
greaterThan,
greaterThanOrEqual,
isAfter,
isBefore,
isEmpty,
isFalse,
isNotNull,
isNull,
isTrue,
lastMonth,
lastYear,
lessThan,
lessThanOrEqual,
nextMonth,
nextYear,
notEmpty,
notEqual,
selectAll,
startsWith,
thisMonth,
thisYear,
today,
ungroup,
yesterday
];

filteringIcons.forEach(icon => {
iconService.addSvgIconFromText(icon.name, icon.value, 'imx-icons');
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from '@angular/core';
import { FormsModule } from '@angular/forms';
import { Subject } from 'rxjs';
import { editor } from '@igniteui/material-icons-extended';
import { IButtonGroupEventArgs, IgxButtonGroupComponent } from '../buttonGroup/buttonGroup.component';
import { IgxChipComponent } from '../chips/chip.component';
import { IQueryBuilderResourceStrings, QueryBuilderResourceStringsEN } from '../core/i18n/query-builder-resources';
Expand Down Expand Up @@ -37,6 +36,7 @@ import { IgxPrefixDirective } from '../directives/prefix/prefix.directive';
import { IgxIconComponent } from '../icon/icon.component';
import { getCurrentResourceStrings } from '../core/i18n/resources';
import { IgxIconButtonDirective } from '../directives/button/icon-button.directive';
import { registerFilteringSVGIcons } from '../icon/filtering-icons';

const DEFAULT_PIPE_DATE_FORMAT = 'mediumDate';
const DEFAULT_PIPE_TIME_FORMAT = 'mediumTime';
Expand Down Expand Up @@ -158,7 +158,7 @@ export class IgxQueryBuilderComponent implements AfterViewInit, OnDestroy {
/**
* Returns the expression tree.
*/
public get expressionTree(): IExpressionTree {
public get expressionTree(): IExpressionTree {
return this._expressionTree;
}

Expand Down Expand Up @@ -651,8 +651,8 @@ export class IgxQueryBuilderComponent implements AfterViewInit, OnDestroy {

if (!this.selectedField) {
this.fieldSelect.input.nativeElement.focus();
} else if (this.selectedField.filters.condition(this.selectedCondition).isUnary) {
this.conditionSelect.input.nativeElement.focus();
} else if (this.selectedField.filters.condition(this.selectedCondition).isUnary) {
this.conditionSelect.input.nativeElement.focus();
} else {
const input = this.searchValueInput?.nativeElement || this.picker?.getEditElement();
input.focus();
Expand Down Expand Up @@ -1201,11 +1201,6 @@ export class IgxQueryBuilderComponent implements AfterViewInit, OnDestroy {
}

private registerSVGIcons(): void {
const editorIcons = editor as any[];

editorIcons.forEach((icon) => {
this.iconService.addSvgIconFromText(icon.name, icon.value, 'imx-icons');
});
registerFilteringSVGIcons(this.iconService);
}
}

Loading