diff --git a/src/lib/picker/category.component.ts b/src/lib/picker/category.component.ts index 7f1a6ac..26f7ecb 100644 --- a/src/lib/picker/category.component.ts +++ b/src/lib/picker/category.component.ts @@ -1,3 +1,4 @@ +import { Emoji, EmojiService } from '@ctrl/ngx-emoji-mart/ngx-emoji'; import { AfterViewInit, ChangeDetectionStrategy, @@ -12,7 +13,6 @@ import { SimpleChanges, ViewChild } from '@angular/core'; -import { Emoji, EmojiService } from '@ctrl/ngx-emoji-mart/ngx-emoji'; import { Observable, Subject } from 'rxjs'; import { EmojiFrequentlyService } from './emoji-frequently.service'; @@ -35,26 +35,28 @@ import { EmojiFrequentlyService } from './emoji-frequently.service';
- +
+ +
@@ -80,7 +82,7 @@ import { EmojiFrequentlyService } from './emoji-frequently.service'; -
+
= top && -height - (parentHeight + this.virtualizeOffset) <= top) { this.filteredEmojisSubject.next(this.emojis); + } else { + this.filteredEmojisSubject.next([]); } } @@ -269,4 +276,19 @@ export class CategoryComponent implements OnChanges, OnInit, AfterViewInit { trackById(index: number, item: any) { return item; } + + private filterEmojis(): any[] { + const newEmojis = []; + for (const emoji of this.emojis || []) { + if (!emoji) { + continue; + } + const data = this.emojiService.getData(emoji); + if (!data || (data.obsoletedBy && this.hideObsolete) || (!data.unified && !data.custom)) { + continue; + } + newEmojis.push(emoji); + } + return newEmojis; + } } diff --git a/src/lib/picker/ngx-emoji/emoji.component.ts b/src/lib/picker/ngx-emoji/emoji.component.ts index 709908a..c433652 100644 --- a/src/lib/picker/ngx-emoji/emoji.component.ts +++ b/src/lib/picker/ngx-emoji/emoji.component.ts @@ -5,7 +5,6 @@ import { Input, OnChanges, Output, - SimpleChanges, } from '@angular/core'; import { EmojiData } from './data/data.interfaces'; diff --git a/src/lib/picker/preview.component.ts b/src/lib/picker/preview.component.ts index ec9d792..eb13900 100644 --- a/src/lib/picker/preview.component.ts +++ b/src/lib/picker/preview.component.ts @@ -1,3 +1,4 @@ +import { Emoji, EmojiData, EmojiService } from '@ctrl/ngx-emoji-mart/ngx-emoji'; import { ChangeDetectionStrategy, ChangeDetectorRef, @@ -5,11 +6,9 @@ import { EventEmitter, Input, OnChanges, - Output, - SimpleChanges, + Output } from '@angular/core'; -import { Emoji, EmojiData, EmojiService } from '@ctrl/ngx-emoji-mart/ngx-emoji'; @Component({ selector: 'emoji-preview',