
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
github.com/nodeart/angular-firebase-sortable-table
AFST is Angular module giving a solution for common problem - creation a table with firebase as a backend. It was decided to avoid using third part services as firebase cloud functions or writing own observer servers using node. Before you start it is strongly recommended to read an this article.
AFST is supplied with small demo (source)
that shows abilities of sortable table and the way one will use it. In order to start demo locally run npm run demo
.
Note: npm package is not suplied with demo source code, so visit github page to see it.
For full documentation of each component please visit this page.
Sources:
SortableTableComponent
LoadingComponent
SortableTableService
SortableItemDirective
DialogDirective
InfiniteScrollDirective
PriorityKeysPipe
npm install @nodeart/ngfb_sortable_table --save
Module is supplied with set of features that could be useful while working with tables such as
search, sort, filter and infinite scroll.
Due to limitations of firebase querying there are no complicated logic under the hood.
According to firebase documentation one can use only one orderBy
query at a time, so, unfortunately you can not
combine filters.
There are 4 types of events could happen. Each of them has its own querying rules and usage restrictions.
Events | InfiniteScroll | SortByHeader | FilterByInput | FilterBySelect |
---|---|---|---|---|
Reset previous query | false | true | true | true |
Basic query | {orderByKey: true} | {limitTo(First/Last): number, orderByChild: field} | {orderByKey: true} | orderByChild: field |
Priority | medium | low | low | high |
InfiniteScroll:
InfiniteScroll is a default event. First request to database will be done with it if no config for FilterBySelect
provided. It is the only event that doesn't reset previous query, only add the offset.
Fires when user is reached the bottom of the page.
Requirements:
@Input pagination
is passed;SortByHeader:
SortByHeader is an event that happen after toggling the arrow button on sortable
header items.
Restrictions:
Resets other queries.
FilterByInput:
FilterByInput is an event happen when user input some data in a search string. Input is debounced by default.
Restrictions:
Requirements:
@Input filterByInputValue
is passed in;Resets other queries.
FilterBySelect:
FilterBySelect event has the greatest priority value. If it is passed in than the first request to database will be made by the rules of this event.
Restrictions:
Requirements:
@Input filterBySelect
is passed in;Resets other queries.
AFST is designed for following components structure:
<user-table-container-component>
<ngfb-sortable-table>
<!--<ng-template ngfbSortableItem></ng-template>-->
<tr UserTableItemComponent> </tr>
</ngfb-sortable-table>
</user-table-container-component>
According to this structure you can not directly communicate between your components.
In order to do so, you can provide an @Input onChange: Function
to SortableTableComponent
and it will be
called in two cases:
@Input addNew: Component
(passed to SortableTableComponent
) close. ExampleUserTableItemComponent
. Example.Do not forget to bind your onChange
function to your component context in order to save it.
To improve firebase query performance use .indexOn
rule
in your database rules.
The selector of TableItemComponent
that you pass inside SortableTableComponent
must be attributive in
order to be properly displayed. Example: tr [sortableTableItem]
.
To sort your headers use PriorityKeysPipe
and pass enum with a list of headers as an argument and the list
of headers you'd prefer not to show.
Always bind setHeaders
function to your container component context
if you use this
keyword in setHedaers
function because it will be called in SortableTableComponent
context.
As child component doesn't not know who his parent actually is, we can't use forward ref
to done this.
As Angular 4 is released and <template></template>
element is deprecated and will be replaced with <ng-template></ng-template>
.
We use <ng-template></ng-template>
so this module is incompatible with Angular 2.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.