ngx-redi-core 1.2.1 → 1.2.2

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.
@@ -1,3 +1,2 @@
1
1
 
2
- export * from './public-api';
3
- export * from './src/modules/redi-drag-drop.module';
2
+ export * from './public-api';
@@ -1,6 +1,5 @@
1
- export { ProcesoArchivoCsv } from './src/models/classes/proceso-archivo-csv';
2
- export { DragDropDirective } from './src/models/directives/drag-drop.directive';
3
1
 
4
-
5
- export { RediDragDropModule } from './src/modules/redi-drag-drop.module';
6
- export { RediDragDropComponent } from './src/modules/redi-drag-drop/redi-drag-drop.component';
2
+ export * from './src/modules/redi-drag-drop.module';
3
+ export * from './src/modules/redi-drag-drop/redi-drag-drop.component';
4
+ export * from './src/models/classes/proceso-archivo-csv';
5
+ export * from './src/models/directives/drag-drop.directive';
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M250 896q-86 0-148-62T40 686q0-78 49.5-137.5T217 477q20-97 94-158.5T482 257q113 0 189.5 81.5T748 534v24q72-2 122 46.5T920 727q0 69-50 119t-119 50H510q-24 0-42-18t-18-42V578l-83 83-43-43 156-156 156 156-43 43-83-83v258h241q45 0 77-32t32-77q0-45-32-77t-77-32h-63v-84q0-89-60.5-153T478 317q-89 0-150 64t-61 153h-19q-62 0-105 43.5T100 685q0 62 43.929 106.5Q187.857 836 250 836h140v60H250Zm230-290Z" style="fill:rgb(131, 131, 131);"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M319 806h322v-60H319v60Zm0-170h322v-60H319v60Zm-99 340q-24 0-42-18t-18-42V236q0-24 18-42t42-18h361l219 219v521q0 24-18 42t-42 18H220Zm331-554V236H220v680h520V422H551ZM220 236v186-186 680-680Z" style="fill:rgb(131, 131, 131);"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="m612 506 141-142-28-28-113 113-57-57-28 29 85 85ZM120 896v-60h480v60H120Zm519.894-290Q561 606 505.5 550.394t-55.5-134.5Q450 337 505.606 281.5t134.5-55.5Q719 226 774.5 281.606t55.5 134.5Q830 495 774.394 550.5t-134.5 55.5ZM120 556v-60h262q5.32 16.323 12.16 31.161Q401 542 409 556H120Zm0 170v-60h419q13.8 6.364 29.4 10.682Q584 681 600 683v43H120Z" style="fill:rgb(131, 131, 131);"/></svg>
@@ -62,4 +62,11 @@ describe('ProcesoArchivoCsv', () => {
62
62
  expect(d).toBeTruthy();
63
63
  });
64
64
  });
65
+
66
+ it('Método generar columnas > arreglo objetos', () => {
67
+ const proceso = new ProcesoArchivoCsv();
68
+ const columnas = proceso.generaColumnas('1,mass,"salinas, antonio "1","2"",""');
69
+ const noColumnas = 4;
70
+ expect(columnas.length).toEqual(noColumnas);
71
+ });
65
72
  });
@@ -58,8 +58,13 @@ export class ProcesoArchivoCsv {
58
58
  .map((str: string) => { return str.replace(/ /g, '-').trim(); }).filter((stringArchivos: string) => stringArchivos.length > 0);
59
59
 
60
60
  const datosSeparados = lineasTextTotales.filter((valor: string, indice: number) => indice > 0 && valor.length > 0)
61
- .map((dato: string, indice: number) => {
62
- return dato.split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/g);
61
+ .map((dato: string) => {
62
+ if (dato.includes('"')) {
63
+ return this.generaColumnas(dato.trim());
64
+ }
65
+ else {
66
+ return dato.split(',');
67
+ }
63
68
  });
64
69
 
65
70
  if (datosParaDataGrid) {
@@ -85,8 +90,44 @@ export class ProcesoArchivoCsv {
85
90
  informacion.push(objeto);
86
91
  });
87
92
  }
88
-
89
-
90
93
  return [informacion, columnas];
91
94
  }
