@smallpearl/ngx-helper 0.33.49 → 20.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/index.d.ts +3 -1
- package/entities/index.d.ts +313 -2
- package/entity-field/index.d.ts +101 -2
- package/fesm2022/smallpearl-ngx-helper-entities.mjs +18 -18
- package/fesm2022/smallpearl-ngx-helper-entities.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-entity-field.mjs +5 -4
- package/fesm2022/smallpearl-ngx-helper-entity-field.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-forms.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-hover-dropdown.mjs +6 -6
- package/fesm2022/smallpearl-ngx-helper-hover-dropdown.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-locale.mjs +6 -6
- package/fesm2022/smallpearl-ngx-helper-locale.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-busy-wheel.mjs +57 -31
- package/fesm2022/smallpearl-ngx-helper-mat-busy-wheel.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs +15 -15
- package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs +347 -359
- package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs +152 -146
- package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-file-input.mjs +5 -5
- package/fesm2022/smallpearl-ngx-helper-mat-file-input.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-form-error.mjs +19 -19
- package/fesm2022/smallpearl-ngx-helper-mat-form-error.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs +25 -26
- package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-select-infinite-scroll.mjs +7 -7
- package/fesm2022/smallpearl-ngx-helper-mat-select-infinite-scroll.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-side-menu-layout.mjs +24 -24
- package/fesm2022/smallpearl-ngx-helper-mat-side-menu-layout.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-mat-tel-input.mjs +8 -9
- package/fesm2022/smallpearl-ngx-helper-mat-tel-input.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-sideload.mjs.map +1 -1
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs +35 -35
- package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs.map +1 -1
- package/forms/index.d.ts +55 -1
- package/hover-dropdown/index.d.ts +44 -1
- package/index.d.ts +4 -5
- package/locale/index.d.ts +55 -5
- package/mat-busy-wheel/index.d.ts +165 -4
- package/mat-context-menu/index.d.ts +65 -1
- package/mat-entity-crud/index.d.ts +1075 -6
- package/mat-entity-list/index.d.ts +394 -3
- package/mat-file-input/index.d.ts +61 -1
- package/mat-form-error/index.d.ts +184 -6
- package/mat-select-entity/index.d.ts +194 -1
- package/mat-select-infinite-scroll/index.d.ts +45 -2
- package/mat-side-menu-layout/index.d.ts +180 -6
- package/mat-tel-input/index.d.ts +169 -2
- package/package.json +14 -14
- package/sideload/index.d.ts +20 -1
- package/stationary-with-line-items/index.d.ts +78 -1
- package/core/src/version.d.ts +0 -1
- package/entities/src/paged-loader.d.ts +0 -219
- package/entities/src/paginator.d.ts +0 -87
- package/entity-field/src/entity-field.d.ts +0 -70
- package/entity-field/src/provider.d.ts +0 -27
- package/forms/src/validation-error-handler.d.ts +0 -52
- package/hover-dropdown/src/hover-dropdown.directive.d.ts +0 -41
- package/locale/src/currency.pipe.d.ts +0 -14
- package/locale/src/date.pipe.d.ts +0 -14
- package/locale/src/format-currency.d.ts +0 -1
- package/locale/src/format-date.d.ts +0 -2
- package/locale/src/is-empty.d.ts +0 -1
- package/locale/src/providers.d.ts +0 -20
- package/mat-busy-wheel/src/busy-wheel-op.d.ts +0 -65
- package/mat-busy-wheel/src/busy-wheel.component.d.ts +0 -12
- package/mat-busy-wheel/src/busy-wheel.service.d.ts +0 -42
- package/mat-busy-wheel/src/host-busy-wheel.directive.d.ts +0 -35
- package/mat-context-menu/src/mat-context-menu.component.d.ts +0 -61
- package/mat-entity-crud/src/convert-context-input-to-http-context.d.ts +0 -11
- package/mat-entity-crud/src/default-config.d.ts +0 -9
- package/mat-entity-crud/src/form-view-host.component.d.ts +0 -43
- package/mat-entity-crud/src/mat-entity-crud-form-base.d.ts +0 -277
- package/mat-entity-crud/src/mat-entity-crud-internal-types.d.ts +0 -138
- package/mat-entity-crud/src/mat-entity-crud-item-action.d.ts +0 -68
- package/mat-entity-crud/src/mat-entity-crud-types.d.ts +0 -158
- package/mat-entity-crud/src/mat-entity-crud.component.d.ts +0 -367
- package/mat-entity-crud/src/preview-host.component.d.ts +0 -21
- package/mat-entity-crud/src/preview-pane.component.d.ts +0 -31
- package/mat-entity-crud/src/providers.d.ts +0 -3
- package/mat-entity-list/src/config.d.ts +0 -6
- package/mat-entity-list/src/mat-entity-list-types.d.ts +0 -128
- package/mat-entity-list/src/mat-entity-list.component.d.ts +0 -259
- package/mat-entity-list/src/providers.d.ts +0 -3
- package/mat-file-input/src/mat-file-input.component.d.ts +0 -58
- package/mat-form-error/src/locales/en.d.ts +0 -4
- package/mat-form-error/src/locales/hu.d.ts +0 -4
- package/mat-form-error/src/locales/index.d.ts +0 -5
- package/mat-form-error/src/locales/pt-br.d.ts +0 -4
- package/mat-form-error/src/locales/zh-hans.d.ts +0 -4
- package/mat-form-error/src/locales/zh-hant.d.ts +0 -4
- package/mat-form-error/src/ngx-error-list.component.d.ts +0 -9
- package/mat-form-error/src/ngx-mat-error-control.d.ts +0 -17
- package/mat-form-error/src/ngx-mat-error-def.directive.d.ts +0 -30
- package/mat-form-error/src/ngx-mat-errors-for-date-range-picker.directive.d.ts +0 -8
- package/mat-form-error/src/ngx-mat-errors.component.d.ts +0 -44
- package/mat-form-error/src/types.d.ts +0 -68
- package/mat-form-error/src/utils/coerce-to-observable.d.ts +0 -3
- package/mat-form-error/src/utils/distinct-until-error-changed.d.ts +0 -2
- package/mat-form-error/src/utils/find-error-for-control.d.ts +0 -9
- package/mat-form-error/src/utils/get-abstract-controls.d.ts +0 -3
- package/mat-form-error/src/utils/get-control-with-error.d.ts +0 -3
- package/mat-select-entity/src/mat-select-entity.component.d.ts +0 -190
- package/mat-select-infinite-scroll/src/mat-select-infinite-scroll.directive.d.ts +0 -19
- package/mat-select-infinite-scroll/src/mat-select-infinite-scroll.service.d.ts +0 -25
- package/mat-side-menu-layout/src/layout.service.d.ts +0 -23
- package/mat-side-menu-layout/src/mat-menu-layout.component.d.ts +0 -39
- package/mat-side-menu-layout/src/mat-menu-layout.module.d.ts +0 -18
- package/mat-side-menu-layout/src/mat-menu-list-item.component.d.ts +0 -36
- package/mat-side-menu-layout/src/mat-menu-pane.component.d.ts +0 -66
- package/mat-side-menu-layout/src/nav-item.d.ts +0 -10
- package/mat-tel-input/src/country-codes.d.ts +0 -5
- package/mat-tel-input/src/mat-telephone.component.d.ts +0 -129
- package/mat-tel-input/src/providers.d.ts +0 -38
- package/ngx-helper.d.ts +0 -2
- package/public-api.d.ts +0 -1
- package/sideload/src/sideload.d.ts +0 -18
- package/stationary-with-line-items/src/stationary-with-line-items.component.d.ts +0 -74
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
import * as i1 from '@angular/common/http';
|
|
2
|
-
import { HttpContext, HttpClient, HttpParams, HttpContextToken } from '@angular/common/http';
|
|
3
1
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { input, signal, computed, inject, ChangeDetectorRef, Component,
|
|
2
|
+
import { InjectionToken, input, signal, computed, inject, ChangeDetectorRef, Component, ChangeDetectionStrategy, viewChild, ViewContainerRef, viewChildren, EventEmitter, effect, Output, ContentChildren } from '@angular/core';
|
|
3
|
+
import * as i1$1 from '@angular/common/http';
|
|
4
|
+
import { HttpContext, HttpContextToken, HttpClient, HttpParams } from '@angular/common/http';
|
|
5
5
|
import { FormArray } from '@angular/forms';
|
|
6
|
-
import * as
|
|
6
|
+
import * as i3$1 from '@jsverse/transloco';
|
|
7
7
|
import { TranslocoService, TranslocoModule, provideTranslocoScope } from '@jsverse/transloco';
|
|
8
8
|
import { setServerErrorsAsFormErrors } from '@smallpearl/ngx-helper/forms';
|
|
9
9
|
import { Subscription, map, tap, Observable, of, switchMap, firstValueFrom, catchError, EMPTY, throwError } from 'rxjs';
|
|
10
10
|
import { sideloadToComposite } from '@smallpearl/ngx-helper/sideload';
|
|
11
|
-
import * as i4 from '@angular/common';
|
|
12
|
-
import { CommonModule } from '@angular/common';
|
|
13
11
|
import * as i2 from '@angular/material/button';
|
|
14
12
|
import { MatButtonModule } from '@angular/material/button';
|
|
13
|
+
import * as i3 from '@angular/material/icon';
|
|
14
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
15
|
+
import * as i1 from '@angular/material/toolbar';
|
|
16
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
17
|
+
import * as i4 from '@angular/common';
|
|
18
|
+
import { CommonModule } from '@angular/common';
|
|
19
|
+
import * as i8 from '@angular/material/menu';
|
|
20
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
15
21
|
import * as i2$1 from '@angular/material/snack-bar';
|
|
16
22
|
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
|
17
23
|
import { MatSortModule } from '@angular/material/sort';
|
|
18
24
|
import * as i7 from '@angular/material/table';
|
|
19
25
|
import { MatColumnDef, MatTableModule } from '@angular/material/table';
|
|
26
|
+
import * as i3$2 from '@angular/platform-browser';
|
|
20
27
|
import * as i5 from '@angular/router';
|
|
21
28
|
import { RouterModule } from '@angular/router';
|
|
22
29
|
import { SPMatHostBusyWheelDirective, showBusyWheelUntilComplete } from '@smallpearl/ngx-helper/mat-busy-wheel';
|
|
23
30
|
import { SPMatContextMenuComponent } from '@smallpearl/ngx-helper/mat-context-menu';
|
|
24
31
|
import { SPMatEntityListComponent } from '@smallpearl/ngx-helper/mat-entity-list';
|
|
25
|
-
import * as i3 from '@angular/material/icon';
|
|
26
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
27
|
-
import * as i8 from '@angular/material/menu';
|
|
28
|
-
import { MatMenuModule } from '@angular/material/menu';
|
|
29
|
-
import * as i3$1 from '@angular/platform-browser';
|
|
30
32
|
import * as i11 from 'angular-split';
|
|
31
33
|
import { AngularSplitModule } from 'angular-split';
|
|
32
34
|
import { startCase, clone } from 'lodash';
|
|
33
35
|
import { plural } from 'pluralize';
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
|
|
37
|
+
const SP_MAT_ENTITY_CRUD_CONFIG = new InjectionToken('SPMatEntityCrudConfig');
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
40
|
* Converts array of HttpContextToken key, value pairs to HttpContext
|
|
@@ -59,6 +61,13 @@ function convertHttpContextInputToHttpContext(context, reqContext) {
|
|
|
59
61
|
return context;
|
|
60
62
|
}
|
|
61
63
|
|
|
64
|
+
const SP_MAT_ENTITY_CRUD_HTTP_CONTEXT = new HttpContextToken(() => ({
|
|
65
|
+
entityName: '',
|
|
66
|
+
entityNamePlural: '',
|
|
67
|
+
endpoint: '',
|
|
68
|
+
op: undefined,
|
|
69
|
+
}));
|
|
70
|
+
|
|
62
71
|
/**
|
|
63
72
|
* This is a convenience base class that clients can derive from to implement
|
|
64
73
|
* their CRUD form component. Particularly this class registers the change
|
|
@@ -185,37 +194,37 @@ function convertHttpContextInputToHttpContext(context, reqContext) {
|
|
|
185
194
|
*/
|
|
186
195
|
class SPMatEntityCrudFormBase {
|
|
187
196
|
// bridge mode inputs
|
|
188
|
-
entity = input();
|
|
189
|
-
bridge = input();
|
|
190
|
-
params = input();
|
|
197
|
+
entity = input(...(ngDevMode ? [undefined, { debugName: "entity" }] : []));
|
|
198
|
+
bridge = input(...(ngDevMode ? [undefined, { debugName: "bridge" }] : []));
|
|
199
|
+
params = input(...(ngDevMode ? [undefined, { debugName: "params" }] : []));
|
|
191
200
|
// END bridge mode inputs
|
|
192
201
|
// standalone mode inputs
|
|
193
202
|
// Entity name, which is used to parse sideloaded entity responses
|
|
194
|
-
entityName = input();
|
|
203
|
+
entityName = input(...(ngDevMode ? [undefined, { debugName: "entityName" }] : []));
|
|
195
204
|
// Base CRUD URL, which is the GET-list-of-entities/POST-to-create
|
|
196
205
|
// URL. Update URL will be derived from this ias `baseUrl()/${TEntity[IdKey]}`
|
|
197
|
-
baseUrl = input();
|
|
206
|
+
baseUrl = input(...(ngDevMode ? [undefined, { debugName: "baseUrl" }] : []));
|
|
198
207
|
// Additional request context to be passed to the request
|
|
199
|
-
httpReqContext = input();
|
|
208
|
+
httpReqContext = input(...(ngDevMode ? [undefined, { debugName: "httpReqContext" }] : []));
|
|
200
209
|
// ID key, defaults to 'id'
|
|
201
|
-
idKey = input('id');
|
|
210
|
+
idKey = input('id', ...(ngDevMode ? [{ debugName: "idKey" }] : []));
|
|
202
211
|
// END standalone mode inputs
|
|
203
212
|
// IMPLEMENTATION
|
|
204
213
|
loadEntity$;
|
|
205
214
|
// This will hold the raw response returned by load() method
|
|
206
|
-
loadResponse = signal(undefined);
|
|
215
|
+
loadResponse = signal(undefined, ...(ngDevMode ? [{ debugName: "loadResponse" }] : []));
|
|
207
216
|
// This will hold the loaded entity after it's extracted from the
|
|
208
217
|
// load response.
|
|
209
|
-
_entity = signal(undefined);
|
|
218
|
+
_entity = signal(undefined, ...(ngDevMode ? [{ debugName: "_entity" }] : []));
|
|
210
219
|
sub$ = new Subscription();
|
|
211
220
|
// Store for internal form signal. form() is computed from this.
|
|
212
|
-
_form = signal(undefined);
|
|
221
|
+
_form = signal(undefined, ...(ngDevMode ? [{ debugName: "_form" }] : []));
|
|
213
222
|
// Force typecast to TFormGroup so that we can use it in the template
|
|
214
223
|
// without having to use the non-nullable operator ! with every reference
|
|
215
224
|
// of form(). In any case the form() signal is always set in ngOnInit()
|
|
216
225
|
// method after the form is created. And if form() is not set, then there
|
|
217
226
|
// will be errors while loading the form in the template.
|
|
218
|
-
form = computed(() => this._form());
|
|
227
|
+
form = computed(() => this._form(), ...(ngDevMode ? [{ debugName: "form" }] : []));
|
|
219
228
|
transloco = inject(TranslocoService);
|
|
220
229
|
cdr = inject(ChangeDetectorRef);
|
|
221
230
|
http = inject(HttpClient);
|
|
@@ -379,11 +388,6 @@ class SPMatEntityCrudFormBase {
|
|
|
379
388
|
subscriber.complete();
|
|
380
389
|
});
|
|
381
390
|
}
|
|
382
|
-
// entity is of type TEntity[IdKey]. Load it using bridge or HTTP GET.
|
|
383
|
-
const bridge = this.bridge();
|
|
384
|
-
if (!this.getStandaloneMode()) {
|
|
385
|
-
return bridge.loadEntity(typeof entityOrId === 'object' ? entityOrId[this.getIdKey()] : entityOrId, this.getLoadEntityParams());
|
|
386
|
-
}
|
|
387
391
|
return this.loadEntity(typeof entityOrId === 'object' ? entityOrId[this.getIdKey()] : entityOrId);
|
|
388
392
|
}
|
|
389
393
|
/**
|
|
@@ -507,26 +511,151 @@ class SPMatEntityCrudFormBase {
|
|
|
507
511
|
}
|
|
508
512
|
return context;
|
|
509
513
|
}
|
|
510
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
511
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
514
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SPMatEntityCrudFormBase, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
515
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.16", type: SPMatEntityCrudFormBase, isStandalone: false, selector: "_#_sp-mat-entity-crud-form-base_#_", inputs: { entity: { classPropertyName: "entity", publicName: "entity", isSignal: true, isRequired: false, transformFunction: null }, bridge: { classPropertyName: "bridge", publicName: "bridge", isSignal: true, isRequired: false, transformFunction: null }, params: { classPropertyName: "params", publicName: "params", isSignal: true, isRequired: false, transformFunction: null }, entityName: { classPropertyName: "entityName", publicName: "entityName", isSignal: true, isRequired: false, transformFunction: null }, baseUrl: { classPropertyName: "baseUrl", publicName: "baseUrl", isSignal: true, isRequired: false, transformFunction: null }, httpReqContext: { classPropertyName: "httpReqContext", publicName: "httpReqContext", isSignal: true, isRequired: false, transformFunction: null }, idKey: { classPropertyName: "idKey", publicName: "idKey", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true });
|
|
512
516
|
}
|
|
513
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
517
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SPMatEntityCrudFormBase, decorators: [{
|
|
514
518
|
type: Component,
|
|
515
519
|
args: [{
|
|
516
520
|
selector: '_#_sp-mat-entity-crud-form-base_#_',
|
|
517
521
|
template: ``,
|
|
518
522
|
standalone: false,
|
|
519
523
|
}]
|
|
520
|
-
}] });
|
|
524
|
+
}], propDecorators: { entity: [{ type: i0.Input, args: [{ isSignal: true, alias: "entity", required: false }] }], bridge: [{ type: i0.Input, args: [{ isSignal: true, alias: "bridge", required: false }] }], params: [{ type: i0.Input, args: [{ isSignal: true, alias: "params", required: false }] }], entityName: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityName", required: false }] }], baseUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseUrl", required: false }] }], httpReqContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "httpReqContext", required: false }] }], idKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "idKey", required: false }] }] } });
|
|
521
525
|
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
entityNamePlural: '',
|
|
525
|
-
endpoint: '',
|
|
526
|
-
op: undefined,
|
|
527
|
-
}));
|
|
526
|
+
const ITEM_ACTION_UPDATE = '_update_';
|
|
527
|
+
const ITEM_ACTION_DELETE = '_delete_';
|
|
528
528
|
|
|
529
|
-
|
|
529
|
+
/**
|
|
530
|
+
* A preview pane container to provide a consistent UX for all preview panes.
|
|
531
|
+
* It consits of a toolbar on the top and a container div below that takes up
|
|
532
|
+
* the rest of the preview pane area.
|
|
533
|
+
*/
|
|
534
|
+
class SPMatEntityCrudPreviewPaneComponent {
|
|
535
|
+
entity = input.required(...(ngDevMode ? [{ debugName: "entity" }] : []));
|
|
536
|
+
entityCrudComponent = input.required(...(ngDevMode ? [{ debugName: "entityCrudComponent" }] : []));
|
|
537
|
+
title = input(...(ngDevMode ? [undefined, { debugName: "title" }] : []));
|
|
538
|
+
disableUpdate = input(false, ...(ngDevMode ? [{ debugName: "disableUpdate" }] : []));
|
|
539
|
+
hideUpdate = input(false, ...(ngDevMode ? [{ debugName: "hideUpdate" }] : []));
|
|
540
|
+
disableDelete = input(false, ...(ngDevMode ? [{ debugName: "disableDelete" }] : []));
|
|
541
|
+
hideDelete = input(false, ...(ngDevMode ? [{ debugName: "hideDelete" }] : []));
|
|
542
|
+
itemActions;
|
|
543
|
+
_disableActionFactory = (role, signal) => {
|
|
544
|
+
return computed(() => {
|
|
545
|
+
if (signal && signal()) {
|
|
546
|
+
return true;
|
|
547
|
+
}
|
|
548
|
+
const actionFn = this.itemActions.find((a) => a.role === role)?.disable;
|
|
549
|
+
if (actionFn && actionFn(this.entity())) {
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
552
|
+
return false;
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
_disableUpdate = this._disableActionFactory(ITEM_ACTION_UPDATE, this.disableUpdate);
|
|
556
|
+
_disableDelete = this._disableActionFactory(ITEM_ACTION_DELETE, this.disableDelete);
|
|
557
|
+
ngOnInit() {
|
|
558
|
+
this.itemActions = this.entityCrudComponent().getItemActions();
|
|
559
|
+
}
|
|
560
|
+
ngOnDestroy() { }
|
|
561
|
+
onEdit() {
|
|
562
|
+
this.entityCrudComponent().triggerEntityUpdate(this.entity());
|
|
563
|
+
}
|
|
564
|
+
onDelete() {
|
|
565
|
+
this.entityCrudComponent().triggerEntityDelete(this.entity());
|
|
566
|
+
}
|
|
567
|
+
onClose() {
|
|
568
|
+
this.entityCrudComponent().closePreview();
|
|
569
|
+
}
|
|
570
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SPMatEntityCrudPreviewPaneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
571
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", 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: `
|
|
572
|
+
<div class="preview-wrapper">
|
|
573
|
+
<mat-toolbar>
|
|
574
|
+
<mat-toolbar-row>
|
|
575
|
+
@if (title()) {
|
|
576
|
+
<h2>{{ title() }}</h2>
|
|
577
|
+
} @if (!hideUpdate()) {
|
|
578
|
+
<button
|
|
579
|
+
mat-icon-button
|
|
580
|
+
aria-label="Edit"
|
|
581
|
+
(click)="onEdit()"
|
|
582
|
+
[disabled]="_disableUpdate()"
|
|
583
|
+
>
|
|
584
|
+
<mat-icon>edit</mat-icon>
|
|
585
|
+
</button>
|
|
586
|
+
} @if (!hideDelete()) {
|
|
587
|
+
<button
|
|
588
|
+
mat-icon-button
|
|
589
|
+
aria-label="Delete"
|
|
590
|
+
(click)="onDelete()"
|
|
591
|
+
[disabled]="_disableDelete()"
|
|
592
|
+
>
|
|
593
|
+
<mat-icon>delete</mat-icon>
|
|
594
|
+
</button>
|
|
595
|
+
}
|
|
596
|
+
<ng-content select="[previewToolbarContent]"></ng-content>
|
|
597
|
+
<span class="spacer"></span>
|
|
598
|
+
<button mat-icon-button aria-label="Close" (click)="onClose()">
|
|
599
|
+
<mat-icon>close</mat-icon>
|
|
600
|
+
</button>
|
|
601
|
+
</mat-toolbar-row>
|
|
602
|
+
</mat-toolbar>
|
|
603
|
+
<div
|
|
604
|
+
[class]="
|
|
605
|
+
'preview-content ' +
|
|
606
|
+
entityCrudComponent().getPreviewPaneContentClass()
|
|
607
|
+
"
|
|
608
|
+
>
|
|
609
|
+
<ng-content select="[previewContent]"></ng-content>
|
|
610
|
+
</div>
|
|
611
|
+
</div>
|
|
612
|
+
`, isInline: true, styles: [".preview-wrapper{display:flex;flex-direction:column;height:100%!important;width:100%!important}mat-toolbar{background-color:var(--mat-sys-surface-variant)}.spacer{flex:1 1 auto}.preview-content{padding:.4em;flex-grow:1;overflow:scroll}\n"], dependencies: [{ kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i1.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "directive", type: i1.MatToolbarRow, selector: "mat-toolbar-row", exportAs: ["matToolbarRow"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
613
|
+
}
|
|
614
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SPMatEntityCrudPreviewPaneComponent, decorators: [{
|
|
615
|
+
type: Component,
|
|
616
|
+
args: [{ imports: [MatToolbarModule, MatButtonModule, MatIconModule], selector: 'sp-mat-entity-crud-preview-pane', template: `
|
|
617
|
+
<div class="preview-wrapper">
|
|
618
|
+
<mat-toolbar>
|
|
619
|
+
<mat-toolbar-row>
|
|
620
|
+
@if (title()) {
|
|
621
|
+
<h2>{{ title() }}</h2>
|
|
622
|
+
} @if (!hideUpdate()) {
|
|
623
|
+
<button
|
|
624
|
+
mat-icon-button
|
|
625
|
+
aria-label="Edit"
|
|
626
|
+
(click)="onEdit()"
|
|
627
|
+
[disabled]="_disableUpdate()"
|
|
628
|
+
>
|
|
629
|
+
<mat-icon>edit</mat-icon>
|
|
630
|
+
</button>
|
|
631
|
+
} @if (!hideDelete()) {
|
|
632
|
+
<button
|
|
633
|
+
mat-icon-button
|
|
634
|
+
aria-label="Delete"
|
|
635
|
+
(click)="onDelete()"
|
|
636
|
+
[disabled]="_disableDelete()"
|
|
637
|
+
>
|
|
638
|
+
<mat-icon>delete</mat-icon>
|
|
639
|
+
</button>
|
|
640
|
+
}
|
|
641
|
+
<ng-content select="[previewToolbarContent]"></ng-content>
|
|
642
|
+
<span class="spacer"></span>
|
|
643
|
+
<button mat-icon-button aria-label="Close" (click)="onClose()">
|
|
644
|
+
<mat-icon>close</mat-icon>
|
|
645
|
+
</button>
|
|
646
|
+
</mat-toolbar-row>
|
|
647
|
+
</mat-toolbar>
|
|
648
|
+
<div
|
|
649
|
+
[class]="
|
|
650
|
+
'preview-content ' +
|
|
651
|
+
entityCrudComponent().getPreviewPaneContentClass()
|
|
652
|
+
"
|
|
653
|
+
>
|
|
654
|
+
<ng-content select="[previewContent]"></ng-content>
|
|
655
|
+
</div>
|
|
656
|
+
</div>
|
|
657
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".preview-wrapper{display:flex;flex-direction:column;height:100%!important;width:100%!important}mat-toolbar{background-color:var(--mat-sys-surface-variant)}.spacer{flex:1 1 auto}.preview-content{padding:.4em;flex-grow:1;overflow:scroll}\n"] }]
|
|
658
|
+
}], propDecorators: { entity: [{ type: i0.Input, args: [{ isSignal: true, alias: "entity", required: true }] }], entityCrudComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityCrudComponent", required: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], disableUpdate: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableUpdate", required: false }] }], hideUpdate: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideUpdate", required: false }] }], disableDelete: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableDelete", required: false }] }], hideDelete: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideDelete", required: false }] }] } });
|
|
530
659
|
|
|
531
660
|
function defaultCrudResponseParser(entityName, idKey, method, // 'create' | 'retrieve' | 'update' | 'delete',
|
|
532
661
|
resp) {
|
|
@@ -566,27 +695,28 @@ function getEntityCrudConfig() {
|
|
|
566
695
|
}
|
|
567
696
|
|
|
568
697
|
class FormViewHostComponent {
|
|
569
|
-
entityCrudComponentBase = input.required();
|
|
570
|
-
clientViewTemplate = input(null);
|
|
698
|
+
entityCrudComponentBase = input.required(...(ngDevMode ? [{ debugName: "entityCrudComponentBase" }] : []));
|
|
699
|
+
clientViewTemplate = input(null, ...(ngDevMode ? [{ debugName: "clientViewTemplate" }] : []));
|
|
571
700
|
_itemLabel = computed(() => {
|
|
572
701
|
const label = this.entityCrudComponentBase().getItemLabel();
|
|
573
702
|
return label instanceof Observable ? label : of(label);
|
|
574
|
-
});
|
|
703
|
+
}, ...(ngDevMode ? [{ debugName: "_itemLabel" }] : []));
|
|
575
704
|
_itemLabelPlural = computed(() => {
|
|
576
705
|
const label = this.entityCrudComponentBase().getItemLabelPlural();
|
|
577
706
|
return label instanceof Observable ? label : of(label);
|
|
578
|
-
});
|
|
579
|
-
entity = signal(undefined);
|
|
580
|
-
title = signal(undefined);
|
|
581
|
-
params = signal(undefined);
|
|
707
|
+
}, ...(ngDevMode ? [{ debugName: "_itemLabelPlural" }] : []));
|
|
708
|
+
entity = signal(undefined, ...(ngDevMode ? [{ debugName: "entity" }] : []));
|
|
709
|
+
title = signal(undefined, ...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
710
|
+
params = signal(undefined, ...(ngDevMode ? [{ debugName: "params" }] : []));
|
|
582
711
|
clientFormView;
|
|
583
|
-
vc = viewChild('clientFormContainer', { read: ViewContainerRef });
|
|
712
|
+
vc = viewChild('clientFormContainer', ...(ngDevMode ? [{ debugName: "vc", read: ViewContainerRef }] : [{ read: ViewContainerRef }]));
|
|
584
713
|
config;
|
|
585
714
|
sub$ = new Subscription();
|
|
586
715
|
transloco = inject(TranslocoService);
|
|
587
716
|
constructor() {
|
|
588
717
|
this.config = getEntityCrudConfig();
|
|
589
718
|
}
|
|
719
|
+
// loadEntity: (id: any, params: string | HttpParams) => Observable<any>;
|
|
590
720
|
ngOnInit() { }
|
|
591
721
|
ngOnDestroy() {
|
|
592
722
|
this.sub$.unsubscribe();
|
|
@@ -647,9 +777,6 @@ class FormViewHostComponent {
|
|
|
647
777
|
?.update(id, entityValue)
|
|
648
778
|
.pipe(tap(() => this.close(false)));
|
|
649
779
|
}
|
|
650
|
-
loadEntity(id, params) {
|
|
651
|
-
return this.entityCrudComponentBase().loadEntity(id, params);
|
|
652
|
-
}
|
|
653
780
|
// END SPMatEntityCrudCreateEditBridge METHODS //
|
|
654
781
|
/**
|
|
655
782
|
* Creates the client view provided via template
|
|
@@ -683,8 +810,8 @@ class FormViewHostComponent {
|
|
|
683
810
|
this.destroyClientView();
|
|
684
811
|
}
|
|
685
812
|
}
|
|
686
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
687
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
813
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FormViewHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
814
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: FormViewHostComponent, isStandalone: true, selector: "sp-create-edit-entity-host", inputs: { entityCrudComponentBase: { classPropertyName: "entityCrudComponentBase", publicName: "entityCrudComponentBase", isSignal: true, isRequired: true, transformFunction: null }, clientViewTemplate: { classPropertyName: "clientViewTemplate", publicName: "clientViewTemplate", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "vc", first: true, predicate: ["clientFormContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: `
|
|
688
815
|
<div
|
|
689
816
|
[class]="
|
|
690
817
|
'sp-mat-crud-form-wrapper ' +
|
|
@@ -723,9 +850,9 @@ class FormViewHostComponent {
|
|
|
723
850
|
</div>
|
|
724
851
|
</div>
|
|
725
852
|
</div>
|
|
726
|
-
`, isInline: true, styles: [".sp-mat-crud-form-wrapper{width:100%!important;height:100%!important}.sp-mat-crud-form-content{height:100%;width:100%;display:flex;flex-direction:column;padding:.4em}.create-edit-topbar{display:flex;flex-direction:row;align-items:center;min-height:48px;padding:.4em}.form-container{padding-top:.4em;flex-grow:1;overflow:auto}.create-edit-topbar .title{font-size:1.5em;font-weight:500}.create-edit-topbar .spacer{flex-grow:1}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "
|
|
853
|
+
`, isInline: true, styles: [".sp-mat-crud-form-wrapper{width:100%!important;height:100%!important}.sp-mat-crud-form-content{height:100%;width:100%;display:flex;flex-direction:column;padding:.4em}.create-edit-topbar{display:flex;flex-direction:row;align-items:center;min-height:48px;padding:.4em}.form-container{padding-top:.4em;flex-grow:1;overflow:auto}.create-edit-topbar .title{font-size:1.5em;font-weight:500}.create-edit-topbar .spacer{flex-grow:1}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "directive", type: i3$1.TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "directive", type: SPMatHostBusyWheelDirective, selector: "[spHostBusyWheel]", inputs: ["spHostBusyWheel"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
727
854
|
}
|
|
728
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
855
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FormViewHostComponent, decorators: [{
|
|
729
856
|
type: Component,
|
|
730
857
|
args: [{ imports: [
|
|
731
858
|
CommonModule,
|
|
@@ -773,13 +900,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
773
900
|
</div>
|
|
774
901
|
</div>
|
|
775
902
|
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".sp-mat-crud-form-wrapper{width:100%!important;height:100%!important}.sp-mat-crud-form-content{height:100%;width:100%;display:flex;flex-direction:column;padding:.4em}.create-edit-topbar{display:flex;flex-direction:row;align-items:center;min-height:48px;padding:.4em}.form-container{padding-top:.4em;flex-grow:1;overflow:auto}.create-edit-topbar .title{font-size:1.5em;font-weight:500}.create-edit-topbar .spacer{flex-grow:1}\n"] }]
|
|
776
|
-
}], ctorParameters: () => [] });
|
|
903
|
+
}], ctorParameters: () => [], propDecorators: { entityCrudComponentBase: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityCrudComponentBase", required: true }] }], clientViewTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "clientViewTemplate", required: false }] }], vc: [{ type: i0.ViewChild, args: ['clientFormContainer', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
777
904
|
|
|
778
905
|
class PreviewHostComponent {
|
|
779
|
-
vc = viewChild('previewComponent', { read: ViewContainerRef });
|
|
780
|
-
entityCrudComponentBase = input.required();
|
|
781
|
-
clientViewTemplate = input(null);
|
|
782
|
-
entity = signal(undefined);
|
|
906
|
+
vc = viewChild('previewComponent', ...(ngDevMode ? [{ debugName: "vc", read: ViewContainerRef }] : [{ read: ViewContainerRef }]));
|
|
907
|
+
entityCrudComponentBase = input.required(...(ngDevMode ? [{ debugName: "entityCrudComponentBase" }] : []));
|
|
908
|
+
clientViewTemplate = input(null, ...(ngDevMode ? [{ debugName: "clientViewTemplate" }] : []));
|
|
909
|
+
entity = signal(undefined, ...(ngDevMode ? [{ debugName: "entity" }] : []));
|
|
783
910
|
clientView;
|
|
784
911
|
constructor() {
|
|
785
912
|
// effect(() => {
|
|
@@ -830,10 +957,10 @@ class PreviewHostComponent {
|
|
|
830
957
|
this.clientView = null;
|
|
831
958
|
}
|
|
832
959
|
}
|
|
833
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
834
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "
|
|
960
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PreviewHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
961
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.16", type: PreviewHostComponent, isStandalone: true, selector: "sp-entity-crud-preview-host", inputs: { entityCrudComponentBase: { classPropertyName: "entityCrudComponentBase", publicName: "entityCrudComponentBase", isSignal: true, isRequired: true, transformFunction: null }, clientViewTemplate: { classPropertyName: "clientViewTemplate", publicName: "clientViewTemplate", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "vc", first: true, predicate: ["previewComponent"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: ` <ng-container #previewComponent></ng-container> `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
835
962
|
}
|
|
836
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
963
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PreviewHostComponent, decorators: [{
|
|
837
964
|
type: Component,
|
|
838
965
|
args: [{
|
|
839
966
|
imports: [],
|
|
@@ -841,59 +968,59 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
841
968
|
template: ` <ng-container #previewComponent></ng-container> `,
|
|
842
969
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
843
970
|
}]
|
|
844
|
-
}], ctorParameters: () => [] });
|
|
971
|
+
}], ctorParameters: () => [], propDecorators: { vc: [{ type: i0.ViewChild, args: ['previewComponent', { ...{ read: ViewContainerRef }, isSignal: true }] }], entityCrudComponentBase: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityCrudComponentBase", required: true }] }], clientViewTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "clientViewTemplate", required: false }] }] } });
|
|
845
972
|
|
|
846
973
|
class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
847
974
|
snackBar;
|
|
848
975
|
// entityName = input.required<string>();
|
|
849
976
|
// entityNamePlural = input<string>();
|
|
850
|
-
itemLabel = input();
|
|
851
|
-
itemLabelPlural = input();
|
|
977
|
+
itemLabel = input(...(ngDevMode ? [undefined, { debugName: "itemLabel" }] : []));
|
|
978
|
+
itemLabelPlural = input(...(ngDevMode ? [undefined, { debugName: "itemLabelPlural" }] : []));
|
|
852
979
|
/**
|
|
853
980
|
* Title string displayed above the component. If not specified, will use
|
|
854
981
|
* itemLabelPlural() as the title.
|
|
855
982
|
*/
|
|
856
|
-
title = input();
|
|
983
|
+
title = input(...(ngDevMode ? [undefined, { debugName: "title" }] : []));
|
|
857
984
|
/**
|
|
858
985
|
*
|
|
859
986
|
*/
|
|
860
|
-
itemActions = input([]);
|
|
987
|
+
itemActions = input([], ...(ngDevMode ? [{ debugName: "itemActions" }] : []));
|
|
861
988
|
/**
|
|
862
989
|
* Specify the list of router paths that will be set as the value for
|
|
863
990
|
* [routerLink] for the 'New {{ item }}' button. If not specified,
|
|
864
991
|
* if createEditTemplate is specified, it will be shown. If not, `action`
|
|
865
992
|
* out event will be raised with `{ role: '_new_' }`.
|
|
866
993
|
*/
|
|
867
|
-
newItemLink = input();
|
|
994
|
+
newItemLink = input(...(ngDevMode ? [undefined, { debugName: "newItemLink" }] : []));
|
|
868
995
|
/**
|
|
869
996
|
* If not specified, will default to 'New <itemLabel()>'.
|
|
870
997
|
*/
|
|
871
|
-
newItemLabel = input();
|
|
998
|
+
newItemLabel = input(...(ngDevMode ? [undefined, { debugName: "newItemLabel" }] : []));
|
|
872
999
|
/**
|
|
873
1000
|
* Text for the Edit <item> pane title
|
|
874
1001
|
*/
|
|
875
|
-
editItemTitle = input();
|
|
1002
|
+
editItemTitle = input(...(ngDevMode ? [undefined, { debugName: "editItemTitle" }] : []));
|
|
876
1003
|
/**
|
|
877
1004
|
* If you want "New {{item}}" button to support multiple entity types,
|
|
878
1005
|
* you can set this to `NewItemSubType[]`, where each element stands for for
|
|
879
1006
|
* a dropdown menu item. Refer to `NewItemSubType` for details on this
|
|
880
1007
|
* interface.
|
|
881
1008
|
*/
|
|
882
|
-
newItemSubTypes = input();
|
|
1009
|
+
newItemSubTypes = input(...(ngDevMode ? [undefined, { debugName: "newItemSubTypes" }] : []));
|
|
883
1010
|
/**
|
|
884
1011
|
* If you want to take control of the network operations for the CRUD
|
|
885
1012
|
* operations (GET/CREATE/UPDATE/DELETE), provide a value for this property.
|
|
886
1013
|
*/
|
|
887
|
-
crudOpFn = input();
|
|
1014
|
+
crudOpFn = input(...(ngDevMode ? [undefined, { debugName: "crudOpFn" }] : []));
|
|
888
1015
|
/**
|
|
889
1016
|
* Item preview template.
|
|
890
1017
|
*/
|
|
891
|
-
previewTemplate = input();
|
|
1018
|
+
previewTemplate = input(...(ngDevMode ? [undefined, { debugName: "previewTemplate" }] : []));
|
|
892
1019
|
/**
|
|
893
1020
|
* Whether to allow a context menu action or not. Return false to disable
|
|
894
1021
|
* the action.
|
|
895
1022
|
*/
|
|
896
|
-
allowEntityActionFn = input();
|
|
1023
|
+
allowEntityActionFn = input(...(ngDevMode ? [undefined, { debugName: "allowEntityActionFn" }] : []));
|
|
897
1024
|
/**
|
|
898
1025
|
* A template that allows the header to be replaced. Usage:-
|
|
899
1026
|
*
|
|
@@ -904,7 +1031,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
904
1031
|
* <ng-template #myCrudViewHeader>...</ng-template>
|
|
905
1032
|
* ```
|
|
906
1033
|
*/
|
|
907
|
-
headerTemplate = input();
|
|
1034
|
+
headerTemplate = input(...(ngDevMode ? [undefined, { debugName: "headerTemplate" }] : []));
|
|
908
1035
|
/**
|
|
909
1036
|
* Set this to the custom template identifier that will replace the
|
|
910
1037
|
* "New {{Item}}" button portion. This template will expand towards the
|
|
@@ -917,13 +1044,13 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
917
1044
|
* <ng-template #myCrudActions>...</ng-template>
|
|
918
1045
|
* ```
|
|
919
1046
|
*/
|
|
920
|
-
actionsTemplate = input();
|
|
1047
|
+
actionsTemplate = input(...(ngDevMode ? [undefined, { debugName: "actionsTemplate" }] : []));
|
|
921
1048
|
/**
|
|
922
1049
|
* CRUD action response parser. This will be called with the response
|
|
923
1050
|
* from CREATE & UPDATE operations to parse the response JSON and return
|
|
924
1051
|
* the created/updated TEntity.
|
|
925
1052
|
*/
|
|
926
|
-
crudResponseParser = input();
|
|
1053
|
+
crudResponseParser = input(...(ngDevMode ? [undefined, { debugName: "crudResponseParser" }] : []));
|
|
927
1054
|
/**
|
|
928
1055
|
* An ng-template name that contains the component which provides the
|
|
929
1056
|
* create/edit CRUD action.
|
|
@@ -939,16 +1066,16 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
939
1066
|
* (app-create-edit-entity-demo here is the client code that implements the
|
|
940
1067
|
* Create/Edit form)
|
|
941
1068
|
*/
|
|
942
|
-
createEditFormTemplate = input(null);
|
|
1069
|
+
createEditFormTemplate = input(null, ...(ngDevMode ? [{ debugName: "createEditFormTemplate" }] : []));
|
|
943
1070
|
/**
|
|
944
1071
|
* Disables the per item actions column, preventing 'Edit' & 'Delete'
|
|
945
1072
|
* (and other user defined) item operations.
|
|
946
1073
|
*/
|
|
947
|
-
disableItemActions = input(false);
|
|
1074
|
+
disableItemActions = input(false, ...(ngDevMode ? [{ debugName: "disableItemActions" }] : []));
|
|
948
1075
|
/**
|
|
949
1076
|
* Disables the Create function.
|
|
950
1077
|
*/
|
|
951
|
-
disableCreate = input(false);
|
|
1078
|
+
disableCreate = input(false, ...(ngDevMode ? [{ debugName: "disableCreate" }] : []));
|
|
952
1079
|
/**
|
|
953
1080
|
* View refresh policy after a CREATE/UPDATE operation. Values
|
|
954
1081
|
* 'none' - Objects are not refreshed after an edit operation. The return
|
|
@@ -962,7 +1089,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
962
1089
|
* mimics the behaviour of legacy HTML apps with pure server
|
|
963
1090
|
* defined UI.
|
|
964
1091
|
*/
|
|
965
|
-
refreshAfterEdit = input('none');
|
|
1092
|
+
refreshAfterEdit = input('none', ...(ngDevMode ? [{ debugName: "refreshAfterEdit" }] : []));
|
|
966
1093
|
/**
|
|
967
1094
|
* HttpContext for crud requests - `create`, `retrieve`, `update` & `delete`.
|
|
968
1095
|
* Note that HttpContext for `list` operation should be set using the
|
|
@@ -975,19 +1102,19 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
975
1102
|
* `[[HttpContextToken<any>, any]] | [HttpContextToken<any>, any] | HttpContext`,
|
|
976
1103
|
* in which case the same context would be used for all HTTP requests.
|
|
977
1104
|
*/
|
|
978
|
-
crudHttpReqContext = input();
|
|
1105
|
+
crudHttpReqContext = input(...(ngDevMode ? [undefined, { debugName: "crudHttpReqContext" }] : []));
|
|
979
1106
|
/**
|
|
980
1107
|
* Width of the edit pane as a percentange of the overall <as-split> width.
|
|
981
1108
|
*/
|
|
982
|
-
editPaneWidth = input(100);
|
|
1109
|
+
editPaneWidth = input(100, ...(ngDevMode ? [{ debugName: "editPaneWidth" }] : []));
|
|
983
1110
|
/**
|
|
984
1111
|
* Width of the preview pane as a percentange of the overall <as-split> width.
|
|
985
1112
|
*/
|
|
986
|
-
previewPaneWidth = input(50);
|
|
1113
|
+
previewPaneWidth = input(50, ...(ngDevMode ? [{ debugName: "previewPaneWidth" }] : []));
|
|
987
1114
|
/**
|
|
988
1115
|
* The class class that will be applied to the list pane wrapper.
|
|
989
1116
|
*/
|
|
990
|
-
listPaneWrapperClass = input('sp-mat-crud-list-pane-wrapper-class');
|
|
1117
|
+
listPaneWrapperClass = input('sp-mat-crud-list-pane-wrapper-class', ...(ngDevMode ? [{ debugName: "listPaneWrapperClass" }] : []));
|
|
991
1118
|
/**
|
|
992
1119
|
* The class class that will be applied to the preview pane wrapper.
|
|
993
1120
|
* Inside this wrapper, another div element with class='previewPaneContentClass()'
|
|
@@ -1006,11 +1133,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1006
1133
|
* | +------------------------------------+ |
|
|
1007
1134
|
* +----------------------------------------+
|
|
1008
1135
|
*/
|
|
1009
|
-
previewPaneWrapperClass = input('sp-mat-crud-entity-pane-wrapper-class');
|
|
1136
|
+
previewPaneWrapperClass = input('sp-mat-crud-entity-pane-wrapper-class', ...(ngDevMode ? [{ debugName: "previewPaneWrapperClass" }] : []));
|
|
1010
1137
|
/**
|
|
1011
1138
|
* The class class that will be applied to the preview pane content.
|
|
1012
1139
|
*/
|
|
1013
|
-
previewPaneContentClass = input('sp-mat-crud-preview-pane-content-class');
|
|
1140
|
+
previewPaneContentClass = input('sp-mat-crud-preview-pane-content-class', ...(ngDevMode ? [{ debugName: "previewPaneContentClass" }] : []));
|
|
1014
1141
|
/**
|
|
1015
1142
|
* The class class that will be applied to the form pane wrapper. Inside this
|
|
1016
1143
|
* wrapper, another div element with class='formPaneContentClass()' will be
|
|
@@ -1028,11 +1155,11 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1028
1155
|
* | +------------------------------------+ |
|
|
1029
1156
|
* +----------------------------------------+
|
|
1030
1157
|
*/
|
|
1031
|
-
formPaneWrapperClass = input('sp-mat-crud-form-pane-wrapper-class');
|
|
1158
|
+
formPaneWrapperClass = input('sp-mat-crud-form-pane-wrapper-class', ...(ngDevMode ? [{ debugName: "formPaneWrapperClass" }] : []));
|
|
1032
1159
|
/**
|
|
1033
1160
|
* The CSS class that will be applied to the form pane content.
|
|
1034
1161
|
*/
|
|
1035
|
-
formPaneContentClass = input('sp-mat-crud-form-pane-content-class');
|
|
1162
|
+
formPaneContentClass = input('sp-mat-crud-form-pane-content-class', ...(ngDevMode ? [{ debugName: "formPaneContentClass" }] : []));
|
|
1036
1163
|
// INTERNAL PROPERTIES //
|
|
1037
1164
|
// Derive a label from a camelCase source string. If the camelCase string
|
|
1038
1165
|
// can be translated, it returns the translated string. If not, the function
|
|
@@ -1049,23 +1176,23 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1049
1176
|
const itemLabel = this.itemLabel();
|
|
1050
1177
|
const label = itemLabel ? itemLabel : this.getLabel(this.entityName());
|
|
1051
1178
|
return label instanceof Observable ? label : of(label);
|
|
1052
|
-
});
|
|
1179
|
+
}, ...(ngDevMode ? [{ debugName: "_itemLabel" }] : []));
|
|
1053
1180
|
_itemLabelPlural = computed(() => {
|
|
1054
1181
|
const itemLabelPlural = this.itemLabelPlural();
|
|
1055
1182
|
const label = itemLabelPlural
|
|
1056
1183
|
? itemLabelPlural
|
|
1057
1184
|
: this.getLabel(plural(this.entityName()));
|
|
1058
1185
|
return label instanceof Observable ? label : of(label);
|
|
1059
|
-
});
|
|
1186
|
+
}, ...(ngDevMode ? [{ debugName: "_itemLabelPlural" }] : []));
|
|
1060
1187
|
// Computed title
|
|
1061
1188
|
_title = computed(() => {
|
|
1062
1189
|
const title = this.title() ? this.title() : this._itemLabelPlural();
|
|
1063
1190
|
return title instanceof Observable ? title : of(title);
|
|
1064
|
-
});
|
|
1191
|
+
}, ...(ngDevMode ? [{ debugName: "_title" }] : []));
|
|
1065
1192
|
// endpoint with the QP string removed (if one was provided)
|
|
1066
|
-
_endpointSansParams = computed(() => this.endpoint().split('?')[0]);
|
|
1067
|
-
_endpointParams = computed(() => { });
|
|
1068
|
-
componentColumns = viewChildren(MatColumnDef);
|
|
1193
|
+
_endpointSansParams = computed(() => this.endpoint().split('?')[0], ...(ngDevMode ? [{ debugName: "_endpointSansParams" }] : []));
|
|
1194
|
+
_endpointParams = computed(() => { }, ...(ngDevMode ? [{ debugName: "_endpointParams" }] : []));
|
|
1195
|
+
componentColumns = viewChildren(MatColumnDef, ...(ngDevMode ? [{ debugName: "componentColumns" }] : []));
|
|
1069
1196
|
_clientColumnDefs;
|
|
1070
1197
|
/**
|
|
1071
1198
|
* Event raised for user selecting an item action. It's also raised
|
|
@@ -1084,7 +1211,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1084
1211
|
entityViewPaneActivated = new EventEmitter();
|
|
1085
1212
|
busyWheelId = `entityCrudBusyWheel-${Date.now()}`;
|
|
1086
1213
|
sub$ = new Subscription();
|
|
1087
|
-
spEntitiesList = viewChild('entitiesList');
|
|
1214
|
+
spEntitiesList = viewChild('entitiesList', ...(ngDevMode ? [{ debugName: "spEntitiesList" }] : []));
|
|
1088
1215
|
// Theoritically, we ought to be able to initialize the mat-entities-list
|
|
1089
1216
|
// columns from ngAfterViewInit lifecycle hook. But for some strange reason
|
|
1090
1217
|
// when this hook is called, sp-mat-entities-list has not been initialized.
|
|
@@ -1095,33 +1222,33 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1095
1222
|
if (this.spEntitiesList()) {
|
|
1096
1223
|
this._initEntitiesList();
|
|
1097
1224
|
}
|
|
1098
|
-
});
|
|
1225
|
+
}, ...(ngDevMode ? [{ debugName: "spEntitiesListInited" }] : []));
|
|
1099
1226
|
crudConfig;
|
|
1100
1227
|
// This is the internal component that will host the createEditFormTemplate
|
|
1101
|
-
createEditHostComponent = viewChild(FormViewHostComponent);
|
|
1228
|
+
createEditHostComponent = viewChild(FormViewHostComponent, ...(ngDevMode ? [{ debugName: "createEditHostComponent" }] : []));
|
|
1102
1229
|
// A flag to toggle the viewport's contents between the mat-table
|
|
1103
1230
|
// and the create/edit form template.
|
|
1104
|
-
createEditViewActive = signal(false);
|
|
1231
|
+
createEditViewActive = signal(false, ...(ngDevMode ? [{ debugName: "createEditViewActive" }] : []));
|
|
1105
1232
|
// Whether it's okay to cancel the edit
|
|
1106
1233
|
canCancelEditCallback;
|
|
1107
1234
|
// Preview host component
|
|
1108
|
-
previewHostComponent = viewChild(PreviewHostComponent);
|
|
1109
|
-
previewActive = computed(() => this.previewedEntity() !== undefined);
|
|
1110
|
-
previewedEntity = signal(undefined);
|
|
1235
|
+
previewHostComponent = viewChild(PreviewHostComponent, ...(ngDevMode ? [{ debugName: "previewHostComponent" }] : []));
|
|
1236
|
+
previewActive = computed(() => this.previewedEntity() !== undefined, ...(ngDevMode ? [{ debugName: "previewActive" }] : []));
|
|
1237
|
+
previewedEntity = signal(undefined, ...(ngDevMode ? [{ debugName: "previewedEntity" }] : []));
|
|
1111
1238
|
// Whether the pane that hosts the preview/edit-entity template is active.
|
|
1112
1239
|
// We call it entityPane as it's used to either render a selected entity
|
|
1113
1240
|
// or to edit one.
|
|
1114
|
-
entityPaneActive = computed(() => !!this.previewedEntity() || this.createEditViewActive());
|
|
1241
|
+
entityPaneActive = computed(() => !!this.previewedEntity() || this.createEditViewActive(), ...(ngDevMode ? [{ debugName: "entityPaneActive" }] : []));
|
|
1115
1242
|
// Effective width of the entity pane.
|
|
1116
1243
|
entityPaneWidth = computed(() => this.entityPaneActive()
|
|
1117
1244
|
? !!this.previewedEntity()
|
|
1118
1245
|
? this.previewPaneWidth()
|
|
1119
1246
|
: this.editPaneWidth()
|
|
1120
|
-
: 0);
|
|
1247
|
+
: 0, ...(ngDevMode ? [{ debugName: "entityPaneWidth" }] : []));
|
|
1121
1248
|
// Width of the pane showing the list of entities. Calculated as
|
|
1122
|
-
entitiesPaneWidth = computed(() => 100 - this.entityPaneWidth());
|
|
1123
|
-
entitiesPaneHidden = computed(() => this.entityPaneActive() && this.entityPaneWidth() === 100);
|
|
1124
|
-
defaultItemCrudActions = signal([]);
|
|
1249
|
+
entitiesPaneWidth = computed(() => 100 - this.entityPaneWidth(), ...(ngDevMode ? [{ debugName: "entitiesPaneWidth" }] : []));
|
|
1250
|
+
entitiesPaneHidden = computed(() => this.entityPaneActive() && this.entityPaneWidth() === 100, ...(ngDevMode ? [{ debugName: "entitiesPaneHidden" }] : []));
|
|
1251
|
+
defaultItemCrudActions = signal([], ...(ngDevMode ? [{ debugName: "defaultItemCrudActions" }] : []));
|
|
1125
1252
|
columnsWithAction = computed(() => {
|
|
1126
1253
|
const cols = clone(this.columns());
|
|
1127
1254
|
const actionDefined = cols.find((c) => typeof c === 'string' ? c === 'action' : c.name === 'action') !== undefined;
|
|
@@ -1129,7 +1256,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1129
1256
|
cols.push('action');
|
|
1130
1257
|
}
|
|
1131
1258
|
return cols;
|
|
1132
|
-
});
|
|
1259
|
+
}, ...(ngDevMode ? [{ debugName: "columnsWithAction" }] : []));
|
|
1133
1260
|
// Provide per entity actions as a function so that the actions are
|
|
1134
1261
|
// enumerated only when the user clicks on the context menu button.
|
|
1135
1262
|
_itemActions = (entity) => this.getItemActions(entity);
|
|
@@ -1143,7 +1270,7 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1143
1270
|
? this.columnsWithAction()
|
|
1144
1271
|
.map((col) => (typeof col === 'string' ? col : col.name))
|
|
1145
1272
|
.filter((name) => name !== 'action')
|
|
1146
|
-
: []);
|
|
1273
|
+
: [], ...(ngDevMode ? [{ debugName: "visibleColumns" }] : []));
|
|
1147
1274
|
transloco = inject(TranslocoService);
|
|
1148
1275
|
constructor(http, snackBar, sanitizer, injector) {
|
|
1149
1276
|
super(http, sanitizer, injector);
|
|
@@ -1276,23 +1403,6 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1276
1403
|
}
|
|
1277
1404
|
}));
|
|
1278
1405
|
}
|
|
1279
|
-
loadEntity(id, params) {
|
|
1280
|
-
const crudOpFn = this.crudOpFn();
|
|
1281
|
-
if (crudOpFn) {
|
|
1282
|
-
return crudOpFn('get', id, undefined, this);
|
|
1283
|
-
}
|
|
1284
|
-
else {
|
|
1285
|
-
const httpParams = params instanceof HttpParams
|
|
1286
|
-
? params
|
|
1287
|
-
: new HttpParams({ fromString: params });
|
|
1288
|
-
return this.http
|
|
1289
|
-
.get(this.getEntityUrl(id), {
|
|
1290
|
-
context: this.getCrudReqHttpContext('retrieve'),
|
|
1291
|
-
params: httpParams,
|
|
1292
|
-
})
|
|
1293
|
-
.pipe(map((entity) => this.getCrudOpResponseParser()(this.entityName(), this.idKey(), 'retrieve', entity)));
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
1406
|
// END SPMatEntityCrudComponentBase METHODS //
|
|
1297
1407
|
/**
|
|
1298
1408
|
* Thunk these methods to the internal <sp-mat-entity-list> component.
|
|
@@ -1733,8 +1843,8 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1733
1843
|
spEntitiesList.loadMoreEntities();
|
|
1734
1844
|
}
|
|
1735
1845
|
}
|
|
1736
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1737
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
1846
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SPMatEntityCrudComponent, deps: [{ token: i1$1.HttpClient }, { token: i2$1.MatSnackBar }, { token: i3$2.DomSanitizer }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
1847
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", 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 }, formPaneWrapperClass: { classPropertyName: "formPaneWrapperClass", publicName: "formPaneWrapperClass", isSignal: true, isRequired: false, transformFunction: null }, formPaneContentClass: { classPropertyName: "formPaneContentClass", publicName: "formPaneContentClass", 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: ["entitiesList"], 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: `
|
|
1738
1848
|
<as-split direction="horizontal" [gutterSize]="6" *transloco="let t">
|
|
1739
1849
|
<as-split-area
|
|
1740
1850
|
[size]="entitiesPaneWidth()"
|
|
@@ -1745,50 +1855,56 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1745
1855
|
|
|
1746
1856
|
<ng-template #defaultActionButtons>
|
|
1747
1857
|
<div class="action-bar-actions">
|
|
1748
|
-
@if (!disableCreate()) {
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1858
|
+
@if (!disableCreate()) {
|
|
1859
|
+
@if (newItemSubTypes()) {
|
|
1860
|
+
<!-- New {{item}} displays a dropdown menu from which the subtype can be selected -->
|
|
1861
|
+
<button
|
|
1862
|
+
type="button"
|
|
1863
|
+
mat-raised-button
|
|
1864
|
+
color="primary"
|
|
1865
|
+
[matMenuTriggerFor]="newSubTypesMenu"
|
|
1866
|
+
>
|
|
1867
|
+
{{
|
|
1868
|
+
newItemLabel() ??
|
|
1869
|
+
t('spMatEntityCrud.newItem', {
|
|
1870
|
+
item: _itemLabel() | async,
|
|
1871
|
+
})
|
|
1872
|
+
}}
|
|
1873
|
+
<mat-icon>expand_circle_down</mat-icon>
|
|
1874
|
+
</button>
|
|
1875
|
+
<mat-menu #newSubTypesMenu="matMenu">
|
|
1876
|
+
@for (subtype of newItemSubTypes(); track $index) {
|
|
1877
|
+
@if (subtype.role) {
|
|
1878
|
+
<button
|
|
1879
|
+
mat-menu-item
|
|
1880
|
+
(click)="handleNewItemSubType(subtype)"
|
|
1881
|
+
>
|
|
1882
|
+
{{ subtype.label }}
|
|
1883
|
+
</button>
|
|
1884
|
+
} @else {
|
|
1885
|
+
<div style="padding: .2em 0.5em;">
|
|
1886
|
+
<strong>{{ subtype.label }}</strong>
|
|
1887
|
+
</div>
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
</mat-menu>
|
|
1770
1891
|
} @else {
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
})
|
|
1788
|
-
}}
|
|
1789
|
-
<mat-icon>add_circle</mat-icon>
|
|
1790
|
-
</button>
|
|
1791
|
-
} }
|
|
1892
|
+
<button
|
|
1893
|
+
mat-raised-button
|
|
1894
|
+
color="primary"
|
|
1895
|
+
(click)="onCreate($event)"
|
|
1896
|
+
[routerLink]="newItemLink()"
|
|
1897
|
+
>
|
|
1898
|
+
{{
|
|
1899
|
+
newItemLabel() ??
|
|
1900
|
+
t('spMatEntityCrud.newItem', {
|
|
1901
|
+
item: _itemLabel() | async,
|
|
1902
|
+
})
|
|
1903
|
+
}}
|
|
1904
|
+
<mat-icon>add_circle</mat-icon>
|
|
1905
|
+
</button>
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1792
1908
|
</div>
|
|
1793
1909
|
</ng-template>
|
|
1794
1910
|
|
|
@@ -1800,9 +1916,9 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1800
1916
|
<span class="spacer"></span>
|
|
1801
1917
|
<!-- Hide the action buttons when Preview/Edit pane is active -->
|
|
1802
1918
|
@if (!entityPaneActive()) {
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1919
|
+
<ng-container
|
|
1920
|
+
[ngTemplateOutlet]="actionsTemplate() || defaultActionButtons"
|
|
1921
|
+
></ng-container>
|
|
1806
1922
|
}
|
|
1807
1923
|
</div>
|
|
1808
1924
|
</ng-template>
|
|
@@ -1873,9 +1989,9 @@ class SPMatEntityCrudComponent extends SPMatEntityListComponent {
|
|
|
1873
1989
|
</div>
|
|
1874
1990
|
</as-split-area>
|
|
1875
1991
|
</as-split>
|
|
1876
|
-
`, isInline: true, styles: [".sp-hidden{display:none}.sp-visible{display:inherit;height:100%!important;width:100%!important}.entity-pane-wrapper{height:100%!important;width:100%!important}.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: "
|
|
1992
|
+
`, isInline: true, styles: [".sp-hidden{display:none}.sp-visible{display:inherit;height:100%!important;width:100%!important}.entity-pane-wrapper{height:100%!important;width:100%!important}.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: i2.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { 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: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "directive", type: i3$1.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"] }, { kind: "directive", type: SPMatHostBusyWheelDirective, selector: "[spHostBusyWheel]", inputs: ["spHostBusyWheel"] }, { kind: "component", type: PreviewHostComponent, selector: "sp-entity-crud-preview-host", inputs: ["entityCrudComponentBase", "clientViewTemplate"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1877
1993
|
}
|
|
1878
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1994
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: SPMatEntityCrudComponent, decorators: [{
|
|
1879
1995
|
type: Component,
|
|
1880
1996
|
args: [{ imports: [
|
|
1881
1997
|
CommonModule,
|
|
@@ -1904,50 +2020,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1904
2020
|
|
|
1905
2021
|
<ng-template #defaultActionButtons>
|
|
1906
2022
|
<div class="action-bar-actions">
|
|
1907
|
-
@if (!disableCreate()) {
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
2023
|
+
@if (!disableCreate()) {
|
|
2024
|
+
@if (newItemSubTypes()) {
|
|
2025
|
+
<!-- New {{item}} displays a dropdown menu from which the subtype can be selected -->
|
|
2026
|
+
<button
|
|
2027
|
+
type="button"
|
|
2028
|
+
mat-raised-button
|
|
2029
|
+
color="primary"
|
|
2030
|
+
[matMenuTriggerFor]="newSubTypesMenu"
|
|
2031
|
+
>
|
|
2032
|
+
{{
|
|
2033
|
+
newItemLabel() ??
|
|
2034
|
+
t('spMatEntityCrud.newItem', {
|
|
2035
|
+
item: _itemLabel() | async,
|
|
2036
|
+
})
|
|
2037
|
+
}}
|
|
2038
|
+
<mat-icon>expand_circle_down</mat-icon>
|
|
2039
|
+
</button>
|
|
2040
|
+
<mat-menu #newSubTypesMenu="matMenu">
|
|
2041
|
+
@for (subtype of newItemSubTypes(); track $index) {
|
|
2042
|
+
@if (subtype.role) {
|
|
2043
|
+
<button
|
|
2044
|
+
mat-menu-item
|
|
2045
|
+
(click)="handleNewItemSubType(subtype)"
|
|
2046
|
+
>
|
|
2047
|
+
{{ subtype.label }}
|
|
2048
|
+
</button>
|
|
2049
|
+
} @else {
|
|
2050
|
+
<div style="padding: .2em 0.5em;">
|
|
2051
|
+
<strong>{{ subtype.label }}</strong>
|
|
2052
|
+
</div>
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
</mat-menu>
|
|
1929
2056
|
} @else {
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
})
|
|
1947
|
-
}}
|
|
1948
|
-
<mat-icon>add_circle</mat-icon>
|
|
1949
|
-
</button>
|
|
1950
|
-
} }
|
|
2057
|
+
<button
|
|
2058
|
+
mat-raised-button
|
|
2059
|
+
color="primary"
|
|
2060
|
+
(click)="onCreate($event)"
|
|
2061
|
+
[routerLink]="newItemLink()"
|
|
2062
|
+
>
|
|
2063
|
+
{{
|
|
2064
|
+
newItemLabel() ??
|
|
2065
|
+
t('spMatEntityCrud.newItem', {
|
|
2066
|
+
item: _itemLabel() | async,
|
|
2067
|
+
})
|
|
2068
|
+
}}
|
|
2069
|
+
<mat-icon>add_circle</mat-icon>
|
|
2070
|
+
</button>
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
1951
2073
|
</div>
|
|
1952
2074
|
</ng-template>
|
|
1953
2075
|
|
|
@@ -1959,9 +2081,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
1959
2081
|
<span class="spacer"></span>
|
|
1960
2082
|
<!-- Hide the action buttons when Preview/Edit pane is active -->
|
|
1961
2083
|
@if (!entityPaneActive()) {
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
2084
|
+
<ng-container
|
|
2085
|
+
[ngTemplateOutlet]="actionsTemplate() || defaultActionButtons"
|
|
2086
|
+
></ng-container>
|
|
1965
2087
|
}
|
|
1966
2088
|
</div>
|
|
1967
2089
|
</ng-template>
|
|
@@ -2033,148 +2155,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImpor
|
|
|
2033
2155
|
</as-split-area>
|
|
2034
2156
|
</as-split>
|
|
2035
2157
|
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".sp-hidden{display:none}.sp-visible{display:inherit;height:100%!important;width:100%!important}.entity-pane-wrapper{height:100%!important;width:100%!important}.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"] }]
|
|
2036
|
-
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2$1.MatSnackBar }, { type: i3$
|
|
2158
|
+
}], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.MatSnackBar }, { type: i3$2.DomSanitizer }, { type: i0.Injector }], propDecorators: { itemLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemLabel", required: false }] }], itemLabelPlural: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemLabelPlural", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], itemActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemActions", required: false }] }], newItemLink: [{ type: i0.Input, args: [{ isSignal: true, alias: "newItemLink", required: false }] }], newItemLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "newItemLabel", required: false }] }], editItemTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "editItemTitle", required: false }] }], newItemSubTypes: [{ type: i0.Input, args: [{ isSignal: true, alias: "newItemSubTypes", required: false }] }], crudOpFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "crudOpFn", required: false }] }], previewTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewTemplate", required: false }] }], allowEntityActionFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowEntityActionFn", required: false }] }], headerTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "headerTemplate", required: false }] }], actionsTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionsTemplate", required: false }] }], crudResponseParser: [{ type: i0.Input, args: [{ isSignal: true, alias: "crudResponseParser", required: false }] }], createEditFormTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "createEditFormTemplate", required: false }] }], disableItemActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableItemActions", required: false }] }], disableCreate: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableCreate", required: false }] }], refreshAfterEdit: [{ type: i0.Input, args: [{ isSignal: true, alias: "refreshAfterEdit", required: false }] }], crudHttpReqContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "crudHttpReqContext", required: false }] }], editPaneWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "editPaneWidth", required: false }] }], previewPaneWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewPaneWidth", required: false }] }], listPaneWrapperClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "listPaneWrapperClass", required: false }] }], previewPaneWrapperClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewPaneWrapperClass", required: false }] }], previewPaneContentClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "previewPaneContentClass", required: false }] }], formPaneWrapperClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "formPaneWrapperClass", required: false }] }], formPaneContentClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "formPaneContentClass", required: false }] }], componentColumns: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => MatColumnDef), { isSignal: true }] }], _clientColumnDefs: [{
|
|
2037
2159
|
type: ContentChildren,
|
|
2038
2160
|
args: [MatColumnDef]
|
|
2039
2161
|
}], action: [{
|
|
2040
2162
|
type: Output
|
|
2041
2163
|
}], entityViewPaneActivated: [{
|
|
2042
2164
|
type: Output
|
|
2043
|
-
}] } });
|
|
2044
|
-
|
|
2045
|
-
const ITEM_ACTION_UPDATE = '_update_';
|
|
2046
|
-
const ITEM_ACTION_DELETE = '_delete_';
|
|
2047
|
-
|
|
2048
|
-
/**
|
|
2049
|
-
* A preview pane container to provide a consistent UX for all preview panes.
|
|
2050
|
-
* It consits of a toolbar on the top and a container div below that takes up
|
|
2051
|
-
* the rest of the preview pane area.
|
|
2052
|
-
*/
|
|
2053
|
-
class SPMatEntityCrudPreviewPaneComponent {
|
|
2054
|
-
entity = input.required();
|
|
2055
|
-
entityCrudComponent = input.required();
|
|
2056
|
-
title = input();
|
|
2057
|
-
disableUpdate = input(false);
|
|
2058
|
-
hideUpdate = input(false);
|
|
2059
|
-
disableDelete = input(false);
|
|
2060
|
-
hideDelete = input(false);
|
|
2061
|
-
itemActions;
|
|
2062
|
-
_disableActionFactory = (role, signal) => {
|
|
2063
|
-
return computed(() => {
|
|
2064
|
-
if (signal && signal()) {
|
|
2065
|
-
return true;
|
|
2066
|
-
}
|
|
2067
|
-
const actionFn = this.itemActions.find((a) => a.role === role)?.disable;
|
|
2068
|
-
if (actionFn && actionFn(this.entity())) {
|
|
2069
|
-
return true;
|
|
2070
|
-
}
|
|
2071
|
-
return false;
|
|
2072
|
-
});
|
|
2073
|
-
};
|
|
2074
|
-
_disableUpdate = this._disableActionFactory(ITEM_ACTION_UPDATE, this.disableUpdate);
|
|
2075
|
-
_disableDelete = this._disableActionFactory(ITEM_ACTION_DELETE, this.disableDelete);
|
|
2076
|
-
ngOnInit() {
|
|
2077
|
-
this.itemActions = this.entityCrudComponent().getItemActions();
|
|
2078
|
-
}
|
|
2079
|
-
ngOnDestroy() { }
|
|
2080
|
-
onEdit() {
|
|
2081
|
-
this.entityCrudComponent().triggerEntityUpdate(this.entity());
|
|
2082
|
-
}
|
|
2083
|
-
onDelete() {
|
|
2084
|
-
this.entityCrudComponent().triggerEntityDelete(this.entity());
|
|
2085
|
-
}
|
|
2086
|
-
onClose() {
|
|
2087
|
-
this.entityCrudComponent().closePreview();
|
|
2088
|
-
}
|
|
2089
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatEntityCrudPreviewPaneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2090
|
-
/** @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: `
|
|
2091
|
-
<div class="preview-wrapper">
|
|
2092
|
-
<mat-toolbar>
|
|
2093
|
-
<mat-toolbar-row>
|
|
2094
|
-
@if (title()) {
|
|
2095
|
-
<h2>{{ title() }}</h2>
|
|
2096
|
-
} @if (!hideUpdate()) {
|
|
2097
|
-
<button
|
|
2098
|
-
mat-icon-button
|
|
2099
|
-
aria-label="Edit"
|
|
2100
|
-
(click)="onEdit()"
|
|
2101
|
-
[disabled]="_disableUpdate()"
|
|
2102
|
-
>
|
|
2103
|
-
<mat-icon>edit</mat-icon>
|
|
2104
|
-
</button>
|
|
2105
|
-
} @if (!hideDelete()) {
|
|
2106
|
-
<button
|
|
2107
|
-
mat-icon-button
|
|
2108
|
-
aria-label="Delete"
|
|
2109
|
-
(click)="onDelete()"
|
|
2110
|
-
[disabled]="_disableDelete()"
|
|
2111
|
-
>
|
|
2112
|
-
<mat-icon>delete</mat-icon>
|
|
2113
|
-
</button>
|
|
2114
|
-
}
|
|
2115
|
-
<ng-content select="[previewToolbarContent]"></ng-content>
|
|
2116
|
-
<span class="spacer"></span>
|
|
2117
|
-
<button mat-icon-button aria-label="Close" (click)="onClose()">
|
|
2118
|
-
<mat-icon>close</mat-icon>
|
|
2119
|
-
</button>
|
|
2120
|
-
</mat-toolbar-row>
|
|
2121
|
-
</mat-toolbar>
|
|
2122
|
-
<div
|
|
2123
|
-
[class]="
|
|
2124
|
-
'preview-content ' +
|
|
2125
|
-
entityCrudComponent().getPreviewPaneContentClass()
|
|
2126
|
-
"
|
|
2127
|
-
>
|
|
2128
|
-
<ng-content select="[previewContent]"></ng-content>
|
|
2129
|
-
</div>
|
|
2130
|
-
</div>
|
|
2131
|
-
`, isInline: true, styles: [".preview-wrapper{display:flex;flex-direction:column;height:100%!important;width:100%!important}mat-toolbar{background-color:var(--mat-sys-surface-variant)}.spacer{flex:1 1 auto}.preview-content{padding:.4em;flex-grow:1;overflow:scroll}\n"], dependencies: [{ kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i1$1.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "directive", type: i1$1.MatToolbarRow, selector: "mat-toolbar-row", exportAs: ["matToolbarRow"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2132
|
-
}
|
|
2133
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: SPMatEntityCrudPreviewPaneComponent, decorators: [{
|
|
2134
|
-
type: Component,
|
|
2135
|
-
args: [{ imports: [MatToolbarModule, MatButtonModule, MatIconModule], selector: 'sp-mat-entity-crud-preview-pane', template: `
|
|
2136
|
-
<div class="preview-wrapper">
|
|
2137
|
-
<mat-toolbar>
|
|
2138
|
-
<mat-toolbar-row>
|
|
2139
|
-
@if (title()) {
|
|
2140
|
-
<h2>{{ title() }}</h2>
|
|
2141
|
-
} @if (!hideUpdate()) {
|
|
2142
|
-
<button
|
|
2143
|
-
mat-icon-button
|
|
2144
|
-
aria-label="Edit"
|
|
2145
|
-
(click)="onEdit()"
|
|
2146
|
-
[disabled]="_disableUpdate()"
|
|
2147
|
-
>
|
|
2148
|
-
<mat-icon>edit</mat-icon>
|
|
2149
|
-
</button>
|
|
2150
|
-
} @if (!hideDelete()) {
|
|
2151
|
-
<button
|
|
2152
|
-
mat-icon-button
|
|
2153
|
-
aria-label="Delete"
|
|
2154
|
-
(click)="onDelete()"
|
|
2155
|
-
[disabled]="_disableDelete()"
|
|
2156
|
-
>
|
|
2157
|
-
<mat-icon>delete</mat-icon>
|
|
2158
|
-
</button>
|
|
2159
|
-
}
|
|
2160
|
-
<ng-content select="[previewToolbarContent]"></ng-content>
|
|
2161
|
-
<span class="spacer"></span>
|
|
2162
|
-
<button mat-icon-button aria-label="Close" (click)="onClose()">
|
|
2163
|
-
<mat-icon>close</mat-icon>
|
|
2164
|
-
</button>
|
|
2165
|
-
</mat-toolbar-row>
|
|
2166
|
-
</mat-toolbar>
|
|
2167
|
-
<div
|
|
2168
|
-
[class]="
|
|
2169
|
-
'preview-content ' +
|
|
2170
|
-
entityCrudComponent().getPreviewPaneContentClass()
|
|
2171
|
-
"
|
|
2172
|
-
>
|
|
2173
|
-
<ng-content select="[previewContent]"></ng-content>
|
|
2174
|
-
</div>
|
|
2175
|
-
</div>
|
|
2176
|
-
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".preview-wrapper{display:flex;flex-direction:column;height:100%!important;width:100%!important}mat-toolbar{background-color:var(--mat-sys-surface-variant)}.spacer{flex:1 1 auto}.preview-content{padding:.4em;flex-grow:1;overflow:scroll}\n"] }]
|
|
2177
|
-
}] });
|
|
2165
|
+
}], spEntitiesList: [{ type: i0.ViewChild, args: ['entitiesList', { isSignal: true }] }], createEditHostComponent: [{ type: i0.ViewChild, args: [i0.forwardRef(() => FormViewHostComponent), { isSignal: true }] }], previewHostComponent: [{ type: i0.ViewChild, args: [i0.forwardRef(() => PreviewHostComponent), { isSignal: true }] }] } });
|
|
2178
2166
|
|
|
2179
2167
|
/**
|
|
2180
2168
|
* Generated bundle index. Do not edit.
|