@eqproject/eqp-dynamic-module 0.0.2 → 0.0.3
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/bundles/eqproject-eqp-dynamic-module.umd.js +72 -29
- package/bundles/eqproject-eqp-dynamic-module.umd.js.map +1 -1
- package/bundles/eqproject-eqp-dynamic-module.umd.min.js +1 -1
- package/bundles/eqproject-eqp-dynamic-module.umd.min.js.map +1 -1
- package/eqproject-eqp-dynamic-module.metadata.json +1 -1
- package/esm2015/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +33 -12
- package/esm2015/lib/components/private/form-records/add-form-record/add-form-record.component.js +6 -2
- package/esm2015/lib/components/private/form-records/list-form-record/list-form-record.component.js +37 -18
- package/esm5/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.js +33 -12
- package/esm5/lib/components/private/form-records/add-form-record/add-form-record.component.js +6 -2
- package/esm5/lib/components/private/form-records/list-form-record/list-form-record.component.js +37 -20
- package/fesm2015/eqproject-eqp-dynamic-module.js +73 -28
- package/fesm2015/eqproject-eqp-dynamic-module.js.map +1 -1
- package/fesm5/eqproject-eqp-dynamic-module.js +73 -30
- package/fesm5/eqproject-eqp-dynamic-module.js.map +1 -1
- package/lib/components/exported/eqp-dynamic-module/eqp-dynamic-module.component.d.ts +7 -1
- package/lib/components/private/form-records/add-form-record/add-form-record.component.d.ts +1 -0
- package/lib/components/private/form-records/list-form-record/list-form-record.component.d.ts +6 -2
- package/package.json +1 -1
|
@@ -566,7 +566,11 @@
|
|
|
566
566
|
this.context = new Context();
|
|
567
567
|
this.form = new Form();
|
|
568
568
|
this.showButtons = true;
|
|
569
|
+
this.showTitle = true;
|
|
569
570
|
this.viewMode = exports.FormTypeEnum.LIST;
|
|
571
|
+
this.saveRecord = new core.EventEmitter();
|
|
572
|
+
this.deleteRecord = new core.EventEmitter();
|
|
573
|
+
this.duplicateRecord = new core.EventEmitter();
|
|
570
574
|
this.FormTypeEnum = exports.FormTypeEnum;
|
|
571
575
|
}
|
|
572
576
|
EqpDynamicModuleComponent.prototype.ngOnInit = function () {
|
|
@@ -585,16 +589,21 @@
|
|
|
585
589
|
};
|
|
586
590
|
EqpDynamicModuleComponent.prototype.onSaveForm = function (event) {
|
|
587
591
|
//TODO: Salvare il record!
|
|
588
|
-
if (event != null) {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
592
|
+
// if (event != null) {
|
|
593
|
+
// if (event.ID && this.values.find(v => v.ID == event.ID)) {
|
|
594
|
+
// this.values[this.values.findIndex(v => v.ID == event.ID)] = event;
|
|
595
|
+
// } else {
|
|
596
|
+
// this.values.push(event);
|
|
597
|
+
// }
|
|
598
|
+
// }
|
|
599
|
+
this.saveRecord.emit(event);
|
|
596
600
|
this.viewMode = exports.FormTypeEnum.LIST;
|
|
597
|
-
|
|
601
|
+
};
|
|
602
|
+
EqpDynamicModuleComponent.prototype.onDuplicateRecord = function (record) {
|
|
603
|
+
this.duplicateRecord.emit(record);
|
|
604
|
+
};
|
|
605
|
+
EqpDynamicModuleComponent.prototype.onDeleteRecord = function (record) {
|
|
606
|
+
this.deleteRecord.emit(record);
|
|
598
607
|
};
|
|
599
608
|
__decorate([
|
|
600
609
|
core.Input()
|
|
@@ -608,13 +617,25 @@
|
|
|
608
617
|
__decorate([
|
|
609
618
|
core.Input()
|
|
610
619
|
], EqpDynamicModuleComponent.prototype, "showButtons", void 0);
|
|
620
|
+
__decorate([
|
|
621
|
+
core.Input()
|
|
622
|
+
], EqpDynamicModuleComponent.prototype, "showTitle", void 0);
|
|
611
623
|
__decorate([
|
|
612
624
|
core.Input()
|
|
613
625
|
], EqpDynamicModuleComponent.prototype, "viewMode", void 0);
|
|
626
|
+
__decorate([
|
|
627
|
+
core.Output()
|
|
628
|
+
], EqpDynamicModuleComponent.prototype, "saveRecord", void 0);
|
|
629
|
+
__decorate([
|
|
630
|
+
core.Output()
|
|
631
|
+
], EqpDynamicModuleComponent.prototype, "deleteRecord", void 0);
|
|
632
|
+
__decorate([
|
|
633
|
+
core.Output()
|
|
634
|
+
], EqpDynamicModuleComponent.prototype, "duplicateRecord", void 0);
|
|
614
635
|
EqpDynamicModuleComponent = __decorate([
|
|
615
636
|
core.Component({
|
|
616
637
|
selector: 'eqp-dynamic-module',
|
|
617
|
-
template: "<add-form-record *ngIf=\"viewMode == FormTypeEnum.SCALAR\" [form]=\"form\" [record]=\"selectedRecord\"\r\n [showButtons]=\"showButtons\" [onlyView]=\"onlyView\" (saveRecordEvent)=\"onSaveForm($event)\">\r\n</add-form-record>\r\n\r\n<list-form-record *ngIf=\"viewMode == FormTypeEnum.LIST\" [form]=\"form\" [values]=\"values\"\r\n (onAddViewEditRecord)=\"onAddViewEditRecord($event)\">\r\n</list-form-record>",
|
|
638
|
+
template: "<add-form-record *ngIf=\"viewMode == FormTypeEnum.SCALAR\" [form]=\"form\" [record]=\"selectedRecord\"\r\n [showButtons]=\"showButtons\" [onlyView]=\"onlyView\" (saveRecordEvent)=\"onSaveForm($event)\" [showTitle]=\"showTitle\">\r\n</add-form-record>\r\n\r\n<list-form-record *ngIf=\"viewMode == FormTypeEnum.LIST\" [form]=\"form\" [values]=\"values\"\r\n (onAddViewEditRecord)=\"onAddViewEditRecord($event)\" [showTitle]=\"showTitle\"\r\n (onDeleteRecord)=\"onDeleteRecord($event)\" (onDuplicateRecord)=\"onDuplicateRecord($event)\">\r\n</list-form-record>",
|
|
618
639
|
styles: ["::ng-deep mat-form-field{width:100%}"]
|
|
619
640
|
})
|
|
620
641
|
], EqpDynamicModuleComponent);
|
|
@@ -2515,12 +2536,22 @@
|
|
|
2515
2536
|
|
|
2516
2537
|
var ListFormRecordComponent = /** @class */ (function () {
|
|
2517
2538
|
function ListFormRecordComponent() {
|
|
2539
|
+
this.showTitle = true;
|
|
2518
2540
|
this.columns = new Array();
|
|
2519
2541
|
this.onAddViewEditRecord = new core.EventEmitter();
|
|
2542
|
+
this.onDeleteRecord = new core.EventEmitter();
|
|
2543
|
+
this.onDuplicateRecord = new core.EventEmitter();
|
|
2520
2544
|
}
|
|
2521
2545
|
ListFormRecordComponent.prototype.ngOnInit = function () {
|
|
2522
2546
|
this.configureColumns();
|
|
2523
2547
|
};
|
|
2548
|
+
ListFormRecordComponent.prototype.ngOnChanges = function (changes) {
|
|
2549
|
+
// Se viene modificato il valore di "ngModelInput" allora aggiorna l'input
|
|
2550
|
+
if (changes['values'] != undefined && changes['values'].firstChange == false) {
|
|
2551
|
+
this.values = changes['values'].currentValue;
|
|
2552
|
+
this.reloadTables();
|
|
2553
|
+
}
|
|
2554
|
+
};
|
|
2524
2555
|
/**
|
|
2525
2556
|
* Metodo per configurare le colonne della eqp-table.
|
|
2526
2557
|
*/
|
|
@@ -2578,18 +2609,17 @@
|
|
|
2578
2609
|
* @param record Record da duplicare.
|
|
2579
2610
|
*/
|
|
2580
2611
|
ListFormRecordComponent.prototype.duplicateRecord = function (record) {
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
}, false, 'Richiesta conferma');
|
|
2612
|
+
// EqpDynamicModuleDialogService.Confirm('Duplicare il record selezionato?', () => {
|
|
2613
|
+
// var copiedRecord: Record = JSON.parse(JSON.stringify(record));
|
|
2614
|
+
// if (!isNaN(parseInt(copiedRecord.ID))) {
|
|
2615
|
+
// copiedRecord.ID = (parseInt(copiedRecord.ID) + 1).toString();
|
|
2616
|
+
// } else {
|
|
2617
|
+
// copiedRecord.ID = "xxxxxxxxx".replace("x", (c) => { return (Math.random() + 16 | 0).toString(16); });
|
|
2618
|
+
// }
|
|
2619
|
+
// this.values.push(copiedRecord);
|
|
2620
|
+
// this.reloadTables();
|
|
2621
|
+
// }, false, 'Richiesta conferma');
|
|
2622
|
+
this.onDuplicateRecord.emit(record);
|
|
2593
2623
|
//TODO
|
|
2594
2624
|
};
|
|
2595
2625
|
/**
|
|
@@ -2597,11 +2627,11 @@
|
|
|
2597
2627
|
* @param record Record da eliminare selezionato sulla eqp-table.
|
|
2598
2628
|
*/
|
|
2599
2629
|
ListFormRecordComponent.prototype.deleteRecord = function (record) {
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2630
|
+
// EqpDynamicModuleDialogService.Confirm('Eliminare il record selezionato?', () => {
|
|
2631
|
+
// this.values.splice(this.values.indexOf(record), 1);
|
|
2632
|
+
// this.reloadTables();
|
|
2633
|
+
// }, false, 'Richiesta conferma');
|
|
2634
|
+
this.onDeleteRecord.emit(record);
|
|
2605
2635
|
// TODO
|
|
2606
2636
|
};
|
|
2607
2637
|
/**
|
|
@@ -2702,6 +2732,9 @@
|
|
|
2702
2732
|
this.tableRecords.reloadDatatable();
|
|
2703
2733
|
}
|
|
2704
2734
|
};
|
|
2735
|
+
__decorate([
|
|
2736
|
+
core.Input()
|
|
2737
|
+
], ListFormRecordComponent.prototype, "showTitle", void 0);
|
|
2705
2738
|
__decorate([
|
|
2706
2739
|
core.Input()
|
|
2707
2740
|
], ListFormRecordComponent.prototype, "form", void 0);
|
|
@@ -2714,10 +2747,16 @@
|
|
|
2714
2747
|
__decorate([
|
|
2715
2748
|
core.Output()
|
|
2716
2749
|
], ListFormRecordComponent.prototype, "onAddViewEditRecord", void 0);
|
|
2750
|
+
__decorate([
|
|
2751
|
+
core.Output()
|
|
2752
|
+
], ListFormRecordComponent.prototype, "onDeleteRecord", void 0);
|
|
2753
|
+
__decorate([
|
|
2754
|
+
core.Output()
|
|
2755
|
+
], ListFormRecordComponent.prototype, "onDuplicateRecord", void 0);
|
|
2717
2756
|
ListFormRecordComponent = __decorate([
|
|
2718
2757
|
core.Component({
|
|
2719
2758
|
selector: 'list-form-record',
|
|
2720
|
-
template: "<div class=\"row eqp-dynamic-module-title\">\r\n <div class=\"col-md-6\">\r\n <h4><b>Elenco {{form.Name}}</b></h4>\r\n </div>\r\n <div class=\"col-md-6 text-right\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\" (click)=\"onAddViewEditRecord.emit(null)\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi</span>\r\n </button>\r\n </div>\r\n</div>\r\n\r\n\r\n<eqp-table #tableRecords [data]=\"values\" [columns]=\"columns\"></eqp-table>",
|
|
2759
|
+
template: "<div class=\"row eqp-dynamic-module-title\">\r\n <div class=\"col-md-6\">\r\n <h4 *ngIf=\"showTitle\"><b>Elenco {{form.Name}}</b></h4>\r\n </div>\r\n <div class=\"col-md-6 text-right\">\r\n <button class=\"btn btn-primary\" mat-raised-button color=\"primary\" type=\"button\" (click)=\"onAddViewEditRecord.emit(null)\">\r\n <mat-icon>add</mat-icon>\r\n <span style=\"margin-left: 10px;\">Aggiungi</span>\r\n </button>\r\n </div>\r\n</div>\r\n\r\n\r\n<eqp-table #tableRecords [data]=\"values\" [columns]=\"columns\"></eqp-table>",
|
|
2721
2760
|
styles: ["::ng-deep .error-color{color:var(--danger)}::ng-deep .success-color{color:var(--success)}"]
|
|
2722
2761
|
})
|
|
2723
2762
|
], ListFormRecordComponent);
|
|
@@ -2734,6 +2773,7 @@
|
|
|
2734
2773
|
function AddFormRecordComponent(cdr, utilityService) {
|
|
2735
2774
|
this.cdr = cdr;
|
|
2736
2775
|
this.utilityService = utilityService;
|
|
2776
|
+
this.showTitle = true;
|
|
2737
2777
|
this.showButtons = true;
|
|
2738
2778
|
this.form = new Form();
|
|
2739
2779
|
this.fieldGroups = {};
|
|
@@ -2824,6 +2864,9 @@
|
|
|
2824
2864
|
{ type: core.ChangeDetectorRef },
|
|
2825
2865
|
{ type: UtilityHelperService }
|
|
2826
2866
|
]; };
|
|
2867
|
+
__decorate([
|
|
2868
|
+
core.Input()
|
|
2869
|
+
], AddFormRecordComponent.prototype, "showTitle", void 0);
|
|
2827
2870
|
__decorate([
|
|
2828
2871
|
core.Input()
|
|
2829
2872
|
], AddFormRecordComponent.prototype, "showButtons", void 0);
|
|
@@ -2845,7 +2888,7 @@
|
|
|
2845
2888
|
AddFormRecordComponent = __decorate([
|
|
2846
2889
|
core.Component({
|
|
2847
2890
|
selector: 'add-form-record',
|
|
2848
|
-
template: "<div class=\"row eqp-dynamic-module-title\">\n <div class=\"col-md-12
|
|
2891
|
+
template: "<div class=\"row eqp-dynamic-module-title\" *ngIf=\"showTitle\">\n <div class=\"col-md-12\">\n <h4><b>{{form.Name}}</b></h4>\n </div>\n</div>\n\n<form [formGroup]=\"formForm\">\n\n <!-- VISUALIZZAZIONE SEMPLICE -->\n <ng-container *ngIf=\"form.FormScalarType == FormScalarTypeEnum.Semplice\" [ngTemplateOutlet]=\"fieldTemplates\"\n [ngTemplateOutletContext]=\"{ fields: form.Fields }\">\n </ng-container>\n\n <!-- VISUALIZZAZIONE A STEPPER -->\n <mat-horizontal-stepper linear *ngIf=\"form.FormScalarType == FormScalarTypeEnum['A step']\">\n <mat-step *ngFor=\"let group of form.FormFieldsGroups\">\n <ng-template matStepLabel>\n {{group.Name}}\n </ng-template>\n\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\n </ng-container>\n </mat-step>\n </mat-horizontal-stepper>\n\n <!-- VISUALIZZAZIONE A TAB -->\n <mat-tab-group *ngIf=\"form.FormScalarType == FormScalarTypeEnum['In tab']\">\n <mat-tab *ngFor=\"let group of form.FormFieldsGroups\" [label]=\"group.Name\">\n <div class=\"mt-3\">\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\n </ng-container>\n </div>\n </mat-tab>\n </mat-tab-group>\n\n <!-- VISUALIZZAZIONE AD ACCORDION -->\n <mat-accordion multi *ngIf=\"form.FormScalarType == FormScalarTypeEnum['In accordion']\">\n <mat-expansion-panel *ngFor=\"let group of form.FormFieldsGroups\">\n <mat-expansion-panel-header>\n <mat-panel-title>\n {{group.Name}}\n </mat-panel-title>\n </mat-expansion-panel-header>\n\n <ng-container [ngTemplateOutlet]=\"fieldTemplates\"\n [ngTemplateOutletContext]=\"{ fields: fieldGroups[group.Name] }\">\n </ng-container>\n </mat-expansion-panel>\n </mat-accordion>\n</form>\n\n<div class=\"row mt-2\" *ngIf=\"showButtons\">\n <div class=\"col-sm-12 text-right\">\n <button class=\"mr-2\" mat-raised-button (click)=\"saveOrExitForm(true)\" type=\"button\">\n Annulla\n </button>\n <button class=\"mr-2\" mat-raised-button color=\"primary\" (click)=\"saveOrExitForm(false)\"\n [disabled]=\"formForm.invalid || formForm.disabled\" type=\"button\">\n Salva\n </button>\n </div>\n</div>\n\n<!-- TEMPLATE PER LA VISUALIZZAZIONE DEI CAMPI DELLA FORM -->\n<ng-template #fieldTemplates let-fields='fields'>\n <div class=\"row\">\n <div class=\"mt-2\" *ngFor=\"let field of fields\" [ngClass]=\"utilityService.getFieldSyleClass(field)\">\n <dynamic-module-field #fieldTemplate [field]=\"field\" [form]=\"form\" [record]=\"record\"\n (recordChange)=\"onRecordChange()\"></dynamic-module-field>\n </div>\n </div>\n</ng-template>",
|
|
2849
2892
|
styles: [""]
|
|
2850
2893
|
})
|
|
2851
2894
|
], AddFormRecordComponent);
|