95
+
96
+ /**
97
+ * Método para separa las filar del csv en columnas.
98
+ * @param fila La cadena a separar para generar las columnas
99
+ * @returns Arreglo con las columnas
100
+ */
101
+ generaColumnas(fila: string) {
102
+ const values = [];
103
+ const separadorTemporal = 'ꜛ';
104
+ let estaEnComillas = false;
105
+ let val = '';
106
+ fila = fila.replaceAll('""', separadorTemporal);
107
+ [...fila].forEach((letra: string, indice: number) => {
108
+ switch (letra) {
109
+ case ',':
110
+ if (estaEnComillas) {
111
+ val += letra;
112
+ } else {
113
+ values.push(val);
114
+ val = '';
115
+ }
116
+ break;
117
+ case '"':
118
+ if (estaEnComillas && indice + 1 < fila.length && fila[indice + 1] === '"') {
119
+ val += '"';
120
+ }
121
+ else {
122
+ estaEnComillas = !estaEnComillas;
123
+ }
124
+ break;
125
+ default:
126
+ val += fila[indice];
127
+ break;
128
+ }
129
+ });
130
+ values.push(val);
131
+ return values.map(columnas => columnas.replaceAll(separadorTemporal, '"'));
132
+ }
92
133
  }
@@ -27,18 +27,18 @@
27
27
  width: 75px;
28
28
  height: 75px;
29
29
  margin: 0 auto;
30
- background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M250 896q-86 0-148-62T40 686q0-78 49.5-137.5T217 477q20-97 94-158.5T482 257q113 0 189.5 81.5T748 534v24q72-2 122 46.5T920 727q0 69-50 119t-119 50H510q-24 0-42-18t-18-42V578l-83 83-43-43 156-156 156 156-43 43-83-83v258h241q45 0 77-32t32-77q0-45-32-77t-77-32h-63v-84q0-89-60.5-153T478 317q-89 0-150 64t-61 153h-19q-62 0-105 43.5T100 685q0 62 43.929 106.5Q187.857 836 250 836h140v60H250Zm230-290Z" style="fill:rgb(131, 131, 131);"/></svg>');
30
+ background-image: url(../../assets/cloud.svg);
31
31
  background-repeat: no-repeat;
32
32
  background-position: center;
33
33
  background-size: contain;
34
34
  }
35
35
 
36
36
  .archivo {
37
- background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="M319 806h322v-60H319v60Zm0-170h322v-60H319v60Zm-99 340q-24 0-42-18t-18-42V236q0-24 18-42t42-18h361l219 219v521q0 24-18 42t-42 18H220Zm331-554V236H220v680h520V422H551ZM220 236v186-186 680-680Z" style="fill:rgb(131, 131, 131);"/></svg>') !important;
37
+ background-image: url(../../assets/documento.svg) !important;
38
38
  }
39
39
 
40
40
  .archivo-lista {
41
- background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48"><path d="m612 506 141-142-28-28-113 113-57-57-28 29 85 85ZM120 896v-60h480v60H120Zm519.894-290Q561 606 505.5 550.394t-55.5-134.5Q450 337 505.606 281.5t134.5-55.5Q719 226 774.5 281.606t55.5 134.5Q830 495 774.394 550.5t-134.5 55.5ZM120 556v-60h262q5.32 16.323 12.16 31.161Q401 542 409 556H120Zm0 170v-60h419q13.8 6.364 29.4 10.682Q584 681 600 683v43H120Z" style="fill:rgb(131, 131, 131);"/></svg>') !important;
41
+ background-image: url(../../assets/lista.svg) !important;
42
42
  }
43
43
 
44
44
 
@@ -1,4 +1,5 @@
1
1
  import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
2
3
  import { RediDragDropComponent } from './redi-drag-drop/redi-drag-drop.component';
3
4
 
4
5
 
@@ -14,14 +15,11 @@ import { DragDropDirective } from '../models/directives/drag-drop.directive';
14
15
  DragDropDirective
15
16
  ],
16
17
  imports: [
17
- MatListModule,
18
- MatButtonModule,
19
- MatIconModule,
20
- MatRippleModule
18
+ CommonModule,
19
+ MatListModule, MatButtonModule, MatIconModule, MatRippleModule
21
20
  ],
22
21
  exports: [
23
- RediDragDropComponent,
24
- DragDropDirective
22
+ RediDragDropComponent
25
23
  ]
26
24
  })
27
25
  export class RediDragDropModule { }
