@tots/table 16.0.19 → 20.0.0
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 +139 -13
- package/fesm2022/tots-table.mjs +118 -107
- package/fesm2022/tots-table.mjs.map +1 -1
- package/index.d.ts +384 -5
- package/package.json +5 -7
- package/esm2022/lib/column-factories/tots-balance-column.mjs +0 -12
- package/esm2022/lib/column-factories/tots-balance-icon-column.mjs +0 -15
- package/esm2022/lib/column-factories/tots-boolean-column.mjs +0 -8
- package/esm2022/lib/column-factories/tots-checkbox-column.mjs +0 -13
- package/esm2022/lib/column-factories/tots-currency-column.mjs +0 -8
- package/esm2022/lib/column-factories/tots-icon-button-column.mjs +0 -15
- package/esm2022/lib/column-factories/tots-link-column.mjs +0 -12
- package/esm2022/lib/column-factories/tots-more-menu-column.mjs +0 -12
- package/esm2022/lib/column-factories/tots-number-column.mjs +0 -12
- package/esm2022/lib/column-factories/tots-option-column.mjs +0 -13
- package/esm2022/lib/column-factories/tots-status-column.mjs +0 -13
- package/esm2022/lib/column-factories/tots-status-icon-column.mjs +0 -13
- package/esm2022/lib/column-factories/tots-string-column.mjs +0 -11
- package/esm2022/lib/column-factories/tots-two-string-column.mjs +0 -11
- package/esm2022/lib/column-factories/tots-user-column.mjs +0 -16
- package/esm2022/lib/columns/balance-currency-column/balance-currency-column.component.mjs +0 -23
- package/esm2022/lib/columns/balance-currency-icon-column/balance-currency-icon-column.component.mjs +0 -23
- package/esm2022/lib/columns/base-print-column/base-print-column.component.mjs +0 -29
- package/esm2022/lib/columns/boolean-column/boolean-column.component.mjs +0 -13
- package/esm2022/lib/columns/checkbox-column/checkbox-column.component.mjs +0 -20
- package/esm2022/lib/columns/currency-column/currency-column.component.mjs +0 -13
- package/esm2022/lib/columns/icon-button-column/icon-button-column.component.mjs +0 -28
- package/esm2022/lib/columns/link-column/link-column.component.mjs +0 -18
- package/esm2022/lib/columns/more-menu-column/more-menu-column.component.mjs +0 -21
- package/esm2022/lib/columns/number-column/number-column.component.mjs +0 -13
- package/esm2022/lib/columns/option-column/option-column.component.mjs +0 -22
- package/esm2022/lib/columns/status-column/status-column.component.mjs +0 -32
- package/esm2022/lib/columns/status-icon-column/status-icon-column.component.mjs +0 -24
- package/esm2022/lib/columns/string-column/string-column.component.mjs +0 -24
- package/esm2022/lib/columns/tots-base-column.component.mjs +0 -26
- package/esm2022/lib/columns/two-string-column/two-string-column.component.mjs +0 -16
- package/esm2022/lib/columns/user-column/user-column.component.mjs +0 -66
- package/esm2022/lib/components/loading-animation-renderer/loading-animation-renderer.component.mjs +0 -42
- package/esm2022/lib/components/tots-table/tots-table.component.mjs +0 -108
- package/esm2022/lib/components/tots-table-api/tots-table-api.component.mjs +0 -67
- package/esm2022/lib/entities/tots-action-table.mjs +0 -6
- package/esm2022/lib/entities/tots-column-option.mjs +0 -7
- package/esm2022/lib/entities/tots-column.mjs +0 -12
- package/esm2022/lib/entities/tots-more-menu-item.mjs +0 -9
- package/esm2022/lib/entities/tots-status-column-option.mjs +0 -9
- package/esm2022/lib/entities/tots-status-icon-column-option.mjs +0 -8
- package/esm2022/lib/entities/tots-table-api-config.mjs +0 -10
- package/esm2022/lib/entities/tots-table-config.mjs +0 -8
- package/esm2022/lib/entities/tots-table-default-config.mjs +0 -11
- package/esm2022/lib/helpers/tots-table-helper.mjs +0 -25
- package/esm2022/lib/table.module.mjs +0 -142
- package/esm2022/public-api.mjs +0 -66
- package/esm2022/tots-table.mjs +0 -5
- package/lib/column-factories/tots-balance-column.d.ts +0 -4
- package/lib/column-factories/tots-balance-icon-column.d.ts +0 -4
- package/lib/column-factories/tots-boolean-column.d.ts +0 -4
- package/lib/column-factories/tots-checkbox-column.d.ts +0 -5
- package/lib/column-factories/tots-currency-column.d.ts +0 -4
- package/lib/column-factories/tots-icon-button-column.d.ts +0 -5
- package/lib/column-factories/tots-link-column.d.ts +0 -4
- package/lib/column-factories/tots-more-menu-column.d.ts +0 -5
- package/lib/column-factories/tots-number-column.d.ts +0 -4
- package/lib/column-factories/tots-option-column.d.ts +0 -5
- package/lib/column-factories/tots-status-column.d.ts +0 -5
- package/lib/column-factories/tots-status-icon-column.d.ts +0 -5
- package/lib/column-factories/tots-string-column.d.ts +0 -4
- package/lib/column-factories/tots-two-string-column.d.ts +0 -4
- package/lib/column-factories/tots-user-column.d.ts +0 -4
- package/lib/columns/balance-currency-column/balance-currency-column.component.d.ts +0 -9
- package/lib/columns/balance-currency-icon-column/balance-currency-icon-column.component.d.ts +0 -9
- package/lib/columns/base-print-column/base-print-column.component.d.ts +0 -16
- package/lib/columns/boolean-column/boolean-column.component.d.ts +0 -6
- package/lib/columns/checkbox-column/checkbox-column.component.d.ts +0 -8
- package/lib/columns/currency-column/currency-column.component.d.ts +0 -6
- package/lib/columns/icon-button-column/icon-button-column.component.d.ts +0 -10
- package/lib/columns/link-column/link-column.component.d.ts +0 -10
- package/lib/columns/more-menu-column/more-menu-column.component.d.ts +0 -7
- package/lib/columns/number-column/number-column.component.d.ts +0 -6
- package/lib/columns/option-column/option-column.component.d.ts +0 -7
- package/lib/columns/status-column/status-column.component.d.ts +0 -8
- package/lib/columns/status-icon-column/status-icon-column.component.d.ts +0 -7
- package/lib/columns/string-column/string-column.component.d.ts +0 -8
- package/lib/columns/tots-base-column.component.d.ts +0 -13
- package/lib/columns/two-string-column/two-string-column.component.d.ts +0 -7
- package/lib/columns/user-column/user-column.component.d.ts +0 -15
- package/lib/components/loading-animation-renderer/loading-animation-renderer.component.d.ts +0 -15
- package/lib/components/tots-table/tots-table.component.d.ts +0 -44
- package/lib/components/tots-table-api/tots-table-api.component.d.ts +0 -25
- package/lib/entities/tots-action-table.d.ts +0 -4
- package/lib/entities/tots-column-option.d.ts +0 -5
- package/lib/entities/tots-column.d.ts +0 -12
- package/lib/entities/tots-more-menu-item.d.ts +0 -7
- package/lib/entities/tots-status-column-option.d.ts +0 -6
- package/lib/entities/tots-status-icon-column-option.d.ts +0 -5
- package/lib/entities/tots-table-api-config.d.ts +0 -9
- package/lib/entities/tots-table-config.d.ts +0 -9
- package/lib/entities/tots-table-default-config.d.ts +0 -36
- package/lib/helpers/tots-table-helper.d.ts +0 -9
- package/lib/table.module.d.ts +0 -34
- package/public-api.d.ts +0 -62
package/README.md
CHANGED
|
@@ -1,24 +1,150 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://avatars.githubusercontent.com/u/117909365" alt="Tots Logo" width="150">
|
|
3
|
+
|
|
4
|
+
<h1>
|
|
5
|
+
@tots/table
|
|
6
|
+
</h1>
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
</div>
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
<br><br>
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
> Note: Don't forget to add `--project table` or else it will be added to the default project in your `angular.json` file.
|
|
12
|
+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 20.0.0.
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
`@tots/table` is a library for creating tables through column definitions with a predefined logic and look. It includes
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
- Three table components
|
|
17
|
+
- Basic table
|
|
18
|
+
- Table with built in HTTP functionality
|
|
19
|
+
- Table with form logic
|
|
20
|
+
- A set of interchangeable columns
|
|
21
|
+
- Configuration through dependency injection
|
|
22
|
+
- The posibility of creating custom columns
|
|
13
23
|
|
|
14
|
-
|
|
24
|
+
<br>
|
|
25
|
+
<hr>
|
|
26
|
+
<br>
|
|
15
27
|
|
|
16
|
-
|
|
28
|
+
## Installation
|
|
17
29
|
|
|
18
|
-
|
|
30
|
+
```bash
|
|
31
|
+
npm install @tots/table
|
|
32
|
+
```
|
|
19
33
|
|
|
20
|
-
|
|
34
|
+
Ensure your project uses Angular 20+ and compatible versions of TypeScript, and rxjs.
|
|
21
35
|
|
|
22
|
-
|
|
36
|
+
<br>
|
|
37
|
+
<hr>
|
|
38
|
+
<br>
|
|
23
39
|
|
|
24
|
-
|
|
40
|
+
## Importing the module
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { NgModule } from '@angular/core';
|
|
44
|
+
import { TotsTableModule } from '@tots/table';
|
|
45
|
+
|
|
46
|
+
@NgModule({
|
|
47
|
+
imports: [TotsTableModule]
|
|
48
|
+
})
|
|
49
|
+
export class AppModule { }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
<br>
|
|
53
|
+
|
|
54
|
+
## Configuration through providers
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { NgModule } from '@angular/core';
|
|
58
|
+
import { TotsTableModule, TOTS_TABLE_DEFAULT_CONFIG } from '@tots/table';
|
|
59
|
+
import { CustomLoadingComponent } from "./components/custom-loading/custom-loading.component";
|
|
60
|
+
|
|
61
|
+
export const totsTableDefaultConfig : TotsTableDefaultConfig = {
|
|
62
|
+
loadingComponent: CustomLoadingComponent,
|
|
63
|
+
upperPaginator: true,
|
|
64
|
+
upperProgressBar: true
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@NgModule({
|
|
68
|
+
imports: [TotsTableModule],
|
|
69
|
+
providers: [
|
|
70
|
+
{
|
|
71
|
+
provide: TOTS_TABLE_DEFAULT_CONFIG,
|
|
72
|
+
useValue: totsTableDefaultConfig
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
})
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
<br>
|
|
79
|
+
|
|
80
|
+
## Usage of Tots Table
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<tots-table
|
|
84
|
+
[config]="config"
|
|
85
|
+
(onAction)="onTableAction($event)"
|
|
86
|
+
[pageIndex]="1"
|
|
87
|
+
[pageSize]="5"
|
|
88
|
+
></tots-table>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { Component, OnInit } from '@angular/core';
|
|
93
|
+
import { delay, of } from 'rxjs';
|
|
94
|
+
import { TotsTableConfig, TotsStringColumn, TotsOptionColumn, TotsColumnOption, TotsNumberColumn, TotsDateColumn, TotsMoreMenuColumn, TotsMoreMenuItem, TotsActionTable } from 'tots/table';
|
|
95
|
+
import { TotsListResponse } from '@tots/core';
|
|
96
|
+
|
|
97
|
+
@Component({
|
|
98
|
+
//...
|
|
99
|
+
})
|
|
100
|
+
export class AppComponent implements OnInit {
|
|
101
|
+
|
|
102
|
+
protected config! : TotsTableConfig;
|
|
103
|
+
|
|
104
|
+
// Can contain data for starting values or be empty
|
|
105
|
+
protected item = {
|
|
106
|
+
name: "Name",
|
|
107
|
+
type: 2
|
|
108
|
+
};
|
|
109
|
+
protected items = [
|
|
110
|
+
{ id: 1, title: 'Item 1', active: 1, amount: 10500, date: '2025-01-01' },
|
|
111
|
+
{ id: 2, title: 'Item 2', active: 1, amount: 9200, date: '2025-02-02' },
|
|
112
|
+
{ id: 3, title: 'Item 3', active: 0, amount: 18900, date: '2025-03-03' },
|
|
113
|
+
{ id: 4, title: 'Item 4', active: 0, amount: 14500, date: '2025-04-04' },
|
|
114
|
+
{ id: 5, title: 'Item 5', active: 1, amount: 1200, date: '2025-05-05' },
|
|
115
|
+
];
|
|
116
|
+
|
|
117
|
+
ngOnInit() {
|
|
118
|
+
this.config = new TotsTableConfig();
|
|
119
|
+
this.config.id = 'table-example';
|
|
120
|
+
|
|
121
|
+
this.config.columns = [
|
|
122
|
+
new TotsStringColumn("id", "id", "#", true),
|
|
123
|
+
new TotsStringColumn("title", "title", "Título", true),
|
|
124
|
+
new TotsOptionColumn("active", "active", [
|
|
125
|
+
new TotsColumnOption(1, "Active"),
|
|
126
|
+
new TotsColumnOption(0, "Inactive")
|
|
127
|
+
], "Active"),
|
|
128
|
+
new TotsNumberColumn("amount", "amount", "Amount", true)
|
|
129
|
+
new TotsDateColumn("date", "date", "Fecha", "YYYY-MM-DD", 'MM/DD/YYYY'),
|
|
130
|
+
new TotsMoreMenuColumn("menu", [
|
|
131
|
+
new TotsMoreMenuItem("edit", "Edit", "edit", "a_css_class"),
|
|
132
|
+
new TotsMoreMenuItem("delete", "Eliminar", "delete"),
|
|
133
|
+
])
|
|
134
|
+
];
|
|
135
|
+
|
|
136
|
+
// Assign data fetching function
|
|
137
|
+
let data = new TotsListResponse();
|
|
138
|
+
data.data = this.items;
|
|
139
|
+
this.config.obs = of(data).pipe(delay(1000));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
protected onTableAction(action:TotsActionTable) {
|
|
143
|
+
if (action.key == 'click-order') {
|
|
144
|
+
// do something
|
|
145
|
+
} else if (action.key == "page-change") {
|
|
146
|
+
// do something
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|