ngx-redi-core 0.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/.editorconfig +16 -0
- package/.vscode/extensions.json +4 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/tasks.json +42 -0
- package/README.md +27 -0
- package/angular.json +136 -0
- package/package.json +42 -0
- package/projects/ngx-redi-core/Helper/index.ts +2 -0
- package/projects/ngx-redi-core/Helper/ng-package.json +6 -0
- package/projects/ngx-redi-core/Helper/public-api.ts +1 -0
- package/projects/ngx-redi-core/Helper/src/helpers/csv.service.spec.ts +16 -0
- package/projects/ngx-redi-core/Helper/src/helpers/csv.service.ts +67 -0
- package/projects/ngx-redi-core/README.md +24 -0
- package/projects/ngx-redi-core/RediTable/index.ts +2 -0
- package/projects/ngx-redi-core/RediTable/ng-package.json +6 -0
- package/projects/ngx-redi-core/RediTable/public-api.ts +9 -0
- package/projects/ngx-redi-core/RediTable/src/models/interfaces/column-definition.ts +14 -0
- package/projects/ngx-redi-core/RediTable/src/models/interfaces/data-table.ts +28 -0
- package/projects/ngx-redi-core/RediTable/src/models/interfaces/row-action.ts +32 -0
- package/projects/ngx-redi-core/RediTable/src/models/types/event-table.type.spec.ts +7 -0
- package/projects/ngx-redi-core/RediTable/src/models/types/event-table.type.ts +3 -0
- package/projects/ngx-redi-core/RediTable/src/modules/redi-table/redi-table.component.css +106 -0
- package/projects/ngx-redi-core/RediTable/src/modules/redi-table/redi-table.component.html +70 -0
- package/projects/ngx-redi-core/RediTable/src/modules/redi-table/redi-table.component.spec.ts +162 -0
- package/projects/ngx-redi-core/RediTable/src/modules/redi-table/redi-table.component.ts +322 -0
- package/projects/ngx-redi-core/RediTable/src/modules/redi-table.module.ts +32 -0
- package/projects/ngx-redi-core/ng-package.json +7 -0
- package/projects/ngx-redi-core/package.json +12 -0
- package/projects/ngx-redi-core/src/lib/ngx-redi-core.component.spec.ts +23 -0
- package/projects/ngx-redi-core/src/lib/ngx-redi-core.component.ts +16 -0
- package/projects/ngx-redi-core/src/lib/ngx-redi-core.service.spec.ts +16 -0
- package/projects/ngx-redi-core/src/lib/ngx-redi-core.service.ts +9 -0
- package/projects/ngx-redi-core/src/public-api.ts +6 -0
- package/projects/ngx-redi-core/tsconfig.lib.json +14 -0
- package/projects/ngx-redi-core/tsconfig.lib.prod.json +10 -0
- package/projects/ngx-redi-core/tsconfig.spec.json +14 -0
- package/projects/ui-ngx-redi-core/src/app/app.component.html +28 -0
- package/projects/ui-ngx-redi-core/src/app/app.component.scss +53 -0
- package/projects/ui-ngx-redi-core/src/app/app.component.spec.ts +29 -0
- package/projects/ui-ngx-redi-core/src/app/app.component.ts +38 -0
- package/projects/ui-ngx-redi-core/src/app/app.config.ts +9 -0
- package/projects/ui-ngx-redi-core/src/app/app.routes.ts +12 -0
- package/projects/ui-ngx-redi-core/src/app/models/interfaces/componetDemo.interface.ts +6 -0
- package/projects/ui-ngx-redi-core/src/app/modules/demo/demo-routing.module.ts +18 -0
- package/projects/ui-ngx-redi-core/src/app/modules/demo/demo.module.ts +14 -0
- package/projects/ui-ngx-redi-core/src/app/modules/demo/redi-grid-demo/redi-grid-demo.component.html +1 -0
- package/projects/ui-ngx-redi-core/src/app/modules/demo/redi-grid-demo/redi-grid-demo.component.scss +0 -0
- package/projects/ui-ngx-redi-core/src/app/modules/demo/redi-grid-demo/redi-grid-demo.component.spec.ts +23 -0
- package/projects/ui-ngx-redi-core/src/app/modules/demo/redi-grid-demo/redi-grid-demo.component.ts +12 -0
- package/projects/ui-ngx-redi-core/src/app/modules/demo/redi-table-demo/redi-table-demo.component.html +2 -0
- package/projects/ui-ngx-redi-core/src/app/modules/demo/redi-table-demo/redi-table-demo.component.scss +0 -0
- package/projects/ui-ngx-redi-core/src/app/modules/demo/redi-table-demo/redi-table-demo.component.spec.ts +23 -0
- package/projects/ui-ngx-redi-core/src/app/modules/demo/redi-table-demo/redi-table-demo.component.ts +13 -0
- package/projects/ui-ngx-redi-core/src/app/services/components.service.spec.ts +16 -0
- package/projects/ui-ngx-redi-core/src/app/services/components.service.ts +22 -0
- package/projects/ui-ngx-redi-core/src/assets/.gitkeep +0 -0
- package/projects/ui-ngx-redi-core/src/assets/images/angular-white-transparent.png +0 -0
- package/projects/ui-ngx-redi-core/src/favicon.ico +0 -0
- package/projects/ui-ngx-redi-core/src/index.html +15 -0
- package/projects/ui-ngx-redi-core/src/main.ts +6 -0
- package/projects/ui-ngx-redi-core/src/styles.scss +16 -0
- package/projects/ui-ngx-redi-core/tsconfig.app.json +14 -0
- package/projects/ui-ngx-redi-core/tsconfig.spec.json +14 -0
- package/tsconfig.json +38 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Editor configuration, see https://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
indent_style = space
|
|
7
|
+
indent_size = 2
|
|
8
|
+
insert_final_newline = true
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
|
|
11
|
+
[*.ts]
|
|
12
|
+
quote_type = single
|
|
13
|
+
|
|
14
|
+
[*.md]
|
|
15
|
+
max_line_length = off
|
|
16
|
+
trim_trailing_whitespace = false
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"configurations": [
|
|
5
|
+
{
|
|
6
|
+
"name": "ng serve",
|
|
7
|
+
"type": "chrome",
|
|
8
|
+
"request": "launch",
|
|
9
|
+
"preLaunchTask": "npm: start",
|
|
10
|
+
"url": "http://localhost:4200/"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "ng test",
|
|
14
|
+
"type": "chrome",
|
|
15
|
+
"request": "launch",
|
|
16
|
+
"preLaunchTask": "npm: test",
|
|
17
|
+
"url": "http://localhost:9876/debug.html"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"tasks": [
|
|
5
|
+
{
|
|
6
|
+
"type": "npm",
|
|
7
|
+
"script": "start",
|
|
8
|
+
"isBackground": true,
|
|
9
|
+
"problemMatcher": {
|
|
10
|
+
"owner": "typescript",
|
|
11
|
+
"pattern": "$tsc",
|
|
12
|
+
"background": {
|
|
13
|
+
"activeOnStart": true,
|
|
14
|
+
"beginsPattern": {
|
|
15
|
+
"regexp": "(.*?)"
|
|
16
|
+
},
|
|
17
|
+
"endsPattern": {
|
|
18
|
+
"regexp": "bundle generation complete"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "npm",
|
|
25
|
+
"script": "test",
|
|
26
|
+
"isBackground": true,
|
|
27
|
+
"problemMatcher": {
|
|
28
|
+
"owner": "typescript",
|
|
29
|
+
"pattern": "$tsc",
|
|
30
|
+
"background": {
|
|
31
|
+
"activeOnStart": true,
|
|
32
|
+
"beginsPattern": {
|
|
33
|
+
"regexp": "(.*?)"
|
|
34
|
+
},
|
|
35
|
+
"endsPattern": {
|
|
36
|
+
"regexp": "bundle generation complete"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# NgxRediCore
|
|
2
|
+
|
|
3
|
+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.2.2.
|
|
4
|
+
|
|
5
|
+
## Development server
|
|
6
|
+
|
|
7
|
+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
|
|
8
|
+
|
|
9
|
+
## Code scaffolding
|
|
10
|
+
|
|
11
|
+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
|
12
|
+
|
|
13
|
+
## Build
|
|
14
|
+
|
|
15
|
+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
16
|
+
|
|
17
|
+
## Running unit tests
|
|
18
|
+
|
|
19
|
+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
20
|
+
|
|
21
|
+
## Running end-to-end tests
|
|
22
|
+
|
|
23
|
+
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
|
24
|
+
|
|
25
|
+
## Further help
|
|
26
|
+
|
|
27
|
+
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.
|
package/angular.json
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"newProjectRoot": "projects",
|
|
5
|
+
"projects": {
|
|
6
|
+
"ngx-redi-core": {
|
|
7
|
+
"projectType": "library",
|
|
8
|
+
"root": "projects/ngx-redi-core",
|
|
9
|
+
"sourceRoot": "projects/ngx-redi-core/src",
|
|
10
|
+
"prefix": "lib",
|
|
11
|
+
"architect": {
|
|
12
|
+
"build": {
|
|
13
|
+
"builder": "@angular-devkit/build-angular:ng-packagr",
|
|
14
|
+
"options": {
|
|
15
|
+
"project": "projects/ngx-redi-core/ng-package.json"
|
|
16
|
+
},
|
|
17
|
+
"configurations": {
|
|
18
|
+
"production": {
|
|
19
|
+
"tsConfig": "projects/ngx-redi-core/tsconfig.lib.prod.json"
|
|
20
|
+
},
|
|
21
|
+
"development": {
|
|
22
|
+
"tsConfig": "projects/ngx-redi-core/tsconfig.lib.json"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"defaultConfiguration": "production"
|
|
26
|
+
},
|
|
27
|
+
"test": {
|
|
28
|
+
"builder": "@angular-devkit/build-angular:karma",
|
|
29
|
+
"options": {
|
|
30
|
+
"tsConfig": "projects/ngx-redi-core/tsconfig.spec.json",
|
|
31
|
+
"polyfills": [
|
|
32
|
+
"zone.js",
|
|
33
|
+
"zone.js/testing"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"ui-ngx-redi-core": {
|
|
40
|
+
"projectType": "application",
|
|
41
|
+
"schematics": {
|
|
42
|
+
"@schematics/angular:component": {
|
|
43
|
+
"style": "scss"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"root": "projects/ui-ngx-redi-core",
|
|
47
|
+
"sourceRoot": "projects/ui-ngx-redi-core/src",
|
|
48
|
+
"prefix": "app",
|
|
49
|
+
"architect": {
|
|
50
|
+
"build": {
|
|
51
|
+
"builder": "@angular-devkit/build-angular:application",
|
|
52
|
+
"options": {
|
|
53
|
+
"outputPath": "dist/ui-ngx-redi-core",
|
|
54
|
+
"index": "projects/ui-ngx-redi-core/src/index.html",
|
|
55
|
+
"browser": "projects/ui-ngx-redi-core/src/main.ts",
|
|
56
|
+
"polyfills": [
|
|
57
|
+
"zone.js"
|
|
58
|
+
],
|
|
59
|
+
"tsConfig": "projects/ui-ngx-redi-core/tsconfig.app.json",
|
|
60
|
+
"inlineStyleLanguage": "scss",
|
|
61
|
+
"assets": [
|
|
62
|
+
"projects/ui-ngx-redi-core/src/favicon.ico",
|
|
63
|
+
"projects/ui-ngx-redi-core/src/assets"
|
|
64
|
+
],
|
|
65
|
+
"styles": [
|
|
66
|
+
"@angular/material/prebuilt-themes/indigo-pink.css",
|
|
67
|
+
"projects/ui-ngx-redi-core/src/styles.scss"
|
|
68
|
+
],
|
|
69
|
+
"scripts": []
|
|
70
|
+
},
|
|
71
|
+
"configurations": {
|
|
72
|
+
"production": {
|
|
73
|
+
"budgets": [
|
|
74
|
+
{
|
|
75
|
+
"type": "initial",
|
|
76
|
+
"maximumWarning": "500kb",
|
|
77
|
+
"maximumError": "1mb"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"type": "anyComponentStyle",
|
|
81
|
+
"maximumWarning": "2kb",
|
|
82
|
+
"maximumError": "4kb"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"outputHashing": "all"
|
|
86
|
+
},
|
|
87
|
+
"development": {
|
|
88
|
+
"optimization": false,
|
|
89
|
+
"extractLicenses": false,
|
|
90
|
+
"sourceMap": true
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"defaultConfiguration": "production"
|
|
94
|
+
},
|
|
95
|
+
"serve": {
|
|
96
|
+
"builder": "@angular-devkit/build-angular:dev-server",
|
|
97
|
+
"configurations": {
|
|
98
|
+
"production": {
|
|
99
|
+
"buildTarget": "ui-ngx-redi-core:build:production"
|
|
100
|
+
},
|
|
101
|
+
"development": {
|
|
102
|
+
"buildTarget": "ui-ngx-redi-core:build:development"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"defaultConfiguration": "development"
|
|
106
|
+
},
|
|
107
|
+
"extract-i18n": {
|
|
108
|
+
"builder": "@angular-devkit/build-angular:extract-i18n",
|
|
109
|
+
"options": {
|
|
110
|
+
"buildTarget": "ui-ngx-redi-core:build"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"test": {
|
|
114
|
+
"builder": "@angular-devkit/build-angular:karma",
|
|
115
|
+
"options": {
|
|
116
|
+
"polyfills": [
|
|
117
|
+
"zone.js",
|
|
118
|
+
"zone.js/testing"
|
|
119
|
+
],
|
|
120
|
+
"tsConfig": "projects/ui-ngx-redi-core/tsconfig.spec.json",
|
|
121
|
+
"inlineStyleLanguage": "scss",
|
|
122
|
+
"assets": [
|
|
123
|
+
"projects/ui-ngx-redi-core/src/favicon.ico",
|
|
124
|
+
"projects/ui-ngx-redi-core/src/assets"
|
|
125
|
+
],
|
|
126
|
+
"styles": [
|
|
127
|
+
"@angular/material/prebuilt-themes/indigo-pink.css",
|
|
128
|
+
"projects/ui-ngx-redi-core/src/styles.scss"
|
|
129
|
+
],
|
|
130
|
+
"scripts": []
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ngx-redi-core",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"ng": "ng",
|
|
6
|
+
"start": "ng serve",
|
|
7
|
+
"build": "ng build",
|
|
8
|
+
"watch": "ng build --watch --configuration development",
|
|
9
|
+
"test": "ng test"
|
|
10
|
+
},
|
|
11
|
+
"private": false,
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@angular/animations": "^17.2.0",
|
|
14
|
+
"@angular/cdk": "^17.2.1",
|
|
15
|
+
"@angular/common": "^17.2.0",
|
|
16
|
+
"@angular/compiler": "^17.2.0",
|
|
17
|
+
"@angular/core": "^17.2.0",
|
|
18
|
+
"@angular/forms": "^17.2.0",
|
|
19
|
+
"@angular/material": "^17.2.1",
|
|
20
|
+
"@angular/platform-browser": "^17.2.0",
|
|
21
|
+
"@angular/platform-browser-dynamic": "^17.2.0",
|
|
22
|
+
"@angular/router": "^17.2.0",
|
|
23
|
+
"ngx-redi-core": "file:dist/ngx-redi-core",
|
|
24
|
+
"rxjs": "~7.8.0",
|
|
25
|
+
"tslib": "^2.3.0",
|
|
26
|
+
"zone.js": "~0.14.3"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@angular-devkit/build-angular": "^17.2.2",
|
|
30
|
+
"@angular/cli": "^17.2.2",
|
|
31
|
+
"@angular/compiler-cli": "^17.2.0",
|
|
32
|
+
"@types/jasmine": "~5.1.0",
|
|
33
|
+
"jasmine-core": "~5.1.0",
|
|
34
|
+
"karma": "~6.4.0",
|
|
35
|
+
"karma-chrome-launcher": "~3.2.0",
|
|
36
|
+
"karma-coverage": "~2.2.0",
|
|
37
|
+
"karma-jasmine": "~5.1.0",
|
|
38
|
+
"karma-jasmine-html-reporter": "~2.1.0",
|
|
39
|
+
"ng-packagr": "^17.2.0",
|
|
40
|
+
"typescript": "~5.3.2"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/helpers/csv.service';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { CsvService } from './csv.service';
|
|
4
|
+
|
|
5
|
+
describe('CsvService', () => {
|
|
6
|
+
let service: CsvService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(CsvService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Servicio que provee métodos para trabajar con datos CSV
|
|
4
|
+
*/
|
|
5
|
+
@Injectable({
|
|
6
|
+
providedIn: 'root'
|
|
7
|
+
})
|
|
8
|
+
export class CsvService {
|
|
9
|
+
/**
|
|
10
|
+
* Genera el texto CSV a partir de un archivo
|
|
11
|
+
* @param data- Datos a construir
|
|
12
|
+
* @returns CSV texto
|
|
13
|
+
*/
|
|
14
|
+
public generarCsv<T extends {}>(data: Array<T>): string {
|
|
15
|
+
const datos = data.map(d => {
|
|
16
|
+
return Object.values(d)
|
|
17
|
+
.filter(p => this.tipoSerializable(p))
|
|
18
|
+
.map(v => (v as string).includes(',') ? `"${v}"` : v);
|
|
19
|
+
});
|
|
20
|
+
return datos.map(d => { return Object.values(d).join(','); }).join('\n');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Método que indica si la propiedad es serializable
|
|
25
|
+
* @param propiedad - Propiedad a validar
|
|
26
|
+
* @returns True si es una propiedad serializable
|
|
27
|
+
*/
|
|
28
|
+
private tipoSerializable(propiedad: unknown): boolean {
|
|
29
|
+
return typeof (propiedad) !== 'object' &&
|
|
30
|
+
typeof (propiedad) !== 'function';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Descarga el CSV a partir de los datos establecidos
|
|
35
|
+
* @param archivo - Nombre del archivo a descargar
|
|
36
|
+
* @param data - Arreglo de datos a descargar
|
|
37
|
+
*/
|
|
38
|
+
public descargarCsv<T extends {}>(archivo: string, data: Array<T>): void {
|
|
39
|
+
const blob = new Blob([BOM_CSV, this.generarCsv(data)], { type: TYPE_CSV });
|
|
40
|
+
const link = this.generarLink(archivo, blob);
|
|
41
|
+
document.body.appendChild(link);
|
|
42
|
+
link.click();
|
|
43
|
+
document.body.removeChild(link);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Genera el link para el blob y archivo establecidos
|
|
48
|
+
* @param archivo - Nombre del archivo a descargar
|
|
49
|
+
* @param blob - Contenido del blob
|
|
50
|
+
* @returns link
|
|
51
|
+
*/
|
|
52
|
+
private generarLink(archivo: string, blob: Blob): HTMLAnchorElement {
|
|
53
|
+
const link = document.createElement('a') as HTMLAnchorElement;
|
|
54
|
+
if (link.download !== undefined) {
|
|
55
|
+
link.setAttribute('href', URL.createObjectURL(blob));
|
|
56
|
+
link.setAttribute('download', archivo);
|
|
57
|
+
link.style.visibility = 'hidden';
|
|
58
|
+
}
|
|
59
|
+
return link;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Tipo MIME CSV + Encode */
|
|
65
|
+
const TYPE_CSV = 'text/csv;charset=utf-8;';
|
|
66
|
+
/** BOM CSV */
|
|
67
|
+
const BOM_CSV = new Uint8Array([0xEF, 0xBB, 0xBF]);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# NgxRediCore
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project ngx-redi-core` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-redi-core`.
|
|
8
|
+
> Note: Don't forget to add `--project ngx-redi-core` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build ngx-redi-core` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build ngx-redi-core`, go to the dist folder `cd dist/ngx-redi-core` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test ngx-redi-core` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
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.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Módulos y componentes */
|
|
2
|
+
export * from './src/modules/redi-table.module';
|
|
3
|
+
export * from './src/modules/redi-table/redi-table.component';
|
|
4
|
+
/** Modelos */
|
|
5
|
+
export * from './src/models/interfaces/column-definition';
|
|
6
|
+
export * from './src/models/interfaces/data-table';
|
|
7
|
+
export * from './src/models/interfaces/row-action';
|
|
8
|
+
/** Tipos */
|
|
9
|
+
export * from './src/models/types/event-table.type';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ColumnDefinition } from './column-definition';
|
|
2
|
+
import { RowAction } from './row-action';
|
|
3
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Interfaz que define la estructura de configuración y datos para una tabla
|
|
7
|
+
*/
|
|
8
|
+
export interface DataTable<T> {
|
|
9
|
+
/**
|
|
10
|
+
* Contiene el arreglo con los datos
|
|
11
|
+
*/
|
|
12
|
+
dataSource: Array<T>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Contiene la definición de las columnas que se mostraran en la tabla
|
|
16
|
+
*/
|
|
17
|
+
columnas: Array<ColumnDefinition>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Contiene las acciones a realizar para los datos de la tabla
|
|
21
|
+
*/
|
|
22
|
+
acciones: Array<RowAction<T>>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Contiene los elementos seleccionados
|
|
26
|
+
*/
|
|
27
|
+
seleccion: SelectionModel<T>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { eventTable } from '../types/event-table.type';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface que define una acción en el row
|
|
6
|
+
*/
|
|
7
|
+
export interface RowAction<T> {
|
|
8
|
+
/**
|
|
9
|
+
* Contiene el icono para la acción
|
|
10
|
+
*/
|
|
11
|
+
icono: string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Contiene la función o acción a realizar con los datos
|
|
15
|
+
*/
|
|
16
|
+
//accion: fnRowAction<T>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Emitter
|
|
20
|
+
*/
|
|
21
|
+
emiter: EventEmitter<eventTable<T>>;
|
|
22
|
+
|
|
23
|
+
deshabilitar?: boolean;
|
|
24
|
+
|
|
25
|
+
desabilitarActionPorValores?: DeshabilitaAction;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface DeshabilitaAction {
|
|
29
|
+
columnaRef: string;
|
|
30
|
+
valoresADeshabilitar: Array<string>;
|
|
31
|
+
}
|
|
32
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
display: grid;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
tbody {
|
|
6
|
+
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.section {
|
|
10
|
+
overflow: auto;
|
|
11
|
+
height: 300px;
|
|
12
|
+
background-color: white;
|
|
13
|
+
max-height: 90vh;
|
|
14
|
+
border: 1px solid #f4f4f4;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
table {
|
|
18
|
+
width: 100%;
|
|
19
|
+
color: #676a6f;
|
|
20
|
+
|
|
21
|
+
overflow: auto;
|
|
22
|
+
|
|
23
|
+
padding: 0px;
|
|
24
|
+
background-color: #f7f7f7;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.odd {
|
|
28
|
+
background-color: #f4f4f4;
|
|
29
|
+
|
|
30
|
+
font-size: 1.05em;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.even {
|
|
34
|
+
background-color: white;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.odd,
|
|
38
|
+
.even {
|
|
39
|
+
height: 2.5em;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
td.mat-cell {
|
|
44
|
+
border: 0px;
|
|
45
|
+
color: #676a6f;
|
|
46
|
+
font-size: 1.05em;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.odd:hover,
|
|
50
|
+
.even:hover {
|
|
51
|
+
background-color: #cddce9;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
th {
|
|
55
|
+
font-size: 1.2em;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
tr.mat-header-row {
|
|
59
|
+
height: 2.55em;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
input {
|
|
63
|
+
min-width: 250px;
|
|
64
|
+
border: solid 2px #dadada;
|
|
65
|
+
float: right;
|
|
66
|
+
margin-bottom: 8px;
|
|
67
|
+
outline: 0;
|
|
68
|
+
padding-right: 2em;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
mat-icon{
|
|
72
|
+
color: #676a6f;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.icon {
|
|
76
|
+
float: right;
|
|
77
|
+
margin-left: -3em;
|
|
78
|
+
position: relative;
|
|
79
|
+
margin-top: 1px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.visible {
|
|
83
|
+
display: contents;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.hidden {
|
|
87
|
+
display: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
::-webkit-scrollbar {
|
|
91
|
+
width: 6px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
::-webkit-scrollbar-track {
|
|
95
|
+
background: #cccccc;
|
|
96
|
+
margin-top: 2.6em;
|
|
97
|
+
margin-bottom: 1.4em;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
caption {
|
|
101
|
+
display: none;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.disabled-button{
|
|
105
|
+
color: #cecece;
|
|
106
|
+
}
|