package/karma.conf CHANGED
@@ -1,40 +1,40 @@
1
- // Karma configuration file, see link for more information
2
- // https://karma-runner.github.io/1.0/config/configuration-file.html
3
-
4
- module.exports = function (config) {
5
- config.set({
6
- basePath: '',
7
- frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
- plugins: [
9
- require('karma-jasmine'),
10
- require('karma-chrome-launcher'),
11
- require('karma-jasmine-html-reporter'),
12
- require('karma-coverage'),
13
- require('@angular-devkit/build-angular/plugins/karma')
14
- ],
15
- client: {
16
- jasmine: {
17
- // you can add configuration options for Jasmine here
18
- // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19
- // for example, you can disable the random execution with `random: false`
20
- // or set a specific seed with `seed: 4321`
21
- },
22
- clearContext: false // leave Jasmine Spec Runner output visible in browser
23
- },
24
- jasmineHtmlReporter: {
25
- suppressAll: true // removes the duplicated traces
26
- },
27
- coverageReporter: {
28
- dir: require('path').join(__dirname, '../../coverage/ngx-redi-core'),
29
- subdir: '.',
30
- reporters: [
31
- { type: 'html' },
32
- { type: 'text-summary' },
33
- { type: 'lcov' },
34
- ]
35
- },
36
- reporters: ['progress', 'kjhtml'],
37
- browsers: ['Chrome'],
38
- restartOnFileChange: true,
39
- });
40
- };
1
+ // Karma configuration file, see link for more information
2
+ // https://karma-runner.github.io/1.0/config/configuration-file.html
3
+
4
+ module.exports = function (config) {
5
+ config.set({
6
+ basePath: '',
7
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
+ plugins: [
9
+ require('karma-jasmine'),
10
+ require('karma-chrome-launcher'),
11
+ require('karma-jasmine-html-reporter'),
12
+ require('karma-coverage'),
13
+ require('@angular-devkit/build-angular/plugins/karma')
14
+ ],
15
+ client: {
16
+ jasmine: {
17
+ // you can add configuration options for Jasmine here
18
+ // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19
+ // for example, you can disable the random execution with `random: false`
20
+ // or set a specific seed with `seed: 4321`
21
+ },
22
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
23
+ },
24
+ jasmineHtmlReporter: {
25
+ suppressAll: true // removes the duplicated traces
26
+ },
27
+ coverageReporter: {
28
+ dir: require('path').join(__dirname, '../../coverage/ngx-redi-core'),
29
+ subdir: '.',
30
+ reporters: [
31
+ { type: 'html' },
32
+ { type: 'text-summary' },
33
+ { type: 'lcov' },
34
+ ]
35
+ },
36
+ reporters: ['progress', 'kjhtml'],
37
+ browsers: ['Chrome'],
38
+ restartOnFileChange: true,
39
+ });
40
+ };
package/package.json CHANGED
@@ -1,20 +1,37 @@
1
1
  {
2
2
  "name": "ngx-redi-core",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "peerDependencies": {
5
+ },
6
+ "dependencies": {
7
+ "@angular/material": "^15.2.9",
8
+ "tslib": "^2.5.0",
5
9
  "@angular/cdk": "^15.2.9",
6
10
  "@angular/animations": "^15.2.9",
7
11
  "@angular/common": "^15.2.9",
8
12
  "@angular/compiler": "^15.2.9",
9
13
  "@angular/core": "^15.2.9",
10
14
  "@angular/forms": "^15.2.9",
11
- "@angular/material": "^15.2.9",
12
15
  "@angular/platform-browser": "^15.2.9",
13
16
  "@angular/platform-browser-dynamic": "^15.2.9",
14
- "@angular/router": "^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"
15
21
  },
16
- "dependencies": {
17
- "tslib": "^2.5.0"
22
+ "devDependencies": {
23
+ "@angular/cdk": "^15.2.9",
24
+ "@angular/animations": "^15.2.9",
25
+ "@angular/common": "^15.2.9",
26
+ "@angular/compiler": "^15.2.9",
27
+ "@angular/core": "^15.2.9",
28
+ "@angular/forms": "^15.2.9",
29
+ "@angular/material": "^15.2.9",
30
+ "@angular/platform-browser": "^15.2.9",
31
+ "@angular/platform-browser-dynamic": "^15.2.9",
32
+ "@angular/router": "^15.2.9",
33
+ "rxjs": "~7.8.1",
34
+ "zone.js": "~0.13.0"
18
35
  },
19
36
  "sideEffects": false
20
37
  }