@den4ik92/ng2-smart-table 19.0.3 → 19.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +167 -0
- package/fesm2022/den4ik92-ng2-smart-table.mjs +320 -88
- package/fesm2022/den4ik92-ng2-smart-table.mjs.map +1 -1
- package/lib/components/table-columns-editor/column-editor.directive.d.ts +18 -0
- package/lib/components/table-columns-editor/table-columns-editor.component.d.ts +19 -0
- package/lib/lib/grid.d.ts +14 -4
- package/lib/lib/helpers.d.ts +4 -1
- package/lib/lib/interfaces/smart-table.models.d.ts +16 -12
- package/lib/ng2-smart-table.component.d.ts +5 -6
- package/package.json +3 -2
- package/public-api.d.ts +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Angular Smart Table Component
|
|
2
|
+
|
|
3
|
+
ng2-smart-table component made with :heart: by [Akveo team](http://akveo.com/). Follow us on [Twitter](https://twitter.com/akveo_inc) to get latest news about this component first!
|
|
4
|
+
|
|
5
|
+
## ⚠ Low Maintenance
|
|
6
|
+
Due to project priority and resource constraints, this project is currently on low maintenance. We recognize that there are a lot of activities around this package. However, we are unable to accommodate the maintenance this project requires.
|
|
7
|
+
|
|
8
|
+
### Demo
|
|
9
|
+
|
|
10
|
+
<a target="_blank" href="https://akveo.github.io/ng2-smart-table/">Live Demo</a>
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
The library is available as npm package, so all you need to do is to run the following command:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
npm install --save ng2-smart-table
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This command will create a record in your `package.json` file and install the package into the npm modules folder.
|
|
23
|
+
|
|
24
|
+
## Minimal Setup Example
|
|
25
|
+
|
|
26
|
+
First thing you need to do is to import the ng2-smart-table directives into your component.
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
import { Ng2SmartTableModule } from 'ng2-smart-table';
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Then register it by adding to the list of directives of your module:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
// ...
|
|
38
|
+
|
|
39
|
+
@NgModule({
|
|
40
|
+
imports: [
|
|
41
|
+
// ...
|
|
42
|
+
|
|
43
|
+
Ng2SmartTableModule,
|
|
44
|
+
|
|
45
|
+
// ...
|
|
46
|
+
],
|
|
47
|
+
declarations: [ ... ]
|
|
48
|
+
})
|
|
49
|
+
// ...
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Now, we need to configure the table and add it into the template. The only <strong>required</strong> setting for the component to start working is a columns configuration.
|
|
53
|
+
Let's register <i>settings</i> property inside of the component where we want to have the table and configure some columns [Settings documentation](https://akveo.github.io/ng2-smart-table/#/documentation):
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
settings = {
|
|
57
|
+
columns: {
|
|
58
|
+
id: {
|
|
59
|
+
title: 'ID'
|
|
60
|
+
},
|
|
61
|
+
name: {
|
|
62
|
+
title: 'Full Name'
|
|
63
|
+
},
|
|
64
|
+
username: {
|
|
65
|
+
title: 'User Name'
|
|
66
|
+
},
|
|
67
|
+
email: {
|
|
68
|
+
title: 'Email'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Finally let's put the ng2-smart-table component inside of the template:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
// ...
|
|
78
|
+
|
|
79
|
+
@Component({
|
|
80
|
+
template: `
|
|
81
|
+
<ng2-smart-table [settings]="settings"></ng2-smart-table>
|
|
82
|
+
`
|
|
83
|
+
})
|
|
84
|
+
// ...
|
|
85
|
+
```
|
|
86
|
+
At this step you will have a minimal configured table. All functions are available by default and you don't need to configure them anyhow, so now you can add/edit/delete rows, sort or filter the table, etc.
|
|
87
|
+
|
|
88
|
+
Still it seems like something is missing... Right, there is no data in the table by default. To add some, let's create an array property with a list of objects in the component. Please note that object keys are the same as in the columns configuration.
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
data = [
|
|
92
|
+
{
|
|
93
|
+
id: 1,
|
|
94
|
+
name: "Leanne Graham",
|
|
95
|
+
username: "Bret",
|
|
96
|
+
email: "Sincere@april.biz"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 2,
|
|
100
|
+
name: "Ervin Howell",
|
|
101
|
+
username: "Antonette",
|
|
102
|
+
email: "Shanna@melissa.tv"
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
// ... list of items
|
|
106
|
+
|
|
107
|
+
{
|
|
108
|
+
id: 11,
|
|
109
|
+
name: "Nicholas DuBuque",
|
|
110
|
+
username: "Nicholas.Stanton",
|
|
111
|
+
email: "Rey.Padberg@rosamond.biz"
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
And pass the data to the table:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
// ...
|
|
120
|
+
|
|
121
|
+
@Component({
|
|
122
|
+
template: `
|
|
123
|
+
<ng2-smart-table [settings]="settings" [source]="data"></ng2-smart-table>
|
|
124
|
+
`
|
|
125
|
+
})
|
|
126
|
+
// ...
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Now you have some data in the table.
|
|
130
|
+
|
|
131
|
+
## Further Documentation
|
|
132
|
+
Installation, customization and other useful articles: https://akveo.github.io/ng2-smart-table/
|
|
133
|
+
|
|
134
|
+
## UI Bakery
|
|
135
|
+
Try low-code internal tool builder for free
|
|
136
|
+
<a href="https://uibakery.io/?utm_source=github&utm_medium=clicks&utm_campaign=banner"><img src="https://user-images.githubusercontent.com/6151971/125071660-41f84900-e0c2-11eb-882a-0c675eb1e5e3.png"></a>
|
|
137
|
+
|
|
138
|
+
## How can I support developers?
|
|
139
|
+
- Star our GitHub repo :star:
|
|
140
|
+
- Create pull requests, submit bugs, suggest new features or documentation updates :wrench:
|
|
141
|
+
- Follow us on [Twitter](https://twitter.com/akveo_inc) :feet:
|
|
142
|
+
- Like our page on [Facebook](https://www.facebook.com/akveo/) :thumbsup:
|
|
143
|
+
|
|
144
|
+
## Can I hire you guys?
|
|
145
|
+
Yes! Visit [our homepage](http://akveo.com/) or simply leave us a note to [contact@akveo.com](mailto:contact@akveo.com). We will be happy to work with you!
|
|
146
|
+
|
|
147
|
+
## Features
|
|
148
|
+
* Local data source (Server/API LocalDataSource is on its way)
|
|
149
|
+
* Filtering
|
|
150
|
+
* Sorting
|
|
151
|
+
* Pagination
|
|
152
|
+
* Inline Add/Edit/Delete
|
|
153
|
+
* Flexible event model
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
[MIT](LICENSE.txt) license.
|
|
157
|
+
|
|
158
|
+
## Special thanks to our awesome contributors!
|
|
159
|
+
|
|
160
|
+
[<img alt="nnixaa" src="https://avatars0.githubusercontent.com/u/230527?v=3&s=60" width="60">](https://github.com/nnixaa)[<img alt="lexzhukov" src="https://avatars0.githubusercontent.com/u/12192373?v=3&s=60" width="60">](https://github.com/lexzhukov)[<img alt="damnko" src="https://avatars2.githubusercontent.com/u/680205?v=3&s=60" width="60">](https://github.com/damnko)[<img alt="Tibing" src="https://avatars2.githubusercontent.com/u/17410089?v=3&s=60" width="60">](https://github.com/Tibing)[<img alt="Ezeon" src="https://avatars0.githubusercontent.com/u/21973741?v=3&s=60" width="60">](https://github.com/Ezeon)[<img alt="Deilan" src="https://avatars1.githubusercontent.com/u/4777512?v=3&s=60" width="60">](https://github.com/Deilan)[<img alt="hoswey" src="https://avatars0.githubusercontent.com/u/3689445?v=3&s=60" width="60">](https://github.com/hoswey)[<img alt="stacyakveo" src="https://avatars2.githubusercontent.com/u/27723447?v=3&s=60" width="60">](https://github.com/stacyakveo)[<img alt="Akshaymisal5" src="https://avatars3.githubusercontent.com/u/15906551?v=3&s=60" width="60">](https://github.com/Akshaymisal5)[<img alt="geneeblack" src="https://avatars0.githubusercontent.com/u/282525?v=3&s=60" width="60">](https://github.com/geneeblack)[<img alt="vvandoorne" src="https://avatars2.githubusercontent.com/u/26658175?v=3&s=60" width="60">](https://github.com/vvandoorne)[<img alt="ananthhh" src="https://avatars1.githubusercontent.com/u/3583234?v=3&s=60" width="60">](https://github.com/ananthhh)[<img alt="bis-sb" src="https://avatars1.githubusercontent.com/u/22668001?v=3&s=60" width="60">](https://github.com/bis-sb)[<img alt="tadashi-aikawa" src="https://avatars1.githubusercontent.com/u/9500018?v=3&s=60" width="60">](https://github.com/tadashi-aikawa)
|
|
161
|
+
|
|
162
|
+
[<img alt="nureha" src="https://avatars2.githubusercontent.com/u/7064537?v=3&s=60" width="60">](https://github.com/nureha)[<img alt="vlupu10" src="https://avatars1.githubusercontent.com/u/3597512?v=3&s=60" width="60">](https://github.com/vlupu10)[<img alt="zhouhao27" src="https://avatars1.githubusercontent.com/u/8099731?v=3&s=60" width="60">](https://github.com/zhouhao27)[<img alt="hkb1990" src="https://avatars1.githubusercontent.com/u/2637138?v=3&s=60" width="60">](https://github.com/hkb1990)[<img alt="liaosong" src="https://avatars0.githubusercontent.com/u/3927282?v=3&s=60" width="60">](https://github.com/liaosong)[<img alt="ktriek" src="https://avatars2.githubusercontent.com/u/4461059?v=3&s=60" width="60">](https://github.com/ktriek)
|
|
163
|
+
|
|
164
|
+
### From akveo
|
|
165
|
+
|
|
166
|
+
Enjoy :metal:
|
|
167
|
+
We're always happy to hear your feedback!
|