@tots/table 16.0.20 → 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.
Files changed (100) hide show
  1. package/README.md +139 -13
  2. package/fesm2022/tots-table.mjs +116 -106
  3. package/fesm2022/tots-table.mjs.map +1 -1
  4. package/index.d.ts +384 -5
  5. package/package.json +5 -7
  6. package/esm2022/lib/column-factories/tots-balance-column.mjs +0 -12
  7. package/esm2022/lib/column-factories/tots-balance-icon-column.mjs +0 -15
  8. package/esm2022/lib/column-factories/tots-boolean-column.mjs +0 -8
  9. package/esm2022/lib/column-factories/tots-checkbox-column.mjs +0 -13
  10. package/esm2022/lib/column-factories/tots-currency-column.mjs +0 -8
  11. package/esm2022/lib/column-factories/tots-icon-button-column.mjs +0 -15
  12. package/esm2022/lib/column-factories/tots-link-column.mjs +0 -12
  13. package/esm2022/lib/column-factories/tots-more-menu-column.mjs +0 -12
  14. package/esm2022/lib/column-factories/tots-number-column.mjs +0 -12
  15. package/esm2022/lib/column-factories/tots-option-column.mjs +0 -13
  16. package/esm2022/lib/column-factories/tots-status-column.mjs +0 -13
  17. package/esm2022/lib/column-factories/tots-status-icon-column.mjs +0 -13
  18. package/esm2022/lib/column-factories/tots-string-column.mjs +0 -11
  19. package/esm2022/lib/column-factories/tots-two-string-column.mjs +0 -11
  20. package/esm2022/lib/column-factories/tots-user-column.mjs +0 -16
  21. package/esm2022/lib/columns/balance-currency-column/balance-currency-column.component.mjs +0 -23
  22. package/esm2022/lib/columns/balance-currency-icon-column/balance-currency-icon-column.component.mjs +0 -23
  23. package/esm2022/lib/columns/base-print-column/base-print-column.component.mjs +0 -29
  24. package/esm2022/lib/columns/boolean-column/boolean-column.component.mjs +0 -13
  25. package/esm2022/lib/columns/checkbox-column/checkbox-column.component.mjs +0 -20
  26. package/esm2022/lib/columns/currency-column/currency-column.component.mjs +0 -13
  27. package/esm2022/lib/columns/icon-button-column/icon-button-column.component.mjs +0 -28
  28. package/esm2022/lib/columns/link-column/link-column.component.mjs +0 -18
  29. package/esm2022/lib/columns/more-menu-column/more-menu-column.component.mjs +0 -21
  30. package/esm2022/lib/columns/number-column/number-column.component.mjs +0 -13
  31. package/esm2022/lib/columns/option-column/option-column.component.mjs +0 -22
  32. package/esm2022/lib/columns/status-column/status-column.component.mjs +0 -32
  33. package/esm2022/lib/columns/status-icon-column/status-icon-column.component.mjs +0 -24
  34. package/esm2022/lib/columns/string-column/string-column.component.mjs +0 -24
  35. package/esm2022/lib/columns/tots-base-column.component.mjs +0 -26
  36. package/esm2022/lib/columns/two-string-column/two-string-column.component.mjs +0 -16
  37. package/esm2022/lib/columns/user-column/user-column.component.mjs +0 -67
  38. package/esm2022/lib/components/loading-animation-renderer/loading-animation-renderer.component.mjs +0 -42
  39. package/esm2022/lib/components/tots-table/tots-table.component.mjs +0 -108
  40. package/esm2022/lib/components/tots-table-api/tots-table-api.component.mjs +0 -67
  41. package/esm2022/lib/entities/tots-action-table.mjs +0 -6
  42. package/esm2022/lib/entities/tots-column-option.mjs +0 -7
  43. package/esm2022/lib/entities/tots-column.mjs +0 -12
  44. package/esm2022/lib/entities/tots-more-menu-item.mjs +0 -9
  45. package/esm2022/lib/entities/tots-status-column-option.mjs +0 -9
  46. package/esm2022/lib/entities/tots-status-icon-column-option.mjs +0 -8
  47. package/esm2022/lib/entities/tots-table-api-config.mjs +0 -10
  48. package/esm2022/lib/entities/tots-table-config.mjs +0 -8
  49. package/esm2022/lib/entities/tots-table-default-config.mjs +0 -11
  50. package/esm2022/lib/helpers/tots-table-helper.mjs +0 -25
  51. package/esm2022/lib/table.module.mjs +0 -142
  52. package/esm2022/public-api.mjs +0 -66
  53. package/esm2022/tots-table.mjs +0 -5
  54. package/lib/column-factories/tots-balance-column.d.ts +0 -4
  55. package/lib/column-factories/tots-balance-icon-column.d.ts +0 -4
  56. package/lib/column-factories/tots-boolean-column.d.ts +0 -4
  57. package/lib/column-factories/tots-checkbox-column.d.ts +0 -5
  58. package/lib/column-factories/tots-currency-column.d.ts +0 -4
  59. package/lib/column-factories/tots-icon-button-column.d.ts +0 -5
  60. package/lib/column-factories/tots-link-column.d.ts +0 -4
  61. package/lib/column-factories/tots-more-menu-column.d.ts +0 -5
  62. package/lib/column-factories/tots-number-column.d.ts +0 -4
  63. package/lib/column-factories/tots-option-column.d.ts +0 -5
  64. package/lib/column-factories/tots-status-column.d.ts +0 -5
  65. package/lib/column-factories/tots-status-icon-column.d.ts +0 -5
  66. package/lib/column-factories/tots-string-column.d.ts +0 -4
  67. package/lib/column-factories/tots-two-string-column.d.ts +0 -4
  68. package/lib/column-factories/tots-user-column.d.ts +0 -4
  69. package/lib/columns/balance-currency-column/balance-currency-column.component.d.ts +0 -9
  70. package/lib/columns/balance-currency-icon-column/balance-currency-icon-column.component.d.ts +0 -9
  71. package/lib/columns/base-print-column/base-print-column.component.d.ts +0 -16
  72. package/lib/columns/boolean-column/boolean-column.component.d.ts +0 -6
  73. package/lib/columns/checkbox-column/checkbox-column.component.d.ts +0 -8
  74. package/lib/columns/currency-column/currency-column.component.d.ts +0 -6
  75. package/lib/columns/icon-button-column/icon-button-column.component.d.ts +0 -10
  76. package/lib/columns/link-column/link-column.component.d.ts +0 -10
  77. package/lib/columns/more-menu-column/more-menu-column.component.d.ts +0 -7
  78. package/lib/columns/number-column/number-column.component.d.ts +0 -6
  79. package/lib/columns/option-column/option-column.component.d.ts +0 -7
  80. package/lib/columns/status-column/status-column.component.d.ts +0 -8
  81. package/lib/columns/status-icon-column/status-icon-column.component.d.ts +0 -7
  82. package/lib/columns/string-column/string-column.component.d.ts +0 -8
  83. package/lib/columns/tots-base-column.component.d.ts +0 -13
  84. package/lib/columns/two-string-column/two-string-column.component.d.ts +0 -7
  85. package/lib/columns/user-column/user-column.component.d.ts +0 -15
  86. package/lib/components/loading-animation-renderer/loading-animation-renderer.component.d.ts +0 -15
  87. package/lib/components/tots-table/tots-table.component.d.ts +0 -44
  88. package/lib/components/tots-table-api/tots-table-api.component.d.ts +0 -25
  89. package/lib/entities/tots-action-table.d.ts +0 -4
  90. package/lib/entities/tots-column-option.d.ts +0 -5
  91. package/lib/entities/tots-column.d.ts +0 -12
  92. package/lib/entities/tots-more-menu-item.d.ts +0 -7
  93. package/lib/entities/tots-status-column-option.d.ts +0 -6
  94. package/lib/entities/tots-status-icon-column-option.d.ts +0 -5
  95. package/lib/entities/tots-table-api-config.d.ts +0 -9
  96. package/lib/entities/tots-table-config.d.ts +0 -9
  97. package/lib/entities/tots-table-default-config.d.ts +0 -36
  98. package/lib/helpers/tots-table-helper.d.ts +0 -9
  99. package/lib/table.module.d.ts +0 -34
  100. package/public-api.d.ts +0 -62
package/README.md CHANGED
@@ -1,24 +1,150 @@
1
- # Table
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
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.0.0.
8
+ </div>
4
9
 
5
- ## Code scaffolding
10
+ <br><br>
6
11
 
7
- Run `ng generate component component-name --project table` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project table`.
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
- ## Build
14
+ `@tots/table` is a library for creating tables through column definitions with a predefined logic and look. It includes
11
15
 
12
- Run `ng build table` to build the project. The build artifacts will be stored in the `dist/` directory.
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
- ## Publishing
24
+ <br>
25
+ <hr>
26
+ <br>
15
27
 
16
- After building your library with `ng build table`, go to the dist folder `cd dist/table` and run `npm publish`.
28
+ ## Installation
17
29
 
18
- ## Running unit tests
30
+ ```bash
31
+ npm install @tots/table
32
+ ```
19
33
 
20
- Run `ng test table` to execute the unit tests via [Karma](https://karma-runner.github.io).
34
+ Ensure your project uses Angular 20+ and compatible versions of TypeScript, and rxjs.
21
35
 
22
- ## Further help
36
+ <br>
37
+ <hr>
38
+ <br>
23
39
 
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
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
+ ```