ngx-redi-core 1.2.2 → 1.2.4
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 +21 -16
- package/angular.json +45 -0
- package/package.json +36 -21
- 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 +22 -0
- package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/src/modules/redi-drag-drop/redi-drag-drop.component.html +1 -1
- package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/src/modules/redi-drag-drop/redi-drag-drop.component.scss +8 -4
- package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/src/modules/redi-drag-drop/redi-drag-drop.component.ts +20 -13
- package/{RediGrid → projects/ngx-redi-core/RediGrid}/public-api.ts +1 -0
- package/{RediGrid → projects/ngx-redi-core/RediGrid}/src/models/interfaces/cell.ts +15 -0
- package/{RediGrid → projects/ngx-redi-core/RediGrid}/src/models/interfaces/data-grid.ts +12 -2
- package/{RediGrid → projects/ngx-redi-core/RediGrid}/src/modules/redi-grid/redi-grid.component.css +47 -18
- package/projects/ngx-redi-core/RediGrid/src/modules/redi-grid/redi-grid.component.html +38 -0
- package/projects/ngx-redi-core/RediGrid/src/modules/redi-grid/redi-grid.component.ts +183 -0
- package/{RediGrid → projects/ngx-redi-core/RediGrid}/src/modules/redi-grid.module.ts +3 -1
- package/projects/ngx-redi-core/RediTable/index.ts +12 -0
- package/projects/ngx-redi-core/RediTable/ng-package.json +6 -0
- package/projects/ngx-redi-core/RediTable/public-api.ts +9 -0
- package/{RediTable → projects/ngx-redi-core/RediTable}/src/models/interfaces/data-table.ts +2 -2
- 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/{RediTable → projects/ngx-redi-core/RediTable}/src/modules/redi-table/redi-table.component.css +9 -2
- package/{RediTable → projects/ngx-redi-core/RediTable}/src/modules/redi-table/redi-table.component.html +10 -10
- package/{RediTable → projects/ngx-redi-core/RediTable}/src/modules/redi-table/redi-table.component.ts +134 -53
- package/{RediTable → projects/ngx-redi-core/RediTable}/src/modules/redi-table.module.ts +3 -1
- package/projects/ngx-redi-core/Security/ng-package.json +6 -0
- package/{Security → projects/ngx-redi-core/Security}/public-api.ts +2 -1
- package/projects/ngx-redi-core/Security/src/modules/security-web-intercept/interceptors/redi-secure.interceptor.ts +96 -0
- package/{Security → projects/ngx-redi-core/Security}/src/modules/security-web-intercept/services/cifrado.service.ts +0 -3
- package/projects/ngx-redi-core/Security/src/modules/security-web-intercept/services/reflection.service.spec.ts +16 -0
- package/projects/ngx-redi-core/Security/src/modules/security-web-intercept/services/reflection.service.ts +122 -0
- package/projects/ngx-redi-core/package-lock.json +1110 -0
- package/projects/ngx-redi-core/package.json +37 -0
- package/{tsconfig.lib.prod.json → projects/ngx-redi-core/tsconfig.lib.prod.json} +7 -2
- package/tsconfig.json +41 -0
- package/RediGrid/src/modules/redi-grid/redi-grid.component.html +0 -32
- package/RediGrid/src/modules/redi-grid/redi-grid.component.ts +0 -81
- package/RediTable/public-api.ts +0 -3
- package/RediTable/src/models/interfaces/row-action.ts +0 -14
- package/RediTable/src/models/types/fn-row-action.type.spec.ts +0 -7
- package/RediTable/src/models/types/fn-row-action.type.ts +0 -6
- package/Security/src/modules/security-web-intercept/interceptors/redi-secure.interceptor.ts +0 -209
- /package/{RediDragDrop → projects/ngx-redi-core/Helper}/index.ts +0 -0
- /package/{RediDragDrop → projects/ngx-redi-core/Helper}/ng-package.json +0 -0
- /package/{RediGrid → projects/ngx-redi-core/RediDragDrop}/index.ts +0 -0
- /package/{RediGrid → projects/ngx-redi-core/RediDragDrop}/ng-package.json +0 -0
- /package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/public-api.ts +0 -0
- /package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/src/assets/cloud.svg +0 -0
- /package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/src/assets/documento.svg +0 -0
- /package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/src/assets/lista.svg +0 -0
- /package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/src/models/classes/proceso-archivo-csv.spec.ts +0 -0
- /package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/src/models/classes/proceso-archivo-csv.ts +0 -0
- /package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/src/models/directives/drag-drop.directive.spec.ts +0 -0
- /package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/src/models/directives/drag-drop.directive.ts +0 -0
- /package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/src/modules/redi-drag-drop/redi-drag-drop.component.spec.ts +0 -0
- /package/{RediDragDrop → projects/ngx-redi-core/RediDragDrop}/src/modules/redi-drag-drop.module.ts +0 -0
- /package/{RediTable → projects/ngx-redi-core/RediGrid}/index.ts +0 -0
- /package/{RediTable → projects/ngx-redi-core/RediGrid}/ng-package.json +0 -0
- /package/{RediGrid → projects/ngx-redi-core/RediGrid}/src/modules/redi-grid/redi-grid.component.spec.ts +0 -0
- /package/{RediTable → projects/ngx-redi-core/RediTable}/src/models/interfaces/column-definition.ts +0 -0
- /package/{RediTable → projects/ngx-redi-core/RediTable}/src/modules/redi-table/redi-table.component.spec.ts +0 -0
- /package/{Security → projects/ngx-redi-core/Security}/index.ts +0 -0
- /package/{Security → projects/ngx-redi-core/Security}/src/modules/security-web-intercept/interceptors/redi-secure.interceptor.spec.ts +0 -0
- /package/{Security → projects/ngx-redi-core/Security}/src/modules/security-web-intercept/models/secure-factory.model.spec.ts +0 -0
- /package/{Security → projects/ngx-redi-core/Security}/src/modules/security-web-intercept/models/secure-factory.model.ts +0 -0
- /package/{Security → projects/ngx-redi-core/Security}/src/modules/security-web-intercept/models/tipo-operacion.enum.ts +0 -0
- /package/{Security → projects/ngx-redi-core/Security}/src/modules/security-web-intercept/services/cifrado.service.spec.ts +0 -0
- /package/{Security → projects/ngx-redi-core/Security}/src/modules/security.module.ts +0 -0
- /package/{index.ts → projects/ngx-redi-core/index.ts} +0 -0
- /package/{karma.conf → projects/ngx-redi-core/karma.conf} +0 -0
- /package/{ng-package.json → projects/ngx-redi-core/ng-package.json} +0 -0
- /package/{public-api.ts → projects/ngx-redi-core/public-api.ts} +0 -0
- /package/{tsconfig.lib.json → projects/ngx-redi-core/tsconfig.lib.json} +0 -0
- /package/{tsconfig.spec.json → projects/ngx-redi-core/tsconfig.spec.json} +0 -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": "pwa-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
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
|
+
# BazRedi
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
Esta librería fue generada con [Angular CLI](https://www.npmjs.com/package/@angular/cli) version 15.2.8.
|
|
3
|
+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.6.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Development server
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- RediGrid: Componente Grid que presenta la información en una hoja de cálculo
|
|
9
|
-
- RediTable: Componente Tabla que ordena registros interactivos en una tabla con ordenamiento, paginación, filtros y acciones
|
|
10
|
-
- RediSecureInterceptor: Interceptor de seguridad para cifrado y descifrado de peticiones Web
|
|
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.
|
|
11
8
|
|
|
12
|
-
##
|
|
13
|
-
El proyecto se encuentra separado en módulos que contienen la funcionalidad específica de cada componente.
|
|
14
|
-
Cada módulo del proyecto representa un entrypoint para el acceso para la API pública, los entrypoints de referencia son:
|
|
9
|
+
## Code scaffolding
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
ngx-redi-core/RediGrid
|
|
18
|
-
ngx-redi-core/RediDragDrop
|
|
19
|
-
ngx-redi-core/Security
|
|
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`.
|
|
20
12
|
|
|
21
|
-
##
|
|
22
|
-
|
|
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,45 @@
|
|
|
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",
|
|
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
|
+
"codeCoverage": true,
|
|
36
|
+
"karmaConfig": "projects/ngx-redi-core/karma.conf"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"cli": {
|
|
43
|
+
"analytics": false
|
|
44
|
+
}
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-redi-core",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"
|
|
3
|
+
"version": "1.2.4",
|
|
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
|
+
"storybook": "ng run ngx-redi-core:storybook",
|
|
11
|
+
"build-storybook": "ng run ngx-redi-core:build-storybook"
|
|
5
12
|
},
|
|
13
|
+
"private": false,
|
|
6
14
|
"dependencies": {
|
|
7
|
-
"@angular/material": "^15.2.9",
|
|
8
|
-
"tslib": "^2.5.0",
|
|
9
|
-
"@angular/cdk": "^15.2.9",
|
|
10
|
-
"@angular/animations": "^15.2.9",
|
|
11
|
-
"@angular/common": "^15.2.9",
|
|
12
|
-
"@angular/compiler": "^15.2.9",
|
|
13
|
-
"@angular/core": "^15.2.9",
|
|
14
|
-
"@angular/forms": "^15.2.9",
|
|
15
|
-
"@angular/platform-browser": "^15.2.9",
|
|
16
|
-
"@angular/platform-browser-dynamic": "^15.2.9",
|
|
17
|
-
"@angular/router": "^15.2.9",
|
|
18
|
-
"rxjs": "~7.8.1",
|
|
19
|
-
"zone.js": "~0.13.0",
|
|
20
|
-
"reflect-metadata": "0.1.13"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@angular/cdk": "^15.2.9",
|
|
24
15
|
"@angular/animations": "^15.2.9",
|
|
25
16
|
"@angular/common": "^15.2.9",
|
|
26
17
|
"@angular/compiler": "^15.2.9",
|
|
@@ -31,7 +22,31 @@
|
|
|
31
22
|
"@angular/platform-browser-dynamic": "^15.2.9",
|
|
32
23
|
"@angular/router": "^15.2.9",
|
|
33
24
|
"rxjs": "~7.8.1",
|
|
25
|
+
"tslib": "^2.5.0",
|
|
34
26
|
"zone.js": "~0.13.0"
|
|
35
27
|
},
|
|
36
|
-
"
|
|
37
|
-
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@angular-devkit/build-angular": "^15.2.8",
|
|
30
|
+
"@angular/cli": "~15.2.8",
|
|
31
|
+
"@angular/compiler-cli": "^15.2.9",
|
|
32
|
+
"@compodoc/compodoc": "^1.1.19",
|
|
33
|
+
"@storybook/addon-essentials": "^7.0.12",
|
|
34
|
+
"@storybook/addon-interactions": "^7.0.12",
|
|
35
|
+
"@storybook/addon-links": "^7.0.12",
|
|
36
|
+
"@storybook/angular": "^7.0.12",
|
|
37
|
+
"@storybook/blocks": "^7.0.12",
|
|
38
|
+
"@storybook/testing-library": "^0.0.14-next.2",
|
|
39
|
+
"@types/jasmine": "~4.3.1",
|
|
40
|
+
"jasmine-core": "~4.6.0",
|
|
41
|
+
"karma": "~6.4.2",
|
|
42
|
+
"karma-chrome-launcher": "~3.2.0",
|
|
43
|
+
"karma-coverage": "~2.2.0",
|
|
44
|
+
"karma-jasmine": "~5.1.0",
|
|
45
|
+
"karma-jasmine-html-reporter": "~2.0.0",
|
|
46
|
+
"ng-packagr": "^15.2.2",
|
|
47
|
+
"react": "^18.2.0",
|
|
48
|
+
"react-dom": "^18.2.0",
|
|
49
|
+
"storybook": "^7.0.12",
|
|
50
|
+
"typescript": "~4.8.2"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -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,22 @@
|
|
|
1
|
+
|
|
2
|
+
# NgxRediCore
|
|
3
|
+
Esta librería fue generada con [Angular CLI](https://www.npmjs.com/package/@angular/cli) version 15.2.8.
|
|
4
|
+
|
|
5
|
+
Los componentes internos que componen ngx-redi-core son:
|
|
6
|
+
|
|
7
|
+
- RediDragDrop: Componente Drag&Drop para la carga de archivos
|
|
8
|
+
- RediGrid: Componente Grid que presenta la información en una hoja de cálculo
|
|
9
|
+
- RediTable: Componente Tabla que ordena registros interactivos en una tabla con ordenamiento, paginación, filtros y acciones
|
|
10
|
+
- RediSecureInterceptor: Interceptor de seguridad para cifrado y descifrado de peticiones Web
|
|
11
|
+
|
|
12
|
+
## Estructura del proyecto
|
|
13
|
+
El proyecto se encuentra separado en módulos que contienen la funcionalidad específica de cada componente.
|
|
14
|
+
Cada módulo del proyecto representa un entrypoint para el acceso para la API pública, los entrypoints de referencia son:
|
|
15
|
+
|
|
16
|
+
ngx-redi-core/RediTable
|
|
17
|
+
ngx-redi-core/RediGrid
|
|
18
|
+
ngx-redi-core/RediDragDrop
|
|
19
|
+
ngx-redi-core/Security
|
|
20
|
+
|
|
21
|
+
## Importación
|
|
22
|
+
Para importar en un proyecto se ejecutará el siguiente comando `npm install ngx-redi-core`, adicional se deberá incluir la importación en el Módulo sobre el modulo del entrypoint expuesto que se desee importar (https://angular.io/guide/architecture-modules)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<p class="titulo">{{titulo? titulo : 'Sube tu archivo'}}</p>
|
|
1
|
+
<p *ngIf="muestraTitulo" class="titulo">{{titulo? titulo : 'Sube tu archivo'}}</p>
|
|
2
2
|
<div class="contenedor" matRipple dragDrop (clicked)="inputArchivo.click()" tabindex="0"
|
|
3
3
|
(fileDropped)="establecerProceso($event)">
|
|
4
4
|
<div class="contenedor-input">
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
font-weight: lighter;
|
|
8
8
|
margin: 0;
|
|
9
9
|
}
|
|
10
|
+
height: 100%;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
.contenedor {
|
|
13
|
-
display:
|
|
14
|
+
display: flex;
|
|
14
15
|
align-items: center;
|
|
15
16
|
justify-content: center;
|
|
16
17
|
margin-top: 10px;
|
|
@@ -18,16 +19,18 @@
|
|
|
18
19
|
cursor: pointer;
|
|
19
20
|
border-radius: 10px;
|
|
20
21
|
background-color: #f1f2f7;
|
|
21
|
-
|
|
22
|
+
height: 90%;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
+
|
|
25
|
+
.contenedor-input {
|
|
24
26
|
display: none;
|
|
25
27
|
}
|
|
28
|
+
|
|
26
29
|
.imagen {
|
|
27
30
|
width: 75px;
|
|
28
31
|
height: 75px;
|
|
29
32
|
margin: 0 auto;
|
|
30
|
-
background-image:
|
|
33
|
+
background-image: url(../../assets/cloud.svg);
|
|
31
34
|
background-repeat: no-repeat;
|
|
32
35
|
background-position: center;
|
|
33
36
|
background-size: contain;
|
|
@@ -67,6 +70,7 @@
|
|
|
67
70
|
margin: 5px;
|
|
68
71
|
border-radius: 5px;
|
|
69
72
|
background-color: whitesmoke;
|
|
73
|
+
height: 100%;
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
.titulo-lista {
|
|
@@ -15,6 +15,12 @@ export class RediDragDropComponent {
|
|
|
15
15
|
*/
|
|
16
16
|
@Input() titulo: string | undefined;
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Obtiene o establece si el titulo se muestra.
|
|
20
|
+
* @default 'true'
|
|
21
|
+
*/
|
|
22
|
+
@Input() muestraTitulo = true;
|
|
23
|
+
|
|
18
24
|
/**
|
|
19
25
|
* Obtiene o establece las extensiones aceptadas por el componente.
|
|
20
26
|
* @default Acepta todas las extensiones.
|
|
@@ -179,19 +185,20 @@ export class RediDragDropComponent {
|
|
|
179
185
|
return;
|
|
180
186
|
}
|
|
181
187
|
this.archivo = (archivo.length === 0) ? null : archivo;
|
|
182
|
-
this.manejoErrorExtensionesValidas(this.archivos.map(stringArchivos => stringArchivos?.split(/[.]/).pop() ?? ''))
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
188
|
+
if (this.manejoErrorExtensionesValidas(this.archivos.map(stringArchivos => stringArchivos?.split(/[.]/).pop() ?? ''))) {
|
|
189
|
+
if (this.procesoCsv) {
|
|
190
|
+
await this.procesoArchivoCsv.procesar(archivo, this.datosParaDataGrid)
|
|
191
|
+
.then(datos => {
|
|
192
|
+
this.csvDatosProcesados.emit(datos);
|
|
193
|
+
}).catch((error) => {
|
|
194
|
+
this.estableceMensajeError(error.mensaje);
|
|
195
|
+
this.archivo = null;
|
|
196
|
+
this.csvDatosProcesados.emit(null);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
} else {
|
|
200
|
+
this.cambioArchivo.emit(this.archivo);
|
|
201
|
+
}
|
|
195
202
|
}
|
|
196
203
|
}
|
|
197
204
|
/**
|
|
@@ -26,4 +26,19 @@ export interface Cell {
|
|
|
26
26
|
* Contiene el valor de la celda
|
|
27
27
|
*/
|
|
28
28
|
valor?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Indica si su valor fue editado en el grid
|
|
32
|
+
*/
|
|
33
|
+
editado?: boolean;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Indica si el valor esta bloqueado
|
|
37
|
+
*/
|
|
38
|
+
bloqueado?: boolean;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Propiedad que indica si el valor es serializable
|
|
42
|
+
*/
|
|
43
|
+
serializable?: boolean;
|
|
29
44
|
}
|
|
@@ -18,9 +18,19 @@ export interface DataGrid {
|
|
|
18
18
|
* Propiedad que indica si el grid se enumera
|
|
19
19
|
*/
|
|
20
20
|
enumerable?: boolean;
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
/**
|
|
23
23
|
* Propiedad que indica si el grid es editable
|
|
24
24
|
*/
|
|
25
|
-
editable?: boolean
|
|
25
|
+
editable?: boolean;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Arreglo de indices de columnas bloqueadas
|
|
29
|
+
*/
|
|
30
|
+
bloquearColumnas?: Array<number>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Arreglo de indices de columnas no visibles
|
|
34
|
+
*/
|
|
35
|
+
ocultarColumnas?: Array<number>
|
|
26
36
|
}
|
package/{RediGrid → projects/ngx-redi-core/RediGrid}/src/modules/redi-grid/redi-grid.component.css
RENAMED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
.enumerable {
|
|
10
|
+
width: 10px;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
thead {
|
|
10
14
|
text-align: center;
|
|
11
15
|
color: #f9f9f9;
|
|
@@ -32,22 +36,16 @@ td {
|
|
|
32
36
|
padding: 3px;
|
|
33
37
|
height: 1.5em;
|
|
34
38
|
border-right: solid 1px #e1e1e1;
|
|
35
|
-
border-style: groove;
|
|
36
39
|
min-width: 2em;
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
tbody>tr>td:focus-within {
|
|
40
|
-
border: solid 1px #468b51bd;
|
|
41
|
-
background: #9fd0fb6b;
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
42
|
tbody>tr:nth-child(even) {
|
|
46
43
|
background-color: #f4f4f4;
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
tbody>tr:hover {
|
|
50
47
|
background-color: #cddce9;
|
|
48
|
+
border: solid 1px #cddce9;
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
thead>tr>th {
|
|
@@ -63,7 +61,7 @@ thead>tr>th:last-child {
|
|
|
63
61
|
border-right: solid 0px;
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
tbody>tr:last-child{
|
|
64
|
+
tbody>tr:last-child {
|
|
67
65
|
border-bottom: solid 1px #e1e1e1;
|
|
68
66
|
}
|
|
69
67
|
|
|
@@ -79,16 +77,47 @@ table {
|
|
|
79
77
|
min-height: 400px;
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
80
|
+
caption,
|
|
81
|
+
label {
|
|
82
|
+
display: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.warn {
|
|
86
|
+
border-bottom: solid 2px #F44336;
|
|
87
|
+
border-top: solid 2px #F44336;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
tr>.warn:last-child {
|
|
91
|
+
border-right: solid 2px #F44336;
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
tr>.warn:first-child {
|
|
96
|
+
border-left: solid 2px #F44336;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.editado {
|
|
100
|
+
color: #228822;
|
|
101
|
+
font-weight: 600;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.bloqueado {
|
|
105
|
+
background-color: #f4f4f48d;
|
|
106
|
+
color: #00000070
|
|
107
|
+
}
|
|
91
108
|
|
|
92
|
-
|
|
109
|
+
.oculto {
|
|
93
110
|
display: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.lockIcon {
|
|
114
|
+
width: 15px;
|
|
115
|
+
height: 15px;
|
|
116
|
+
font-size: 0.8em;
|
|
117
|
+
float: right;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
tbody>tr>td:focus-within {
|
|
121
|
+
border: solid 1px #468b51bd;
|
|
122
|
+
background: #9fd0fb6b;
|
|
94
123
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<div class="container">
|
|
2
|
+
<!-- Contenedor principal del grid -->
|
|
3
|
+
<cdk-virtual-scroll-viewport #scrollViewport itemSize="25">
|
|
4
|
+
<!-- Tabla de datos -->
|
|
5
|
+
<table (keydown)="moverFoco($event)">
|
|
6
|
+
<caption> RediGridComponent </caption>
|
|
7
|
+
<!-- Cabecera de tabla -->
|
|
8
|
+
<thead>
|
|
9
|
+
<!-- Definición de encabezados -->
|
|
10
|
+
<tr>
|
|
11
|
+
<th scope="col" [style.top]="invertirUbicacion" *ngIf="enumerar">
|
|
12
|
+
<th scope="col" [style.top]="invertirUbicacion" *ngFor="let col of data.columnas; let colNum=index"
|
|
13
|
+
[class.oculto]="!columnaVisible(colNum)">
|
|
14
|
+
<mat-icon *ngIf="columnaBloqueada(colNum)" class="lockIcon">lock</mat-icon>{{col.valor}}
|
|
15
|
+
</th>
|
|
16
|
+
</tr>
|
|
17
|
+
</thead>
|
|
18
|
+
<!-- Cuerpo de tabla -->
|
|
19
|
+
<tbody>
|
|
20
|
+
<tr *cdkVirtualFor="let row of data.filas;let rowNum = index">
|
|
21
|
+
<!-- Contador de fila -->
|
|
22
|
+
<td *ngIf="enumerar"> {{ rowNum + 1 }} </td>
|
|
23
|
+
<!-- Celdas de datos -->
|
|
24
|
+
<td *ngFor="let cell of row; let colNum=index;" [class.warn]="cell.esValido !== undefined && !cell.esValido"
|
|
25
|
+
[class.editado]="cell.editado" [class.bloqueado]="cell.bloqueado || columnaBloqueada(colNum)"
|
|
26
|
+
[class.oculto]="!columnaVisible(colNum)">
|
|
27
|
+
<label for="cell"> Value </label>
|
|
28
|
+
<!-- Campo editable -->
|
|
29
|
+
<input *ngIf="editable && !cell.bloqueado && !columnaBloqueada(colNum)" type="text" [value]="cell.valor"
|
|
30
|
+
name="cell" id="cell" (focusout)="actualizarDatos(rowNum,colNum,$any($event.target).value)"
|
|
31
|
+
[class.editado]="cell.editado" />
|
|
32
|
+
{{ !editable || cell.bloqueado || columnaBloqueada(colNum) ? cell.valor : '' }}
|
|
33
|
+
</td>
|
|
34
|
+
</tr>
|
|
35
|
+
</tbody>
|
|
36
|
+
</table>
|
|
37
|
+
</cdk-virtual-scroll-viewport>
|
|
38
|
+
</div>
|