Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
tt-ui-md-table
Advanced tools
v1.0.0 - Angular Material Design -- Table Component
Add module:
angular.module('app', [
'ttmd.table'
]);
Include file:
require('angular-md-table/dist/tt-ui-md-table.min.css');
require('angular-md-table/dist/tt-ui-md-table.min.js');
#DEMO
The default breakpoint is 'xs', able to pass breakpoint
bindings to the component
<ttmd-table items="vm.items" headers="vm.headers" breakpoint="sm"></ttmd-table>
If there is a case you only want to display mobile view, pass in force-mobile
:
<ttmd-table items="vm.items" headers="vm.headers" force-mobile="true"></ttmd-table>
To re-render the data efficient, you can have type
:
<ttmd-table items="vm.accounts.dueDate" headers="vm.headers" type="dueDate"></ttmd-table>
The type
you pass in , will be the listType
inside js:
this.SomeService.fetchDataAccordingPagination(limit, offset, listType)
.then((res) => {
if(listType){
this.accounts[listType] = [
...res
];
}
})
To display the toolbar for the table, passing tooblar
attr. Which is an object contains title
and icon
:
Here icon
is Material font icon: string
<ttmd-table items="vm.items" headers="vm.headers" toolbar="{
title="Due Date"
icon="account_circle"
}"></ttmd-table>
The desktop and mobile pagination will be handle differently. To enable pagination, need to pass in total-number
to tell how many pages in total. on-page-change
the function need to be called when fetch another page's data.
<ttmd-table items="vm.items" headers="vm.headers" total-number="vm.totalNumber" on-page-change="vm.fetchData(payload)"></ttmd-table>
Able to sort
data according to the attr, this should be an array, but currently, only work with the first element inside the array.
<ttmd-table items="vm.items" headers="vm.headers" sort=['dueDate']"></ttmd-table>
If there is any attr inside the data you don't want to display on the interface, you can use exclude
:
<ttmd-table items="vm.items" headers="vm.headers" exclude="['id']"></ttmd-table>
You can use Angular built-in filter such as date
& currency
by adding pipies
to format the field:
<ttmd-table items="vm.items" headers="vm.headers" pipes="vm.pipes"></ttmd-table>
this.pipes = {
currency: {
targets: ['amount', 'amountWithOutTax'],
foramt: '$' // default $, optional
},
date: {
tragets: ['dueDate'],
format: 'mm-DD-yyyy'
}
}
You can highlight row by adding highlight-row
to the html:
<ttmd-table items="vm.items" headers="vm.headers" highlight-row="vm.someFn"></ttmd-table>
It takes function:
//Item is sent back with callback
const someFn = (item) => {
return fn(item.someAttr); // parsing some logic
}
By default, desktop view show 8 pre-page, mobile view shows 3 pre-page, you can config this for each table:
<ttmd-table items="vm.items" headers="vm.headers" limits="{desktop: 5, mobile: 4}"></ttmd-table>
Besides displaying data, you can pass in action. By default, action will be shown as a button
<ttmd-table
headers="vm.multiPaymentsHeaders"
items="vm.accounts.all"
total-number="vm.accounts.totals.all"
on-page-change="vm.updateMultiPaymentList(payload)"
type="all"
breakpoint="sm"
sort="['dueDate']"
toolbar="{
title: vm.$translate.instant('paymentComponent.allPendingBills'),
icon: 'account_circle'
}">
<ttmd-actions>
<ttmd-action
text="vm.$translate.instant('paymentComponent.pay')"
on-click="vm.pay(payload)"
></ttmd-action>
</ttmd-actions>
</ttmd-table>
If there is a case you want to display as a button based on prop something
is true, and just display normal text if something
is false.
<ttmd-actions>
<!-- Button -->
<ttmd-action
show-as="button"
if="something"
text="pay"
></ttmd-action>
<!-- Text -->
<ttmd-action
show-as="text"
if="!something"
text="Paid"
></ttmd-action>
</ttmd-actions>
If you want to display more detail information when click the row, you can add <ttmd-detail>
to the code, inside <ttmd-detail>
, passing the directive you want to display. Also add on-row-click
to the
<ttmd-table
items="vm.invoices"
headers="vm.headers"
on-row-click="vm.someFn(payload)">
<ttmd-detail>
<your_directive selected-invoice="vm.someData"></your_directive>
</ttmd-detail>
</ttmd-table>
Inside someFn()
function, it will return someData
for your_directive
to display.
someFn(payload){
this.someData = payload;
}
It is possible to config for all the tables inside application.
To do that, go to the ngModule.config()
, inject ttmdTableProvider
:
ngModule.config( (ttmdTableProvider) => {
ttmdTableProvider.setConfig({
limits: {desktop: 7, mobile: 4},
breakpoint: 'sm'
})
});
const _defaultConfigs = {
forceMobile: false,
breakpoint: 'xs',
limits: {
desktop: 8,
mobile: 3
}
}
[
{
"serviceCode": "1-260-865-6252 x638",
"username": "Milton Mraz",
"amount": "8.03",
"dueDate": "2016-05-20T05:15:02.719Z"
},
{
"serviceCode": "1-965-662-5118",
"username": "Alessandro Kassulke",
"amount": "8.61",
"dueDate": "2016-06-25T19:15:02.720Z"
}
]
// Using angular-translate inside the table component, so you need to give the path to find your value
vm.headers =[
'some.path.to.value',
'some.path.to.value2'
]
vm.limits = {
desktop: 3,
mobile: 3,
}
vm.toolbar = {
title: this.$translate.instant('path.to.value'),
icon: 'string'
}
vm.pipes = {
target: [],
foramt: string
}
Default: 'button' Available value: 'button', 'text'
Use the attr on the each object
if= "someAttr > 3"; // if someAttr = 5, then action doesn't show, if someAttr = 2, then action will show
FAQs
Angular Material Design Table Component
The npm package tt-ui-md-table receives a total of 1 weekly downloads. As such, tt-ui-md-table popularity was classified as not popular.
We found that tt-ui-md-table demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.