@processpuzzle/base-entity 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -129
- package/fesm2022/processpuzzle-base-entity.mjs +175 -99
- package/fesm2022/processpuzzle-base-entity.mjs.map +1 -1
- package/index.d.ts +378 -3
- package/package.json +26 -16
- package/lib/base-entity/abstact-attr.descriptor.d.ts +0 -21
- package/lib/base-entity/base-entity-attr.descriptor.d.ts +0 -29
- package/lib/base-entity/base-entity.d.ts +0 -3
- package/lib/base-entity/base-entity.descriptor.d.ts +0 -7
- package/lib/base-entity/filter-attr-descriptor.d.ts +0 -3
- package/lib/base-entity/flexboxDescriptor.d.ts +0 -11
- package/lib/base-entity-container.component.d.ts +0 -15
- package/lib/base-entity-container.store.d.ts +0 -12
- package/lib/base-entity-service/base-entity-firestore.service.d.ts +0 -27
- package/lib/base-entity-service/base-entity-load-response.d.ts +0 -48
- package/lib/base-entity-service/base-entity-rest.service.d.ts +0 -26
- package/lib/base-entity-service/base-entity.service.d.ts +0 -14
- package/lib/base-entity-store/addEntity.d.ts +0 -9
- package/lib/base-entity-store/base-entity.store.d.ts +0 -78
- package/lib/base-entity-store/deleteAllEntities.d.ts +0 -9
- package/lib/base-entity-store/deleteEntity.d.ts +0 -9
- package/lib/base-entity-store/findByQuery.d.ts +0 -10
- package/lib/base-entity-store/updateEntity.d.ts +0 -9
- package/lib/base-entity.mapper.d.ts +0 -7
- package/lib/base-entity.routes.d.ts +0 -2
- package/lib/base-form/base-entity-form.builder.d.ts +0 -11
- package/lib/base-form/base-entity-form.component.d.ts +0 -24
- package/lib/base-form/base-form-control.component.d.ts +0 -17
- package/lib/base-form/base-form-host.directive.d.ts +0 -8
- package/lib/base-form/checkbox/checkbox.component.d.ts +0 -7
- package/lib/base-form/datepicker/datepicker.component.d.ts +0 -7
- package/lib/base-form/dropdown/dropdown.component.d.ts +0 -7
- package/lib/base-form/flex-box/flex-box-host.directive.d.ts +0 -8
- package/lib/base-form/flex-box/flex-box.component.d.ts +0 -11
- package/lib/base-form/foreign-key/foreign-key.component.d.ts +0 -8
- package/lib/base-form/label/label.component.d.ts +0 -7
- package/lib/base-form/radio/radio.component.d.ts +0 -7
- package/lib/base-form/textarea/textarea.component.d.ts +0 -7
- package/lib/base-form/textbox/textbox.component.d.ts +0 -7
- package/lib/base-form-navigator/base-form-navigator.store.d.ts +0 -30
- package/lib/base-form-navigator/base-url-segments.d.ts +0 -7
- package/lib/base-list/base-entity-list.component.d.ts +0 -38
- package/lib/base-statusbar/base-entity-statusbar.component.d.ts +0 -13
- package/lib/base-tabs/base-entity-tabs.component.d.ts +0 -18
- package/lib/base-tabs/base-entity-tabs.store.d.ts +0 -16
- package/lib/base-toolbar/base-entity-toolbar.component.d.ts +0 -19
- package/public-api.d.ts +0 -19
package/index.d.ts
CHANGED
|
@@ -1,5 +1,380 @@
|
|
|
1
|
+
import { Routes, Router } from '@angular/router';
|
|
2
|
+
import * as _ngrx_signals from '@ngrx/signals';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { OnDestroy, OnInit, ViewContainerRef, Signal, AfterViewInit, InjectionToken, ProviderToken } from '@angular/core';
|
|
5
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
6
|
+
import { FormGroup } from '@angular/forms';
|
|
7
|
+
import { MatTableDataSource } from '@angular/material/table';
|
|
8
|
+
import { MatSort } from '@angular/material/sort';
|
|
9
|
+
import { MatPaginator } from '@angular/material/paginator';
|
|
10
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
11
|
+
import { WhereFilterOp, Firestore } from '@angular/fire/firestore';
|
|
12
|
+
import { Observable } from 'rxjs';
|
|
13
|
+
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
14
|
+
import * as _processpuzzle_base_entity from '@processpuzzle/base-entity';
|
|
15
|
+
import * as _ngrx_signals_rxjs_interop from '@ngrx/signals/rxjs-interop';
|
|
16
|
+
import * as _angular_material_paginator_d from '@angular/material/paginator.d';
|
|
17
|
+
import * as _firebase_firestore from '@firebase/firestore';
|
|
18
|
+
|
|
19
|
+
declare enum FormControlType {
|
|
20
|
+
CHECKBOX = "CHECKBOX",
|
|
21
|
+
DATE = "DATE",
|
|
22
|
+
DROPDOWN = "DROPDOWN",
|
|
23
|
+
FLEX_BOX = "FLEX_BOX",
|
|
24
|
+
FOREIGN_KEY = "FOREIGN_KEY",
|
|
25
|
+
LABEL = "LABEL",
|
|
26
|
+
RADIO = "RADIO",
|
|
27
|
+
TITLE = "TITLE",
|
|
28
|
+
TEXT_BOX = "TEXT_BOX",
|
|
29
|
+
TEXTAREA = "TEXTAREA"
|
|
30
|
+
}
|
|
31
|
+
declare abstract class AbstractAttrDescriptor {
|
|
32
|
+
attrName: string;
|
|
33
|
+
formControlType: FormControlType;
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
style: {
|
|
36
|
+
[p: string]: any;
|
|
37
|
+
} | null | undefined;
|
|
38
|
+
protected constructor(attrName: string, formControlType: FormControlType);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare const BASE_ENTITY_ROUTES: Routes;
|
|
42
|
+
|
|
43
|
+
declare function BaseEntityContainerStore(): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
44
|
+
state: {
|
|
45
|
+
filterKey: string | undefined;
|
|
46
|
+
};
|
|
47
|
+
props: {};
|
|
48
|
+
methods: {
|
|
49
|
+
doFilter: (filterKey: string) => void;
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
52
|
+
|
|
53
|
+
interface BaseEntity {
|
|
54
|
+
readonly id: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface BaseEntityDescriptor {
|
|
58
|
+
store: any;
|
|
59
|
+
attrDescriptors: AbstractAttrDescriptor[];
|
|
60
|
+
entityName: string;
|
|
61
|
+
entityTitle: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare class BaseEntityContainerComponent implements OnDestroy, OnInit {
|
|
65
|
+
baseEntityListOptions: i0.InputSignal<BaseEntityDescriptor>;
|
|
66
|
+
protected snackBar: MatSnackBar;
|
|
67
|
+
store: any;
|
|
68
|
+
constructor();
|
|
69
|
+
ngOnDestroy(): void;
|
|
70
|
+
ngOnInit(): void;
|
|
71
|
+
private registerEffects;
|
|
72
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityContainerComponent, never>;
|
|
73
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityContainerComponent, "base-entity-container", never, { "baseEntityListOptions": { "alias": "baseEntityListOptions"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
77
|
+
description?: string;
|
|
78
|
+
styleClass?: string | undefined;
|
|
79
|
+
labelClass?: string;
|
|
80
|
+
format?: string;
|
|
81
|
+
isLinkToDetails?: boolean;
|
|
82
|
+
selectables?: Array<{
|
|
83
|
+
key: string;
|
|
84
|
+
value: any;
|
|
85
|
+
}>;
|
|
86
|
+
visible: boolean;
|
|
87
|
+
isHeading?: boolean;
|
|
88
|
+
placeholder?: string;
|
|
89
|
+
lines?: number;
|
|
90
|
+
options: {
|
|
91
|
+
inputType: 'text';
|
|
92
|
+
};
|
|
93
|
+
private _label?;
|
|
94
|
+
private _linkedEntityType?;
|
|
95
|
+
constructor(attrName: string, formControlType: FormControlType, label?: string, selectables?: Array<{
|
|
96
|
+
key: string;
|
|
97
|
+
value: any;
|
|
98
|
+
}>, isLinkToDetails?: boolean, options?: object);
|
|
99
|
+
get label(): string;
|
|
100
|
+
set label(label: string);
|
|
101
|
+
get linkedEntityType(): any;
|
|
102
|
+
set linkedEntityType(linkedEntityType: string);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare class BaseFormHostDirective {
|
|
106
|
+
viewContainerRef: ViewContainerRef;
|
|
107
|
+
constructor(viewContainerRef: ViewContainerRef);
|
|
108
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormHostDirective, never>;
|
|
109
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseFormHostDirective, "[baseFormHost]", never, {}, {}, never, never, true, never>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
declare class BaseEntityFormComponent<Entity extends BaseEntity> implements OnInit {
|
|
113
|
+
baseEntityForm: FormGroup;
|
|
114
|
+
baseEntityListOptions: Signal<BaseEntityDescriptor>;
|
|
115
|
+
entity: Signal<Entity>;
|
|
116
|
+
entityId: Signal<string>;
|
|
117
|
+
componentHost: BaseFormHostDirective;
|
|
118
|
+
store: Signal<any>;
|
|
119
|
+
private readonly entityFormBuilder;
|
|
120
|
+
private readonly formBuilder;
|
|
121
|
+
private readonly isNewObject;
|
|
122
|
+
constructor();
|
|
123
|
+
ngOnInit(): void;
|
|
124
|
+
onCancel(): Promise<void>;
|
|
125
|
+
onSubmit(): Promise<void>;
|
|
126
|
+
private registerEffects;
|
|
127
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormComponent<any>, never>;
|
|
128
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityFormComponent<any>, "base-form", never, { "entityId": { "alias": "entityId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
declare const BASE_LIST_DESCRIPTORS: InjectionToken<string[]>;
|
|
132
|
+
declare class BaseEntityListComponent<Entity extends BaseEntity> implements AfterViewInit, OnInit {
|
|
133
|
+
dataSource: MatTableDataSource<Entity>;
|
|
134
|
+
selection: SelectionModel<Entity>;
|
|
135
|
+
private readonly entityDescriptor;
|
|
136
|
+
columnDescriptors: Signal<BaseEntityAttrDescriptor[]>;
|
|
137
|
+
displayedColumns: Signal<string[]>;
|
|
138
|
+
sort: MatSort;
|
|
139
|
+
paginator: MatPaginator;
|
|
140
|
+
store: any;
|
|
141
|
+
router: Router;
|
|
142
|
+
constructor();
|
|
143
|
+
ngAfterViewInit(): void;
|
|
144
|
+
ngOnInit(): void;
|
|
145
|
+
onChangeSelection(entity?: Entity): void;
|
|
146
|
+
onNavigateToDetails(entity: Entity): void;
|
|
147
|
+
onNavigateToRelated(config: BaseEntityAttrDescriptor, entity: Entity): void;
|
|
148
|
+
onRowClick(entity: Entity): void;
|
|
149
|
+
onToggleAllRows(): void;
|
|
150
|
+
private cancelSelections;
|
|
151
|
+
private doFilter;
|
|
152
|
+
private getPropertyValue;
|
|
153
|
+
private loadAllData;
|
|
154
|
+
protected registerEffects(): void;
|
|
155
|
+
isAllSelected(): boolean;
|
|
156
|
+
isSelected(row: Entity): boolean;
|
|
157
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityListComponent<any>, never>;
|
|
158
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityListComponent<any>, "base-list", never, {}, {}, never, never, true, never>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface OrderByCondition<Entity extends BaseEntity> {
|
|
162
|
+
field: keyof Entity;
|
|
163
|
+
order?: OrderByDirection;
|
|
164
|
+
}
|
|
165
|
+
interface FilterCondition {
|
|
166
|
+
property: string;
|
|
167
|
+
operator: WhereFilterOp;
|
|
168
|
+
value: string;
|
|
169
|
+
}
|
|
170
|
+
declare enum OrderByDirection {
|
|
171
|
+
ASC = "asc",
|
|
172
|
+
DESC = "desc"
|
|
173
|
+
}
|
|
174
|
+
interface OrderBy {
|
|
175
|
+
property: string;
|
|
176
|
+
direction: string;
|
|
177
|
+
}
|
|
178
|
+
interface BaseEntityQueryCondition {
|
|
179
|
+
path?: string;
|
|
180
|
+
hash?: string;
|
|
181
|
+
page?: number;
|
|
182
|
+
pageSize?: number;
|
|
183
|
+
pathParams?: Map<string, string>;
|
|
184
|
+
filters?: FilterCondition[];
|
|
185
|
+
orderBys?: OrderBy[];
|
|
186
|
+
}
|
|
187
|
+
interface BaseEntityLoadResponse<Entity extends BaseEntity> {
|
|
188
|
+
page: number | undefined;
|
|
189
|
+
pageSize: number | undefined;
|
|
190
|
+
totalPageCount: number | undefined;
|
|
191
|
+
content: Entity[];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface BaseEntityMapper<Entity extends BaseEntity> {
|
|
195
|
+
fromDto(dto: any, index?: number): Entity;
|
|
196
|
+
toDto(entity: Entity): any;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
declare const BASE_ENTITY_SERVICE: InjectionToken<BaseEntityService<any>>;
|
|
200
|
+
interface BaseEntityService<Entity extends BaseEntity> {
|
|
201
|
+
add(entity: Entity, id?: number): Observable<Entity>;
|
|
202
|
+
delete(id: string): Observable<unknown>;
|
|
203
|
+
deleteAll(): Observable<unknown>;
|
|
204
|
+
findAll(page?: number, pageSize?: number): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
205
|
+
findById(id: string): Observable<Entity | void>;
|
|
206
|
+
findByQuery(condition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
207
|
+
update(entity: Entity): Observable<Entity>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
declare abstract class BaseEntityRestService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
211
|
+
protected entityMapper: BaseEntityMapper<Entity>;
|
|
212
|
+
protected urlProperty: string;
|
|
213
|
+
protected resourceUrl: string;
|
|
214
|
+
private readonly runtimeConfiguration;
|
|
215
|
+
private readonly baseUrl;
|
|
216
|
+
protected httpClient: HttpClient;
|
|
217
|
+
protected headers: HttpHeaders;
|
|
218
|
+
protected constructor(entityMapper: BaseEntityMapper<Entity>, urlProperty: string, resourceUrl: string);
|
|
219
|
+
delete(id: string): Observable<unknown>;
|
|
220
|
+
deleteAll(): Observable<any>;
|
|
221
|
+
findAll(page?: number): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
222
|
+
findByQuery(queryCondition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
223
|
+
findById(id: string): Observable<void | Entity>;
|
|
224
|
+
add(entity: Entity, id?: number): Observable<Entity>;
|
|
225
|
+
update(entity: Entity): Observable<Entity>;
|
|
226
|
+
protected buildFullUrl(resourceUri: string, queryCondition: BaseEntityQueryCondition): string | undefined;
|
|
227
|
+
private mapPagedResponse;
|
|
228
|
+
private mapSimpleResponse;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
declare function BaseEntityTabsStore(): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
232
|
+
state: {
|
|
233
|
+
activeTabs: string[];
|
|
234
|
+
currentTab: string | undefined;
|
|
235
|
+
};
|
|
236
|
+
props: {};
|
|
237
|
+
methods: {
|
|
238
|
+
reset: () => void;
|
|
239
|
+
tabIsActive: (tabName: string) => void;
|
|
240
|
+
tabIsInactive: (tabName: string) => void;
|
|
241
|
+
};
|
|
242
|
+
}>;
|
|
243
|
+
|
|
244
|
+
declare const BASE_ENTITY_STORE: InjectionToken<any>;
|
|
245
|
+
declare function BaseEntityStore<Entity extends BaseEntity>(entityType: new () => Entity, repositoryType: ProviderToken<BaseEntityService<Entity>>): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
246
|
+
state: {
|
|
247
|
+
entities: Entity[];
|
|
248
|
+
page: number;
|
|
249
|
+
pageSize: number;
|
|
250
|
+
totalPageCount: number;
|
|
251
|
+
currentId: string | undefined;
|
|
252
|
+
currentEntity: Entity | undefined;
|
|
253
|
+
isLoading: boolean;
|
|
254
|
+
error: string | undefined;
|
|
255
|
+
selectedEntities: Entity[];
|
|
256
|
+
};
|
|
257
|
+
props: {
|
|
258
|
+
countOfEntities: i0.Signal<number>;
|
|
259
|
+
matTableDataSource: i0.Signal<MatTableDataSource<Entity, _angular_material_paginator_d.MatPaginator>>;
|
|
260
|
+
};
|
|
261
|
+
methods: {
|
|
262
|
+
clearCurrentEntity: () => void;
|
|
263
|
+
createEntity: () => Entity;
|
|
264
|
+
add: _ngrx_signals_rxjs_interop.RxMethod<Entity>;
|
|
265
|
+
delete: _ngrx_signals_rxjs_interop.RxMethod<string>;
|
|
266
|
+
deleteAll: _ngrx_signals_rxjs_interop.RxMethod<void>;
|
|
267
|
+
deselectAll: () => void;
|
|
268
|
+
deselectEntity: (id: string) => void;
|
|
269
|
+
load: _ngrx_signals_rxjs_interop.RxMethod<_processpuzzle_base_entity.BaseEntityQueryCondition>;
|
|
270
|
+
loadById: (id: string) => Entity | undefined;
|
|
271
|
+
resetErrorState: () => void;
|
|
272
|
+
selectEntity: (id: string) => void;
|
|
273
|
+
setCurrentEntity: (id: string) => void;
|
|
274
|
+
update: _ngrx_signals_rxjs_interop.RxMethod<Entity>;
|
|
275
|
+
};
|
|
276
|
+
}>;
|
|
277
|
+
|
|
278
|
+
declare enum RouteSegments {
|
|
279
|
+
LIST_ROUTE = "LIST_ROUTE",
|
|
280
|
+
DETAILS_ROUTE = "DETAILS_ROUTE"
|
|
281
|
+
}
|
|
282
|
+
interface NavigationState {
|
|
283
|
+
activeRouteSegment: RouteSegments;
|
|
284
|
+
entityName: string;
|
|
285
|
+
navigationError?: string;
|
|
286
|
+
navigateTo: string;
|
|
287
|
+
returnTo: string;
|
|
288
|
+
}
|
|
289
|
+
declare function BaseFormNavigatorStore(entityName: string): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
290
|
+
state: {
|
|
291
|
+
activeRouteSegment: RouteSegments;
|
|
292
|
+
entityName: string;
|
|
293
|
+
navigationError?: string | undefined;
|
|
294
|
+
navigateTo: string;
|
|
295
|
+
returnTo: string;
|
|
296
|
+
};
|
|
297
|
+
props: {};
|
|
298
|
+
methods: {
|
|
299
|
+
determineCurrentUrl: () => string;
|
|
300
|
+
determineActiveRouteSegment: () => void;
|
|
301
|
+
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
302
|
+
navigateToDetails: (id: string, returnTo?: string) => Promise<void>;
|
|
303
|
+
navigateToList: (returnTo?: string) => Promise<void>;
|
|
304
|
+
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string) => Promise<void>;
|
|
305
|
+
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
306
|
+
};
|
|
307
|
+
}>;
|
|
308
|
+
|
|
309
|
+
declare abstract class BaseEntityFirestoreService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
310
|
+
protected entityMapper: BaseEntityMapper<Entity>;
|
|
311
|
+
protected collectionName: string;
|
|
312
|
+
protected collection: _firebase_firestore.CollectionReference<_firebase_firestore.DocumentData, _firebase_firestore.DocumentData>;
|
|
313
|
+
protected readonly firestore: Firestore;
|
|
314
|
+
protected constructor(entityMapper: BaseEntityMapper<Entity>, collectionName: string);
|
|
315
|
+
add(entity: Entity): Observable<Entity>;
|
|
316
|
+
delete(id: string): Observable<unknown>;
|
|
317
|
+
deleteAll(): Observable<unknown>;
|
|
318
|
+
findAll(page?: number, pageSize?: number): Observable<BaseEntityLoadResponse<Entity> | Entity[]>;
|
|
319
|
+
findById(id: string): Observable<Entity | void>;
|
|
320
|
+
findByQuery(queryCondition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<Entity> | Entity[]>;
|
|
321
|
+
update(entity: Entity): Observable<Entity>;
|
|
322
|
+
protected addAsync(entity: Entity): Promise<Entity>;
|
|
323
|
+
protected createQuery(queryCondition: BaseEntityQueryCondition): _firebase_firestore.Query<_firebase_firestore.DocumentData, _firebase_firestore.DocumentData>;
|
|
324
|
+
protected findByQueryAsync(queryCondition: BaseEntityQueryCondition): Promise<BaseEntityLoadResponse<Entity> | Entity[]>;
|
|
325
|
+
protected mapCollection(collection: Observable<any[]>): Entity[];
|
|
326
|
+
protected mapDocument(document: any): Entity;
|
|
327
|
+
private mapEntity;
|
|
328
|
+
private updateAsync;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
declare enum FlexDirection {
|
|
332
|
+
CONTAINER = 0,
|
|
333
|
+
COLUMN = 1,
|
|
334
|
+
ROW = 2
|
|
335
|
+
}
|
|
336
|
+
declare class FlexboxDescriptor extends AbstractAttrDescriptor {
|
|
337
|
+
readonly attrDescriptors: AbstractAttrDescriptor[];
|
|
338
|
+
readonly direction: FlexDirection;
|
|
339
|
+
constructor(attrDescriptors: AbstractAttrDescriptor[], direction: FlexDirection);
|
|
340
|
+
}
|
|
341
|
+
|
|
1
342
|
/**
|
|
2
|
-
*
|
|
343
|
+
* Defines an entity data transformer capable of transforming data to and from the server.
|
|
3
344
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
345
|
+
interface IEntityTransformer {
|
|
346
|
+
fromServer?: (data: any, criteria?: any) => any;
|
|
347
|
+
toServer?: (entity: any, criteria?: any) => any;
|
|
348
|
+
}
|
|
349
|
+
interface EntityOptions {
|
|
350
|
+
modelName: string;
|
|
351
|
+
pluralName: string;
|
|
352
|
+
uriName: string;
|
|
353
|
+
transform?: IEntityTransformer;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Class decorator for entity classes
|
|
357
|
+
* @param options Configuration options for the entity
|
|
358
|
+
* @returns Class decorator function
|
|
359
|
+
*/
|
|
360
|
+
declare function Entity(options: EntityOptions): ClassDecorator;
|
|
361
|
+
/**
|
|
362
|
+
* Gets entity options from an entity instance
|
|
363
|
+
* @param instance An instance of a class decorated with @Entity
|
|
364
|
+
* @returns The entity options or undefined if not found
|
|
365
|
+
*/
|
|
366
|
+
declare function getEntityOptions(instance: any): EntityOptions | undefined;
|
|
367
|
+
/**
|
|
368
|
+
* Property decorator for marking entity properties as ID fields
|
|
369
|
+
* @returns PropertyDecorator function
|
|
370
|
+
*/
|
|
371
|
+
declare function Id(): PropertyDecorator;
|
|
372
|
+
/**
|
|
373
|
+
* Gets all property names marked with @Id decorator from an entity instance
|
|
374
|
+
* @param instance An instance of a class with properties decorated with @Id
|
|
375
|
+
* @returns Array of property names marked as IDs or empty array if none found
|
|
376
|
+
*/
|
|
377
|
+
declare function getEntityIds(instance: any): string[];
|
|
378
|
+
|
|
379
|
+
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 };
|
|
380
|
+
export type { BaseEntity, BaseEntityDescriptor, BaseEntityLoadResponse, BaseEntityMapper, BaseEntityQueryCondition, EntityOptions, FilterCondition, NavigationState, OrderByCondition };
|
package/package.json
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@processpuzzle/base-entity",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Zsolt Zsuffa",
|
|
7
|
+
"email": "zsolt.zsuffa@gmailmcom"
|
|
8
|
+
},
|
|
4
9
|
"publishConfig": {
|
|
5
10
|
"access": "public"
|
|
6
11
|
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/ZsZs/processpuzzle.git",
|
|
15
|
+
"directory": "libs/base-entity"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/ZsZs/processpuzzle#readme",
|
|
7
18
|
"peerDependencies": {
|
|
8
|
-
"@angular/cdk": "^
|
|
9
|
-
"@angular/common": "
|
|
10
|
-
"@angular/core": "
|
|
11
|
-
"@angular/forms": "~
|
|
12
|
-
"@angular/material": "^
|
|
13
|
-
"@angular/platform-browser": "~
|
|
14
|
-
"@angular/router": "~
|
|
15
|
-
"@
|
|
16
|
-
"@ngrx/
|
|
17
|
-
"@
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"uuid": "^11.0.5"
|
|
19
|
+
"@angular/cdk": "^20.2.10",
|
|
20
|
+
"@angular/common": "~20.3.9",
|
|
21
|
+
"@angular/core": "~20.3.9",
|
|
22
|
+
"@angular/forms": "~20.3.9",
|
|
23
|
+
"@angular/material": "^20.2.10",
|
|
24
|
+
"@angular/platform-browser": "~20.3.9",
|
|
25
|
+
"@angular/router": "~20.3.9",
|
|
26
|
+
"@angular/fire": "^20.0.1",
|
|
27
|
+
"@ngrx/operators": "^20.1.0",
|
|
28
|
+
"@ngrx/signals": "^20.1.0",
|
|
29
|
+
"@processpuzzle/util": "^0.2.4",
|
|
30
|
+
"build-url-ts": "^6.2.0",
|
|
31
|
+
"rxjs": "~7.8.2",
|
|
32
|
+
"uuid": "^13.0.0"
|
|
23
33
|
},
|
|
24
34
|
"dependencies": {
|
|
25
35
|
"tslib": "^2.8.1"
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare enum FormControlType {
|
|
2
|
-
CHECKBOX = "CHECKBOX",
|
|
3
|
-
DATE = "DATE",
|
|
4
|
-
DROPDOWN = "DROPDOWN",
|
|
5
|
-
FLEX_BOX = "FLEX_BOX",
|
|
6
|
-
FOREIGN_KEY = "FOREIGN_KEY",
|
|
7
|
-
LABEL = "LABEL",
|
|
8
|
-
RADIO = "RADIO",
|
|
9
|
-
TITLE = "TITLE",
|
|
10
|
-
TEXT_BOX = "TEXT_BOX",
|
|
11
|
-
TEXTAREA = "TEXTAREA"
|
|
12
|
-
}
|
|
13
|
-
export declare abstract class AbstractAttrDescriptor {
|
|
14
|
-
attrName: string;
|
|
15
|
-
formControlType: FormControlType;
|
|
16
|
-
disabled: boolean;
|
|
17
|
-
style: {
|
|
18
|
-
[p: string]: any;
|
|
19
|
-
} | null | undefined;
|
|
20
|
-
protected constructor(attrName: string, formControlType: FormControlType);
|
|
21
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { AbstractAttrDescriptor, FormControlType } from './abstact-attr.descriptor';
|
|
2
|
-
export declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
3
|
-
description?: string;
|
|
4
|
-
styleClass?: string | undefined;
|
|
5
|
-
labelClass?: string;
|
|
6
|
-
format?: string;
|
|
7
|
-
isLinkToDetails?: boolean;
|
|
8
|
-
selectables?: Array<{
|
|
9
|
-
key: string;
|
|
10
|
-
value: any;
|
|
11
|
-
}>;
|
|
12
|
-
visible: boolean;
|
|
13
|
-
isHeading?: boolean;
|
|
14
|
-
placeholder?: string;
|
|
15
|
-
lines?: number;
|
|
16
|
-
options: {
|
|
17
|
-
inputType: 'text';
|
|
18
|
-
};
|
|
19
|
-
private _label?;
|
|
20
|
-
private _linkedEntityType?;
|
|
21
|
-
constructor(attrName: string, formControlType: FormControlType, label?: string, selectables?: Array<{
|
|
22
|
-
key: string;
|
|
23
|
-
value: any;
|
|
24
|
-
}>, isLinkToDetails?: boolean, options?: object);
|
|
25
|
-
get label(): string;
|
|
26
|
-
set label(label: string);
|
|
27
|
-
get linkedEntityType(): any;
|
|
28
|
-
set linkedEntityType(linkedEntityType: string);
|
|
29
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AbstractAttrDescriptor } from './abstact-attr.descriptor';
|
|
2
|
-
export declare enum FlexDirection {
|
|
3
|
-
CONTAINER = 0,
|
|
4
|
-
COLUMN = 1,
|
|
5
|
-
ROW = 2
|
|
6
|
-
}
|
|
7
|
-
export declare class FlexboxDescriptor extends AbstractAttrDescriptor {
|
|
8
|
-
readonly attrDescriptors: AbstractAttrDescriptor[];
|
|
9
|
-
readonly direction: FlexDirection;
|
|
10
|
-
constructor(attrDescriptors: AbstractAttrDescriptor[], direction: FlexDirection);
|
|
11
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
-
import { BaseEntityDescriptor } from './base-entity/base-entity.descriptor';
|
|
3
|
-
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
export declare class BaseEntityContainerComponent implements OnDestroy, OnInit {
|
|
6
|
-
baseEntityListOptions: import("@angular/core").InputSignal<BaseEntityDescriptor>;
|
|
7
|
-
protected snackBar: MatSnackBar;
|
|
8
|
-
store: any;
|
|
9
|
-
constructor();
|
|
10
|
-
ngOnDestroy(): void;
|
|
11
|
-
ngOnInit(): void;
|
|
12
|
-
private registerEffects;
|
|
13
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityContainerComponent, never>;
|
|
14
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityContainerComponent, "base-entity-container", never, { "baseEntityListOptions": { "alias": "baseEntityListOptions"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
15
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface EntityContainerState {
|
|
2
|
-
filterKey: string | undefined;
|
|
3
|
-
}
|
|
4
|
-
export declare function BaseEntityContainerStore(): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
5
|
-
state: {
|
|
6
|
-
filterKey: string | undefined;
|
|
7
|
-
};
|
|
8
|
-
props: {};
|
|
9
|
-
methods: {
|
|
10
|
-
doFilter: (filterKey: string) => void;
|
|
11
|
-
};
|
|
12
|
-
}>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from '../base-entity/base-entity';
|
|
2
|
-
import { BaseEntityService } from './base-entity.service';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { BaseEntityLoadResponse, BaseEntityQueryCondition } from './base-entity-load-response';
|
|
5
|
-
import { Firestore } from '@angular/fire/firestore';
|
|
6
|
-
import { BaseEntityMapper } from '../base-entity.mapper';
|
|
7
|
-
export declare abstract class BaseEntityFirestoreService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
8
|
-
protected entityMapper: BaseEntityMapper<Entity>;
|
|
9
|
-
protected collectionName: string;
|
|
10
|
-
protected collection: import("@firebase/firestore").CollectionReference<import("@firebase/firestore").DocumentData, import("@firebase/firestore").DocumentData>;
|
|
11
|
-
protected readonly firestore: Firestore;
|
|
12
|
-
protected constructor(entityMapper: BaseEntityMapper<Entity>, collectionName: string);
|
|
13
|
-
add(entity: Entity): Observable<Entity>;
|
|
14
|
-
delete(id: string): Observable<unknown>;
|
|
15
|
-
deleteAll(): Observable<unknown>;
|
|
16
|
-
findAll(page?: number, pageSize?: number): Observable<BaseEntityLoadResponse<Entity> | Entity[]>;
|
|
17
|
-
findById(id: string): Observable<Entity | void>;
|
|
18
|
-
findByQuery(queryCondition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<Entity> | Entity[]>;
|
|
19
|
-
update(entity: Entity): Observable<Entity>;
|
|
20
|
-
protected addAsync(entity: Entity): Promise<Entity>;
|
|
21
|
-
protected createQuery(queryCondition: BaseEntityQueryCondition): import("@firebase/firestore").Query<import("@firebase/firestore").DocumentData, import("@firebase/firestore").DocumentData>;
|
|
22
|
-
protected findByQueryAsync(queryCondition: BaseEntityQueryCondition): Promise<BaseEntityLoadResponse<Entity> | Entity[]>;
|
|
23
|
-
protected mapCollection(collection: Observable<any[]>): Entity[];
|
|
24
|
-
protected mapDocument(document: any): Entity;
|
|
25
|
-
private mapEntity;
|
|
26
|
-
private updateAsync;
|
|
27
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from '../base-entity/base-entity';
|
|
2
|
-
import { DocumentSnapshot, WhereFilterOp } from '@angular/fire/firestore';
|
|
3
|
-
export interface WhereCondition<Entity extends BaseEntity> {
|
|
4
|
-
field: keyof Entity;
|
|
5
|
-
operator: WhereFilterOp;
|
|
6
|
-
value: Entity[keyof Entity];
|
|
7
|
-
}
|
|
8
|
-
export interface OrderByCondition<Entity extends BaseEntity> {
|
|
9
|
-
field: keyof Entity;
|
|
10
|
-
order?: OrderByDirection;
|
|
11
|
-
}
|
|
12
|
-
export interface FilterCondition {
|
|
13
|
-
property: string;
|
|
14
|
-
operator: WhereFilterOp;
|
|
15
|
-
value: string;
|
|
16
|
-
}
|
|
17
|
-
export declare enum OrderByDirection {
|
|
18
|
-
ASC = "asc",
|
|
19
|
-
DESC = "desc"
|
|
20
|
-
}
|
|
21
|
-
export interface OrderBy {
|
|
22
|
-
property: string;
|
|
23
|
-
direction: string;
|
|
24
|
-
}
|
|
25
|
-
export interface BaseEntityQueryCondition {
|
|
26
|
-
path?: string;
|
|
27
|
-
hash?: string;
|
|
28
|
-
page?: number;
|
|
29
|
-
pageSize?: number;
|
|
30
|
-
pathParams?: Map<string, string>;
|
|
31
|
-
filters?: FilterCondition[];
|
|
32
|
-
orderBys?: OrderBy[];
|
|
33
|
-
}
|
|
34
|
-
export interface FirestoreQuery<Entity extends BaseEntity> {
|
|
35
|
-
limit?: number;
|
|
36
|
-
startAt?: number | string | DocumentSnapshot<Entity>;
|
|
37
|
-
startAfter?: number | string | DocumentSnapshot<Entity> | null;
|
|
38
|
-
endAt?: number | DocumentSnapshot<Entity>;
|
|
39
|
-
endBefore?: number | DocumentSnapshot<Entity>;
|
|
40
|
-
orderBy?: OrderByCondition<Entity>[];
|
|
41
|
-
where?: WhereCondition<Entity>[];
|
|
42
|
-
}
|
|
43
|
-
export interface BaseEntityLoadResponse<Entity extends BaseEntity> {
|
|
44
|
-
page: number | undefined;
|
|
45
|
-
pageSize: number | undefined;
|
|
46
|
-
totalPageCount: number | undefined;
|
|
47
|
-
content: Entity[];
|
|
48
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from '../base-entity/base-entity';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { BaseEntityMapper } from '../base-entity.mapper';
|
|
4
|
-
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
5
|
-
import { BaseEntityLoadResponse, BaseEntityQueryCondition } from './base-entity-load-response';
|
|
6
|
-
import { BaseEntityService } from './base-entity.service';
|
|
7
|
-
export declare abstract class BaseEntityRestService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
8
|
-
protected entityMapper: BaseEntityMapper<Entity>;
|
|
9
|
-
protected urlProperty: string;
|
|
10
|
-
protected resourceUrl: string;
|
|
11
|
-
private readonly runtimeConfiguration;
|
|
12
|
-
private readonly baseUrl;
|
|
13
|
-
protected httpClient: HttpClient;
|
|
14
|
-
protected headers: HttpHeaders;
|
|
15
|
-
protected constructor(entityMapper: BaseEntityMapper<Entity>, urlProperty: string, resourceUrl: string);
|
|
16
|
-
delete(id: string): Observable<unknown>;
|
|
17
|
-
deleteAll(): Observable<any>;
|
|
18
|
-
findAll(page?: number): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
19
|
-
findByQuery(queryCondition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
20
|
-
findById(id: string): Observable<void | Entity>;
|
|
21
|
-
add(entity: Entity, id?: number): Observable<Entity>;
|
|
22
|
-
update(entity: Entity): Observable<Entity>;
|
|
23
|
-
protected buildFullUrl(resourceUri: string, queryCondition: BaseEntityQueryCondition): string | undefined;
|
|
24
|
-
private mapPagedResponse;
|
|
25
|
-
private mapSimpleResponse;
|
|
26
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from '../base-entity/base-entity';
|
|
2
|
-
import { BaseEntityLoadResponse, BaseEntityQueryCondition } from './base-entity-load-response';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { InjectionToken } from '@angular/core';
|
|
5
|
-
export declare const BASE_ENTITY_SERVICE: InjectionToken<BaseEntityService<any>>;
|
|
6
|
-
export interface BaseEntityService<Entity extends BaseEntity> {
|
|
7
|
-
add(entity: Entity, id?: number): Observable<Entity>;
|
|
8
|
-
delete(id: string): Observable<unknown>;
|
|
9
|
-
deleteAll(): Observable<unknown>;
|
|
10
|
-
findAll(page?: number, pageSize?: number): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
11
|
-
findById(id: string): Observable<Entity | void>;
|
|
12
|
-
findByQuery(condition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<Entity> | Entity[] | Entity>;
|
|
13
|
-
update(entity: Entity): Observable<Entity>;
|
|
14
|
-
}
|