@jvsoft/components 0.0.9 → 0.0.11
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/CHANGELOG.md +9 -0
- package/build.js +20 -0
- package/dialog-flotante/dialog-flotante.component.html +66 -0
- package/dialog-flotante/dialog-flotante.component.ts +115 -0
- package/dialog-flotante/dialog-flotante.interface.ts +13 -0
- package/dialog-flotante/index.ts +1 -0
- package/dialog-flotante/ng-package.json +5 -0
- package/{index.d.ts → index.ts} +8 -0
- package/lista-arbol/lista-arbol.component.html +66 -0
- package/lista-arbol/lista-arbol.component.ts +238 -0
- package/lista-arbol/lista-arbol.functions.ts +46 -0
- package/lista-arbol/ng-package.json +5 -0
- package/lista-arbol/public-api.ts +1 -0
- package/luces-navidad/christmas-tree.png +0 -0
- package/luces-navidad/index.ts +1 -0
- package/luces-navidad/luces-navidad.component.html +6 -0
- package/luces-navidad/luces-navidad.component.ts +24 -0
- package/luces-navidad/ng-package.json +5 -0
- package/mat-suffix-search-button/index.ts +1 -0
- package/mat-suffix-search-button/mat-suffix-search-button.component.html +5 -0
- package/mat-suffix-search-button/mat-suffix-search-button.component.ts +36 -0
- package/mat-suffix-search-button/ng-package.json +5 -0
- package/menu/index.ts +1 -0
- package/menu/menu.component.html +40 -0
- package/menu/menu.component.ts +88 -0
- package/menu/menu.interface.ts +16 -0
- package/menu/ng-package.json +5 -0
- package/ng-package.json +17 -0
- package/package.json +15 -36
- package/progress-spinner.zip +0 -0
- package/tabla-mantenimiento/classes/data-model.ts +150 -0
- package/tabla-mantenimiento/components/progress-bar/index.ts +1 -0
- package/tabla-mantenimiento/components/progress-bar/ng-package.json +5 -0
- package/tabla-mantenimiento/components/progress-bar/progress-bar.component.html +10 -0
- package/tabla-mantenimiento/components/progress-bar/progress-bar.component.ts +85 -0
- package/tabla-mantenimiento/components/progress-bar/public-api.ts +2 -0
- package/tabla-mantenimiento/index.ts +1 -0
- package/tabla-mantenimiento/interfaces/{archivo.d.ts → archivo.ts} +7 -4
- package/tabla-mantenimiento/interfaces/global/{boton-mantenimiento.d.ts → boton-mantenimiento.ts} +9 -3
- package/tabla-mantenimiento/interfaces/global/{columnas-tabla.d.ts → columnas-tabla.ts} +90 -13
- package/tabla-mantenimiento/interfaces/global/export-excel-servidor.ts +0 -0
- package/tabla-mantenimiento/interfaces/global/no-export.ts +11 -0
- package/tabla-mantenimiento/interfaces/global/{otros.d.ts → otros.ts} +15 -3
- package/tabla-mantenimiento/interfaces/implements/{incluye-tabla-mantenimiento.d.ts → incluye-tabla-mantenimiento.ts} +6 -4
- package/tabla-mantenimiento/interfaces/implements/{index.d.ts → index.ts} +1 -0
- package/tabla-mantenimiento/mat-row-keyboard-selection.directive.ts +97 -0
- package/tabla-mantenimiento/ng-package.json +5 -0
- package/tabla-mantenimiento/pipes/no-sanitize.pipe.ts +12 -0
- package/tabla-mantenimiento/pipes/zero-fill.pipe.ts +19 -0
- package/tabla-mantenimiento/{public-api.d.ts → public-api.ts} +3 -2
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-date/column-type-date.component.html +22 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-date/column-type-date.component.ts +12 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-icons/column-type-icons.component.html +58 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-icons/column-type-icons.component.ts +19 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-money/column-type-money.component.html +40 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-money/column-type-money.component.ts +17 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-number/column-type-number.component.html +25 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-number/column-type-number.component.ts +14 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-progressbar/column-type-progressbar.component.html +28 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-progressbar/column-type-progressbar.component.ts +13 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-sino/column-type-sino.component.html +30 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-sino/column-type-sino.component.ts +38 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-text/column-type-text.component.html +97 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-text/column-type-text.component.ts +43 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.component.html +26 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.component.ts +36 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.module.ts +54 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component.html +76 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component.ts +67 -0
- package/tabla-mantenimiento/tabla-mantenimiento-menu/tabla-mantenimiento-menu.component.html +7 -0
- package/tabla-mantenimiento/tabla-mantenimiento-menu/tabla-mantenimiento-menu.component.ts +39 -0
- package/tabla-mantenimiento/tabla-mantenimiento.component.html +385 -0
- package/tabla-mantenimiento/tabla-mantenimiento.component.ts +951 -0
- package/tabla-mantenimiento/tabla-mantenimiento.functions.ts +57 -0
- package/tabla-mantenimiento/tabla-mantenimiento.service.ts +44 -0
- package/tabla-mantenimiento/table-util.ts +49 -0
- package/tabla-mantenimiento.zip +0 -0
- package/tsconfig.lib.json +16 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/yarn-error.log +68 -0
- package/dialog-flotante/dialog-flotante.component.d.ts +0 -32
- package/dialog-flotante/dialog-flotante.interface.d.ts +0 -11
- package/dialog-flotante/index.d.ts +0 -5
- package/fesm2022/jvsoft-components-dialog-flotante.mjs +0 -130
- package/fesm2022/jvsoft-components-dialog-flotante.mjs.map +0 -1
- package/fesm2022/jvsoft-components-luces-navidad.mjs +0 -33
- package/fesm2022/jvsoft-components-luces-navidad.mjs.map +0 -1
- package/fesm2022/jvsoft-components-mat-suffix-search-button.mjs +0 -47
- package/fesm2022/jvsoft-components-mat-suffix-search-button.mjs.map +0 -1
- package/fesm2022/jvsoft-components-menu.mjs +0 -102
- package/fesm2022/jvsoft-components-menu.mjs.map +0 -1
- package/fesm2022/jvsoft-components-tabla-mantenimiento-components-progress-bar.mjs +0 -91
- package/fesm2022/jvsoft-components-tabla-mantenimiento-components-progress-bar.mjs.map +0 -1
- package/fesm2022/jvsoft-components-tabla-mantenimiento.mjs +0 -1801
- package/fesm2022/jvsoft-components-tabla-mantenimiento.mjs.map +0 -1
- package/fesm2022/jvsoft-components.mjs +0 -2061
- package/fesm2022/jvsoft-components.mjs.map +0 -1
- package/luces-navidad/index.d.ts +0 -5
- package/luces-navidad/luces-navidad.component.d.ts +0 -11
- package/mat-suffix-search-button/index.d.ts +0 -5
- package/mat-suffix-search-button/mat-suffix-search-button.component.d.ts +0 -12
- package/menu/index.d.ts +0 -5
- package/menu/menu.component.d.ts +0 -25
- package/menu/menu.interface.d.ts +0 -16
- package/src/styles/base-jvsoft-components.css +0 -9
- package/tabla-mantenimiento/classes/data-model.d.ts +0 -25
- package/tabla-mantenimiento/components/progress-bar/index.d.ts +0 -5
- package/tabla-mantenimiento/components/progress-bar/progress-bar.component.d.ts +0 -30
- package/tabla-mantenimiento/components/progress-bar/public-api.d.ts +0 -1
- package/tabla-mantenimiento/index.d.ts +0 -5
- package/tabla-mantenimiento/interfaces/global/no-export.d.ts +0 -2
- package/tabla-mantenimiento/mat-row-keyboard-selection.directive.d.ts +0 -19
- package/tabla-mantenimiento/pipes/no-sanitize.pipe.d.ts +0 -10
- package/tabla-mantenimiento/pipes/zero-fill.pipe.d.ts +0 -8
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-date/column-type-date.component.d.ts +0 -8
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-icons/column-type-icons.component.d.ts +0 -9
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-money/column-type-money.component.d.ts +0 -9
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-number/column-type-number.component.d.ts +0 -8
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-progressbar/column-type-progressbar.component.d.ts +0 -8
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-sino/column-type-sino.component.d.ts +0 -9
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-text/column-type-text.component.d.ts +0 -8
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.component.d.ts +0 -18
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.module.d.ts +0 -23
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component.d.ts +0 -21
- package/tabla-mantenimiento/tabla-mantenimiento-menu/tabla-mantenimiento-menu.component.d.ts +0 -18
- package/tabla-mantenimiento/tabla-mantenimiento.component.d.ts +0 -147
- package/tabla-mantenimiento/tabla-mantenimiento.functions.d.ts +0 -5
- package/tabla-mantenimiento/tabla-mantenimiento.service.d.ts +0 -8
- package/tabla-mantenimiento/table-util.d.ts +0 -11
- /package/dialog-flotante/{public-api.d.ts → public-api.ts} +0 -0
- /package/luces-navidad/{public-api.d.ts → public-api.ts} +0 -0
- /package/mat-suffix-search-button/{public-api.d.ts → public-api.ts} +0 -0
- /package/menu/{public-api.d.ts → public-api.ts} +0 -0
- /package/tabla-mantenimiento/interfaces/global/{index.d.ts → index.ts} +0 -0
- /package/tabla-mantenimiento/interfaces/{index.d.ts → index.ts} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
|
2
|
+
import {FormControl} from '@angular/forms';
|
|
3
|
+
import {MatRipple} from '@angular/material/core';
|
|
4
|
+
import {MatIcon} from '@angular/material/icon';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'div[matSuffix][matSuffixSearchButton]',
|
|
8
|
+
imports: [
|
|
9
|
+
MatRipple,
|
|
10
|
+
MatIcon
|
|
11
|
+
],
|
|
12
|
+
templateUrl: './mat-suffix-search-button.component.html',
|
|
13
|
+
host: {
|
|
14
|
+
class: 'flex items-center justify-start',
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
export class MatSuffixSearchButtonComponent {
|
|
18
|
+
@Input({required: true}) fControl: any;
|
|
19
|
+
@Output() eventLimpiar: EventEmitter<any> = new EventEmitter();
|
|
20
|
+
@Output() eventBuscar: EventEmitter<any> = new EventEmitter();
|
|
21
|
+
|
|
22
|
+
get control(): FormControl {
|
|
23
|
+
return this.fControl;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
emitirClick() {
|
|
27
|
+
if (this.control.value) {
|
|
28
|
+
this.control.reset();
|
|
29
|
+
this.eventLimpiar.emit(true);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
this.eventBuscar.emit(true);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
package/menu/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './public-api'
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<ng-container *ngIf="yet">
|
|
2
|
+
<button matRipple [matMenuTriggerFor]="matmenus.first"
|
|
3
|
+
[disabled]="disabled"
|
|
4
|
+
type="button" [class]="cssBoton ?? 'boton-circular boton-circular-red border-0'"
|
|
5
|
+
(click)="$event.preventDefault(); $event.stopImmediatePropagation()"
|
|
6
|
+
[matTooltip]="title"
|
|
7
|
+
>
|
|
8
|
+
<ng-content></ng-content>
|
|
9
|
+
</button>
|
|
10
|
+
</ng-container>
|
|
11
|
+
|
|
12
|
+
<!--<pre class="text-indigo-900">{{_submenus | json}}</pre>-->
|
|
13
|
+
<ng-container *ngFor="let menu of _submenus">
|
|
14
|
+
<!--<pre class="text-red-700">{{menu | json}}</pre>-->
|
|
15
|
+
<mat-menu xPosition="before" yPosition="below" class="max-w-none">
|
|
16
|
+
<ng-container *ngFor="let item of menu">
|
|
17
|
+
<!--<pre *ngIf="menu$" class="text-orange-700">{{item | json}}</pre>-->
|
|
18
|
+
<!--<span>{{ [item.label, item.idxOpcionCalc!=-1 , yet , (!item.esVisible || item.esVisible({itemMenu: item, archivo: itemSeleccion})), [!item.esVisible , (item.esVisible ? item.esVisible({itemMenu: item, archivo: itemSeleccion}) : 'NO HAY')]] | json }}</span>-->
|
|
19
|
+
<button mat-menu-item *ngIf="item.idxOpcionCalc!=-1 && yet && (!item.esVisible || item.esVisible({itemMenu: item, archivo: itemSeleccion}))"
|
|
20
|
+
class="flex items-center justify-items-center uppercase w-full rounded-none px-2 "
|
|
21
|
+
[matMenuTriggerFor]="getMenu(item.idxOpcionCalc)">
|
|
22
|
+
<mat-icon *ngIf="item.icono"
|
|
23
|
+
class="flex-none flex items-center justify-center !text-red-700 !mr-1 icon-2xs"
|
|
24
|
+
[svgIcon]="item.icono ?? 'fa5sFileSignature'"
|
|
25
|
+
></mat-icon>
|
|
26
|
+
<span class="grow text-2xs" [innerHTML]="item.label">{{item.label}}</span>
|
|
27
|
+
</button>
|
|
28
|
+
<button mat-menu-item *ngIf="item.idxOpcionCalc==-1 && (!item.esVisible || item.esVisible(item))" (click)="onClick(item.valorSeleccion)"
|
|
29
|
+
class="flex items-center justify-items-center uppercase w-full rounded-none px-2 "
|
|
30
|
+
>
|
|
31
|
+
<mat-icon *ngIf="item.icono"
|
|
32
|
+
class="flex-none flex items-center justify-center !text-red-700 !mr-1 icon-2xs"
|
|
33
|
+
[svgIcon]="item.icono ?? 'fa5sFileSignature'"
|
|
34
|
+
></mat-icon>
|
|
35
|
+
<span class="grow text-2xs" [innerHTML]="item.label">{{item.label}} </span>
|
|
36
|
+
</button>
|
|
37
|
+
|
|
38
|
+
</ng-container>
|
|
39
|
+
</mat-menu>
|
|
40
|
+
</ng-container>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {AfterViewInit, Component, EventEmitter, Input, OnInit, Output, QueryList, ViewChildren} from '@angular/core';
|
|
2
|
+
import {CommonModule} from '@angular/common';
|
|
3
|
+
import {MatMenu, MatMenuModule} from '@angular/material/menu';
|
|
4
|
+
import {MatIconModule} from '@angular/material/icon';
|
|
5
|
+
import {MatRippleModule} from '@angular/material/core';
|
|
6
|
+
import {MatTooltipModule} from '@angular/material/tooltip';
|
|
7
|
+
import {BotonMenu} from './menu.interface';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'jvs-menu',
|
|
11
|
+
standalone: true,
|
|
12
|
+
imports: [
|
|
13
|
+
CommonModule,
|
|
14
|
+
MatMenuModule,
|
|
15
|
+
MatIconModule,
|
|
16
|
+
MatRippleModule,
|
|
17
|
+
MatTooltipModule,
|
|
18
|
+
],
|
|
19
|
+
templateUrl: './menu.component.html',
|
|
20
|
+
})
|
|
21
|
+
export class MenuComponent implements OnInit, AfterViewInit {
|
|
22
|
+
@Input() cssBoton?: string;
|
|
23
|
+
@Input() title?: string;
|
|
24
|
+
@Input() disabled: boolean = false;
|
|
25
|
+
@Input() itemSeleccion?: string;
|
|
26
|
+
@Input() menu: BotonMenu[] = [];
|
|
27
|
+
@Output() action: EventEmitter<string> = new EventEmitter<string>();
|
|
28
|
+
|
|
29
|
+
@ViewChildren(MatMenu) matmenus!: QueryList<MatMenu>;
|
|
30
|
+
|
|
31
|
+
menuItems: string[] = [];
|
|
32
|
+
yet: boolean = false;
|
|
33
|
+
_submenus: BotonMenu[][] = []; // 🔥 Tipo explícito como Array de Array de BotonMenu
|
|
34
|
+
|
|
35
|
+
get submenus(): BotonMenu[][] {
|
|
36
|
+
return this._submenus.filter(() => true); // Mantiene la estructura, aunque no hace filtro real
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
ngOnInit(): void {
|
|
40
|
+
this.createSubmenus(this.menu, 's0', 1);
|
|
41
|
+
this.reindex();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
ngAfterViewInit(): void {
|
|
45
|
+
// Previene errores de Angular al repintar el menú
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
this.yet = true;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
onClick(value: string): void {
|
|
52
|
+
this.action.emit(value);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
getMenu(index: number): MatMenu | null {
|
|
56
|
+
return index >= 0 && this.matmenus ? this.matmenus.get(index) ?? null:null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
reindex(): void {
|
|
60
|
+
// Asigna el índice del ítem del menú
|
|
61
|
+
this._submenus.forEach((menu: BotonMenu[]) => {
|
|
62
|
+
menu.forEach((item: BotonMenu) => {
|
|
63
|
+
if (item.idxOpcionCalc !== -1) {
|
|
64
|
+
item.idxOpcionCalc = this.menuItems.indexOf(item.valorSeleccion ?? '');
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
createSubmenus(menu: BotonMenu[], prefix: string, count: number): void {
|
|
71
|
+
this.menuItems.push(prefix);
|
|
72
|
+
|
|
73
|
+
this._submenus.push(
|
|
74
|
+
menu.map((item, index): BotonMenu => ({
|
|
75
|
+
...item,
|
|
76
|
+
valorSeleccion: item.subItems ? `${prefix}${index}`:item.valorSeleccion,
|
|
77
|
+
idxOpcionCalc: item.subItems ? 0:-1,
|
|
78
|
+
}))
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// Llamada recursiva para crear submenús
|
|
82
|
+
menu.forEach((item, index) => {
|
|
83
|
+
if (item.subItems) {
|
|
84
|
+
this.createSubmenus(item.subItems, `${prefix}${index}`, count + 1);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface BotonMenu {
|
|
2
|
+
idUnico?: string,
|
|
3
|
+
class?: string;
|
|
4
|
+
icono?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
soloIcono?: boolean;
|
|
7
|
+
sinCondicion?: boolean;
|
|
8
|
+
badge?: string;
|
|
9
|
+
tooltip?: string;
|
|
10
|
+
idxOpcionCalc?: any,
|
|
11
|
+
subItems?: BotonMenu[];
|
|
12
|
+
datosExtra?: any;
|
|
13
|
+
valorSeleccion?: any;
|
|
14
|
+
esVisible?(dataValid?: any): boolean;
|
|
15
|
+
estaDeshabilitado?(item?: any): boolean;
|
|
16
|
+
}
|
package/ng-package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
+
"dest": "../../dist/components",
|
|
4
|
+
"lib": {
|
|
5
|
+
"entryFile": "./index.ts",
|
|
6
|
+
"styleIncludePaths": [
|
|
7
|
+
"./src"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"assets": [
|
|
11
|
+
"**/*.scss",
|
|
12
|
+
"**/*.css"
|
|
13
|
+
],
|
|
14
|
+
"allowedNonPeerDependencies": [
|
|
15
|
+
"."
|
|
16
|
+
]
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jvsoft/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"peerDependencies": {
|
|
5
8
|
"@angular/common": ">=16.0.0",
|
|
6
9
|
"@angular/core": ">=16.0.0",
|
|
@@ -13,44 +16,20 @@
|
|
|
13
16
|
"xlsx": "^0.18.5"
|
|
14
17
|
},
|
|
15
18
|
"dependencies": {
|
|
19
|
+
"@jvsoft/utils": "workspace:*",
|
|
16
20
|
"tslib": "^2.3.0"
|
|
17
21
|
},
|
|
18
22
|
"sideEffects": false,
|
|
19
23
|
"exports": {
|
|
20
24
|
"./base.scss": "./src/styles/base.scss",
|
|
21
|
-
"./styles.css": "./src/styles/base-jvsoft-components.css"
|
|
22
|
-
"./package.json": {
|
|
23
|
-
"default": "./package.json"
|
|
24
|
-
},
|
|
25
|
-
".": {
|
|
26
|
-
"types": "./index.d.ts",
|
|
27
|
-
"default": "./fesm2022/jvsoft-components.mjs"
|
|
28
|
-
},
|
|
29
|
-
"./dialog-flotante": {
|
|
30
|
-
"types": "./dialog-flotante/index.d.ts",
|
|
31
|
-
"default": "./fesm2022/jvsoft-components-dialog-flotante.mjs"
|
|
32
|
-
},
|
|
33
|
-
"./luces-navidad": {
|
|
34
|
-
"types": "./luces-navidad/index.d.ts",
|
|
35
|
-
"default": "./fesm2022/jvsoft-components-luces-navidad.mjs"
|
|
36
|
-
},
|
|
37
|
-
"./mat-suffix-search-button": {
|
|
38
|
-
"types": "./mat-suffix-search-button/index.d.ts",
|
|
39
|
-
"default": "./fesm2022/jvsoft-components-mat-suffix-search-button.mjs"
|
|
40
|
-
},
|
|
41
|
-
"./menu": {
|
|
42
|
-
"types": "./menu/index.d.ts",
|
|
43
|
-
"default": "./fesm2022/jvsoft-components-menu.mjs"
|
|
44
|
-
},
|
|
45
|
-
"./tabla-mantenimiento": {
|
|
46
|
-
"types": "./tabla-mantenimiento/index.d.ts",
|
|
47
|
-
"default": "./fesm2022/jvsoft-components-tabla-mantenimiento.mjs"
|
|
48
|
-
},
|
|
49
|
-
"./tabla-mantenimiento/components/progress-bar": {
|
|
50
|
-
"types": "./tabla-mantenimiento/components/progress-bar/index.d.ts",
|
|
51
|
-
"default": "./fesm2022/jvsoft-components-tabla-mantenimiento-components-progress-bar.mjs"
|
|
52
|
-
}
|
|
25
|
+
"./styles.css": "./src/styles/base-jvsoft-components.css"
|
|
53
26
|
},
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "ng build components --configuration production",
|
|
29
|
+
"build:lib": "node build.js && yarn build",
|
|
30
|
+
"build:styles": "tailwindcss -i ./src/styles/base.scss -o ./src/styles/base-jvsoft-components.css",
|
|
31
|
+
"watch:styles": "yarn build:styles --watch",
|
|
32
|
+
"watch": "ng build components --watch --configuration development",
|
|
33
|
+
"test": "ng test components"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {AbstractControl, FormControl, FormControlOptions, FormGroup, ValidationErrors, ValidatorFn, Validators} from '@angular/forms';
|
|
2
|
+
import {esNumero} from '../tabla-mantenimiento.functions';
|
|
3
|
+
|
|
4
|
+
export class DataModel {
|
|
5
|
+
public modelosChk: { [key: string]: boolean | any } = {}; // Usar any para valores dinámicos
|
|
6
|
+
|
|
7
|
+
public checkbox: ForCheckboxModel;
|
|
8
|
+
|
|
9
|
+
constructor() {
|
|
10
|
+
this.checkbox = new ForCheckboxModel(this);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
generarId(row: any, campoValor: string[] | string, separador = '') {
|
|
14
|
+
if (typeof campoValor == 'string') {
|
|
15
|
+
campoValor = [campoValor];
|
|
16
|
+
}
|
|
17
|
+
return campoValor.map(data => row[data]).join(separador);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Agrega controles al objeto modelosChk
|
|
21
|
+
agregarControles(lista: any[], idLista: string, limpiar = true, campoValor: string[] | string | null = null, campoValorSeparador = '') {
|
|
22
|
+
|
|
23
|
+
if (limpiar) {
|
|
24
|
+
this.modelosChk = {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const asignarValor = (dat: any, idLista: string, campoValor: string, key?: string) => {
|
|
28
|
+
if (!key) {
|
|
29
|
+
key = dat[idLista] + (campoValor.includes('.') ? '':`.${campoValor}`);
|
|
30
|
+
}
|
|
31
|
+
const mat = campoValor.match(/^([in])[A-Z][a-zA-Z]+/);
|
|
32
|
+
if (mat) {
|
|
33
|
+
this.modelosChk[key] = dat[campoValor] * 1;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.modelosChk[key] = dat[campoValor];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
lista.forEach(dat => {
|
|
42
|
+
if (campoValor === null) {
|
|
43
|
+
// Caso 1: Sin campoValor, se asigna false
|
|
44
|
+
this.modelosChk[dat[idLista]] = false;
|
|
45
|
+
}
|
|
46
|
+
else if (typeof campoValor === 'string') {
|
|
47
|
+
// Caso 2: campoValor es un string
|
|
48
|
+
asignarValor(dat, idLista, campoValor, dat[idLista]);
|
|
49
|
+
}
|
|
50
|
+
else if (campoValorSeparador) {
|
|
51
|
+
const idStr = this.generarId(dat, campoValor, campoValorSeparador);
|
|
52
|
+
// Caso 2: campoValor es un string
|
|
53
|
+
asignarValor(dat, idLista, '.', idStr);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// Caso 3: campoValor es un array de strings
|
|
57
|
+
campoValor.forEach(data => asignarValor(dat, idLista, data));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Establece el estado de un índice
|
|
63
|
+
setState(idx: string, state: boolean) {
|
|
64
|
+
this.modelosChk[idx] = state;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Obtiene el estado de un índice
|
|
68
|
+
getState(idx: string): boolean | any {
|
|
69
|
+
return this.modelosChk[idx];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
getDataMultiple(idx: string) {
|
|
73
|
+
const camposMod = Object.keys(this.modelosChk).filter(key => key.split('.')[0] == idx);
|
|
74
|
+
const vRet: any = {};
|
|
75
|
+
camposMod.forEach(key => {
|
|
76
|
+
vRet[key.split('.')[1]] = this.modelosChk[key];
|
|
77
|
+
});
|
|
78
|
+
return vRet;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Genera una lista basada en el estado de los índices
|
|
82
|
+
generarLista(tipoRetorno: 'array' | 'object' | null = null, esCampoNumerico = false): string | object | any[] {
|
|
83
|
+
const strLista: string[] = [];
|
|
84
|
+
const objLista: { [key: string]: boolean | any } = {};
|
|
85
|
+
Object.keys(this.modelosChk).forEach(key => {
|
|
86
|
+
if ((esCampoNumerico && esNumero(this.modelosChk[key])) ||
|
|
87
|
+
(this.modelosChk[key])
|
|
88
|
+
) {
|
|
89
|
+
strLista.push(key);
|
|
90
|
+
objLista[key] = this.modelosChk[key];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
if (tipoRetorno === 'array') {
|
|
94
|
+
return strLista;
|
|
95
|
+
}
|
|
96
|
+
if (tipoRetorno === 'object') {
|
|
97
|
+
return objLista;
|
|
98
|
+
}
|
|
99
|
+
return strLista.join(',');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
generarFormGroupFromModelosChk(tipo?: string): FormGroup {
|
|
103
|
+
const formGroupObj: { [key: string]: FormControl } = {};
|
|
104
|
+
let validadores: ValidatorFn | ((control: AbstractControl) => ValidationErrors | null)[] | FormControlOptions | null | undefined = []
|
|
105
|
+
if (tipo == 'number') {
|
|
106
|
+
validadores = [
|
|
107
|
+
Validators.required,
|
|
108
|
+
Validators.min(1)
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
Object.keys(this.modelosChk).forEach(key => {
|
|
112
|
+
formGroupObj[key] = new FormControl(this.modelosChk[key], validadores);
|
|
113
|
+
});
|
|
114
|
+
return new FormGroup(formGroupObj);
|
|
115
|
+
|
|
116
|
+
// return this.formBuilder.group(formGroupObj);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
class ForCheckboxModel {
|
|
121
|
+
private modeloCheck: DataModel;
|
|
122
|
+
|
|
123
|
+
constructor(modeloCheck: DataModel) {
|
|
124
|
+
this.modeloCheck = modeloCheck;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
get cantidadActivos() {
|
|
128
|
+
return Object.values(this.modeloCheck.modelosChk).filter(Boolean).length;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
get existenActivados() {
|
|
132
|
+
return this.cantidadActivos > 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
get todosActivos() {
|
|
136
|
+
const total = Object.keys(this.modeloCheck.modelosChk).length;
|
|
137
|
+
const activos = this.cantidadActivos;
|
|
138
|
+
return activos > 0 && total === activos;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
get algunosActivos() {
|
|
142
|
+
const total = Object.keys(this.modeloCheck.modelosChk).length;
|
|
143
|
+
const activos = this.cantidadActivos;
|
|
144
|
+
return activos > 0 && total !== activos;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
establecerTodos(activo: boolean) {
|
|
148
|
+
Object.keys(this.modeloCheck.modelosChk).forEach(idx => this.modeloCheck.modelosChk[idx] = activo);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './public-api'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div class="w-full bg-gray-200 text-gray-700 rounded-full" [class.text-center]="textoCentrado">
|
|
2
|
+
<div class="text-xxs font-medium text-center p-1 leading-none rounded-full"
|
|
3
|
+
[ngClass]="colorEstilo().class ? colorEstilo().class : 'bg-blue-600 text-blue-100'"
|
|
4
|
+
[style]="colorEstilo().style ? colorEstilo().style : ''"
|
|
5
|
+
[style.width]="(textoCentrado ? 100 : porcentaje) + '%'"
|
|
6
|
+
>
|
|
7
|
+
<span *ngIf="textoMostrar else defaultText;" class="whitespace-nowrap">{{ textoMostrar }}</span>
|
|
8
|
+
<ng-template #defaultText>{{ porcentaje | number: formatoNumero }}%</ng-template>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {Component, Input, OnInit} from '@angular/core';
|
|
2
|
+
import {CommonModule, DecimalPipe} from '@angular/common';
|
|
3
|
+
|
|
4
|
+
export interface EstilosBarra {
|
|
5
|
+
valorMaximo: number;
|
|
6
|
+
class?: string;
|
|
7
|
+
style?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: 'jvs-progress-bar',
|
|
12
|
+
templateUrl: './progress-bar.component.html',
|
|
13
|
+
imports: [
|
|
14
|
+
CommonModule,
|
|
15
|
+
DecimalPipe
|
|
16
|
+
],
|
|
17
|
+
host: {
|
|
18
|
+
class: 'jvs-progress-bar',
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
export class ProgressBarComponent implements OnInit {
|
|
22
|
+
|
|
23
|
+
@Input() objThis: any;
|
|
24
|
+
@Input() porcentaje = 0;
|
|
25
|
+
@Input() textoCentrado = false;
|
|
26
|
+
|
|
27
|
+
private _textoMostrar: string = '';
|
|
28
|
+
get textoMostrar(): string { return this._textoMostrar; }
|
|
29
|
+
@Input() set textoMostrar(val: string) { this._textoMostrar = val; }
|
|
30
|
+
|
|
31
|
+
private _formatoNumero: string = '';
|
|
32
|
+
get formatoNumero(): string { return this._formatoNumero; }
|
|
33
|
+
@Input() set formatoNumero(val: string | undefined) { this._formatoNumero = val ?? '1.0-0'; }
|
|
34
|
+
|
|
35
|
+
private _coloresValor: EstilosBarra[] = [];
|
|
36
|
+
get coloresValor(): EstilosBarra[] { return this._coloresValor; }
|
|
37
|
+
@Input() set coloresValor(val: EstilosBarra[] | undefined ) {
|
|
38
|
+
if (!val || !Array.isArray(val)) {
|
|
39
|
+
this._coloresValor = [
|
|
40
|
+
{valorMaximo: 1, class: 'p-0'},
|
|
41
|
+
{valorMaximo: 40, class: 'bg-red-400 text-red-900'},
|
|
42
|
+
// {valorMaximo: 35, class: 'bg-red-600 text-red-100'},
|
|
43
|
+
{valorMaximo: 80, class: 'bg-yellow-600 text-yellow-100'},
|
|
44
|
+
{valorMaximo: 100, class: 'bg-green-600 text-green-100'},
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this._coloresValor = val;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
constructor() { }
|
|
53
|
+
|
|
54
|
+
ngOnInit(): void {
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
colorEstilo(): {style: string, class: string} {
|
|
58
|
+
let estiloFin = null;
|
|
59
|
+
let claseFin = null;
|
|
60
|
+
let encontro = false;
|
|
61
|
+
|
|
62
|
+
this.coloresValor = this.ordenarPorPropiedad(this.coloresValor, 'valorMaximo');
|
|
63
|
+
|
|
64
|
+
this.coloresValor.forEach(estilo => {
|
|
65
|
+
if (!encontro && (this.porcentaje <= estilo.valorMaximo)) {
|
|
66
|
+
// console.log(this.porcentaje, estilo, (this.porcentaje < estilo.valorMaximo));
|
|
67
|
+
encontro = true;
|
|
68
|
+
estiloFin = estilo.style;
|
|
69
|
+
claseFin = estilo.class;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
style: estiloFin ?? '',
|
|
74
|
+
class: claseFin ?? '',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
ordenarPorPropiedad(objData: any[], propiedad: string, numeros = false) {
|
|
79
|
+
if (numeros) {
|
|
80
|
+
return objData.sort((a, b) => a[propiedad] - b[propiedad]);
|
|
81
|
+
}
|
|
82
|
+
return objData.sort((a, b) => (a[propiedad] > b[propiedad]) ? 1:((b[propiedad] > a[propiedad]) ? -1:0));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './public-api'
|
|
@@ -11,16 +11,19 @@ export interface Archivo {
|
|
|
11
11
|
loading?: boolean;
|
|
12
12
|
archivoFisico?: File;
|
|
13
13
|
progress?: any;
|
|
14
|
+
|
|
14
15
|
keyFirmaTramite?: string;
|
|
16
|
+
|
|
15
17
|
cArchivoNombre?: string;
|
|
16
18
|
cArchivoKey?: any;
|
|
17
19
|
iArchivoId?: any;
|
|
18
20
|
cArchivoRuta?: string;
|
|
19
21
|
cArchivoData?: string;
|
|
22
|
+
|
|
20
23
|
servFile?: Archivo;
|
|
21
24
|
cantidadFirmas?: {
|
|
22
|
-
total: number
|
|
23
|
-
digitales: number
|
|
24
|
-
electronicas: number
|
|
25
|
-
}
|
|
25
|
+
total: number,
|
|
26
|
+
digitales: number,
|
|
27
|
+
electronicas: number,
|
|
28
|
+
}
|
|
26
29
|
}
|
package/tabla-mantenimiento/interfaces/global/{boton-mantenimiento.d.ts → boton-mantenimiento.ts}
RENAMED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {TablaMantenimientoComponent} from '../../tabla-mantenimiento.component';
|
|
2
|
+
|
|
3
|
+
export type TiposOpciones = 'ver' | 'nuevo' | 'editar' | 'guardar' | 'eliminar' | 'seleccionar' | 'editar_item' | 'detalle' |
|
|
4
|
+
'ver_archivos' | 'eliminar_fila' | 'imprimir' | 'descargar' | 'exportar_pdf' | 'exportar_excel' |
|
|
5
|
+
'exportacion_avanzada' | 'ver_mapa' | string;
|
|
3
6
|
export interface BotonMantenimiento {
|
|
4
7
|
tipo: TiposOpciones;
|
|
5
8
|
tipoTemplate?: TiposOpciones;
|
|
@@ -20,6 +23,7 @@ export interface BotonMantenimiento {
|
|
|
20
23
|
esVisible?(item: any, tablaRef?: TablaMantenimientoComponent<any>): boolean;
|
|
21
24
|
estaDeshabilitado?(item: any, tablaRef?: TablaMantenimientoComponent<any>): boolean;
|
|
22
25
|
}
|
|
26
|
+
|
|
23
27
|
export interface BotonDialog {
|
|
24
28
|
tipo?: TiposOpciones;
|
|
25
29
|
class?: string;
|
|
@@ -27,6 +31,7 @@ export interface BotonDialog {
|
|
|
27
31
|
label?: string;
|
|
28
32
|
sinCondicion?: boolean;
|
|
29
33
|
}
|
|
34
|
+
|
|
30
35
|
export interface SeccionesBotonesMantenimiento {
|
|
31
36
|
crud?: BotonMantenimiento[];
|
|
32
37
|
principal?: BotonMantenimiento[];
|
|
@@ -34,8 +39,9 @@ export interface SeccionesBotonesMantenimiento {
|
|
|
34
39
|
derecha?: BotonMantenimiento[];
|
|
35
40
|
secundario?: BotonMantenimiento[];
|
|
36
41
|
inferior?: BotonMantenimiento[];
|
|
37
|
-
[key: string]: BotonMantenimiento[] | undefined;
|
|
42
|
+
[key: string]: BotonMantenimiento[] | undefined; // 🔹 Permite indexar con cualquier string
|
|
38
43
|
}
|
|
44
|
+
|
|
39
45
|
export interface TablaMantenimientoSeccionBotones {
|
|
40
46
|
[key: string]: SeccionesBotonesMantenimiento;
|
|
41
47
|
}
|