@smallpearl/ngx-helper 0.29.39 → 0.30.1
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/assets/i18n/sp-mat-entity-crud/en.json +5 -3
- package/assets/i18n/sp-mat-entity-crud/zh-hant.json +3 -1
- package/assets/i18n/sp-mat-select-entity/en.json +5 -0
- package/assets/i18n/sp-mat-select-entity/zh-hant.json +5 -0
- package/core/index.d.ts +0 -1
- package/entity-field/src/entity-field-spec.d.ts +1 -3
- package/fesm2022/smallpearl-ngx-helper-core.mjs +1 -16
- package/fesm2022/smallpearl-ngx-helper-core.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-entity-field.mjs +2 -4
- package/fesm2022/smallpearl-ngx-helper-entity-field.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs +6 -14
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs +198 -178
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs +48 -55
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs +145 -166
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs +1 -4
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs.map +1 -1
- package/mat-entity-crud/src/form-view-host.component.d.ts +2 -0
- package/mat-entity-crud/src/mat-entity-crud-form-base.d.ts +2 -0
- package/mat-entity-crud/src/mat-entity-crud-internal-types.d.ts +6 -0
- package/mat-entity-crud/src/mat-entity-crud-types.d.ts +6 -15
- package/mat-entity-crud/src/mat-entity-crud.component.d.ts +16 -5
- package/mat-entity-crud/src/preview-pane.component.d.ts +1 -4
- package/mat-entity-list/src/mat-entity-list.component.d.ts +2 -1
- package/mat-select-entity/index.d.ts +0 -1
- package/mat-select-entity/src/mat-select-entity.component.d.ts +6 -8
- package/package.json +15 -15
- package/stationary-with-line-items/src/stationary-with-line-items.component.d.ts +0 -2
- package/core/src/ngx-helper.d.ts +0 -7
- package/mat-select-entity/src/providers.d.ts +0 -9
|
@@ -2,32 +2,32 @@ import * as i1$1 from '@angular/common/http';
|
|
|
2
2
|
import { HttpContextToken, HttpContext } from '@angular/common/http';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { InjectionToken, inject, input, signal, viewChild, ViewContainerRef, Component, ChangeDetectionStrategy, computed, viewChildren, EventEmitter, ContentChildren, Output, ChangeDetectorRef } from '@angular/core';
|
|
5
|
-
import * as
|
|
5
|
+
import * as i4 from '@angular/common';
|
|
6
6
|
import { CommonModule } from '@angular/common';
|
|
7
7
|
import * as i1 from '@angular/material/button';
|
|
8
8
|
import { MatButtonModule } from '@angular/material/button';
|
|
9
9
|
import * as i2$1 from '@angular/material/snack-bar';
|
|
10
10
|
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
|
11
11
|
import { MatSortModule } from '@angular/material/sort';
|
|
12
|
-
import * as
|
|
12
|
+
import * as i7 from '@angular/material/table';
|
|
13
13
|
import { MatColumnDef, MatTableModule } from '@angular/material/table';
|
|
14
|
-
import * as
|
|
14
|
+
import * as i5 from '@angular/router';
|
|
15
15
|
import { RouterModule } from '@angular/router';
|
|
16
16
|
import { SPMatHostBusyWheelDirective, showBusyWheelUntilComplete } from '@smallpearl/ngx-helper/mat-busy-wheel';
|
|
17
17
|
import { SPMatContextMenuComponent } from '@smallpearl/ngx-helper/mat-context-menu';
|
|
18
18
|
import { SPMatEntityListComponent } from '@smallpearl/ngx-helper/mat-entity-list';
|
|
19
|
-
import * as
|
|
19
|
+
import * as i2 from '@angular/material/icon';
|
|
20
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
21
|
+
import * as i8 from '@angular/material/menu';
|
|
20
22
|
import { MatMenuModule } from '@angular/material/menu';
|
|
21
23
|
import * as i3 from '@angular/platform-browser';
|
|
24
|
+
import * as i10 from '@jsverse/transloco';
|
|
25
|
+
import { TranslocoService, provideTranslocoScope, TranslocoModule } from '@jsverse/transloco';
|
|
22
26
|
import * as i11 from 'angular-split';
|
|
23
27
|
import { AngularSplitModule } from 'angular-split';
|
|
24
28
|
import { startCase } from 'lodash';
|
|
25
29
|
import { plural } from 'pluralize';
|
|
26
30
|
import { Subscription, tap, switchMap, of, map } from 'rxjs';
|
|
27
|
-
import * as i2 from '@angular/material/icon';
|
|
28
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
29
|
-
import * as i4 from '@jsverse/transloco';
|
|
30
|
-
import { provideTranslocoScope, TranslocoModule } from '@jsverse/transloco';
|
|
31
31
|
import * as i1$2 from '@angular/material/toolbar';
|
|
32
32
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
33
33
|
import { setServerErrorsAsFormErrors } from '@smallpearl/ngx-helper/forms';
|
|
@@ -59,18 +59,6 @@ function defaultCrudResponseParser(entityName, idKey, method, resp) {
|
|
|
59
59
|
return undefined;
|
|
60
60
|
}
|
|
61
61
|
const DefaultSPMatEntityCrudConfig = {
|
|
62
|
-
i18n: {
|
|
63
|
-
newItemLabel: (itemLabel) => `New ${itemLabel}`,
|
|
64
|
-
editItemLabel: (itemLabel) => `Edit ${itemLabel}`,
|
|
65
|
-
edit: 'Edit',
|
|
66
|
-
delete: 'Delete',
|
|
67
|
-
deleteItemHeader: (itemLabel) => `Confirm Delete ${itemLabel}`,
|
|
68
|
-
deleteItemMessage: (itemLabel) => `Are you sure you want to delete this ${itemLabel}`,
|
|
69
|
-
itemDeletedNotification: (itemLabel) => `${itemLabel} deleted`,
|
|
70
|
-
createdItemNotification: (itemLabel) => `${itemLabel} created.`,
|
|
71
|
-
updatedItemNotification: (itemLabel) => `${itemLabel} saved.`,
|
|
72
|
-
loseChangesPrompt: 'OK to lose changes?'
|
|
73
|
-
},
|
|
74
62
|
crudOpResponseParser: defaultCrudResponseParser
|
|
75
63
|
};
|
|
76
64
|
/**
|
|
@@ -101,6 +89,7 @@ class FormViewHostComponent {
|
|
|
101
89
|
vc = viewChild('clientFormContainer', { read: ViewContainerRef });
|
|
102
90
|
config;
|
|
103
91
|
sub$ = new Subscription();
|
|
92
|
+
transloco = inject(TranslocoService);
|
|
104
93
|
constructor() {
|
|
105
94
|
this.config = getEntityCrudConfig();
|
|
106
95
|
}
|
|
@@ -114,7 +103,10 @@ class FormViewHostComponent {
|
|
|
114
103
|
this.title.set(params.title);
|
|
115
104
|
}
|
|
116
105
|
else {
|
|
117
|
-
this.title.set(entity ? this.config.i18n.editItemLabel(this.itemLabel()) : this.config.i18n.newItemLabel(this.itemLabel()));
|
|
106
|
+
// this.title.set(entity ? this.config.i18n.editItemLabel(this.itemLabel()) : this.config.i18n.newItemLabel(this.itemLabel()));
|
|
107
|
+
this.title.set(this.transloco.translate(entity ? 'editItem' : 'newItem', {
|
|
108
|
+
item: this.itemLabel(),
|
|
109
|
+
}));
|
|
118
110
|
}
|
|
119
111
|
this.params.set(params);
|
|
120
112
|
this.createClientView();
|
|
@@ -187,7 +179,7 @@ class FormViewHostComponent {
|
|
|
187
179
|
<div class="spacer"></div>
|
|
188
180
|
<div class="close">
|
|
189
181
|
<button mat-icon-button (click)="onClose()">
|
|
190
|
-
<mat-icon>
|
|
182
|
+
<mat-icon>cancel</mat-icon>
|
|
191
183
|
</button>
|
|
192
184
|
</div>
|
|
193
185
|
</div>
|
|
@@ -206,7 +198,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
206
198
|
<div class="spacer"></div>
|
|
207
199
|
<div class="close">
|
|
208
200
|
<button mat-icon-button (click)="onClose()">
|
|
209
|
-
<mat-icon>
|
|
201
|
+
<mat-icon>cancel</mat-icon>
|
|
210
202
|
</button>
|
|
211
203
|
</div>
|
|
212
204
|
</div>
|
|
@@ -285,7 +277,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
285
277
|
|
|
286
278
|
class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
287
279
|
snackBar;
|
|
288
|
-
transloco;
|
|
289
280
|
// entityName = input.required<string>();
|
|
290
281
|
// entityNamePlural = input<string>();
|
|
291
282
|
itemLabel = input();
|
|
@@ -307,7 +298,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
307
298
|
*/
|
|
308
299
|
newItemLink = input();
|
|
309
300
|
/**
|
|
310
|
-
* If not specified, will
|
|
301
|
+
* If not specified, will default to 'New <itemLabel()>'.
|
|
311
302
|
*/
|
|
312
303
|
newItemLabel = input();
|
|
313
304
|
/**
|
|
@@ -425,12 +416,24 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
425
416
|
* Width of the preview pane as a percentange of the overall <as-split> width.
|
|
426
417
|
*/
|
|
427
418
|
previewPaneWidth = input(50);
|
|
419
|
+
/**
|
|
420
|
+
* The class class that will be applied to the list pane wrapper.
|
|
421
|
+
*/
|
|
422
|
+
listPaneWrapperClass = input('sp-mat-crud-list-pane-wrapper-class');
|
|
423
|
+
/**
|
|
424
|
+
* The class class that will be applied to the preview pane wrapper.
|
|
425
|
+
*/
|
|
426
|
+
previewPaneWrapperClass = input('sp-mat-crud-preview-pane-wrapper-class');
|
|
427
|
+
/**
|
|
428
|
+
* The class class that will be applied to the preview pane content.
|
|
429
|
+
*/
|
|
430
|
+
previewPaneContentClass = input('sp-mat-crud-preview-pane-content-class');
|
|
428
431
|
// INTERNAL PROPERTIES //
|
|
429
432
|
// Derive a label from a camelCase source string. If the camelCase string
|
|
430
433
|
// can be translated, it returns the translated string. If not, the function
|
|
431
434
|
// converts the camelCase to 'Title Case' and returns it.
|
|
432
435
|
getLabel = (source) => {
|
|
433
|
-
const label = this.
|
|
436
|
+
const label = this.transloco.translate(source);
|
|
434
437
|
if (label.localeCompare(source) !== 0) {
|
|
435
438
|
// Successful translation, return it
|
|
436
439
|
return label;
|
|
@@ -485,7 +488,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
485
488
|
// or to edit one.
|
|
486
489
|
entityPaneActive = computed(() => !!this.previewedEntity() || this.createEditViewActive());
|
|
487
490
|
// Effective width of the entity pane.
|
|
488
|
-
entityPaneWidth = computed(() =>
|
|
491
|
+
entityPaneWidth = computed(() => this.entityPaneActive()
|
|
492
|
+
? !!this.previewedEntity()
|
|
493
|
+
? this.previewPaneWidth()
|
|
494
|
+
: this.editPaneWidth()
|
|
495
|
+
: 0);
|
|
489
496
|
// Width of the pane showing the list of entities. Calculated as
|
|
490
497
|
entitiesPaneWidth = computed(() => 100 - this.entityPaneWidth());
|
|
491
498
|
entitiesPaneHidden = computed(() => this.entityPaneActive() && this.entityPaneWidth() === 100);
|
|
@@ -550,27 +557,27 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
550
557
|
.map((col) => (typeof col === 'string' ? col : col.name))
|
|
551
558
|
.filter((name) => name !== 'action')
|
|
552
559
|
: []);
|
|
553
|
-
constructor(http, snackBar, sanitizer, injector
|
|
560
|
+
constructor(http, snackBar, sanitizer, injector) {
|
|
554
561
|
super(http, sanitizer, injector);
|
|
555
562
|
this.snackBar = snackBar;
|
|
556
|
-
this.transloco = transloco;
|
|
557
563
|
this.crudConfig = getEntityCrudConfig();
|
|
558
564
|
if (this.crudConfig?.defaultItemActions) {
|
|
559
565
|
this.defaultItemCrudActions.set(this.crudConfig?.defaultItemActions);
|
|
560
566
|
}
|
|
561
567
|
else {
|
|
562
568
|
this.defaultItemCrudActions.set([
|
|
563
|
-
{
|
|
564
|
-
|
|
569
|
+
{
|
|
570
|
+
label: this.transloco.translate('spMatEntityCrud.edit'),
|
|
571
|
+
role: '_update_',
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
label: this.transloco.translate('spMatEntityCrud.delete'),
|
|
575
|
+
role: '_delete_',
|
|
576
|
+
},
|
|
565
577
|
]);
|
|
566
578
|
}
|
|
567
|
-
this.transloco.selectTranslate('editItem', { item: 'Invoice' }, 'sp-mat-entity-crud').subscribe((t) => {
|
|
568
|
-
console.log(`MatEntityCrudComponent: "sp-mat-entity-crud.edit": ${t}, translate: ${this.transloco.translate('editItem', { item: 'Invoice' }, 'sp-mat-entity-crud')}`);
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
ngOnInit() {
|
|
572
|
-
console.log('MatEntityCrudComponent: ngOnInit');
|
|
573
579
|
}
|
|
580
|
+
ngOnInit() { }
|
|
574
581
|
ngOnDestroy() {
|
|
575
582
|
this.sub$.unsubscribe();
|
|
576
583
|
}
|
|
@@ -630,7 +637,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
630
637
|
}
|
|
631
638
|
closeCreateEdit(cancelled) {
|
|
632
639
|
this.createEditViewActive.set(false);
|
|
633
|
-
this.entityViewPaneActivated.emit({
|
|
640
|
+
this.entityViewPaneActivated.emit({
|
|
641
|
+
activated: false,
|
|
642
|
+
cancelled: !!cancelled,
|
|
643
|
+
mode: 'edit',
|
|
644
|
+
});
|
|
634
645
|
}
|
|
635
646
|
canCancelEdit() {
|
|
636
647
|
if (this.canCancelEditCallback) {
|
|
@@ -665,7 +676,9 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
665
676
|
// render the new item in the mat-table.
|
|
666
677
|
if (entity) {
|
|
667
678
|
this.spEntitiesList()?.addEntity(entity);
|
|
668
|
-
this.snackBar.open(this.
|
|
679
|
+
this.snackBar.open(this.transloco.translate('spMatEntityCrud.createSuccess', {
|
|
680
|
+
item: this._itemLabel(),
|
|
681
|
+
}));
|
|
669
682
|
}
|
|
670
683
|
}));
|
|
671
684
|
}
|
|
@@ -683,7 +696,9 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
683
696
|
return obs.pipe(showBusyWheelUntilComplete('formBusyWheel'), switchMap((resp) => resp ? this.doRefreshAfterEdit(resp, 'update') : of(null)), tap((entity) => {
|
|
684
697
|
if (entity) {
|
|
685
698
|
this.spEntitiesList()?.updateEntity(id, entity);
|
|
686
|
-
this.snackBar.open(this.
|
|
699
|
+
this.snackBar.open(this.transloco.translate('spMatEntityCrud.updateSuccess', {
|
|
700
|
+
item: this._itemLabel(),
|
|
701
|
+
}));
|
|
687
702
|
}
|
|
688
703
|
}));
|
|
689
704
|
}
|
|
@@ -735,7 +750,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
735
750
|
this.spEntitiesList()?.toggleActiveEntity(this.previewedEntity());
|
|
736
751
|
}
|
|
737
752
|
this.previewedEntity.set(undefined);
|
|
738
|
-
this.entityViewPaneActivated.emit({
|
|
753
|
+
this.entityViewPaneActivated.emit({
|
|
754
|
+
activated: false,
|
|
755
|
+
cancelled: undefined,
|
|
756
|
+
mode: 'preview',
|
|
757
|
+
});
|
|
739
758
|
}
|
|
740
759
|
}
|
|
741
760
|
onItemAction(role, entity) {
|
|
@@ -757,7 +776,10 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
757
776
|
event.preventDefault();
|
|
758
777
|
event.stopImmediatePropagation();
|
|
759
778
|
const params = {
|
|
760
|
-
title: this.newItemLabel() ??
|
|
779
|
+
title: this.newItemLabel() ??
|
|
780
|
+
this.transloco.translate('spMatEntityCrud.newItem', {
|
|
781
|
+
item: this._itemLabel(),
|
|
782
|
+
}),
|
|
761
783
|
};
|
|
762
784
|
this.showCreateEditView(undefined, params);
|
|
763
785
|
// const tmpl = this.createEditFormTemplate();
|
|
@@ -777,7 +799,10 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
777
799
|
}
|
|
778
800
|
onUpdate(entity) {
|
|
779
801
|
const params = {
|
|
780
|
-
title: this.editItemTitle() ??
|
|
802
|
+
title: this.editItemTitle() ??
|
|
803
|
+
this.transloco.translate('spMatEntityCrud.editItem', {
|
|
804
|
+
item: this._itemLabel(),
|
|
805
|
+
}),
|
|
781
806
|
};
|
|
782
807
|
this.showCreateEditView(entity, params);
|
|
783
808
|
// const tmpl = this.createEditFormTemplate();
|
|
@@ -814,7 +839,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
814
839
|
const createEditHost = this.createEditHostComponent();
|
|
815
840
|
createEditHost.show(entity, params);
|
|
816
841
|
this.createEditViewActive.set(true);
|
|
817
|
-
this.entityViewPaneActivated.emit({
|
|
842
|
+
this.entityViewPaneActivated.emit({
|
|
843
|
+
activated: true,
|
|
844
|
+
cancelled: undefined,
|
|
845
|
+
mode: 'edit',
|
|
846
|
+
});
|
|
818
847
|
}
|
|
819
848
|
}
|
|
820
849
|
showPreviewView(entity, params) {
|
|
@@ -824,7 +853,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
824
853
|
const previewHost = this.previewHostComponent();
|
|
825
854
|
this.previewedEntity.set(entity);
|
|
826
855
|
previewHost?.show(entity, params);
|
|
827
|
-
this.entityViewPaneActivated.emit({
|
|
856
|
+
this.entityViewPaneActivated.emit({
|
|
857
|
+
activated: true,
|
|
858
|
+
cancelled: undefined,
|
|
859
|
+
mode: 'preview',
|
|
860
|
+
});
|
|
828
861
|
// this.previewActivated.emit({ entity, activated: true });
|
|
829
862
|
}
|
|
830
863
|
}
|
|
@@ -840,7 +873,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
840
873
|
// Do the delete prompt asynchronously so that the context menu is
|
|
841
874
|
// dismissed before the prompt is displayed.
|
|
842
875
|
setTimeout(() => {
|
|
843
|
-
const deletedItemPrompt = this.
|
|
876
|
+
const deletedItemPrompt = this.transloco.translate('spMatEntityCrud.deleteItemConfirm', { item: this._itemLabel().toLocaleLowerCase() });
|
|
844
877
|
const yes = confirm(deletedItemPrompt);
|
|
845
878
|
if (yes) {
|
|
846
879
|
const entityId = entity[this.idKey()];
|
|
@@ -865,7 +898,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
865
898
|
tap(() => {
|
|
866
899
|
this.spEntitiesList().removeEntity(entityId);
|
|
867
900
|
// TODO: customize by providing an interface via SPMatEntityCrudConfig?
|
|
868
|
-
const deletedMessage = this.
|
|
901
|
+
const deletedMessage = this.transloco.translate('spMatEntityCrud.deleteItemSuccess', { item: this._itemLabel() });
|
|
869
902
|
this.snackBar.open(deletedMessage);
|
|
870
903
|
}))
|
|
871
904
|
.subscribe());
|
|
@@ -979,16 +1012,17 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
979
1012
|
});
|
|
980
1013
|
return actionsCopy;
|
|
981
1014
|
}
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1015
|
+
getPreviewPaneContentClass() {
|
|
1016
|
+
return this.previewPaneContentClass();
|
|
1017
|
+
}
|
|
1018
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatEntityCrudComponent, deps: [{ token: i1$1.HttpClient }, { token: i2$1.MatSnackBar }, { token: i3.DomSanitizer }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
1019
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", type: SPMatEntityCrudComponent, isStandalone: true, selector: "sp-mat-entity-crud", inputs: { itemLabel: { classPropertyName: "itemLabel", publicName: "itemLabel", isSignal: true, isRequired: false, transformFunction: null }, itemLabelPlural: { classPropertyName: "itemLabelPlural", publicName: "itemLabelPlural", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, itemActions: { classPropertyName: "itemActions", publicName: "itemActions", isSignal: true, isRequired: false, transformFunction: null }, newItemLink: { classPropertyName: "newItemLink", publicName: "newItemLink", isSignal: true, isRequired: false, transformFunction: null }, newItemLabel: { classPropertyName: "newItemLabel", publicName: "newItemLabel", isSignal: true, isRequired: false, transformFunction: null }, editItemTitle: { classPropertyName: "editItemTitle", publicName: "editItemTitle", isSignal: true, isRequired: false, transformFunction: null }, newItemSubTypes: { classPropertyName: "newItemSubTypes", publicName: "newItemSubTypes", isSignal: true, isRequired: false, transformFunction: null }, crudOpFn: { classPropertyName: "crudOpFn", publicName: "crudOpFn", isSignal: true, isRequired: false, transformFunction: null }, previewTemplate: { classPropertyName: "previewTemplate", publicName: "previewTemplate", isSignal: true, isRequired: false, transformFunction: null }, allowEntityActionFn: { classPropertyName: "allowEntityActionFn", publicName: "allowEntityActionFn", isSignal: true, isRequired: false, transformFunction: null }, headerTemplate: { classPropertyName: "headerTemplate", publicName: "headerTemplate", isSignal: true, isRequired: false, transformFunction: null }, actionsTemplate: { classPropertyName: "actionsTemplate", publicName: "actionsTemplate", isSignal: true, isRequired: false, transformFunction: null }, crudResponseParser: { classPropertyName: "crudResponseParser", publicName: "crudResponseParser", isSignal: true, isRequired: false, transformFunction: null }, createEditFormTemplate: { classPropertyName: "createEditFormTemplate", publicName: "createEditFormTemplate", isSignal: true, isRequired: false, transformFunction: null }, disableItemActions: { classPropertyName: "disableItemActions", publicName: "disableItemActions", isSignal: true, isRequired: false, transformFunction: null }, disableCreate: { classPropertyName: "disableCreate", publicName: "disableCreate", isSignal: true, isRequired: false, transformFunction: null }, refreshAfterEdit: { classPropertyName: "refreshAfterEdit", publicName: "refreshAfterEdit", isSignal: true, isRequired: false, transformFunction: null }, crudHttpReqContext: { classPropertyName: "crudHttpReqContext", publicName: "crudHttpReqContext", isSignal: true, isRequired: false, transformFunction: null }, editPaneWidth: { classPropertyName: "editPaneWidth", publicName: "editPaneWidth", isSignal: true, isRequired: false, transformFunction: null }, previewPaneWidth: { classPropertyName: "previewPaneWidth", publicName: "previewPaneWidth", isSignal: true, isRequired: false, transformFunction: null }, listPaneWrapperClass: { classPropertyName: "listPaneWrapperClass", publicName: "listPaneWrapperClass", isSignal: true, isRequired: false, transformFunction: null }, previewPaneWrapperClass: { classPropertyName: "previewPaneWrapperClass", publicName: "previewPaneWrapperClass", isSignal: true, isRequired: false, transformFunction: null }, previewPaneContentClass: { classPropertyName: "previewPaneContentClass", publicName: "previewPaneContentClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { action: "action", entityViewPaneActivated: "entityViewPaneActivated" }, providers: [provideTranslocoScope('sp-mat-entity-crud')], queries: [{ propertyName: "_clientColumnDefs", predicate: MatColumnDef }], viewQueries: [{ propertyName: "componentColumns", predicate: MatColumnDef, descendants: true, isSignal: true }, { propertyName: "spEntitiesList", first: true, predicate: (SPMatEntityListComponent), descendants: true, isSignal: true }, { propertyName: "createEditHostComponent", first: true, predicate: FormViewHostComponent, descendants: true, isSignal: true }, { propertyName: "previewHostComponent", first: true, predicate: PreviewHostComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
986
1020
|
<as-split direction="horizontal" [gutterSize]="6" *transloco="let t">
|
|
987
|
-
<as-split-area
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1021
|
+
<as-split-area
|
|
1022
|
+
[size]="entitiesPaneWidth()"
|
|
1023
|
+
[visible]="!entitiesPaneHidden()"
|
|
1024
|
+
>
|
|
1025
|
+
<div [class]="listPaneWrapperClass()">
|
|
992
1026
|
<ng-content select="[breadCrumbs]"></ng-content>
|
|
993
1027
|
|
|
994
1028
|
<ng-template #defaultActionButtons>
|
|
@@ -1001,13 +1035,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1001
1035
|
color="primary"
|
|
1002
1036
|
[matMenuTriggerFor]="newSubTypesMenu"
|
|
1003
1037
|
>
|
|
1004
|
-
|
|
1005
|
-
<mat-icon>expand_circle_down</mat-icon>
|
|
1006
|
-
<!-- {{
|
|
1038
|
+
{{
|
|
1007
1039
|
newItemLabel() ??
|
|
1008
|
-
|
|
1009
|
-
}}
|
|
1010
|
-
|
|
1040
|
+
t('spMatEntityCrud.newItem', { item: _itemLabel() })
|
|
1041
|
+
}}
|
|
1042
|
+
<mat-icon>expand_circle_down</mat-icon>
|
|
1011
1043
|
</button>
|
|
1012
1044
|
<mat-menu #newSubTypesMenu="matMenu">
|
|
1013
1045
|
@for (subtype of newItemSubTypes(); track $index) { @if
|
|
@@ -1028,12 +1060,10 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1028
1060
|
(click)="onCreate($event)"
|
|
1029
1061
|
[routerLink]="newItemLink()"
|
|
1030
1062
|
>
|
|
1031
|
-
{{ t('spMatEntityCrud.newItem', {item: _itemLabel() }) }}
|
|
1032
|
-
<!--
|
|
1033
1063
|
{{
|
|
1034
1064
|
newItemLabel() ??
|
|
1035
|
-
|
|
1036
|
-
}}
|
|
1065
|
+
t('spMatEntityCrud.newItem', { item: _itemLabel() })
|
|
1066
|
+
}}
|
|
1037
1067
|
</button>
|
|
1038
1068
|
} }
|
|
1039
1069
|
</div>
|
|
@@ -1045,11 +1075,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1045
1075
|
{{ _title() }}
|
|
1046
1076
|
</div>
|
|
1047
1077
|
<span class="spacer"></span>
|
|
1048
|
-
|
|
1078
|
+
<!-- Hide the action buttons when Preview/Edit pane is active -->
|
|
1049
1079
|
@if (!entityPaneActive()) {
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1080
|
+
<ng-container
|
|
1081
|
+
[ngTemplateOutlet]="actionsTemplate() || defaultActionButtons"
|
|
1082
|
+
></ng-container>
|
|
1053
1083
|
}
|
|
1054
1084
|
</div>
|
|
1055
1085
|
</ng-template>
|
|
@@ -1099,25 +1129,12 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1099
1129
|
}
|
|
1100
1130
|
</td>
|
|
1101
1131
|
</ng-container>
|
|
1102
|
-
|
|
1103
|
-
|
|
1132
|
+
</as-split-area>
|
|
1133
|
+
<as-split-area [size]="entityPaneWidth()" [visible]="entityPaneActive()">
|
|
1104
1134
|
<div
|
|
1105
|
-
[class]="
|
|
1106
|
-
[ngStyle]="{ display: createEditViewActive() ? 'inherit' : 'none' }"
|
|
1135
|
+
[class]="previewPaneWrapperClass()"
|
|
1107
1136
|
spHostBusyWheel="formBusyWheel"
|
|
1108
1137
|
>
|
|
1109
|
-
<ng-content select="[breadCrumbs]"></ng-content>
|
|
1110
|
-
<sp-create-edit-entity-host
|
|
1111
|
-
[itemLabel]="_itemLabel()"
|
|
1112
|
-
[itemLabelPlural]="_itemLabelPlural()"
|
|
1113
|
-
[entityCrudComponentBase]="this"
|
|
1114
|
-
[clientViewTemplate]="createEditFormTemplate()"
|
|
1115
|
-
></sp-create-edit-entity-host>
|
|
1116
|
-
</div>
|
|
1117
|
-
-->
|
|
1118
|
-
</as-split-area>
|
|
1119
|
-
<as-split-area [size]="entityPaneWidth()" [visible]="entityPaneActive()">
|
|
1120
|
-
<div [class]="crudConfig.previewPaneWrapperClass" spHostBusyWheel="formBusyWheel">
|
|
1121
1138
|
<sp-entity-crud-preview-host
|
|
1122
1139
|
[ngClass]="createEditViewActive() ? 'd-none' : 'd-inherit'"
|
|
1123
1140
|
[entityCrudComponentBase]="this"
|
|
@@ -1134,7 +1151,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1134
1151
|
</div>
|
|
1135
1152
|
</as-split-area>
|
|
1136
1153
|
</as-split>
|
|
1137
|
-
`, isInline: true, styles: [".d-none{display:none}.d-inherit{display:inherit}.action-bar{display:flex;flex-direction:row;align-items:center;padding-bottom:.5em}.action-bar-title{font-size:1.5em;font-weight:600}.spacer{flex-grow:1}.action-bar-actions{text-align:end}.active-row{font-weight:700}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type:
|
|
1154
|
+
`, isInline: true, styles: [".d-none{display:none}.d-inherit{display:inherit}.action-bar{display:flex;flex-direction:row;align-items:center;padding-bottom:.5em}.action-bar-title{font-size:1.5em;font-weight:600}.spacer{flex-grow:1}.action-bar-actions{text-align:end}.active-row{font-weight:700}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i5.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "directive", type: i7.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i7.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i7.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i7.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i7.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "ngmodule", type: MatSortModule }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i8.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i8.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i8.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatSnackBarModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "directive", type: i10.TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "ngmodule", type: AngularSplitModule }, { kind: "component", type: i11.SplitComponent, selector: "as-split", inputs: ["gutterSize", "gutterStep", "disabled", "gutterClickDeltaPx", "direction", "dir", "unit", "gutterAriaLabel", "restrictMove", "useTransition", "gutterDblClickDuration"], outputs: ["gutterClick", "gutterDblClick", "dragStart", "dragEnd", "transitionEnd"], exportAs: ["asSplit"] }, { kind: "component", type: i11.SplitAreaComponent, selector: "as-split-area", inputs: ["size", "minSize", "maxSize", "lockSize", "visible"], exportAs: ["asSplitArea"] }, { kind: "component", type: SPMatEntityListComponent, selector: "sp-mat-entity-list", inputs: ["entityName", "entityNamePlural", "endpoint", "entityLoaderFn", "columns", "displayedColumns", "pageSize", "idKey", "pagination", "paginator", "sorter", "disableSort", "infiniteScrollContainer", "infiniteScrollDistance", "infiniteScrollThrottle", "infiniteScrollWindow", "httpReqContext", "_deferViewInit"], outputs: ["selectEntity"] }, { kind: "component", type: SPMatContextMenuComponent, selector: "sp-mat-context-menu", inputs: ["menuItems", "label", "menuIconName", "enableHover", "contextData", "hasBackdrop"], outputs: ["selected"] }, { kind: "component", type: FormViewHostComponent, selector: "sp-create-edit-entity-host", inputs: ["entityCrudComponentBase", "clientViewTemplate", "itemLabel", "itemLabelPlural"] }, { kind: "directive", type: SPMatHostBusyWheelDirective, selector: "[spHostBusyWheel]", inputs: ["spHostBusyWheel"] }, { kind: "component", type: PreviewHostComponent, selector: "sp-entity-crud-preview-host", inputs: ["entityCrudComponentBase", "clientViewTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1138
1155
|
}
|
|
1139
1156
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatEntityCrudComponent, decorators: [{
|
|
1140
1157
|
type: Component,
|
|
@@ -1154,15 +1171,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1154
1171
|
FormViewHostComponent,
|
|
1155
1172
|
SPMatHostBusyWheelDirective,
|
|
1156
1173
|
PreviewHostComponent,
|
|
1157
|
-
], providers: [
|
|
1158
|
-
provideTranslocoScope('sp-mat-entity-crud')
|
|
1159
|
-
], selector: 'sp-mat-entity-crud', template: `
|
|
1174
|
+
], providers: [provideTranslocoScope('sp-mat-entity-crud')], selector: 'sp-mat-entity-crud', template: `
|
|
1160
1175
|
<as-split direction="horizontal" [gutterSize]="6" *transloco="let t">
|
|
1161
|
-
<as-split-area
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1176
|
+
<as-split-area
|
|
1177
|
+
[size]="entitiesPaneWidth()"
|
|
1178
|
+
[visible]="!entitiesPaneHidden()"
|
|
1179
|
+
>
|
|
1180
|
+
<div [class]="listPaneWrapperClass()">
|
|
1166
1181
|
<ng-content select="[breadCrumbs]"></ng-content>
|
|
1167
1182
|
|
|
1168
1183
|
<ng-template #defaultActionButtons>
|
|
@@ -1175,13 +1190,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1175
1190
|
color="primary"
|
|
1176
1191
|
[matMenuTriggerFor]="newSubTypesMenu"
|
|
1177
1192
|
>
|
|
1178
|
-
|
|
1179
|
-
<mat-icon>expand_circle_down</mat-icon>
|
|
1180
|
-
<!-- {{
|
|
1193
|
+
{{
|
|
1181
1194
|
newItemLabel() ??
|
|
1182
|
-
|
|
1183
|
-
}}
|
|
1184
|
-
|
|
1195
|
+
t('spMatEntityCrud.newItem', { item: _itemLabel() })
|
|
1196
|
+
}}
|
|
1197
|
+
<mat-icon>expand_circle_down</mat-icon>
|
|
1185
1198
|
</button>
|
|
1186
1199
|
<mat-menu #newSubTypesMenu="matMenu">
|
|
1187
1200
|
@for (subtype of newItemSubTypes(); track $index) { @if
|
|
@@ -1202,12 +1215,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1202
1215
|
(click)="onCreate($event)"
|
|
1203
1216
|
[routerLink]="newItemLink()"
|
|
1204
1217
|
>
|
|
1205
|
-
{{ t('spMatEntityCrud.newItem', {item: _itemLabel() }) }}
|
|
1206
|
-
<!--
|
|
1207
1218
|
{{
|
|
1208
1219
|
newItemLabel() ??
|
|
1209
|
-
|
|
1210
|
-
}}
|
|
1220
|
+
t('spMatEntityCrud.newItem', { item: _itemLabel() })
|
|
1221
|
+
}}
|
|
1211
1222
|
</button>
|
|
1212
1223
|
} }
|
|
1213
1224
|
</div>
|
|
@@ -1219,11 +1230,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1219
1230
|
{{ _title() }}
|
|
1220
1231
|
</div>
|
|
1221
1232
|
<span class="spacer"></span>
|
|
1222
|
-
|
|
1233
|
+
<!-- Hide the action buttons when Preview/Edit pane is active -->
|
|
1223
1234
|
@if (!entityPaneActive()) {
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1235
|
+
<ng-container
|
|
1236
|
+
[ngTemplateOutlet]="actionsTemplate() || defaultActionButtons"
|
|
1237
|
+
></ng-container>
|
|
1227
1238
|
}
|
|
1228
1239
|
</div>
|
|
1229
1240
|
</ng-template>
|
|
@@ -1273,25 +1284,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1273
1284
|
}
|
|
1274
1285
|
</td>
|
|
1275
1286
|
</ng-container>
|
|
1276
|
-
|
|
1277
|
-
|
|
1287
|
+
</as-split-area>
|
|
1288
|
+
<as-split-area [size]="entityPaneWidth()" [visible]="entityPaneActive()">
|
|
1278
1289
|
<div
|
|
1279
|
-
[class]="
|
|
1280
|
-
[ngStyle]="{ display: createEditViewActive() ? 'inherit' : 'none' }"
|
|
1290
|
+
[class]="previewPaneWrapperClass()"
|
|
1281
1291
|
spHostBusyWheel="formBusyWheel"
|
|
1282
1292
|
>
|
|
1283
|
-
<ng-content select="[breadCrumbs]"></ng-content>
|
|
1284
|
-
<sp-create-edit-entity-host
|
|
1285
|
-
[itemLabel]="_itemLabel()"
|
|
1286
|
-
[itemLabelPlural]="_itemLabelPlural()"
|
|
1287
|
-
[entityCrudComponentBase]="this"
|
|
1288
|
-
[clientViewTemplate]="createEditFormTemplate()"
|
|
1289
|
-
></sp-create-edit-entity-host>
|
|
1290
|
-
</div>
|
|
1291
|
-
-->
|
|
1292
|
-
</as-split-area>
|
|
1293
|
-
<as-split-area [size]="entityPaneWidth()" [visible]="entityPaneActive()">
|
|
1294
|
-
<div [class]="crudConfig.previewPaneWrapperClass" spHostBusyWheel="formBusyWheel">
|
|
1295
1293
|
<sp-entity-crud-preview-host
|
|
1296
1294
|
[ngClass]="createEditViewActive() ? 'd-none' : 'd-inherit'"
|
|
1297
1295
|
[entityCrudComponentBase]="this"
|
|
@@ -1309,7 +1307,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1309
1307
|
</as-split-area>
|
|
1310
1308
|
</as-split>
|
|
1311
1309
|
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".d-none{display:none}.d-inherit{display:inherit}.action-bar{display:flex;flex-direction:row;align-items:center;padding-bottom:.5em}.action-bar-title{font-size:1.5em;font-weight:600}.spacer{flex-grow:1}.action-bar-actions{text-align:end}.active-row{font-weight:700}\n"] }]
|
|
1312
|
-
}], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.MatSnackBar }, { type: i3.DomSanitizer }, { type: i0.Injector }
|
|
1310
|
+
}], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.MatSnackBar }, { type: i3.DomSanitizer }, { type: i0.Injector }], propDecorators: { _clientColumnDefs: [{
|
|
1313
1311
|
type: ContentChildren,
|
|
1314
1312
|
args: [MatColumnDef]
|
|
1315
1313
|
}], action: [{
|
|
@@ -1334,7 +1332,6 @@ class SPMatEntityCrudPreviewPaneComponent {
|
|
|
1334
1332
|
hideUpdate = input(false);
|
|
1335
1333
|
disableDelete = input(false);
|
|
1336
1334
|
hideDelete = input(false);
|
|
1337
|
-
config;
|
|
1338
1335
|
itemActions;
|
|
1339
1336
|
_disableActionFactory = (role, signal) => {
|
|
1340
1337
|
return computed(() => {
|
|
@@ -1350,14 +1347,10 @@ class SPMatEntityCrudPreviewPaneComponent {
|
|
|
1350
1347
|
};
|
|
1351
1348
|
_disableUpdate = this._disableActionFactory(ITEM_ACTION_UPDATE, this.disableUpdate);
|
|
1352
1349
|
_disableDelete = this._disableActionFactory(ITEM_ACTION_DELETE, this.disableDelete);
|
|
1353
|
-
constructor() {
|
|
1354
|
-
this.config = getEntityCrudConfig();
|
|
1355
|
-
}
|
|
1356
1350
|
ngOnInit() {
|
|
1357
1351
|
this.itemActions = this.entityCrudComponent().getItemActions();
|
|
1358
1352
|
}
|
|
1359
|
-
ngOnDestroy() {
|
|
1360
|
-
}
|
|
1353
|
+
ngOnDestroy() { }
|
|
1361
1354
|
onEdit() {
|
|
1362
1355
|
this.entityCrudComponent().triggerEntityUpdate(this.entity());
|
|
1363
1356
|
}
|
|
@@ -1369,67 +1362,93 @@ class SPMatEntityCrudPreviewPaneComponent {
|
|
|
1369
1362
|
}
|
|
1370
1363
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatEntityCrudPreviewPaneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1371
1364
|
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.6", type: SPMatEntityCrudPreviewPaneComponent, isStandalone: true, selector: "sp-mat-entity-crud-preview-pane", inputs: { entity: { classPropertyName: "entity", publicName: "entity", isSignal: true, isRequired: true, transformFunction: null }, entityCrudComponent: { classPropertyName: "entityCrudComponent", publicName: "entityCrudComponent", isSignal: true, isRequired: true, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, disableUpdate: { classPropertyName: "disableUpdate", publicName: "disableUpdate", isSignal: true, isRequired: false, transformFunction: null }, hideUpdate: { classPropertyName: "hideUpdate", publicName: "hideUpdate", isSignal: true, isRequired: false, transformFunction: null }, disableDelete: { classPropertyName: "disableDelete", publicName: "disableDelete", isSignal: true, isRequired: false, transformFunction: null }, hideDelete: { classPropertyName: "hideDelete", publicName: "hideDelete", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
<h2>{{ title() }}</h2
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1365
|
+
<div class="preview-wrapper">
|
|
1366
|
+
<mat-toolbar>
|
|
1367
|
+
<mat-toolbar-row>
|
|
1368
|
+
@if (title()) {
|
|
1369
|
+
<h2>{{ title() }}</h2>
|
|
1370
|
+
} @if (!hideUpdate()) {
|
|
1371
|
+
<button
|
|
1372
|
+
mat-icon-button
|
|
1373
|
+
aria-label="Edit"
|
|
1374
|
+
(click)="onEdit()"
|
|
1375
|
+
[disabled]="_disableUpdate()"
|
|
1376
|
+
>
|
|
1380
1377
|
<mat-icon>edit</mat-icon>
|
|
1381
1378
|
</button>
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1379
|
+
} @if (!hideDelete()) {
|
|
1380
|
+
<button
|
|
1381
|
+
mat-icon-button
|
|
1382
|
+
aria-label="Delete"
|
|
1383
|
+
(click)="onDelete()"
|
|
1384
|
+
[disabled]="_disableDelete()"
|
|
1385
|
+
>
|
|
1385
1386
|
<mat-icon>delete</mat-icon>
|
|
1386
1387
|
</button>
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1388
|
+
}
|
|
1389
|
+
<ng-content select="[previewToolbarContent]"></ng-content>
|
|
1390
|
+
<span class="spacer"></span>
|
|
1391
|
+
<button mat-icon-button aria-label="Close" (click)="onClose()">
|
|
1392
|
+
<mat-icon>close</mat-icon>
|
|
1393
|
+
</button>
|
|
1394
|
+
</mat-toolbar-row>
|
|
1395
|
+
</mat-toolbar>
|
|
1396
|
+
<div
|
|
1397
|
+
[class]="
|
|
1398
|
+
'preview-content ' +
|
|
1399
|
+
entityCrudComponent().getPreviewPaneContentClass()
|
|
1400
|
+
"
|
|
1401
|
+
>
|
|
1402
|
+
<ng-content select="[previewContent]"></ng-content>
|
|
1403
|
+
</div>
|
|
1397
1404
|
</div>
|
|
1398
|
-
</div>
|
|
1399
1405
|
`, isInline: true, styles: [".preview-wrapper{display:flex;flex-direction:column;height:100%}.spacer{flex:1 1 auto}.preview-content{flex-grow:1;overflow:scroll}\n"], dependencies: [{ kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i1$2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "directive", type: i1$2.MatToolbarRow, selector: "mat-toolbar-row", exportAs: ["matToolbarRow"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1400
1406
|
}
|
|
1401
1407
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatEntityCrudPreviewPaneComponent, decorators: [{
|
|
1402
1408
|
type: Component,
|
|
1403
1409
|
args: [{ imports: [MatToolbarModule, MatButtonModule, MatIconModule], selector: 'sp-mat-entity-crud-preview-pane', template: `
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
<h2>{{ title() }}</h2
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1410
|
+
<div class="preview-wrapper">
|
|
1411
|
+
<mat-toolbar>
|
|
1412
|
+
<mat-toolbar-row>
|
|
1413
|
+
@if (title()) {
|
|
1414
|
+
<h2>{{ title() }}</h2>
|
|
1415
|
+
} @if (!hideUpdate()) {
|
|
1416
|
+
<button
|
|
1417
|
+
mat-icon-button
|
|
1418
|
+
aria-label="Edit"
|
|
1419
|
+
(click)="onEdit()"
|
|
1420
|
+
[disabled]="_disableUpdate()"
|
|
1421
|
+
>
|
|
1412
1422
|
<mat-icon>edit</mat-icon>
|
|
1413
1423
|
</button>
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1424
|
+
} @if (!hideDelete()) {
|
|
1425
|
+
<button
|
|
1426
|
+
mat-icon-button
|
|
1427
|
+
aria-label="Delete"
|
|
1428
|
+
(click)="onDelete()"
|
|
1429
|
+
[disabled]="_disableDelete()"
|
|
1430
|
+
>
|
|
1417
1431
|
<mat-icon>delete</mat-icon>
|
|
1418
1432
|
</button>
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1433
|
+
}
|
|
1434
|
+
<ng-content select="[previewToolbarContent]"></ng-content>
|
|
1435
|
+
<span class="spacer"></span>
|
|
1436
|
+
<button mat-icon-button aria-label="Close" (click)="onClose()">
|
|
1437
|
+
<mat-icon>close</mat-icon>
|
|
1438
|
+
</button>
|
|
1439
|
+
</mat-toolbar-row>
|
|
1440
|
+
</mat-toolbar>
|
|
1441
|
+
<div
|
|
1442
|
+
[class]="
|
|
1443
|
+
'preview-content ' +
|
|
1444
|
+
entityCrudComponent().getPreviewPaneContentClass()
|
|
1445
|
+
"
|
|
1446
|
+
>
|
|
1447
|
+
<ng-content select="[previewContent]"></ng-content>
|
|
1448
|
+
</div>
|
|
1429
1449
|
</div>
|
|
1430
|
-
</div>
|
|
1431
1450
|
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".preview-wrapper{display:flex;flex-direction:column;height:100%}.spacer{flex:1 1 auto}.preview-content{flex-grow:1;overflow:scroll}\n"] }]
|
|
1432
|
-
}]
|
|
1451
|
+
}] });
|
|
1433
1452
|
|
|
1434
1453
|
/**
|
|
1435
1454
|
* This is a convenience base class that clients can derive from to implement
|
|
@@ -1492,6 +1511,7 @@ class SPMatEntityCrudFormBase {
|
|
|
1492
1511
|
sub$ = new Subscription();
|
|
1493
1512
|
form = computed(() => this._form());
|
|
1494
1513
|
crudConfig = getEntityCrudConfig();
|
|
1514
|
+
transloco = inject(TranslocoService);
|
|
1495
1515
|
cdr = inject(ChangeDetectorRef);
|
|
1496
1516
|
canCancelEdit = () => {
|
|
1497
1517
|
return this._canCancelEdit();
|
|
@@ -1499,7 +1519,7 @@ class SPMatEntityCrudFormBase {
|
|
|
1499
1519
|
_canCancelEdit() {
|
|
1500
1520
|
const form = this._form();
|
|
1501
1521
|
if (form && form.touched) {
|
|
1502
|
-
return window.confirm(this.
|
|
1522
|
+
return window.confirm(this.transloco.translate('spMatEntityCrud.loseChangesConfirm'));
|
|
1503
1523
|
}
|
|
1504
1524
|
return true;
|
|
1505
1525
|
}
|