@smallpearl/ngx-helper 0.29.36 → 0.29.40
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 +26 -0
- package/assets/i18n/sp-mat-entity-crud/zh-hant.json +26 -0
- 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 +191 -146
- 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 +15 -2
- 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 +19 -26
- 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
|
@@ -16,16 +16,18 @@ 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 i2 from '@angular/material/icon';
|
|
20
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
19
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';
|
|
22
|
-
import * as
|
|
24
|
+
import * as i10 from '@jsverse/transloco';
|
|
25
|
+
import { TranslocoService, provideTranslocoScope, TranslocoModule } from '@jsverse/transloco';
|
|
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
31
|
import * as i1$2 from '@angular/material/toolbar';
|
|
30
32
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
31
33
|
import { setServerErrorsAsFormErrors } from '@smallpearl/ngx-helper/forms';
|
|
@@ -57,18 +59,6 @@ function defaultCrudResponseParser(entityName, idKey, method, resp) {
|
|
|
57
59
|
return undefined;
|
|
58
60
|
}
|
|
59
61
|
const DefaultSPMatEntityCrudConfig = {
|
|
60
|
-
i18n: {
|
|
61
|
-
newItemLabel: (itemLabel) => `New ${itemLabel}`,
|
|
62
|
-
editItemLabel: (itemLabel) => `Edit ${itemLabel}`,
|
|
63
|
-
edit: 'Edit',
|
|
64
|
-
delete: 'Delete',
|
|
65
|
-
deleteItemHeader: (itemLabel) => `Confirm Delete ${itemLabel}`,
|
|
66
|
-
deleteItemMessage: (itemLabel) => `Are you sure you want to delete this ${itemLabel}`,
|
|
67
|
-
itemDeletedNotification: (itemLabel) => `${itemLabel} deleted`,
|
|
68
|
-
createdItemNotification: (itemLabel) => `${itemLabel} created.`,
|
|
69
|
-
updatedItemNotification: (itemLabel) => `${itemLabel} saved.`,
|
|
70
|
-
loseChangesPrompt: 'OK to lose changes?'
|
|
71
|
-
},
|
|
72
62
|
crudOpResponseParser: defaultCrudResponseParser
|
|
73
63
|
};
|
|
74
64
|
/**
|
|
@@ -99,6 +89,7 @@ class FormViewHostComponent {
|
|
|
99
89
|
vc = viewChild('clientFormContainer', { read: ViewContainerRef });
|
|
100
90
|
config;
|
|
101
91
|
sub$ = new Subscription();
|
|
92
|
+
transloco = inject(TranslocoService);
|
|
102
93
|
constructor() {
|
|
103
94
|
this.config = getEntityCrudConfig();
|
|
104
95
|
}
|
|
@@ -112,7 +103,10 @@ class FormViewHostComponent {
|
|
|
112
103
|
this.title.set(params.title);
|
|
113
104
|
}
|
|
114
105
|
else {
|
|
115
|
-
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
|
+
}));
|
|
116
110
|
}
|
|
117
111
|
this.params.set(params);
|
|
118
112
|
this.createClientView();
|
|
@@ -185,7 +179,7 @@ class FormViewHostComponent {
|
|
|
185
179
|
<div class="spacer"></div>
|
|
186
180
|
<div class="close">
|
|
187
181
|
<button mat-icon-button (click)="onClose()">
|
|
188
|
-
<mat-icon>
|
|
182
|
+
<mat-icon>cancel</mat-icon>
|
|
189
183
|
</button>
|
|
190
184
|
</div>
|
|
191
185
|
</div>
|
|
@@ -204,7 +198,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
204
198
|
<div class="spacer"></div>
|
|
205
199
|
<div class="close">
|
|
206
200
|
<button mat-icon-button (click)="onClose()">
|
|
207
|
-
<mat-icon>
|
|
201
|
+
<mat-icon>cancel</mat-icon>
|
|
208
202
|
</button>
|
|
209
203
|
</div>
|
|
210
204
|
</div>
|
|
@@ -304,7 +298,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
304
298
|
*/
|
|
305
299
|
newItemLink = input();
|
|
306
300
|
/**
|
|
307
|
-
* If not specified, will
|
|
301
|
+
* If not specified, will default to 'New <itemLabel()>'.
|
|
308
302
|
*/
|
|
309
303
|
newItemLabel = input();
|
|
310
304
|
/**
|
|
@@ -422,12 +416,24 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
422
416
|
* Width of the preview pane as a percentange of the overall <as-split> width.
|
|
423
417
|
*/
|
|
424
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');
|
|
425
431
|
// INTERNAL PROPERTIES //
|
|
426
432
|
// Derive a label from a camelCase source string. If the camelCase string
|
|
427
433
|
// can be translated, it returns the translated string. If not, the function
|
|
428
434
|
// converts the camelCase to 'Title Case' and returns it.
|
|
429
435
|
getLabel = (source) => {
|
|
430
|
-
const label = this.
|
|
436
|
+
const label = this.transloco.translate(source);
|
|
431
437
|
if (label.localeCompare(source) !== 0) {
|
|
432
438
|
// Successful translation, return it
|
|
433
439
|
return label;
|
|
@@ -482,7 +488,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
482
488
|
// or to edit one.
|
|
483
489
|
entityPaneActive = computed(() => !!this.previewedEntity() || this.createEditViewActive());
|
|
484
490
|
// Effective width of the entity pane.
|
|
485
|
-
entityPaneWidth = computed(() =>
|
|
491
|
+
entityPaneWidth = computed(() => this.entityPaneActive()
|
|
492
|
+
? !!this.previewedEntity()
|
|
493
|
+
? this.previewPaneWidth()
|
|
494
|
+
: this.editPaneWidth()
|
|
495
|
+
: 0);
|
|
486
496
|
// Width of the pane showing the list of entities. Calculated as
|
|
487
497
|
entitiesPaneWidth = computed(() => 100 - this.entityPaneWidth());
|
|
488
498
|
entitiesPaneHidden = computed(() => this.entityPaneActive() && this.entityPaneWidth() === 100);
|
|
@@ -556,8 +566,14 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
556
566
|
}
|
|
557
567
|
else {
|
|
558
568
|
this.defaultItemCrudActions.set([
|
|
559
|
-
{
|
|
560
|
-
|
|
569
|
+
{
|
|
570
|
+
label: this.transloco.translate('spMatEntityCrud.edit'),
|
|
571
|
+
role: '_update_',
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
label: this.transloco.translate('spMatEntityCrud.delete'),
|
|
575
|
+
role: '_delete_',
|
|
576
|
+
},
|
|
561
577
|
]);
|
|
562
578
|
}
|
|
563
579
|
}
|
|
@@ -621,7 +637,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
621
637
|
}
|
|
622
638
|
closeCreateEdit(cancelled) {
|
|
623
639
|
this.createEditViewActive.set(false);
|
|
624
|
-
this.entityViewPaneActivated.emit({
|
|
640
|
+
this.entityViewPaneActivated.emit({
|
|
641
|
+
activated: false,
|
|
642
|
+
cancelled: !!cancelled,
|
|
643
|
+
mode: 'edit',
|
|
644
|
+
});
|
|
625
645
|
}
|
|
626
646
|
canCancelEdit() {
|
|
627
647
|
if (this.canCancelEditCallback) {
|
|
@@ -656,7 +676,9 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
656
676
|
// render the new item in the mat-table.
|
|
657
677
|
if (entity) {
|
|
658
678
|
this.spEntitiesList()?.addEntity(entity);
|
|
659
|
-
this.snackBar.open(this.
|
|
679
|
+
this.snackBar.open(this.transloco.translate('spMatEntityCrud.createSuccess', {
|
|
680
|
+
item: this._itemLabel(),
|
|
681
|
+
}));
|
|
660
682
|
}
|
|
661
683
|
}));
|
|
662
684
|
}
|
|
@@ -674,7 +696,9 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
674
696
|
return obs.pipe(showBusyWheelUntilComplete('formBusyWheel'), switchMap((resp) => resp ? this.doRefreshAfterEdit(resp, 'update') : of(null)), tap((entity) => {
|
|
675
697
|
if (entity) {
|
|
676
698
|
this.spEntitiesList()?.updateEntity(id, entity);
|
|
677
|
-
this.snackBar.open(this.
|
|
699
|
+
this.snackBar.open(this.transloco.translate('spMatEntityCrud.updateSuccess', {
|
|
700
|
+
item: this._itemLabel(),
|
|
701
|
+
}));
|
|
678
702
|
}
|
|
679
703
|
}));
|
|
680
704
|
}
|
|
@@ -726,7 +750,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
726
750
|
this.spEntitiesList()?.toggleActiveEntity(this.previewedEntity());
|
|
727
751
|
}
|
|
728
752
|
this.previewedEntity.set(undefined);
|
|
729
|
-
this.entityViewPaneActivated.emit({
|
|
753
|
+
this.entityViewPaneActivated.emit({
|
|
754
|
+
activated: false,
|
|
755
|
+
cancelled: undefined,
|
|
756
|
+
mode: 'preview',
|
|
757
|
+
});
|
|
730
758
|
}
|
|
731
759
|
}
|
|
732
760
|
onItemAction(role, entity) {
|
|
@@ -748,7 +776,10 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
748
776
|
event.preventDefault();
|
|
749
777
|
event.stopImmediatePropagation();
|
|
750
778
|
const params = {
|
|
751
|
-
title: this.newItemLabel() ??
|
|
779
|
+
title: this.newItemLabel() ??
|
|
780
|
+
this.transloco.translate('spMatEntityCrud.newItem', {
|
|
781
|
+
item: this._itemLabel(),
|
|
782
|
+
}),
|
|
752
783
|
};
|
|
753
784
|
this.showCreateEditView(undefined, params);
|
|
754
785
|
// const tmpl = this.createEditFormTemplate();
|
|
@@ -768,7 +799,10 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
768
799
|
}
|
|
769
800
|
onUpdate(entity) {
|
|
770
801
|
const params = {
|
|
771
|
-
title: this.editItemTitle() ??
|
|
802
|
+
title: this.editItemTitle() ??
|
|
803
|
+
this.transloco.translate('spMatEntityCrud.editItem', {
|
|
804
|
+
item: this._itemLabel(),
|
|
805
|
+
}),
|
|
772
806
|
};
|
|
773
807
|
this.showCreateEditView(entity, params);
|
|
774
808
|
// const tmpl = this.createEditFormTemplate();
|
|
@@ -805,7 +839,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
805
839
|
const createEditHost = this.createEditHostComponent();
|
|
806
840
|
createEditHost.show(entity, params);
|
|
807
841
|
this.createEditViewActive.set(true);
|
|
808
|
-
this.entityViewPaneActivated.emit({
|
|
842
|
+
this.entityViewPaneActivated.emit({
|
|
843
|
+
activated: true,
|
|
844
|
+
cancelled: undefined,
|
|
845
|
+
mode: 'edit',
|
|
846
|
+
});
|
|
809
847
|
}
|
|
810
848
|
}
|
|
811
849
|
showPreviewView(entity, params) {
|
|
@@ -815,7 +853,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
815
853
|
const previewHost = this.previewHostComponent();
|
|
816
854
|
this.previewedEntity.set(entity);
|
|
817
855
|
previewHost?.show(entity, params);
|
|
818
|
-
this.entityViewPaneActivated.emit({
|
|
856
|
+
this.entityViewPaneActivated.emit({
|
|
857
|
+
activated: true,
|
|
858
|
+
cancelled: undefined,
|
|
859
|
+
mode: 'preview',
|
|
860
|
+
});
|
|
819
861
|
// this.previewActivated.emit({ entity, activated: true });
|
|
820
862
|
}
|
|
821
863
|
}
|
|
@@ -831,7 +873,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
831
873
|
// Do the delete prompt asynchronously so that the context menu is
|
|
832
874
|
// dismissed before the prompt is displayed.
|
|
833
875
|
setTimeout(() => {
|
|
834
|
-
const deletedItemPrompt = this.
|
|
876
|
+
const deletedItemPrompt = this.transloco.translate('spMatEntityCrud.deleteItemConfirm', { item: this._itemLabel().toLocaleLowerCase() });
|
|
835
877
|
const yes = confirm(deletedItemPrompt);
|
|
836
878
|
if (yes) {
|
|
837
879
|
const entityId = entity[this.idKey()];
|
|
@@ -856,7 +898,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
856
898
|
tap(() => {
|
|
857
899
|
this.spEntitiesList().removeEntity(entityId);
|
|
858
900
|
// TODO: customize by providing an interface via SPMatEntityCrudConfig?
|
|
859
|
-
const deletedMessage = this.
|
|
901
|
+
const deletedMessage = this.transloco.translate('spMatEntityCrud.deleteItemSuccess', { item: this._itemLabel() });
|
|
860
902
|
this.snackBar.open(deletedMessage);
|
|
861
903
|
}))
|
|
862
904
|
.subscribe());
|
|
@@ -970,13 +1012,17 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
970
1012
|
});
|
|
971
1013
|
return actionsCopy;
|
|
972
1014
|
}
|
|
1015
|
+
getPreviewPaneContentClass() {
|
|
1016
|
+
return this.previewPaneContentClass();
|
|
1017
|
+
}
|
|
973
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 });
|
|
974
|
-
/** @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 } }, outputs: { action: "action", entityViewPaneActivated: "entityViewPaneActivated" }, 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: `
|
|
975
|
-
<as-split direction="horizontal" [gutterSize]="6">
|
|
976
|
-
<as-split-area
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
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: `
|
|
1020
|
+
<as-split direction="horizontal" [gutterSize]="6" *transloco="let t">
|
|
1021
|
+
<as-split-area
|
|
1022
|
+
[size]="entitiesPaneWidth()"
|
|
1023
|
+
[visible]="!entitiesPaneHidden()"
|
|
1024
|
+
>
|
|
1025
|
+
<div [class]="listPaneWrapperClass()">
|
|
980
1026
|
<ng-content select="[breadCrumbs]"></ng-content>
|
|
981
1027
|
|
|
982
1028
|
<ng-template #defaultActionButtons>
|
|
@@ -991,9 +1037,9 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
991
1037
|
>
|
|
992
1038
|
{{
|
|
993
1039
|
newItemLabel() ??
|
|
994
|
-
|
|
995
|
-
}}
|
|
996
|
-
|
|
1040
|
+
t('spMatEntityCrud.newItem', { item: _itemLabel() })
|
|
1041
|
+
}}
|
|
1042
|
+
<mat-icon>expand_circle_down</mat-icon>
|
|
997
1043
|
</button>
|
|
998
1044
|
<mat-menu #newSubTypesMenu="matMenu">
|
|
999
1045
|
@for (subtype of newItemSubTypes(); track $index) { @if
|
|
@@ -1016,7 +1062,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1016
1062
|
>
|
|
1017
1063
|
{{
|
|
1018
1064
|
newItemLabel() ??
|
|
1019
|
-
|
|
1065
|
+
t('spMatEntityCrud.newItem', { item: _itemLabel() })
|
|
1020
1066
|
}}
|
|
1021
1067
|
</button>
|
|
1022
1068
|
} }
|
|
@@ -1029,11 +1075,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1029
1075
|
{{ _title() }}
|
|
1030
1076
|
</div>
|
|
1031
1077
|
<span class="spacer"></span>
|
|
1032
|
-
|
|
1078
|
+
<!-- Hide the action buttons when Preview/Edit pane is active -->
|
|
1033
1079
|
@if (!entityPaneActive()) {
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1080
|
+
<ng-container
|
|
1081
|
+
[ngTemplateOutlet]="actionsTemplate() || defaultActionButtons"
|
|
1082
|
+
></ng-container>
|
|
1037
1083
|
}
|
|
1038
1084
|
</div>
|
|
1039
1085
|
</ng-template>
|
|
@@ -1083,25 +1129,12 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1083
1129
|
}
|
|
1084
1130
|
</td>
|
|
1085
1131
|
</ng-container>
|
|
1086
|
-
|
|
1087
|
-
|
|
1132
|
+
</as-split-area>
|
|
1133
|
+
<as-split-area [size]="entityPaneWidth()" [visible]="entityPaneActive()">
|
|
1088
1134
|
<div
|
|
1089
|
-
[class]="
|
|
1090
|
-
[ngStyle]="{ display: createEditViewActive() ? 'inherit' : 'none' }"
|
|
1135
|
+
[class]="previewPaneWrapperClass()"
|
|
1091
1136
|
spHostBusyWheel="formBusyWheel"
|
|
1092
1137
|
>
|
|
1093
|
-
<ng-content select="[breadCrumbs]"></ng-content>
|
|
1094
|
-
<sp-create-edit-entity-host
|
|
1095
|
-
[itemLabel]="_itemLabel()"
|
|
1096
|
-
[itemLabelPlural]="_itemLabelPlural()"
|
|
1097
|
-
[entityCrudComponentBase]="this"
|
|
1098
|
-
[clientViewTemplate]="createEditFormTemplate()"
|
|
1099
|
-
></sp-create-edit-entity-host>
|
|
1100
|
-
</div>
|
|
1101
|
-
-->
|
|
1102
|
-
</as-split-area>
|
|
1103
|
-
<as-split-area [size]="entityPaneWidth()" [visible]="entityPaneActive()">
|
|
1104
|
-
<div [class]="crudConfig.previewPaneWrapperClass" spHostBusyWheel="formBusyWheel">
|
|
1105
1138
|
<sp-entity-crud-preview-host
|
|
1106
1139
|
[ngClass]="createEditViewActive() ? 'd-none' : 'd-inherit'"
|
|
1107
1140
|
[entityCrudComponentBase]="this"
|
|
@@ -1118,7 +1151,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1118
1151
|
</div>
|
|
1119
1152
|
</as-split-area>
|
|
1120
1153
|
</as-split>
|
|
1121
|
-
`, 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: AngularSplitModule }, { kind: "component", 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 });
|
|
1122
1155
|
}
|
|
1123
1156
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatEntityCrudComponent, decorators: [{
|
|
1124
1157
|
type: Component,
|
|
@@ -1130,18 +1163,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1130
1163
|
MatSortModule,
|
|
1131
1164
|
MatMenuModule,
|
|
1132
1165
|
MatSnackBarModule,
|
|
1166
|
+
MatIconModule,
|
|
1167
|
+
TranslocoModule,
|
|
1133
1168
|
AngularSplitModule,
|
|
1134
1169
|
SPMatEntityListComponent,
|
|
1135
1170
|
SPMatContextMenuComponent,
|
|
1136
1171
|
FormViewHostComponent,
|
|
1137
1172
|
SPMatHostBusyWheelDirective,
|
|
1138
1173
|
PreviewHostComponent,
|
|
1139
|
-
], selector: 'sp-mat-entity-crud', template: `
|
|
1140
|
-
<as-split direction="horizontal" [gutterSize]="6">
|
|
1141
|
-
<as-split-area
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1174
|
+
], providers: [provideTranslocoScope('sp-mat-entity-crud')], selector: 'sp-mat-entity-crud', template: `
|
|
1175
|
+
<as-split direction="horizontal" [gutterSize]="6" *transloco="let t">
|
|
1176
|
+
<as-split-area
|
|
1177
|
+
[size]="entitiesPaneWidth()"
|
|
1178
|
+
[visible]="!entitiesPaneHidden()"
|
|
1179
|
+
>
|
|
1180
|
+
<div [class]="listPaneWrapperClass()">
|
|
1145
1181
|
<ng-content select="[breadCrumbs]"></ng-content>
|
|
1146
1182
|
|
|
1147
1183
|
<ng-template #defaultActionButtons>
|
|
@@ -1156,9 +1192,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1156
1192
|
>
|
|
1157
1193
|
{{
|
|
1158
1194
|
newItemLabel() ??
|
|
1159
|
-
|
|
1160
|
-
}}
|
|
1161
|
-
|
|
1195
|
+
t('spMatEntityCrud.newItem', { item: _itemLabel() })
|
|
1196
|
+
}}
|
|
1197
|
+
<mat-icon>expand_circle_down</mat-icon>
|
|
1162
1198
|
</button>
|
|
1163
1199
|
<mat-menu #newSubTypesMenu="matMenu">
|
|
1164
1200
|
@for (subtype of newItemSubTypes(); track $index) { @if
|
|
@@ -1181,7 +1217,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1181
1217
|
>
|
|
1182
1218
|
{{
|
|
1183
1219
|
newItemLabel() ??
|
|
1184
|
-
|
|
1220
|
+
t('spMatEntityCrud.newItem', { item: _itemLabel() })
|
|
1185
1221
|
}}
|
|
1186
1222
|
</button>
|
|
1187
1223
|
} }
|
|
@@ -1194,11 +1230,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1194
1230
|
{{ _title() }}
|
|
1195
1231
|
</div>
|
|
1196
1232
|
<span class="spacer"></span>
|
|
1197
|
-
|
|
1233
|
+
<!-- Hide the action buttons when Preview/Edit pane is active -->
|
|
1198
1234
|
@if (!entityPaneActive()) {
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1235
|
+
<ng-container
|
|
1236
|
+
[ngTemplateOutlet]="actionsTemplate() || defaultActionButtons"
|
|
1237
|
+
></ng-container>
|
|
1202
1238
|
}
|
|
1203
1239
|
</div>
|
|
1204
1240
|
</ng-template>
|
|
@@ -1248,25 +1284,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1248
1284
|
}
|
|
1249
1285
|
</td>
|
|
1250
1286
|
</ng-container>
|
|
1251
|
-
|
|
1252
|
-
|
|
1287
|
+
</as-split-area>
|
|
1288
|
+
<as-split-area [size]="entityPaneWidth()" [visible]="entityPaneActive()">
|
|
1253
1289
|
<div
|
|
1254
|
-
[class]="
|
|
1255
|
-
[ngStyle]="{ display: createEditViewActive() ? 'inherit' : 'none' }"
|
|
1290
|
+
[class]="previewPaneWrapperClass()"
|
|
1256
1291
|
spHostBusyWheel="formBusyWheel"
|
|
1257
1292
|
>
|
|
1258
|
-
<ng-content select="[breadCrumbs]"></ng-content>
|
|
1259
|
-
<sp-create-edit-entity-host
|
|
1260
|
-
[itemLabel]="_itemLabel()"
|
|
1261
|
-
[itemLabelPlural]="_itemLabelPlural()"
|
|
1262
|
-
[entityCrudComponentBase]="this"
|
|
1263
|
-
[clientViewTemplate]="createEditFormTemplate()"
|
|
1264
|
-
></sp-create-edit-entity-host>
|
|
1265
|
-
</div>
|
|
1266
|
-
-->
|
|
1267
|
-
</as-split-area>
|
|
1268
|
-
<as-split-area [size]="entityPaneWidth()" [visible]="entityPaneActive()">
|
|
1269
|
-
<div [class]="crudConfig.previewPaneWrapperClass" spHostBusyWheel="formBusyWheel">
|
|
1270
1293
|
<sp-entity-crud-preview-host
|
|
1271
1294
|
[ngClass]="createEditViewActive() ? 'd-none' : 'd-inherit'"
|
|
1272
1295
|
[entityCrudComponentBase]="this"
|
|
@@ -1309,7 +1332,6 @@ class SPMatEntityCrudPreviewPaneComponent {
|
|
|
1309
1332
|
hideUpdate = input(false);
|
|
1310
1333
|
disableDelete = input(false);
|
|
1311
1334
|
hideDelete = input(false);
|
|
1312
|
-
config;
|
|
1313
1335
|
itemActions;
|
|
1314
1336
|
_disableActionFactory = (role, signal) => {
|
|
1315
1337
|
return computed(() => {
|
|
@@ -1325,14 +1347,10 @@ class SPMatEntityCrudPreviewPaneComponent {
|
|
|
1325
1347
|
};
|
|
1326
1348
|
_disableUpdate = this._disableActionFactory(ITEM_ACTION_UPDATE, this.disableUpdate);
|
|
1327
1349
|
_disableDelete = this._disableActionFactory(ITEM_ACTION_DELETE, this.disableDelete);
|
|
1328
|
-
constructor() {
|
|
1329
|
-
this.config = getEntityCrudConfig();
|
|
1330
|
-
}
|
|
1331
1350
|
ngOnInit() {
|
|
1332
1351
|
this.itemActions = this.entityCrudComponent().getItemActions();
|
|
1333
1352
|
}
|
|
1334
|
-
ngOnDestroy() {
|
|
1335
|
-
}
|
|
1353
|
+
ngOnDestroy() { }
|
|
1336
1354
|
onEdit() {
|
|
1337
1355
|
this.entityCrudComponent().triggerEntityUpdate(this.entity());
|
|
1338
1356
|
}
|
|
@@ -1344,67 +1362,93 @@ class SPMatEntityCrudPreviewPaneComponent {
|
|
|
1344
1362
|
}
|
|
1345
1363
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatEntityCrudPreviewPaneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1346
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: `
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
<h2>{{ title() }}</h2
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
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
|
+
>
|
|
1355
1377
|
<mat-icon>edit</mat-icon>
|
|
1356
1378
|
</button>
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1379
|
+
} @if (!hideDelete()) {
|
|
1380
|
+
<button
|
|
1381
|
+
mat-icon-button
|
|
1382
|
+
aria-label="Delete"
|
|
1383
|
+
(click)="onDelete()"
|
|
1384
|
+
[disabled]="_disableDelete()"
|
|
1385
|
+
>
|
|
1360
1386
|
<mat-icon>delete</mat-icon>
|
|
1361
1387
|
</button>
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
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>
|
|
1372
1404
|
</div>
|
|
1373
|
-
</div>
|
|
1374
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 });
|
|
1375
1406
|
}
|
|
1376
1407
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatEntityCrudPreviewPaneComponent, decorators: [{
|
|
1377
1408
|
type: Component,
|
|
1378
1409
|
args: [{ imports: [MatToolbarModule, MatButtonModule, MatIconModule], selector: 'sp-mat-entity-crud-preview-pane', template: `
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
<h2>{{ title() }}</h2
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
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
|
+
>
|
|
1387
1422
|
<mat-icon>edit</mat-icon>
|
|
1388
1423
|
</button>
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1424
|
+
} @if (!hideDelete()) {
|
|
1425
|
+
<button
|
|
1426
|
+
mat-icon-button
|
|
1427
|
+
aria-label="Delete"
|
|
1428
|
+
(click)="onDelete()"
|
|
1429
|
+
[disabled]="_disableDelete()"
|
|
1430
|
+
>
|
|
1392
1431
|
<mat-icon>delete</mat-icon>
|
|
1393
1432
|
</button>
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
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>
|
|
1404
1449
|
</div>
|
|
1405
|
-
</div>
|
|
1406
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"] }]
|
|
1407
|
-
}]
|
|
1451
|
+
}] });
|
|
1408
1452
|
|
|
1409
1453
|
/**
|
|
1410
1454
|
* This is a convenience base class that clients can derive from to implement
|
|
@@ -1467,6 +1511,7 @@ class SPMatEntityCrudFormBase {
|
|
|
1467
1511
|
sub$ = new Subscription();
|
|
1468
1512
|
form = computed(() => this._form());
|
|
1469
1513
|
crudConfig = getEntityCrudConfig();
|
|
1514
|
+
transloco = inject(TranslocoService);
|
|
1470
1515
|
cdr = inject(ChangeDetectorRef);
|
|
1471
1516
|
canCancelEdit = () => {
|
|
1472
1517
|
return this._canCancelEdit();
|
|
@@ -1474,7 +1519,7 @@ class SPMatEntityCrudFormBase {
|
|
|
1474
1519
|
_canCancelEdit() {
|
|
1475
1520
|
const form = this._form();
|
|
1476
1521
|
if (form && form.touched) {
|
|
1477
|
-
return window.confirm(this.
|
|
1522
|
+
return window.confirm(this.transloco.translate('spMatEntityCrud.loseChangesConfirm'));
|
|
1478
1523
|
}
|
|
1479
1524
|
return true;
|
|
1480
1525
|
}
|