@processpuzzle/base-entity 0.3.4 → 0.3.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@processpuzzle/base-entity",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Zsolt Zsuffa",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
},
|
|
17
17
|
"homepage": "https://github.com/ZsZs/processpuzzle#readme",
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@angular/cdk": "^21.2.
|
|
20
|
-
"@angular/common": "~21.2.
|
|
21
|
-
"@angular/core": "~21.2.
|
|
22
|
-
"@angular/forms": "~21.2.
|
|
23
|
-
"@angular/material": "^21.2.
|
|
24
|
-
"@angular/platform-browser": "~21.2.
|
|
25
|
-
"@angular/router": "~21.2.
|
|
19
|
+
"@angular/cdk": "^21.2.3",
|
|
20
|
+
"@angular/common": "~21.2.5",
|
|
21
|
+
"@angular/core": "~21.2.5",
|
|
22
|
+
"@angular/forms": "~21.2.5",
|
|
23
|
+
"@angular/material": "^21.2.3",
|
|
24
|
+
"@angular/platform-browser": "~21.2.5",
|
|
25
|
+
"@angular/router": "~21.2.5",
|
|
26
26
|
"@angular/fire": "^20.0.1",
|
|
27
27
|
"@ngrx/operators": "^21.0.1",
|
|
28
28
|
"@ngrx/signals": "^21.0.1",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import * as _ngrx_signals from '@ngrx/signals';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
2
|
+
import { OnDestroy, OnInit, InjectionToken, ViewContainerRef, Signal, AfterViewInit, ProviderToken } from '@angular/core';
|
|
3
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
4
|
+
import * as _ngrx_signals from '@ngrx/signals';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
6
|
+
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
7
|
+
import { WhereFilterOp, Firestore } from '@angular/fire/firestore';
|
|
4
8
|
import { FormGroup } from '@angular/forms';
|
|
5
9
|
import { MatTableDataSource } from '@angular/material/table';
|
|
6
10
|
import { MatSort } from '@angular/material/sort';
|
|
@@ -8,8 +12,6 @@ import * as _angular_material_paginator from '@angular/material/paginator';
|
|
|
8
12
|
import { MatPaginator } from '@angular/material/paginator';
|
|
9
13
|
import { Router, Routes } from '@angular/router';
|
|
10
14
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
11
|
-
import { WhereFilterOp, Firestore } from '@angular/fire/firestore';
|
|
12
|
-
import { Observable } from 'rxjs';
|
|
13
15
|
import * as _processpuzzle_base_entity from '@processpuzzle/base-entity';
|
|
14
16
|
import * as _ngrx_signals_rxjs_interop from '@ngrx/signals/rxjs-interop';
|
|
15
17
|
import * as _firebase_firestore from '@firebase/firestore';
|
|
@@ -36,6 +38,25 @@ declare abstract class AbstractAttrDescriptor {
|
|
|
36
38
|
protected constructor(attrName: string, formControlType: FormControlType);
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
interface BaseEntityDescriptor {
|
|
42
|
+
store: any;
|
|
43
|
+
attrDescriptors: AbstractAttrDescriptor[];
|
|
44
|
+
entityName: string;
|
|
45
|
+
entityTitle: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare class BaseEntityContainerComponent implements OnDestroy, OnInit {
|
|
49
|
+
baseEntityListOptions: i0.InputSignal<BaseEntityDescriptor>;
|
|
50
|
+
protected snackBar: MatSnackBar;
|
|
51
|
+
store: any;
|
|
52
|
+
constructor();
|
|
53
|
+
ngOnDestroy(): void;
|
|
54
|
+
ngOnInit(): void;
|
|
55
|
+
private registerEffects;
|
|
56
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityContainerComponent, never>;
|
|
57
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityContainerComponent, "base-entity-container", never, { "baseEntityListOptions": { "alias": "baseEntityListOptions"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
58
|
+
}
|
|
59
|
+
|
|
39
60
|
declare function BaseEntityContainerStore(): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
40
61
|
state: {
|
|
41
62
|
filterKey: string | undefined;
|
|
@@ -50,6 +71,76 @@ interface BaseEntity {
|
|
|
50
71
|
readonly id: string;
|
|
51
72
|
}
|
|
52
73
|
|
|
74
|
+
interface BaseEntityMapper<Entity extends BaseEntity> {
|
|
75
|
+
fromDto(dto: any, index?: number): Entity;
|
|
76
|
+
toDto(entity: Entity): any;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
interface OrderByCondition<Entity extends BaseEntity> {
|
|
80
|
+
field: keyof Entity;
|
|
81
|
+
order?: OrderByDirection;
|
|
82
|
+
}
|
|
83
|
+
interface FilterCondition {
|
|
84
|
+
property: string;
|
|
85
|
+
operator: WhereFilterOp;
|
|
86
|
+
value: string;
|
|
87
|
+
}
|
|
88
|
+
declare enum OrderByDirection {
|
|
89
|
+
ASC = "asc",
|
|
90
|
+
DESC = "desc"
|
|
91
|
+
}
|
|
92
|
+
interface OrderBy {
|
|
93
|
+
property: string;
|
|
94
|
+
direction: string;
|
|
95
|
+
}
|
|
96
|
+
interface BaseEntityQueryCondition {
|
|
97
|
+
path?: string;
|
|
98
|
+
hash?: string;
|
|
99
|
+
page?: number;
|
|
100
|
+
pageSize?: number;
|
|
101
|
+
pathParams?: Map<string, string>;
|
|
102
|
+
filters?: FilterCondition[];
|
|
103
|
+
orderBys?: OrderBy[];
|
|
104
|
+
}
|
|
105
|
+
interface BaseEntityLoadResponse<Entity extends BaseEntity> {
|
|
106
|
+
page: number | undefined;
|
|
107
|
+
pageSize: number | undefined;
|
|
108
|
+
totalPageCount: number | undefined;
|
|
109
|
+
content: Entity[];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
declare const BASE_ENTITY_SERVICE: InjectionToken<BaseEntityService<any>>;
|
|
113
|
+
interface BaseEntityService<Entity extends BaseEntity> {
|
|
114
|
+
add(entity: Entity, id?: number): Observable<Entity>;
|
|
115
|
+
delete(id: string): Observable<unknown>;
|
|
116
|
+
deleteAll(): Observable<unknown>;
|
|
117
|
+
findAll(page?: number, pageSize?: number): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
118
|
+
findById(id: string): Observable<Entity | void>;
|
|
119
|
+
findByQuery(condition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
120
|
+
update(entity: Entity): Observable<Entity>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
declare abstract class BaseEntityRestService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
124
|
+
protected entityMapper: BaseEntityMapper<Entity>;
|
|
125
|
+
protected urlProperty: string;
|
|
126
|
+
protected resourceUrl: string;
|
|
127
|
+
private readonly runtimeConfiguration;
|
|
128
|
+
private readonly baseUrl;
|
|
129
|
+
protected httpClient: HttpClient;
|
|
130
|
+
protected headers: HttpHeaders;
|
|
131
|
+
protected constructor(entityMapper: BaseEntityMapper<Entity>, urlProperty: string, resourceUrl: string);
|
|
132
|
+
delete(id: string): Observable<unknown>;
|
|
133
|
+
deleteAll(): Observable<any>;
|
|
134
|
+
findAll(page?: number): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
135
|
+
findByQuery(queryCondition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
136
|
+
findById(id: string): Observable<void | Entity>;
|
|
137
|
+
add(entity: Entity, id?: number): Observable<Entity>;
|
|
138
|
+
update(entity: Entity): Observable<Entity>;
|
|
139
|
+
protected buildFullUrl(resourceUri: string, queryCondition: BaseEntityQueryCondition): string | undefined;
|
|
140
|
+
private mapPagedResponse;
|
|
141
|
+
private mapSimpleResponse;
|
|
142
|
+
}
|
|
143
|
+
|
|
53
144
|
declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
54
145
|
description?: string;
|
|
55
146
|
styleClass?: string | undefined;
|
|
@@ -79,13 +170,6 @@ declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
|
79
170
|
set linkedEntityType(linkedEntityType: string);
|
|
80
171
|
}
|
|
81
172
|
|
|
82
|
-
interface BaseEntityDescriptor {
|
|
83
|
-
store: any;
|
|
84
|
-
attrDescriptors: AbstractAttrDescriptor[];
|
|
85
|
-
entityName: string;
|
|
86
|
-
entityTitle: string;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
173
|
declare class BaseFormHostDirective {
|
|
90
174
|
viewContainerRef: ViewContainerRef;
|
|
91
175
|
constructor(viewContainerRef: ViewContainerRef);
|
|
@@ -103,6 +187,7 @@ declare class BaseEntityFormComponent<Entity extends BaseEntity> implements OnIn
|
|
|
103
187
|
private readonly entityFormBuilder;
|
|
104
188
|
private readonly formBuilder;
|
|
105
189
|
private readonly isNewObject;
|
|
190
|
+
private readonly logger;
|
|
106
191
|
constructor();
|
|
107
192
|
ngOnInit(): void;
|
|
108
193
|
onCancel(): Promise<void>;
|
|
@@ -117,6 +202,7 @@ declare class BaseEntityListComponent<Entity extends BaseEntity> implements Afte
|
|
|
117
202
|
dataSource: MatTableDataSource<Entity>;
|
|
118
203
|
selection: SelectionModel<Entity>;
|
|
119
204
|
private readonly entityDescriptor;
|
|
205
|
+
private readonly logger;
|
|
120
206
|
columnDescriptors: Signal<BaseEntityAttrDescriptor[]>;
|
|
121
207
|
displayedColumns: Signal<string[]>;
|
|
122
208
|
sort: MatSort;
|
|
@@ -142,44 +228,6 @@ declare class BaseEntityListComponent<Entity extends BaseEntity> implements Afte
|
|
|
142
228
|
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityListComponent<any>, "base-list", never, {}, {}, never, never, true, never>;
|
|
143
229
|
}
|
|
144
230
|
|
|
145
|
-
interface OrderByCondition<Entity extends BaseEntity> {
|
|
146
|
-
field: keyof Entity;
|
|
147
|
-
order?: OrderByDirection;
|
|
148
|
-
}
|
|
149
|
-
interface FilterCondition {
|
|
150
|
-
property: string;
|
|
151
|
-
operator: WhereFilterOp;
|
|
152
|
-
value: string;
|
|
153
|
-
}
|
|
154
|
-
declare enum OrderByDirection {
|
|
155
|
-
ASC = "asc",
|
|
156
|
-
DESC = "desc"
|
|
157
|
-
}
|
|
158
|
-
interface OrderBy {
|
|
159
|
-
property: string;
|
|
160
|
-
direction: string;
|
|
161
|
-
}
|
|
162
|
-
interface BaseEntityQueryCondition {
|
|
163
|
-
path?: string;
|
|
164
|
-
hash?: string;
|
|
165
|
-
page?: number;
|
|
166
|
-
pageSize?: number;
|
|
167
|
-
pathParams?: Map<string, string>;
|
|
168
|
-
filters?: FilterCondition[];
|
|
169
|
-
orderBys?: OrderBy[];
|
|
170
|
-
}
|
|
171
|
-
interface BaseEntityLoadResponse<Entity extends BaseEntity> {
|
|
172
|
-
page: number | undefined;
|
|
173
|
-
pageSize: number | undefined;
|
|
174
|
-
totalPageCount: number | undefined;
|
|
175
|
-
content: Entity[];
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
interface BaseEntityMapper<Entity extends BaseEntity> {
|
|
179
|
-
fromDto(dto: any, index?: number): Entity;
|
|
180
|
-
toDto(entity: Entity): any;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
231
|
declare function BaseEntityTabsStore(): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
184
232
|
state: {
|
|
185
233
|
activeTabs: string[];
|
|
@@ -193,17 +241,6 @@ declare function BaseEntityTabsStore(): _ngrx_signals.SignalStoreFeature<_ngrx_s
|
|
|
193
241
|
};
|
|
194
242
|
}>;
|
|
195
243
|
|
|
196
|
-
declare const BASE_ENTITY_SERVICE: InjectionToken<BaseEntityService<any>>;
|
|
197
|
-
interface BaseEntityService<Entity extends BaseEntity> {
|
|
198
|
-
add(entity: Entity, id?: number): Observable<Entity>;
|
|
199
|
-
delete(id: string): Observable<unknown>;
|
|
200
|
-
deleteAll(): Observable<unknown>;
|
|
201
|
-
findAll(page?: number, pageSize?: number): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
202
|
-
findById(id: string): Observable<Entity | void>;
|
|
203
|
-
findByQuery(condition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
204
|
-
update(entity: Entity): Observable<Entity>;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
244
|
declare const BASE_ENTITY_STORE: InjectionToken<any>;
|
|
208
245
|
declare function BaseEntityStore<Entity extends BaseEntity>(entityType: new () => Entity, repositoryType: ProviderToken<BaseEntityService<Entity>>): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
209
246
|
state: {
|
|
@@ -341,5 +378,5 @@ declare function getEntityIds(instance: any): string[];
|
|
|
341
378
|
|
|
342
379
|
declare const BASE_ENTITY_ROUTES: Routes;
|
|
343
380
|
|
|
344
|
-
export { AbstractAttrDescriptor, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerStore, BaseEntityFirestoreService, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorStore, Entity, FlexDirection, FlexboxDescriptor, FormControlType, Id, OrderByDirection, RouteSegments, getEntityIds, getEntityOptions };
|
|
381
|
+
export { AbstractAttrDescriptor, BASE_ENTITY_ROUTES, BASE_ENTITY_SERVICE, BASE_ENTITY_STORE, BASE_LIST_DESCRIPTORS, BaseEntityAttrDescriptor, BaseEntityContainerComponent, BaseEntityContainerStore, BaseEntityFirestoreService, BaseEntityFormComponent, BaseEntityListComponent, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseFormHostDirective, BaseFormNavigatorStore, Entity, FlexDirection, FlexboxDescriptor, FormControlType, Id, OrderByDirection, RouteSegments, getEntityIds, getEntityOptions };
|
|
345
382
|
export type { BaseEntity, BaseEntityDescriptor, BaseEntityLoadResponse, BaseEntityMapper, BaseEntityQueryCondition, EntityOptions, FilterCondition, NavigationState, OrderByCondition };
|