@processpuzzle/base-entity 1.3.0 → 1.5.0
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 +17 -5
- package/assets/i18n/base_entity/de.json +182 -7
- package/assets/i18n/base_entity/en.json +182 -7
- package/assets/i18n/base_entity/es.json +182 -7
- package/assets/i18n/base_entity/fr.json +182 -7
- package/assets/i18n/base_entity/hu.json +182 -7
- package/fesm2022/processpuzzle-base-entity.mjs +14371 -7038
- package/fesm2022/processpuzzle-base-entity.mjs.map +1 -1
- package/package.json +5 -3
- package/types/processpuzzle-base-entity.d.ts +2119 -661
- package/types/processpuzzle-base-entity.d.ts.map +1 -1
|
@@ -1,36 +1,67 @@
|
|
|
1
|
-
import { Observable } from "rxjs";
|
|
2
1
|
import * as i0 from "@angular/core";
|
|
3
2
|
import { AfterViewInit, EnvironmentProviders, InjectionToken, Injector, InputSignal, OnDestroy, OnInit, PipeTransform, Provider, ProviderToken, Signal, TemplateRef, Type, ViewContainerRef, WritableSignal } from "@angular/core";
|
|
4
|
-
import {
|
|
5
|
-
import { ActivatedRouteSnapshot, CanActivateFn, Route, Routes } from "@angular/router";
|
|
6
|
-
import { DocumentData, DocumentSnapshot, Firestore, WhereFilterOp, collection, deleteDoc, doc, getDoc, getDocs, limit, orderBy, query, setDoc, updateDoc, where } from "@angular/fire/firestore";
|
|
7
|
-
import { WritableStateSource } from "@ngrx/signals";
|
|
8
|
-
import { MatTableDataSource } from "@angular/material/table";
|
|
9
|
-
import { HttpClient, HttpHeaders } from "@angular/common/http";
|
|
10
|
-
import { FormGroup } from "@angular/forms";
|
|
3
|
+
import { FormControl, FormGroup } from "@angular/forms";
|
|
11
4
|
import { NGXLogger } from "ngx-logging-kit";
|
|
5
|
+
import { ActivatedRouteSnapshot, CanActivateFn, CanDeactivateFn, Route, Routes } from "@angular/router";
|
|
6
|
+
import { Observable } from "rxjs";
|
|
7
|
+
import "@ngrx/signals";
|
|
8
|
+
import { MatTableDataSource } from "@angular/material/table";
|
|
9
|
+
import { MatSnackBar } from "@angular/material/snack-bar";
|
|
10
|
+
import { HttpClient, HttpContext, HttpHeaders } from "@angular/common/http";
|
|
11
|
+
import { CdkDragDrop } from "@angular/cdk/drag-drop";
|
|
12
|
+
import { Editor, Extensions, JSONContent } from "@tiptap/core";
|
|
12
13
|
import { TranslocoService } from "@jsverse/transloco";
|
|
14
|
+
import { NativeDateAdapter } from "@angular/material/core";
|
|
13
15
|
import { MatSort } from "@angular/material/sort";
|
|
14
16
|
import { MatPaginator } from "@angular/material/paginator";
|
|
15
17
|
import { SelectionModel } from "@angular/cdk/collections";
|
|
18
|
+
import { ReleaseState, TranslationSource } from "@processpuzzle/util";
|
|
16
19
|
import "reflect-metadata";
|
|
17
|
-
import {
|
|
20
|
+
import { MatDialogRef } from "@angular/material/dialog";
|
|
18
21
|
export declare enum FormControlType {
|
|
19
22
|
ADDITIONAL_PROPERTIES = "ADDITIONAL_PROPERTIES",
|
|
23
|
+
/**
|
|
24
|
+
* A postal address — the value is one `PostalAddress` object. The fields and their order follow the selected
|
|
25
|
+
* country; with `showMap` the address is also shown on a map, with coordinates derived from it.
|
|
26
|
+
*/
|
|
27
|
+
ADDRESS = "ADDRESS",
|
|
20
28
|
ARTIFACT = "ARTIFACT",
|
|
29
|
+
AVATAR = "AVATAR",
|
|
30
|
+
/**
|
|
31
|
+
* A value a calculation derives. Read-only; shows what the calculation would produce from the form's unsaved
|
|
32
|
+
* state. Rendered by the component registered under `ENTITY_CALCULATED_CONTROL`, a plain label without one.
|
|
33
|
+
*/
|
|
34
|
+
CALCULATED = "CALCULATED",
|
|
21
35
|
CHECKBOX = "CHECKBOX",
|
|
36
|
+
/**
|
|
37
|
+
* An append-only history of rich-text comments, each stamped with its author and time — the value is an
|
|
38
|
+
* array of `EntityComment`, oldest first. A new comment is written below the history and saved with the record.
|
|
39
|
+
*/
|
|
40
|
+
COMMENTS = "COMMENTS",
|
|
22
41
|
COMPONENTS = "COMPONENTS",
|
|
23
42
|
/** Rendered by the descriptor's own `component` — the extension point for controls base-entity cannot know. */
|
|
24
43
|
CUSTOM = "CUSTOM",
|
|
25
44
|
DATE = "DATE",
|
|
26
45
|
DROPDOWN = "DROPDOWN",
|
|
46
|
+
/**
|
|
47
|
+
* Where the device was when the user pressed the control's button — the value is one `GeoLocation` object.
|
|
48
|
+
* Shown read-only; pressing the button again replaces it. Disabled where the browser offers no location.
|
|
49
|
+
*/
|
|
50
|
+
GEO_LOCATION = "GEO_LOCATION",
|
|
27
51
|
EMBEDDED_COMPONENTS = "EMBEDDED_COMPONENTS",
|
|
52
|
+
EMBEDDED_LIST = "EMBEDDED_LIST",
|
|
53
|
+
EMBEDDED_OBJECT = "EMBEDDED_OBJECT",
|
|
28
54
|
FLEX_BOX = "FLEX_BOX",
|
|
29
55
|
FOREIGN_KEY = "FOREIGN_KEY",
|
|
30
56
|
LABEL = "LABEL",
|
|
31
57
|
LOOKUP = "LOOKUP",
|
|
32
58
|
RADIO = "RADIO",
|
|
33
59
|
RELATED_ENTITIES = "RELATED_ENTITIES",
|
|
60
|
+
/**
|
|
61
|
+
* The attribute a state machine governs. Shows the current state and offers only the transitions allowed from
|
|
62
|
+
* it; rendered by the component registered under `ENTITY_STATE_CONTROL`, read-only as a label without one.
|
|
63
|
+
*/
|
|
64
|
+
STATE = "STATE",
|
|
34
65
|
TAGS = "TAGS",
|
|
35
66
|
TITLE = "TITLE",
|
|
36
67
|
TEXT_BOX = "TEXT_BOX",
|
|
@@ -40,6 +71,11 @@ export declare abstract class AbstractAttrDescriptor {
|
|
|
40
71
|
attrName: string;
|
|
41
72
|
formControlType: FormControlType;
|
|
42
73
|
disabled: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Editable only while the entity is new: a key chosen at creation, which the entity is then known by. Once it
|
|
76
|
+
* has been saved the control is disabled, so it stays out of the update the same way a read-only attribute does.
|
|
77
|
+
*/
|
|
78
|
+
createOnly: boolean;
|
|
43
79
|
style: {
|
|
44
80
|
[p: string]: unknown;
|
|
45
81
|
} | null | undefined;
|
|
@@ -59,41 +95,111 @@ export declare abstract class AbstractAttrDescriptor {
|
|
|
59
95
|
* collide with an unrelated translation in the consuming app.
|
|
60
96
|
*/
|
|
61
97
|
i18nKey(): string | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Transloco key of the tooltip the generated form shows on this attribute's control:
|
|
100
|
+
* `<scopeRoot>._tooltips.<labelKey|attrName>`. Under a `_tooltips` node of its own — the `_` prefix
|
|
101
|
+
* like `_self` — so it can never collide with an attribute that happens to be called `tooltips`.
|
|
102
|
+
* `undefined` for the same reason as {@link i18nKey}.
|
|
103
|
+
*/
|
|
104
|
+
tooltipI18nKey(): string | undefined;
|
|
62
105
|
}
|
|
63
|
-
interface
|
|
64
|
-
readonly
|
|
65
|
-
readonly objectId: string;
|
|
66
|
-
readonly name: string;
|
|
67
|
-
readonly mimeType: string;
|
|
106
|
+
interface BaseEntity {
|
|
107
|
+
readonly id?: string;
|
|
68
108
|
}
|
|
69
|
-
interface
|
|
70
|
-
|
|
71
|
-
fileName: string;
|
|
72
|
-
mimeType: string;
|
|
73
|
-
bucketName?: string;
|
|
109
|
+
interface PersistedBaseEntity extends BaseEntity {
|
|
110
|
+
readonly id: string;
|
|
74
111
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
112
|
+
type PersistedEntity<Entity extends BaseEntity> = Entity & PersistedBaseEntity;
|
|
113
|
+
/**
|
|
114
|
+
* The named display style of a DATE / DATE_TIME attribute.
|
|
115
|
+
*
|
|
116
|
+
* A designer picks a style, not a pattern: the style is rendered with `Intl.DateTimeFormat` in the *active*
|
|
117
|
+
* language, so `short` reads `09.12.1960` under `de` and `1960. 12. 09.` under `hu` without anyone authoring
|
|
118
|
+
* either. Mirrors the contract's `AttributeDateFormat`.
|
|
119
|
+
*/
|
|
120
|
+
type DateStyle = 'none' | 'short' | 'medium' | 'long' | 'full';
|
|
121
|
+
type TimeStyle = 'none' | 'short' | 'medium' | 'long';
|
|
122
|
+
type DateFormat = {
|
|
123
|
+
dateStyle?: DateStyle;
|
|
124
|
+
timeStyle?: TimeStyle;
|
|
125
|
+
};
|
|
126
|
+
export declare const DATE_STYLES: readonly DateStyle[];
|
|
127
|
+
export declare const TIME_STYLES: readonly TimeStyle[];
|
|
128
|
+
export declare const DEFAULT_DATE_FORMAT: Readonly<Required<DateFormat>>;
|
|
129
|
+
export declare const DEFAULT_DATE_TIME_FORMAT: Readonly<Required<DateFormat>>;
|
|
130
|
+
/**
|
|
131
|
+
* The format an attribute is rendered with: its own `dateFormat`, each missing style filled from the value
|
|
132
|
+
* kind's default. A descriptor carries no value kind, so a hand-written DATE control defaults to a date; the
|
|
133
|
+
* metadata path resolves DATE_TIME here before the descriptor is built (see `attrDescriptorOf`).
|
|
134
|
+
*/
|
|
135
|
+
export declare function effectiveDateFormat(attr: {
|
|
136
|
+
dateFormat?: DateFormat;
|
|
137
|
+
} | undefined, valueKind?: 'DATE' | 'DATE_TIME'): Required<DateFormat>;
|
|
138
|
+
/** The `Intl.DateTimeFormat` options of a format; a `none` style is left out rather than passed through. */
|
|
139
|
+
export declare function intlOptionsOf(format: DateFormat): Intl.DateTimeFormatOptions;
|
|
140
|
+
/** Renders `value` in `locale`; a value that is not a date is returned unchanged. */
|
|
141
|
+
export declare function formatDateValue<T>(value: T, format: DateFormat, locale: string): string | T;
|
|
142
|
+
/**
|
|
143
|
+
* How many values an attribute holds: the lower bound is 0 or 1, the upper bound 1, a fixed maximum `x`
|
|
144
|
+
* (given by `maxOccurs`) or unbounded `n`. Absent means a single value. Value counts are not validated yet.
|
|
145
|
+
*/
|
|
146
|
+
type Multiplicity = '0..1' | '0..x' | '0..n' | '1..x' | '1..n';
|
|
147
|
+
export declare const MULTIPLICITIES: readonly Multiplicity[];
|
|
148
|
+
interface MultiplicityHolder {
|
|
149
|
+
multiplicity?: Multiplicity;
|
|
150
|
+
maxOccurs?: number;
|
|
79
151
|
}
|
|
80
|
-
|
|
81
|
-
|
|
152
|
+
/** True for the `x` forms, whose upper bound is `maxOccurs`. */
|
|
153
|
+
export declare function isBoundedByMaxOccurs(multiplicity: Multiplicity | undefined): boolean;
|
|
154
|
+
/** The upper bound of the attribute's multiplicity; `Infinity` for `n`, and a missing `maxOccurs` counts as 1. */
|
|
155
|
+
export declare function upperBound(attr: MultiplicityHolder): number;
|
|
156
|
+
/** An attribute is multi-valued when its upper bound exceeds 1. */
|
|
157
|
+
export declare function isMultiValued(attr: MultiplicityHolder): boolean;
|
|
158
|
+
/** Where the coordinates of an address came from — derived from the address, or typed in by the user. */
|
|
159
|
+
type LocationSource = 'GEOCODED' | 'MANUAL';
|
|
160
|
+
/**
|
|
161
|
+
* The value of an `ADDRESS` attribute: one object, held by a single form control and saved as is.
|
|
162
|
+
*
|
|
163
|
+
* `country` is an ISO 3166-1 alpha-2 code (`HU`, `DE`, `US`), which is also what decides the layout the
|
|
164
|
+
* fields are edited in — see `address-formats.ts`. The coordinates are only filled when the attribute shows a
|
|
165
|
+
* map; `locationSource` remembers whether the user placed them by hand, so a later change of the address does
|
|
166
|
+
* not move a pin the user put somewhere on purpose.
|
|
167
|
+
*/
|
|
168
|
+
interface PostalAddress {
|
|
169
|
+
country?: string;
|
|
170
|
+
street?: string;
|
|
171
|
+
addressLine2?: string;
|
|
172
|
+
postalCode?: string;
|
|
173
|
+
city?: string;
|
|
174
|
+
/** State, province, county or prefecture — whatever the country calls its first-level subdivision. */
|
|
175
|
+
region?: string;
|
|
176
|
+
latitude?: number;
|
|
177
|
+
longitude?: number;
|
|
178
|
+
locationSource?: LocationSource;
|
|
82
179
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
getObjectByID(bucketName: string, objectID: string): Observable<ObjectDownloadResponse>;
|
|
89
|
-
deleteObjectByID(bucketName: string, objectID: string): Observable<void>;
|
|
90
|
-
getObjectUriByID(bucketName: string, objectID: string): Observable<ObjectUriResponse>;
|
|
91
|
-
getThumbnailUriByID(bucketName: string, objectID: string): Observable<ObjectUriResponse | null>;
|
|
92
|
-
private buildFullUrl;
|
|
93
|
-
private resolveBaseUrl;
|
|
94
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ObjectStoreService, never>;
|
|
95
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
180
|
+
/** The fields of a {@link PostalAddress} a user types — everything but the country and the location. */
|
|
181
|
+
type AddressLineField = 'street' | 'addressLine2' | 'postalCode' | 'city' | 'region';
|
|
182
|
+
interface GeoPoint {
|
|
183
|
+
latitude: number;
|
|
184
|
+
longitude: number;
|
|
96
185
|
}
|
|
186
|
+
/** The value of an `ADDRESS` attribute as an address — anything that is not an object holds none. */
|
|
187
|
+
export declare function addressOf(value: unknown): PostalAddress;
|
|
188
|
+
/** True when no line of the address holds text — a country alone, or coordinates alone, are no address. */
|
|
189
|
+
export declare function isAddressEmpty(address: PostalAddress): boolean;
|
|
190
|
+
/** The coordinates of the address, when it has both. */
|
|
191
|
+
export declare function geoPointOf(address: PostalAddress): GeoPoint | undefined;
|
|
192
|
+
/**
|
|
193
|
+
* Who draws the map of an `ADDRESS` attribute. OpenStreetMap is the default: its embed needs no API key.
|
|
194
|
+
* Whichever draws it, a click on the map opens the location in Google Maps.
|
|
195
|
+
*/
|
|
196
|
+
type MapProvider = 'OPENSTREETMAP' | 'GOOGLE';
|
|
197
|
+
export declare const MAP_PROVIDERS: readonly MapProvider[];
|
|
198
|
+
export declare const DEFAULT_MAP_PROVIDER: MapProvider;
|
|
199
|
+
/** The URL of an embeddable map centred on `point`, with a marker on it. */
|
|
200
|
+
export declare function mapEmbedUrl(provider: MapProvider, point: GeoPoint): string;
|
|
201
|
+
/** The location in Google Maps, which is what a click on the map opens. */
|
|
202
|
+
export declare function googleMapsUrl(point: GeoPoint): string;
|
|
97
203
|
type Selectable = {
|
|
98
204
|
key: string;
|
|
99
205
|
value: unknown;
|
|
@@ -104,11 +210,45 @@ export declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
|
104
210
|
styleClass?: string | undefined;
|
|
105
211
|
labelClass?: string;
|
|
106
212
|
format?: string;
|
|
213
|
+
/**
|
|
214
|
+
* `DATE` only: the named style the value is shown and edited in, rendered in the active language. Absent
|
|
215
|
+
* styles fall back to the defaults of `effectiveDateFormat`; a `timeStyle` other than `none` adds a time
|
|
216
|
+
* field and makes the value an instant rather than a calendar day.
|
|
217
|
+
*/
|
|
218
|
+
dateFormat?: DateFormat;
|
|
107
219
|
isLinkToDetails?: boolean;
|
|
108
220
|
selectables?: SelectablesInput;
|
|
221
|
+
/**
|
|
222
|
+
* `TAGS` only: the key of the `TAG_SUGGESTION_SOURCES` entry that supplies values to pick from. The control
|
|
223
|
+
* still accepts free text; values the source does not know are marked as new.
|
|
224
|
+
*/
|
|
225
|
+
tagSuggestions?: string;
|
|
109
226
|
visible: boolean;
|
|
110
227
|
showThumbnail?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* `AVATAR` only: the icon name (e.g. `'person'`, `'sailing'`) or image URL shown as placeholder before an image is uploaded.
|
|
230
|
+
* If omitted, defaults to `'person'`.
|
|
231
|
+
*/
|
|
232
|
+
defaultAvatar?: string;
|
|
233
|
+
/**
|
|
234
|
+
* `ADDRESS` only: show the address on a map, with editable coordinates derived from the address. Off by
|
|
235
|
+
* default — geocoding asks a third-party service, which an attribute has to opt into.
|
|
236
|
+
*/
|
|
237
|
+
showMap?: boolean;
|
|
238
|
+
/** `ADDRESS` only: who draws the map when {@link showMap} is set; OpenStreetMap when absent. */
|
|
239
|
+
mapProvider?: MapProvider;
|
|
240
|
+
/**
|
|
241
|
+
* `ADDRESS` only: the ISO 3166-1 alpha-2 code a new address starts with. When absent, the country of the
|
|
242
|
+
* browser's locale, if it names one.
|
|
243
|
+
*/
|
|
244
|
+
defaultCountry?: string;
|
|
111
245
|
hideInTable?: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* The list column hugs its content instead of sharing the space left over. Meant for short values — an id,
|
|
248
|
+
* a status, a date. A hugging cell never grows past 60% of the table's width; longer content is cut off
|
|
249
|
+
* with an ellipsis. Columns that are not autosized fill the remaining width and wrap.
|
|
250
|
+
*/
|
|
251
|
+
autosizeColumn?: boolean;
|
|
112
252
|
isHeading?: boolean;
|
|
113
253
|
placeholder?: string;
|
|
114
254
|
lines?: number;
|
|
@@ -116,6 +256,10 @@ export declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
|
116
256
|
inputType: 'text';
|
|
117
257
|
};
|
|
118
258
|
required: boolean;
|
|
259
|
+
/** Child attribute descriptors for nested forms (`EMBEDDED_OBJECT`, `EMBEDDED_LIST`). */
|
|
260
|
+
childDescriptors?: AbstractAttrDescriptor[];
|
|
261
|
+
/** `EMBEDDED_LIST` only: the attribute whose value titles a collapsed row. */
|
|
262
|
+
rowLabelAttr?: string;
|
|
119
263
|
/**
|
|
120
264
|
* Regular-expression source the value has to match, applied as `Validators.pattern` and anchored by
|
|
121
265
|
* Angular at both ends.
|
|
@@ -127,6 +271,20 @@ export declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
|
127
271
|
*/
|
|
128
272
|
pattern?: string;
|
|
129
273
|
referenceIdField?: string;
|
|
274
|
+
/**
|
|
275
|
+
* `EMBEDDED_COMPONENTS` only: the rows' order means something — widgets render in it, nav items are listed
|
|
276
|
+
* in it — so the list lets the user reorder them. The order is the array's, so it needs nothing from the
|
|
277
|
+
* backend beyond keeping the array as sent.
|
|
278
|
+
*/
|
|
279
|
+
ordered: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* How many values the attribute holds — see {@link Multiplicity}. Absent means a single value. Only
|
|
282
|
+
* `ARTIFACT` acts on it today: with an upper bound above 1 the value is an array and uploads append.
|
|
283
|
+
* Counts are not validated; `required` stays a separate flag.
|
|
284
|
+
*/
|
|
285
|
+
multiplicity?: Multiplicity;
|
|
286
|
+
/** The upper bound of the `x` multiplicities (`0..x`, `1..x`); ignored for the others. */
|
|
287
|
+
maxOccurs?: number;
|
|
130
288
|
/**
|
|
131
289
|
* The control of a {@link FormControlType.CUSTOM} attribute: a `BaseFormControlComponent` subclass the form
|
|
132
290
|
* builder creates like any built-in control. Typed loosely because the base class is generic over the entity
|
|
@@ -161,6 +319,8 @@ interface EntityTabDescriptor {
|
|
|
161
319
|
i18nKey: string;
|
|
162
320
|
/** Component the route mounts. */
|
|
163
321
|
component: Type<unknown>;
|
|
322
|
+
/** Leaves out the entity status bar (breadcrumb) while this tab is open — for a tab that brings a header of its own. */
|
|
323
|
+
hideStatusbar?: boolean;
|
|
164
324
|
/** Suffix for the link's `data-testid`; defaults to `show-<segment>`. */
|
|
165
325
|
testIdSuffix?: string;
|
|
166
326
|
/**
|
|
@@ -186,6 +346,7 @@ interface BaseEntityDescriptorOptions {
|
|
|
186
346
|
entityName: string;
|
|
187
347
|
entityTitle?: EntityTitle;
|
|
188
348
|
extraFormActionsTemplate?: ExtraFormActionsTemplate;
|
|
349
|
+
extraListActionsTemplate?: ExtraFormActionsTemplate;
|
|
189
350
|
/** Screens beyond List and Details. See {@link EntityTabDescriptor}. */
|
|
190
351
|
extraTabs?: EntityTabDescriptor[];
|
|
191
352
|
/**
|
|
@@ -201,6 +362,26 @@ interface BaseEntityDescriptorOptions {
|
|
|
201
362
|
*/
|
|
202
363
|
titleKey?: string;
|
|
203
364
|
isAbstract?: boolean;
|
|
365
|
+
/**
|
|
366
|
+
* True for an entity whose screens only look: the toolbar offers neither New nor Delete and the form cannot
|
|
367
|
+
* be saved. For rows the server alone writes — issued documents, say. Distinct from {@link isAbstract}, which
|
|
368
|
+
* is about inheritance, and from the preview mode, which is a host's decision about definitions built at run time.
|
|
369
|
+
*/
|
|
370
|
+
isReadOnly?: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* False for an entity whose rows come into being some other way than the generic New — the users of an
|
|
373
|
+
* organization, who are invited. The toolbar then does not offer New, while edit and delete stay as they
|
|
374
|
+
* are. Defaults to true.
|
|
375
|
+
*/
|
|
376
|
+
isCreatable?: boolean;
|
|
377
|
+
/**
|
|
378
|
+
* Whether one row may be changed, decided per entity. A row the server owns outright, an administrator's role
|
|
379
|
+
* for instance, is shown and saved only where this answers true. The form then shows it read-only. Not a
|
|
380
|
+
* kind of row: that is {@link isReadOnly}.
|
|
381
|
+
*/
|
|
382
|
+
isEditable?: (entity: BaseEntity) => boolean;
|
|
383
|
+
/** As {@link isEditable}, for the delete action on the row. */
|
|
384
|
+
isDeletable?: (entity: BaseEntity) => boolean;
|
|
204
385
|
/** Name of the entity this one inherits from. Unrelated to {@link componentParent}. */
|
|
205
386
|
parentEntity?: string;
|
|
206
387
|
route?: string;
|
|
@@ -220,23 +401,40 @@ interface BaseEntityDescriptorOptions {
|
|
|
220
401
|
* without {@link componentParent}, and rejected without it.
|
|
221
402
|
*/
|
|
222
403
|
isEmbedded?: boolean;
|
|
404
|
+
/**
|
|
405
|
+
* True when a user can pick one object of this entity as the **context object** — the aggregate whose embedded
|
|
406
|
+
* components are then listed and edited without naming it again. Rejected on an embedded entity: it has no
|
|
407
|
+
* object of its own to pick.
|
|
408
|
+
*/
|
|
409
|
+
canContextObject?: boolean;
|
|
223
410
|
}
|
|
224
411
|
export declare class BaseEntityDescriptor {
|
|
225
412
|
store: unknown;
|
|
413
|
+
/**
|
|
414
|
+
* Takes a retired row back, when this entity has retired rows (a shared type's deleted records). Assigned by the
|
|
415
|
+
* facade that knows the repository, like {@link store}; the form offers Reinstate on a retired row only if it is set.
|
|
416
|
+
*/
|
|
417
|
+
reinstate?: (id: string) => Observable<unknown>;
|
|
226
418
|
attrDescriptors: AbstractAttrDescriptor[];
|
|
227
419
|
entityName: string;
|
|
228
420
|
entityTitle: EntityTitle;
|
|
229
421
|
extraFormActionsTemplate?: ExtraFormActionsTemplate;
|
|
422
|
+
extraListActionsTemplate?: ExtraFormActionsTemplate;
|
|
230
423
|
extraTabs: EntityTabDescriptor[];
|
|
231
424
|
i18nScope?: string;
|
|
232
425
|
titleKey?: string;
|
|
233
426
|
parentEntity: string | undefined;
|
|
234
427
|
readonly isAbstract: boolean;
|
|
428
|
+
readonly isReadOnly: boolean;
|
|
429
|
+
readonly isCreatable: boolean;
|
|
430
|
+
readonly isEditable: ((entity: BaseEntity) => boolean) | undefined;
|
|
431
|
+
readonly isDeletable: ((entity: BaseEntity) => boolean) | undefined;
|
|
235
432
|
route: string | undefined;
|
|
236
433
|
/** Normalized {@link BaseEntityDescriptorOptions.componentParent}; empty when this is not a component. */
|
|
237
434
|
readonly componentParents: readonly string[];
|
|
238
435
|
readonly isEmbedded: boolean;
|
|
239
|
-
|
|
436
|
+
readonly canContextObject: boolean;
|
|
437
|
+
constructor({ store, attrDescriptors, entityName, entityTitle, extraFormActionsTemplate, extraListActionsTemplate, extraTabs, i18nScope, titleKey, isAbstract, isReadOnly, isCreatable, isEditable, isDeletable, parentEntity, route, componentParent, isEmbedded, canContextObject }: BaseEntityDescriptorOptions);
|
|
240
438
|
createTestId(suffix: string): string;
|
|
241
439
|
/** Transloco key root for this entity, derived from {@link entityName} unless {@link i18nScope} overrides it. */
|
|
242
440
|
scopeRoot(): string;
|
|
@@ -268,43 +466,48 @@ export declare class BaseEntityDescriptor {
|
|
|
268
466
|
titleAttrName(): string;
|
|
269
467
|
overwriteLinkedEntityAttr(attrName: string, linkedEntityName: string): void;
|
|
270
468
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
export declare
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
469
|
+
/**
|
|
470
|
+
* Resolves an entity's descriptor and store **by name**, whichever world the entity comes from: a
|
|
471
|
+
* compile-time `BaseEntityFacade` registered in `BASE_ENTITY_FACADE_REGISTRY`, or a `BaseEntityDefinition`
|
|
472
|
+
* synthesized at run-time by `DynamicEntityRegistry` and published into {@link ResolvedEntityCache}.
|
|
473
|
+
*
|
|
474
|
+
* Being the single lookup surface is what makes the metadata-defined case cost the rest of the library
|
|
475
|
+
* nothing. `EmbeddedAggregateAccessor` asks here for the root store of an aggregate and for the descriptor
|
|
476
|
+
* of every level below it; `resolveEmbeddedRouteContext` walks the containment graph through the
|
|
477
|
+
* descriptors it gets back; the embedded form controls read their child's label the same way. None of them
|
|
478
|
+
* changed, and none of them can tell the difference.
|
|
479
|
+
*
|
|
480
|
+
* Compile-time first. A host application that registered a facade did so on purpose — it may carry extra
|
|
481
|
+
* tabs, a hand-tuned layout or a repository of its own — and a definition of the same name does not
|
|
482
|
+
* override that decision. The dynamic side is a fallback, in both senses.
|
|
483
|
+
*
|
|
484
|
+
* The synthesized side is read out of a cache rather than from the registry that builds it, so that this
|
|
485
|
+
* class — injected by half the library — does not depend on the facades, and through them on every
|
|
486
|
+
* repository implementation there is. See {@link ResolvedEntityCache}.
|
|
487
|
+
*/
|
|
488
|
+
export declare class BaseEntityDescriptorRegistry {
|
|
489
|
+
private readonly registry;
|
|
490
|
+
private readonly resolvedEntities;
|
|
491
|
+
private readonly injector;
|
|
492
|
+
getDescriptor(entityName: string | undefined): BaseEntityDescriptor | undefined;
|
|
493
|
+
/**
|
|
494
|
+
* An embedded entity has a store too — see `EmbeddedEntityFacade`. It reads and writes the containing
|
|
495
|
+
* entity's document rather than an endpoint of its own, which is invisible from here.
|
|
496
|
+
*/
|
|
497
|
+
getStore<Store = unknown>(entityName: string | undefined): Store | undefined;
|
|
498
|
+
private resolveFacade;
|
|
499
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityDescriptorRegistry, never>;
|
|
500
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
300
501
|
}
|
|
502
|
+
/** The comparison operators a filter condition may use; `toRsql` maps each onto its RSQL/FIQL operator. */
|
|
503
|
+
type FilterOperator = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'array-contains-any' | 'not-in';
|
|
301
504
|
interface OrderByCondition<Entity extends BaseEntity> {
|
|
302
505
|
field: keyof Entity;
|
|
303
506
|
order?: OrderByDirection;
|
|
304
507
|
}
|
|
305
508
|
interface FilterCondition {
|
|
306
509
|
property: string;
|
|
307
|
-
operator:
|
|
510
|
+
operator: FilterOperator;
|
|
308
511
|
value: string;
|
|
309
512
|
}
|
|
310
513
|
type LogicalOperator = 'AND' | 'OR';
|
|
@@ -312,7 +515,6 @@ interface FilterGroup {
|
|
|
312
515
|
operator: LogicalOperator;
|
|
313
516
|
conditions: Array<FilterCondition | FilterGroup>;
|
|
314
517
|
}
|
|
315
|
-
declare function isFilterGroup(node: FilterCondition | FilterGroup): node is FilterGroup;
|
|
316
518
|
export declare enum OrderByDirection {
|
|
317
519
|
ASC = "asc",
|
|
318
520
|
DESC = "desc"
|
|
@@ -331,15 +533,14 @@ interface BaseEntityQueryCondition {
|
|
|
331
533
|
filterGroup?: FilterGroup;
|
|
332
534
|
orderBys?: OrderBy[];
|
|
333
535
|
query?: string;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
where?: WhereCondition<Entity>[];
|
|
536
|
+
/**
|
|
537
|
+
* Read every page and answer them as one, for a screen that works on the whole set (a dashboard) rather than on a
|
|
538
|
+
* page of it behind a pager. Pages are read one after another, `pageSize` (200 when not given) rows each; a bare
|
|
539
|
+
* array answer has no pages and comes back as it is.
|
|
540
|
+
*/
|
|
541
|
+
allPages?: boolean;
|
|
542
|
+
/** Also list the retired records of a shared type — the backend honours it for the owner of a record and for the common's own members. */
|
|
543
|
+
includeRetired?: boolean;
|
|
343
544
|
}
|
|
344
545
|
interface BaseEntityLoadResponse<Entity extends BaseEntity> {
|
|
345
546
|
number: number | undefined;
|
|
@@ -358,61 +559,11 @@ interface BaseEntityService<Entity extends BaseEntity> {
|
|
|
358
559
|
findByQuery(condition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
|
|
359
560
|
update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
|
|
360
561
|
}
|
|
361
|
-
type EntityServiceKind = 'rest' | 'firestore';
|
|
362
|
-
export declare abstract class BaseEntityFacade<Entity extends BaseEntity> {
|
|
363
|
-
abstract readonly entityType: Type<Entity>;
|
|
364
|
-
protected readonly serviceKind: EntityServiceKind;
|
|
365
|
-
protected readonly endpoint?: string;
|
|
366
|
-
protected readonly backendRoot?: string;
|
|
367
|
-
protected readonly injector: Injector;
|
|
368
|
-
private _mapper?;
|
|
369
|
-
private _service?;
|
|
370
|
-
private _storeClass?;
|
|
371
|
-
private _storeInstance?;
|
|
372
|
-
private _descriptor?;
|
|
373
|
-
get mapper(): BaseEntityMapper<Entity>;
|
|
374
|
-
get service(): BaseEntityService<Entity>;
|
|
375
|
-
get storeClass(): Type<unknown>;
|
|
376
|
-
get store(): unknown;
|
|
377
|
-
get descriptor(): BaseEntityDescriptor;
|
|
378
|
-
/**
|
|
379
|
-
* Deliberately does not go through {@link descriptor}: the store is created with a repository, and a
|
|
380
|
-
* repository may need to know which entity it serves — as an embedded one does. Binding the store into the
|
|
381
|
-
* descriptor only when the descriptor itself is asked for keeps that from re-entering the store getter and
|
|
382
|
-
* building a second store.
|
|
383
|
-
*/
|
|
384
|
-
get entityName(): string;
|
|
385
|
-
get attrDescriptors(): AbstractAttrDescriptor[];
|
|
386
|
-
get entityTitle(): string;
|
|
387
|
-
protected createMapper(): BaseEntityMapper<Entity>;
|
|
388
|
-
protected createService(mapper: BaseEntityMapper<Entity>): BaseEntityService<Entity>;
|
|
389
|
-
/** The descriptor as declared, before the store is bound into it. See {@link entityName}. */
|
|
390
|
-
private declaredDescriptor;
|
|
391
|
-
protected createStoreClass(): Type<unknown>;
|
|
392
|
-
protected abstract createDescriptor(): BaseEntityDescriptor;
|
|
393
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFacade<any>, never>;
|
|
394
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
395
|
-
}
|
|
396
562
|
export declare const BASE_ENTITY_STORE: InjectionToken<unknown>;
|
|
397
|
-
interface EntityStoreState<Entity extends BaseEntity> {
|
|
398
|
-
entities: Entity[];
|
|
399
|
-
number: number;
|
|
400
|
-
size: number;
|
|
401
|
-
totalElements: number;
|
|
402
|
-
totalPages: number;
|
|
403
|
-
currentId: string | undefined;
|
|
404
|
-
currentEntity: Entity | undefined;
|
|
405
|
-
isLoading: boolean;
|
|
406
|
-
error: string | undefined;
|
|
407
|
-
selectedEntities: Array<Entity>;
|
|
408
|
-
}
|
|
409
|
-
type EntityStoreHandle<Entity extends BaseEntity> = WritableStateSource<EntityStoreState<Entity>> & {
|
|
410
|
-
entities: Signal<Entity[]>;
|
|
411
|
-
selectedEntities: Signal<Entity[]>;
|
|
412
|
-
};
|
|
413
563
|
interface BaseEntityStoreApi<Entity extends BaseEntity> {
|
|
414
564
|
entities: Signal<Entity[]>;
|
|
415
565
|
selectedEntities: Signal<Entity[]>;
|
|
566
|
+
stagedIds: Signal<string[]>;
|
|
416
567
|
currentEntity: Signal<Entity | undefined>;
|
|
417
568
|
currentId: Signal<string | undefined>;
|
|
418
569
|
isLoading: Signal<boolean>;
|
|
@@ -433,9 +584,24 @@ interface BaseEntityStoreApi<Entity extends BaseEntity> {
|
|
|
433
584
|
deselectEntity(id: string): void;
|
|
434
585
|
load(query: BaseEntityQueryCondition): void;
|
|
435
586
|
loadById(id: string): Entity | undefined;
|
|
587
|
+
/**
|
|
588
|
+
* Re-reads one row from the repository — after something other than this store changed it on the server.
|
|
589
|
+
* Also how staged changes are discarded: the row is replaced by what the server holds.
|
|
590
|
+
*/
|
|
591
|
+
reload(id: string): Promise<PersistedEntity<Entity> | undefined>;
|
|
436
592
|
resetErrorState(): void;
|
|
437
593
|
selectEntity(id: string): void;
|
|
594
|
+
/** What identifies a row of this store — its `id`, or for an embedded row the attribute its entity keys it by. */
|
|
595
|
+
keyOf?(entity: Entity): string | undefined;
|
|
438
596
|
setCurrentEntity(id: string | undefined): void;
|
|
597
|
+
/**
|
|
598
|
+
* Replaces a row in this store **without** persisting it, and remembers that it is unsaved. An embedded
|
|
599
|
+
* child's Save lands here: its row lives inside this entity's document, which is only written when the
|
|
600
|
+
* document's own Save runs — so a rule spanning the document (an order's total against its lines) judges
|
|
601
|
+
* the finished document, not each step towards it. `update` persists and clears the mark; `reload` discards.
|
|
602
|
+
*/
|
|
603
|
+
stage(entity: PersistedEntity<Entity>): void;
|
|
604
|
+
hasStagedChanges(id: string): boolean;
|
|
439
605
|
update(entity: PersistedEntity<Entity>): Promise<PersistedEntity<Entity> | undefined>;
|
|
440
606
|
clearCurrentEntity(): void;
|
|
441
607
|
createEntity(): Entity;
|
|
@@ -453,7 +619,6 @@ interface BaseEntityStoreApi<Entity extends BaseEntity> {
|
|
|
453
619
|
* its owner's attribute declares. See `EmbeddedEntityFacade`.
|
|
454
620
|
*/
|
|
455
621
|
type EntityKeyResolver<Entity extends BaseEntity> = (entity: Entity) => string | undefined;
|
|
456
|
-
declare const entityKeyById: <Entity extends BaseEntity>(entity: Entity) => string | undefined;
|
|
457
622
|
export declare function BaseEntityStore<Entity extends BaseEntity>(entityType: new () => Entity, getRepository: () => BaseEntityService<Entity>, keyOf?: EntityKeyResolver<Entity>): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
458
623
|
state: {
|
|
459
624
|
entities: Entity[];
|
|
@@ -466,6 +631,7 @@ export declare function BaseEntityStore<Entity extends BaseEntity>(entityType: n
|
|
|
466
631
|
isLoading: boolean;
|
|
467
632
|
error: string | undefined;
|
|
468
633
|
selectedEntities: Entity[];
|
|
634
|
+
stagedIds: string[];
|
|
469
635
|
};
|
|
470
636
|
props: {
|
|
471
637
|
countOfEntities: Signal<number>;
|
|
@@ -476,73 +642,335 @@ export declare function BaseEntityStore<Entity extends BaseEntity>(entityType: n
|
|
|
476
642
|
createEntity: () => Entity;
|
|
477
643
|
add: (entity: Entity) => Promise<PersistedEntity<Entity> | undefined>;
|
|
478
644
|
delete: (id: string) => Promise<void>;
|
|
645
|
+
keyOf: EntityKeyResolver<Entity>;
|
|
646
|
+
hasStagedChanges: (id: string) => boolean;
|
|
479
647
|
deleteAll: import("@ngrx/signals/rxjs-interop").RxMethod<void>;
|
|
480
648
|
deselectAll: () => void;
|
|
481
649
|
deselectEntity: (id: string) => void;
|
|
482
650
|
load: import("@ngrx/signals/rxjs-interop").RxMethod<BaseEntityQueryCondition>;
|
|
483
651
|
loadById: (id: string) => Entity | undefined;
|
|
652
|
+
reload: (id: string) => Promise<PersistedEntity<Entity> | undefined>;
|
|
484
653
|
resetErrorState: () => void;
|
|
485
654
|
selectEntity: (id: string) => void;
|
|
486
655
|
setCurrentEntity: (id: string | undefined) => void;
|
|
656
|
+
stage: (entity: PersistedEntity<Entity>) => void;
|
|
487
657
|
update: (entity: PersistedEntity<Entity>) => Promise<PersistedEntity<Entity> | undefined>;
|
|
488
658
|
};
|
|
489
659
|
}>;
|
|
490
|
-
export declare class
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
private readonly
|
|
494
|
-
|
|
495
|
-
store: BaseEntityStoreApi<
|
|
496
|
-
protected activeFacade: import("@angular/core").Signal<BaseEntityFacade<BaseEntity> | undefined>;
|
|
497
|
-
protected resolvedDescriptor: import("@angular/core").Signal<BaseEntityDescriptor>;
|
|
498
|
-
constructor();
|
|
499
|
-
ngOnDestroy(): void;
|
|
500
|
-
ngOnInit(): void;
|
|
501
|
-
private registerEffects;
|
|
502
|
-
private registerFacadeDescriptorMerge;
|
|
503
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityContainerComponent, never>;
|
|
504
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityContainerComponent, "base-entity-container", never, {
|
|
505
|
-
"entityDescriptor": {
|
|
506
|
-
"alias": "entityDescriptor";
|
|
507
|
-
"required": false;
|
|
508
|
-
"isSignal": true;
|
|
509
|
-
};
|
|
510
|
-
"facade": {
|
|
511
|
-
"alias": "facade";
|
|
512
|
-
"required": false;
|
|
513
|
-
"isSignal": true;
|
|
514
|
-
};
|
|
515
|
-
}, {}, never, ["*"], true, never>;
|
|
516
|
-
}
|
|
517
|
-
interface EntityContainerState {
|
|
518
|
-
filterKey: string | undefined;
|
|
519
|
-
}
|
|
520
|
-
export declare function BaseEntityContainerStore(): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
521
|
-
state: {
|
|
522
|
-
filterKey: string | undefined;
|
|
523
|
-
};
|
|
524
|
-
props: {};
|
|
525
|
-
methods: {
|
|
526
|
-
doFilter: (filterKey: string) => void;
|
|
527
|
-
};
|
|
528
|
-
}>;
|
|
529
|
-
export declare class BaseEntityRestService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
530
|
-
protected entityMapper: BaseEntityMapper<Entity>;
|
|
531
|
-
protected urlProperty: string;
|
|
532
|
-
protected resourceUrl: string;
|
|
533
|
-
private readonly runtimeConfiguration;
|
|
534
|
-
private readonly baseUrl;
|
|
535
|
-
protected httpClient: HttpClient;
|
|
536
|
-
protected headers: HttpHeaders;
|
|
660
|
+
export declare class BaseEntityFormBuilder<Entity extends BaseEntity> {
|
|
661
|
+
private readonly logger;
|
|
662
|
+
private readonly transloco;
|
|
663
|
+
private readonly stateControl;
|
|
664
|
+
private readonly calculatedControl;
|
|
665
|
+
buildForm(viewContainerRef: ViewContainerRef, baseEntityForm: FormGroup, store: BaseEntityStoreApi<Entity>, attrDescriptors: AbstractAttrDescriptor[], entity: Signal<Entity>, entityName: string, initialValues?: Record<string, unknown>): void;
|
|
537
666
|
/**
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
667
|
+
* The tooltip of one control, attached to the control's host element so that every control type — the
|
|
668
|
+
* ones base-entity ships and the CUSTOM ones it cannot know — gets it without a template change.
|
|
669
|
+
*
|
|
670
|
+
* The message is read from {@link AbstractAttrDescriptor.tooltipI18nKey}, falling back to the
|
|
671
|
+
* descriptor's `description` (which is also what an entity authored as metadata carries). The binding is a
|
|
672
|
+
* getter, re-read on every change detection, so a language switch or a lazily-loaded scope shows up without
|
|
673
|
+
* rebuilding the form. An attribute with neither a key nor a description gets no tooltip directive at all;
|
|
674
|
+
* an empty message is one MatTooltip never opens.
|
|
543
675
|
*/
|
|
544
|
-
|
|
545
|
-
|
|
676
|
+
private tooltipFor;
|
|
677
|
+
private createFormControlFor;
|
|
678
|
+
private createFormControl;
|
|
679
|
+
private componentOf;
|
|
680
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormBuilder<any>, never>;
|
|
681
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
682
|
+
}
|
|
683
|
+
export declare abstract class BaseFormControlComponent<Entity extends BaseEntity> {
|
|
684
|
+
config: InputSignal<BaseEntityAttrDescriptor>;
|
|
685
|
+
entity: InputSignal<Entity>;
|
|
686
|
+
entityName: InputSignal<string>;
|
|
687
|
+
formGroup: FormGroup;
|
|
688
|
+
store: BaseEntityStoreApi<Entity>;
|
|
689
|
+
/**
|
|
690
|
+
* Set by {@link BaseEntityFormBuilder} on every control it creates, for the controls that build sub-forms of
|
|
691
|
+
* their own. Handed over rather than injected because the builder maps control types to these very component
|
|
692
|
+
* classes — injecting it here would close a runtime import cycle (NG0919). The import above is type-only.
|
|
693
|
+
*/
|
|
694
|
+
formBuilder: BaseEntityFormBuilder<Entity>;
|
|
695
|
+
style: import("@angular/core").Signal<{
|
|
696
|
+
[p: string]: unknown;
|
|
697
|
+
} | null | undefined>;
|
|
698
|
+
linkedEntityName: import("@angular/core").Signal<string>;
|
|
699
|
+
linkedEntityDescriptor: import("@angular/core").Signal<BaseEntityDescriptor | undefined>;
|
|
700
|
+
value: InputSignal<unknown>;
|
|
701
|
+
get testId(): string | null;
|
|
702
|
+
get hostStyle(): string | null;
|
|
703
|
+
protected readonly logger: NGXLogger;
|
|
704
|
+
protected readonly formNavigator: {
|
|
705
|
+
activeRouteSegment: import("@angular/core").Signal<import("@processpuzzle/base-entity").RouteSegments | undefined>;
|
|
706
|
+
activeTabSegment: import("@angular/core").Signal<string | undefined>;
|
|
707
|
+
tabSegments: import("@angular/core").Signal<string[]>;
|
|
708
|
+
breadcrumb: import("@angular/core").Signal<import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[]>;
|
|
709
|
+
entityName: import("@angular/core").Signal<string>;
|
|
710
|
+
navigationError?: import("@angular/core").Signal<string | undefined> | undefined;
|
|
711
|
+
navigateTo: import("@angular/core").Signal<string>;
|
|
712
|
+
responsePayloads: import("@angular/core").Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
713
|
+
requestPayloads: import("@angular/core").Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
714
|
+
returnTo: import("@angular/core").Signal<string>;
|
|
715
|
+
formSnapshots: import("@angular/core").Signal<Record<string, Record<string, unknown>>>;
|
|
716
|
+
roundTripOpen: import("@angular/core").Signal<boolean>;
|
|
717
|
+
determineCurrentUrl: () => string;
|
|
718
|
+
determineOwnerUrl: () => string;
|
|
719
|
+
determineActiveRouteSegment: () => void;
|
|
720
|
+
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
721
|
+
navigateToBreadcrumbLevel: (index: number) => Promise<void>;
|
|
722
|
+
navigateToDetails: (entityName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
723
|
+
navigateToEmbedded: (embeddedTypeName: string, id: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
724
|
+
navigateToList: (entityName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
725
|
+
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
726
|
+
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
727
|
+
navigateToTab: (entityName: string, id: string, segment: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
728
|
+
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
729
|
+
registerTabSegments: (segments: string[]) => void;
|
|
730
|
+
showsScreenOf: (entityName: string) => boolean;
|
|
731
|
+
destroyNavigationTracking: () => void;
|
|
732
|
+
initializeNavigationTracking: () => void;
|
|
733
|
+
beginRoundTrip: () => void;
|
|
734
|
+
hasRoundTrip: () => boolean;
|
|
735
|
+
keepFormSnapshot: (owner: string, values: Record<string, unknown>) => void;
|
|
736
|
+
popFormSnapshot: (owner: string) => Record<string, unknown> | undefined;
|
|
737
|
+
popRequestPayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
738
|
+
popResponsePayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
739
|
+
pushResponsePayload: (payload: import("@processpuzzle/base-entity").NavigationPayload) => void;
|
|
740
|
+
setEntityName: (entityName: string) => void;
|
|
741
|
+
} & import("@ngrx/signals").StateSource<{
|
|
742
|
+
activeRouteSegment: import("@processpuzzle/base-entity").RouteSegments | undefined;
|
|
743
|
+
activeTabSegment: string | undefined;
|
|
744
|
+
tabSegments: string[];
|
|
745
|
+
breadcrumb: import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[];
|
|
746
|
+
entityName: string;
|
|
747
|
+
navigationError?: string | undefined;
|
|
748
|
+
navigateTo: string;
|
|
749
|
+
responsePayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
750
|
+
requestPayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
751
|
+
returnTo: string;
|
|
752
|
+
formSnapshots: Record<string, Record<string, unknown>>;
|
|
753
|
+
roundTripOpen: boolean;
|
|
754
|
+
}>;
|
|
755
|
+
protected readonly descriptorRegistry: BaseEntityDescriptorRegistry;
|
|
756
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormControlComponent<any>, never>;
|
|
757
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseFormControlComponent<any>, "ng-component", never, {
|
|
758
|
+
"config": {
|
|
759
|
+
"alias": "config";
|
|
760
|
+
"required": true;
|
|
761
|
+
"isSignal": true;
|
|
762
|
+
};
|
|
763
|
+
"entity": {
|
|
764
|
+
"alias": "entity";
|
|
765
|
+
"required": true;
|
|
766
|
+
"isSignal": true;
|
|
767
|
+
};
|
|
768
|
+
"entityName": {
|
|
769
|
+
"alias": "entityName";
|
|
770
|
+
"required": true;
|
|
771
|
+
"isSignal": true;
|
|
772
|
+
};
|
|
773
|
+
"value": {
|
|
774
|
+
"alias": "value";
|
|
775
|
+
"required": true;
|
|
776
|
+
"isSignal": true;
|
|
777
|
+
};
|
|
778
|
+
}, {}, never, never, true, never>;
|
|
779
|
+
}
|
|
780
|
+
interface ArtifactAttr {
|
|
781
|
+
readonly bucket: string;
|
|
782
|
+
readonly objectId: string;
|
|
783
|
+
readonly name: string;
|
|
784
|
+
readonly mimeType: string;
|
|
785
|
+
}
|
|
786
|
+
export declare class ArtifactComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
787
|
+
private readonly objectStoreService;
|
|
788
|
+
private readonly dialog;
|
|
789
|
+
private readonly destroyRef;
|
|
790
|
+
private readonly valueSignal;
|
|
791
|
+
/**
|
|
792
|
+
* With an upper bound above 1 (see `multiplicity`) the value is an `ArtifactAttr[]`, an upload appends and
|
|
793
|
+
* a delete removes one; otherwise it is a single `ArtifactAttr` and an upload replaces it.
|
|
794
|
+
*/
|
|
795
|
+
readonly multiValued: import("@angular/core").Signal<boolean>;
|
|
796
|
+
/** The artifacts shown, one row each — at most one when single-valued. */
|
|
797
|
+
readonly artifacts: import("@angular/core").Signal<ArtifactAttr[]>;
|
|
798
|
+
/** The single-valued view: the one artifact, or null. */
|
|
799
|
+
readonly artifact: import("@angular/core").Signal<ArtifactAttr>;
|
|
800
|
+
/** A single-valued control can always take an upload (it replaces); a multi-valued one until it is full. */
|
|
801
|
+
readonly canAdd: import("@angular/core").Signal<boolean>;
|
|
802
|
+
/** Signed thumbnail URIs by `objectId`; null where the store has none. */
|
|
803
|
+
private readonly thumbnailUrls;
|
|
804
|
+
ngOnInit(): void;
|
|
805
|
+
thumbnailUrlOf(artifact: ArtifactAttr): string | null;
|
|
806
|
+
/** Fetches a thumbnail once per image artifact and forgets those of artifacts no longer in the value. */
|
|
807
|
+
private refreshThumbnails;
|
|
808
|
+
private setThumbnailUrl;
|
|
809
|
+
mimeIcon(mimeType: string | undefined): string;
|
|
810
|
+
openArtifact(event: Event, artifact: ArtifactAttr): void;
|
|
811
|
+
onArtifactUploaded(artifact: ArtifactAttr): void;
|
|
812
|
+
/** Deletes `artifact` — the single one when omitted — after the user confirms. */
|
|
813
|
+
deleteArtifact(artifact?: ArtifactAttr | null): void;
|
|
814
|
+
private removeArtifact;
|
|
815
|
+
private writeValue;
|
|
816
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ArtifactComponent<any>, never>;
|
|
817
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ArtifactComponent<any>, "app-artifact", never, {}, {}, never, never, true, never>;
|
|
818
|
+
}
|
|
819
|
+
export declare class AvatarComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
820
|
+
private readonly objectStoreService;
|
|
821
|
+
private readonly dialog;
|
|
822
|
+
private readonly destroyRef;
|
|
823
|
+
private readonly valueSignal;
|
|
824
|
+
/** The single avatar artifact, or null if none uploaded. */
|
|
825
|
+
readonly artifact: import("@angular/core").Signal<ArtifactAttr | null>;
|
|
826
|
+
/** The fallback avatar (icon name or image URL) configured on the descriptor, defaulting to 'person'. */
|
|
827
|
+
readonly defaultAvatar: import("@angular/core").Signal<string>;
|
|
828
|
+
/** When not disabled, an upload can be performed to set or replace the avatar. */
|
|
829
|
+
readonly canAdd: import("@angular/core").Signal<boolean>;
|
|
830
|
+
/** Signed thumbnail URIs by `objectId`; null where the store has none. */
|
|
831
|
+
private readonly thumbnailUrls;
|
|
832
|
+
ngOnInit(): void;
|
|
833
|
+
isDefaultAvatarImage(avatar: string | undefined): boolean;
|
|
834
|
+
thumbnailUrlOf(artifact: ArtifactAttr): string | null;
|
|
835
|
+
private refreshThumbnails;
|
|
836
|
+
private setThumbnailUrl;
|
|
837
|
+
openArtifact(event: Event, artifact: ArtifactAttr): void;
|
|
838
|
+
onArtifactUploaded(artifact: ArtifactAttr): void;
|
|
839
|
+
deleteArtifact(artifact?: ArtifactAttr | null): void;
|
|
840
|
+
private writeValue;
|
|
841
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AvatarComponent<any>, never>;
|
|
842
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AvatarComponent<any>, "app-avatar", never, {}, {}, never, never, true, never>;
|
|
843
|
+
}
|
|
844
|
+
interface UploadObjectResponse {
|
|
845
|
+
objectID: string;
|
|
846
|
+
fileName: string;
|
|
847
|
+
mimeType: string;
|
|
848
|
+
bucketName?: string;
|
|
849
|
+
}
|
|
850
|
+
interface ObjectDownloadResponse {
|
|
851
|
+
data: Blob;
|
|
852
|
+
fileName?: string;
|
|
853
|
+
bucketName?: string;
|
|
854
|
+
}
|
|
855
|
+
interface ObjectUriResponse {
|
|
856
|
+
uri: string;
|
|
857
|
+
}
|
|
858
|
+
export declare class ObjectStoreService {
|
|
859
|
+
private readonly runtimeConfiguration;
|
|
860
|
+
private readonly httpClient;
|
|
861
|
+
private readonly baseUrl;
|
|
862
|
+
uploadObject(file: Blob, name: string, mimeType: string): Observable<UploadObjectResponse>;
|
|
863
|
+
getObjectByID(bucketName: string, objectID: string): Observable<ObjectDownloadResponse>;
|
|
864
|
+
deleteObjectByID(bucketName: string, objectID: string): Observable<void>;
|
|
865
|
+
getObjectUriByID(bucketName: string, objectID: string): Observable<ObjectUriResponse>;
|
|
866
|
+
getThumbnailUriByID(bucketName: string, objectID: string): Observable<ObjectUriResponse | null>;
|
|
867
|
+
private buildFullUrl;
|
|
868
|
+
private resolveBaseUrl;
|
|
869
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ObjectStoreService, never>;
|
|
870
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
871
|
+
}
|
|
872
|
+
interface BaseEntityMapper<Entity extends BaseEntity> {
|
|
873
|
+
fromDto(dto: unknown, index?: number): Entity;
|
|
874
|
+
toDto(entity: Entity): unknown;
|
|
875
|
+
}
|
|
876
|
+
export declare class SimpleEntityMapper<Entity extends BaseEntity> implements BaseEntityMapper<Entity> {
|
|
877
|
+
private readonly entityType;
|
|
878
|
+
constructor(entityType: new (...args: unknown[]) => Entity);
|
|
879
|
+
fromDto(dto: unknown): Entity;
|
|
880
|
+
toDto(entity: Entity): unknown;
|
|
881
|
+
}
|
|
882
|
+
export declare function getEnumKeyByValue<E>(myEnum: {
|
|
883
|
+
[key: number]: string;
|
|
884
|
+
}, enumValue: number): E | undefined;
|
|
885
|
+
export declare function getEnumValueByKey<E>(myEnum: {
|
|
886
|
+
[key: string]: E | string;
|
|
887
|
+
}, enumKey: string): E | undefined;
|
|
888
|
+
export declare abstract class BaseEntityFacade<Entity extends BaseEntity> {
|
|
889
|
+
abstract readonly entityType: Type<Entity>;
|
|
890
|
+
protected readonly endpoint?: string;
|
|
891
|
+
protected readonly backendRoot?: string;
|
|
892
|
+
protected readonly injector: Injector;
|
|
893
|
+
private _mapper?;
|
|
894
|
+
private _service?;
|
|
895
|
+
private _storeClass?;
|
|
896
|
+
private _storeInstance?;
|
|
897
|
+
private _descriptor?;
|
|
898
|
+
get mapper(): BaseEntityMapper<Entity>;
|
|
899
|
+
get service(): BaseEntityService<Entity>;
|
|
900
|
+
get storeClass(): Type<unknown>;
|
|
901
|
+
get store(): unknown;
|
|
902
|
+
get descriptor(): BaseEntityDescriptor;
|
|
903
|
+
/**
|
|
904
|
+
* Deliberately does not go through {@link descriptor}: the store is created with a repository, and a
|
|
905
|
+
* repository may need to know which entity it serves — as an embedded one does. Binding the store into the
|
|
906
|
+
* descriptor only when the descriptor itself is asked for keeps that from re-entering the store getter and
|
|
907
|
+
* building a second store.
|
|
908
|
+
*/
|
|
909
|
+
get entityName(): string;
|
|
910
|
+
get attrDescriptors(): AbstractAttrDescriptor[];
|
|
911
|
+
get entityTitle(): string;
|
|
912
|
+
protected createMapper(): BaseEntityMapper<Entity>;
|
|
913
|
+
protected createService(mapper: BaseEntityMapper<Entity>): BaseEntityService<Entity>;
|
|
914
|
+
/** The descriptor as declared, before the store is bound into it. See {@link entityName}. */
|
|
915
|
+
private declaredDescriptor;
|
|
916
|
+
protected createStoreClass(): Type<unknown>;
|
|
917
|
+
protected abstract createDescriptor(): BaseEntityDescriptor;
|
|
918
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFacade<any>, never>;
|
|
919
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
920
|
+
}
|
|
921
|
+
export declare class BaseEntityContainerComponent implements OnDestroy, OnInit {
|
|
922
|
+
entityDescriptor: import("@angular/core").InputSignal<BaseEntityDescriptor | undefined>;
|
|
923
|
+
facade: import("@angular/core").InputSignal<BaseEntityFacade<BaseEntity> | undefined>;
|
|
924
|
+
private readonly injectedFacade;
|
|
925
|
+
protected snackBar: MatSnackBar;
|
|
926
|
+
store: BaseEntityStoreApi<BaseEntity>;
|
|
927
|
+
protected activeFacade: import("@angular/core").Signal<BaseEntityFacade<BaseEntity> | undefined>;
|
|
928
|
+
protected resolvedDescriptor: import("@angular/core").Signal<BaseEntityDescriptor>;
|
|
929
|
+
constructor();
|
|
930
|
+
ngOnDestroy(): void;
|
|
931
|
+
ngOnInit(): void;
|
|
932
|
+
private registerEffects;
|
|
933
|
+
private registerFacadeDescriptorMerge;
|
|
934
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityContainerComponent, never>;
|
|
935
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityContainerComponent, "base-entity-container", never, {
|
|
936
|
+
"entityDescriptor": {
|
|
937
|
+
"alias": "entityDescriptor";
|
|
938
|
+
"required": false;
|
|
939
|
+
"isSignal": true;
|
|
940
|
+
};
|
|
941
|
+
"facade": {
|
|
942
|
+
"alias": "facade";
|
|
943
|
+
"required": false;
|
|
944
|
+
"isSignal": true;
|
|
945
|
+
};
|
|
946
|
+
}, {}, never, ["*"], true, never>;
|
|
947
|
+
}
|
|
948
|
+
export declare function BaseEntityContainerStore(): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
949
|
+
state: {
|
|
950
|
+
filterKey: string | undefined;
|
|
951
|
+
};
|
|
952
|
+
props: {};
|
|
953
|
+
methods: {
|
|
954
|
+
doFilter: (filterKey: string) => void;
|
|
955
|
+
};
|
|
956
|
+
}>;
|
|
957
|
+
export declare class BaseEntityRestService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
958
|
+
protected entityMapper: BaseEntityMapper<Entity>;
|
|
959
|
+
protected urlProperty: string;
|
|
960
|
+
protected resourceUrl: string;
|
|
961
|
+
private readonly runtimeConfiguration;
|
|
962
|
+
private readonly baseUrl;
|
|
963
|
+
protected httpClient: HttpClient;
|
|
964
|
+
protected headers: HttpHeaders;
|
|
965
|
+
/**
|
|
966
|
+
* Names of the two query parameters a filtered, sorted collection read is built from. Overridable
|
|
967
|
+
* because the workspace's contracts do not agree on them: `shared-api.yaml` and every feature that
|
|
968
|
+
* refers to it say `where` / `order`, while base-entity's *instances* resource says `rsql` / `sort`
|
|
969
|
+
* (`base-entity-api.yaml`, `listEntities`). The RSQL and the sort expression themselves are identical,
|
|
970
|
+
* so a subclass renames rather than reimplements — see `DynamicEntityService`.
|
|
971
|
+
*/
|
|
972
|
+
protected readonly filterParamName: string;
|
|
973
|
+
protected readonly sortParamName: string;
|
|
546
974
|
constructor(entityMapper: BaseEntityMapper<Entity>, urlProperty: string, resourceUrl: string);
|
|
547
975
|
delete(id: string): Observable<unknown>;
|
|
548
976
|
deleteAll(): Observable<unknown>;
|
|
@@ -553,11 +981,17 @@ export declare class BaseEntityRestService<Entity extends BaseEntity> implements
|
|
|
553
981
|
/**
|
|
554
982
|
* Reads one entity by id. The `/%{id}` suffix is what makes this a single-entity read: without it the
|
|
555
983
|
* URL is the collection's, and the response mapper then sees a list where it expects one record — the
|
|
556
|
-
*
|
|
984
|
+
* embedded implementation of this interface addresses one document, and so does this one.
|
|
557
985
|
*/
|
|
558
986
|
findById(id: string): Observable<void | PersistedEntity<Entity>>;
|
|
559
987
|
add(entity: Entity, id?: number): Observable<PersistedEntity<Entity>>;
|
|
560
988
|
update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
|
|
989
|
+
/**
|
|
990
|
+
* The context the reads of this service carry; none by default. A service whose entities are *definitions*
|
|
991
|
+
* returns `definitionRead()`, so that a host's `definitionRevisionInterceptor` addresses its reads to the draft or
|
|
992
|
+
* the released revision — writes always go to the draft and carry nothing.
|
|
993
|
+
*/
|
|
994
|
+
protected readContext(): HttpContext | undefined;
|
|
561
995
|
protected buildFullUrl(resourceUri: string, queryCondition: BaseEntityQueryCondition): string | undefined;
|
|
562
996
|
protected buildRsql(queryCondition: BaseEntityQueryCondition): string | undefined;
|
|
563
997
|
private buildOrder;
|
|
@@ -602,12 +1036,27 @@ interface RuleEngine {
|
|
|
602
1036
|
evaluate(entity: unknown, rule: EvaluatableRule): RuleEvaluationResult;
|
|
603
1037
|
}
|
|
604
1038
|
export declare const RULE_ENGINE: InjectionToken<RuleEngine>;
|
|
605
|
-
|
|
1039
|
+
/** Implemented by a screen that can tell whether leaving it would lose the user's edits. */
|
|
1040
|
+
interface HasUnsavedChanges {
|
|
1041
|
+
/** Resolves true when it is fine to leave — nothing to lose, or the user chose to discard it. */
|
|
1042
|
+
confirmLeave(): boolean | Promise<boolean>;
|
|
1043
|
+
}
|
|
1044
|
+
/** Reminds the user of unsaved changes before they navigate away from an entity form. */
|
|
1045
|
+
export declare const unsavedChangesGuard: CanDeactivateFn<HasUnsavedChanges>;
|
|
1046
|
+
export declare class BaseEntityFormComponent<Entity extends BaseEntity> implements OnInit, OnDestroy, HasUnsavedChanges {
|
|
606
1047
|
baseEntityForm: FormGroup;
|
|
607
1048
|
entityDescriptor: Signal<BaseEntityDescriptor>;
|
|
608
1049
|
entity: Signal<Entity>;
|
|
609
1050
|
entityId: InputSignal<string>;
|
|
610
1051
|
isAbstract: Signal<boolean>;
|
|
1052
|
+
/** A preview of draft definitions over live objects: shown, never saved or deleted — see EntityPreviewMode. */
|
|
1053
|
+
/** The entity-wide read-only state: a kind of row that is never edited, or the preview of a draft. */
|
|
1054
|
+
entityReadOnly: Signal<boolean>;
|
|
1055
|
+
/** Whether the row being shown may be changed; a new entity always may. See {@link BaseEntityDescriptorOptions.isEditable}. */
|
|
1056
|
+
rowEditable: Signal<boolean>;
|
|
1057
|
+
/** Whether the row being shown may be deleted. See {@link BaseEntityDescriptorOptions.isDeletable}. */
|
|
1058
|
+
rowDeletable: Signal<boolean>;
|
|
1059
|
+
isReadOnly: Signal<boolean>;
|
|
611
1060
|
isNewObject: Signal<boolean>;
|
|
612
1061
|
store: Signal<BaseEntityStoreApi<Entity>>;
|
|
613
1062
|
componentHost: BaseFormHostDirective;
|
|
@@ -619,6 +1068,11 @@ export declare class BaseEntityFormComponent<Entity extends BaseEntity> implemen
|
|
|
619
1068
|
violations: WritableSignal<RuleEvaluationResult[]>;
|
|
620
1069
|
hasErrorViolations: Signal<boolean>;
|
|
621
1070
|
saveDisabled: Signal<boolean>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Edits made here, or staged in this entity's document by an embedded child or a relationship, that only
|
|
1073
|
+
* this form's Save persists. Read by the status bar indicator and by the leave guard.
|
|
1074
|
+
*/
|
|
1075
|
+
hasUnsavedChanges: Signal<boolean>;
|
|
622
1076
|
private readonly entityFormBuilder;
|
|
623
1077
|
private readonly formBuilder;
|
|
624
1078
|
protected readonly formNavigator: {
|
|
@@ -631,152 +1085,9 @@ export declare class BaseEntityFormComponent<Entity extends BaseEntity> implemen
|
|
|
631
1085
|
navigateTo: Signal<string>;
|
|
632
1086
|
responsePayloads: Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
633
1087
|
requestPayloads: Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
634
|
-
returnTo: Signal<string>;
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
determineCurrentUrl: () => string;
|
|
638
|
-
determineOwnerUrl: () => string;
|
|
639
|
-
determineActiveRouteSegment: () => void;
|
|
640
|
-
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
641
|
-
navigateToBreadcrumbLevel: (index: number) => Promise<void>;
|
|
642
|
-
navigateToDetails: (entityName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
643
|
-
navigateToEmbedded: (embeddedTypeName: string, id: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
644
|
-
navigateToList: (entityName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
645
|
-
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
646
|
-
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
647
|
-
navigateToTab: (entityName: string, id: string, segment: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
648
|
-
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
649
|
-
registerTabSegments: (segments: string[]) => void;
|
|
650
|
-
showsScreenOf: (entityName: string) => boolean;
|
|
651
|
-
destroyNavigationTracking: () => void;
|
|
652
|
-
initializeNavigationTracking: () => void;
|
|
653
|
-
popFormSnapshot: () => Record<string, unknown> | undefined;
|
|
654
|
-
popRequestPayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
655
|
-
popResponsePayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
656
|
-
pushResponsePayload: (payload: import("@processpuzzle/base-entity").NavigationPayload) => void;
|
|
657
|
-
setEntityName: (entityName: string) => void;
|
|
658
|
-
} & import("@ngrx/signals").StateSource<{
|
|
659
|
-
activeRouteSegment: import("@processpuzzle/base-entity").RouteSegments | undefined;
|
|
660
|
-
activeTabSegment: string | undefined;
|
|
661
|
-
tabSegments: string[];
|
|
662
|
-
breadcrumb: import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[];
|
|
663
|
-
entityName: string;
|
|
664
|
-
navigationError?: string | undefined;
|
|
665
|
-
navigateTo: string;
|
|
666
|
-
responsePayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
667
|
-
requestPayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
668
|
-
returnTo: string;
|
|
669
|
-
formSnapshot: Record<string, unknown> | undefined;
|
|
670
|
-
}>;
|
|
671
|
-
private readonly logger;
|
|
672
|
-
private readonly ruleEngine;
|
|
673
|
-
private readonly violationsStore;
|
|
674
|
-
private rules;
|
|
675
|
-
private readonly fieldsWithRuleErrors;
|
|
676
|
-
private readonly ruleLoad$;
|
|
677
|
-
private ruleSubscription;
|
|
678
|
-
constructor();
|
|
679
|
-
ngOnInit(): void;
|
|
680
|
-
ngOnDestroy(): void;
|
|
681
|
-
onCancel(): Promise<void>;
|
|
682
|
-
onDelete(): Promise<void>;
|
|
683
|
-
onFieldBlur(): void;
|
|
684
|
-
onSubmit(): Promise<void>;
|
|
685
|
-
/**
|
|
686
|
-
* Leaving an embedded child goes to the form of the entity that contains it. Only a fallback: a drill-down
|
|
687
|
-
* already records where it came from. It is a page opened straight on its URL — a deep link, a reload —
|
|
688
|
-
* that has nothing recorded, and would otherwise land on the child's own list.
|
|
689
|
-
*/
|
|
690
|
-
private navigateBack;
|
|
691
|
-
private evaluateRules;
|
|
692
|
-
private applyFieldRuleErrors;
|
|
693
|
-
private clearFieldRuleErrors;
|
|
694
|
-
private loadRules;
|
|
695
|
-
private registerEffects;
|
|
696
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormComponent<any>, never>;
|
|
697
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityFormComponent<any>, "base-form", never, {
|
|
698
|
-
"entityId": {
|
|
699
|
-
"alias": "entityId";
|
|
700
|
-
"required": true;
|
|
701
|
-
"isSignal": true;
|
|
702
|
-
};
|
|
703
|
-
}, {}, never, never, true, never>;
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* Resolves an entity's descriptor and store **by name**, whichever world the entity comes from: a
|
|
707
|
-
* compile-time `BaseEntityFacade` registered in `BASE_ENTITY_FACADE_REGISTRY`, or a `BaseEntityDefinition`
|
|
708
|
-
* synthesized at run-time by `DynamicEntityRegistry` and published into {@link ResolvedEntityCache}.
|
|
709
|
-
*
|
|
710
|
-
* Being the single lookup surface is what makes the metadata-defined case cost the rest of the library
|
|
711
|
-
* nothing. `EmbeddedAggregateAccessor` asks here for the root store of an aggregate and for the descriptor
|
|
712
|
-
* of every level below it; `resolveEmbeddedRouteContext` walks the containment graph through the
|
|
713
|
-
* descriptors it gets back; the embedded form controls read their child's label the same way. None of them
|
|
714
|
-
* changed, and none of them can tell the difference.
|
|
715
|
-
*
|
|
716
|
-
* Compile-time first. A host application that registered a facade did so on purpose — it may carry extra
|
|
717
|
-
* tabs, a hand-tuned layout or a Firestore repository — and a definition of the same name does not
|
|
718
|
-
* override that decision. The dynamic side is a fallback, in both senses.
|
|
719
|
-
*
|
|
720
|
-
* The synthesized side is read out of a cache rather than from the registry that builds it, so that this
|
|
721
|
-
* class — injected by half the library — does not depend on the facades, and through them on every
|
|
722
|
-
* repository implementation there is. See {@link ResolvedEntityCache}.
|
|
723
|
-
*/
|
|
724
|
-
export declare class BaseEntityDescriptorRegistry {
|
|
725
|
-
private readonly registry;
|
|
726
|
-
private readonly resolvedEntities;
|
|
727
|
-
private readonly injector;
|
|
728
|
-
getDescriptor(entityName: string | undefined): BaseEntityDescriptor | undefined;
|
|
729
|
-
/**
|
|
730
|
-
* An embedded entity has a store too — see `EmbeddedEntityFacade`. It reads and writes the containing
|
|
731
|
-
* entity's document rather than an endpoint of its own, which is invisible from here.
|
|
732
|
-
*/
|
|
733
|
-
getStore<Store = unknown>(entityName: string | undefined): Store | undefined;
|
|
734
|
-
private resolveFacade;
|
|
735
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityDescriptorRegistry, never>;
|
|
736
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
737
|
-
}
|
|
738
|
-
declare class BaseEntityFormBuilder<Entity extends BaseEntity> {
|
|
739
|
-
private readonly logger;
|
|
740
|
-
buildForm(viewContainerRef: ViewContainerRef, baseEntityForm: FormGroup, store: BaseEntityStoreApi<Entity>, attrDescriptors: AbstractAttrDescriptor[], entity: Signal<Entity>, entityName: string, initialValues?: Record<string, unknown>): void;
|
|
741
|
-
private createFormControlFor;
|
|
742
|
-
private createFormControl;
|
|
743
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormBuilder<any>, never>;
|
|
744
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
745
|
-
}
|
|
746
|
-
export declare abstract class BaseFormControlComponent<Entity extends BaseEntity> {
|
|
747
|
-
config: InputSignal<BaseEntityAttrDescriptor>;
|
|
748
|
-
entity: InputSignal<Entity>;
|
|
749
|
-
entityName: InputSignal<string>;
|
|
750
|
-
formGroup: FormGroup;
|
|
751
|
-
store: BaseEntityStoreApi<Entity>;
|
|
752
|
-
/**
|
|
753
|
-
* Set by {@link BaseEntityFormBuilder} on every control it creates, for the controls that build sub-forms of
|
|
754
|
-
* their own. Handed over rather than injected because the builder maps control types to these very component
|
|
755
|
-
* classes — injecting it here would close a runtime import cycle (NG0919). The import above is type-only.
|
|
756
|
-
*/
|
|
757
|
-
formBuilder: BaseEntityFormBuilder<Entity>;
|
|
758
|
-
style: import("@angular/core").Signal<{
|
|
759
|
-
[p: string]: unknown;
|
|
760
|
-
} | null | undefined>;
|
|
761
|
-
linkedEntityName: import("@angular/core").Signal<string>;
|
|
762
|
-
linkedEntityDescriptor: import("@angular/core").Signal<BaseEntityDescriptor | undefined>;
|
|
763
|
-
value: InputSignal<unknown>;
|
|
764
|
-
get testId(): string | null;
|
|
765
|
-
get hostStyle(): string | null;
|
|
766
|
-
protected readonly logger: NGXLogger;
|
|
767
|
-
protected readonly formNavigator: {
|
|
768
|
-
activeRouteSegment: import("@angular/core").Signal<import("@processpuzzle/base-entity").RouteSegments | undefined>;
|
|
769
|
-
activeTabSegment: import("@angular/core").Signal<string | undefined>;
|
|
770
|
-
tabSegments: import("@angular/core").Signal<string[]>;
|
|
771
|
-
breadcrumb: import("@angular/core").Signal<import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[]>;
|
|
772
|
-
entityName: import("@angular/core").Signal<string>;
|
|
773
|
-
navigationError?: import("@angular/core").Signal<string | undefined> | undefined;
|
|
774
|
-
navigateTo: import("@angular/core").Signal<string>;
|
|
775
|
-
responsePayloads: import("@angular/core").Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
776
|
-
requestPayloads: import("@angular/core").Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
777
|
-
returnTo: import("@angular/core").Signal<string>;
|
|
778
|
-
formSnapshot: import("@angular/core").Signal<Record<string, unknown> | undefined>;
|
|
779
|
-
captureFormSnapshot: (snapshot: Record<string, unknown>) => void;
|
|
1088
|
+
returnTo: Signal<string>;
|
|
1089
|
+
formSnapshots: Signal<Record<string, Record<string, unknown>>>;
|
|
1090
|
+
roundTripOpen: Signal<boolean>;
|
|
780
1091
|
determineCurrentUrl: () => string;
|
|
781
1092
|
determineOwnerUrl: () => string;
|
|
782
1093
|
determineActiveRouteSegment: () => void;
|
|
@@ -793,7 +1104,10 @@ export declare abstract class BaseFormControlComponent<Entity extends BaseEntity
|
|
|
793
1104
|
showsScreenOf: (entityName: string) => boolean;
|
|
794
1105
|
destroyNavigationTracking: () => void;
|
|
795
1106
|
initializeNavigationTracking: () => void;
|
|
796
|
-
|
|
1107
|
+
beginRoundTrip: () => void;
|
|
1108
|
+
hasRoundTrip: () => boolean;
|
|
1109
|
+
keepFormSnapshot: (owner: string, values: Record<string, unknown>) => void;
|
|
1110
|
+
popFormSnapshot: (owner: string) => Record<string, unknown> | undefined;
|
|
797
1111
|
popRequestPayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
798
1112
|
popResponsePayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
799
1113
|
pushResponsePayload: (payload: import("@processpuzzle/base-entity").NavigationPayload) => void;
|
|
@@ -809,33 +1123,83 @@ export declare abstract class BaseFormControlComponent<Entity extends BaseEntity
|
|
|
809
1123
|
responsePayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
810
1124
|
requestPayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
811
1125
|
returnTo: string;
|
|
812
|
-
|
|
1126
|
+
formSnapshots: Record<string, Record<string, unknown>>;
|
|
1127
|
+
roundTripOpen: boolean;
|
|
813
1128
|
}>;
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
1129
|
+
private readonly logger;
|
|
1130
|
+
private readonly ruleEngine;
|
|
1131
|
+
private readonly violationsStore;
|
|
1132
|
+
private readonly previewMode;
|
|
1133
|
+
private readonly dialog;
|
|
1134
|
+
private readonly unsavedChanges;
|
|
1135
|
+
private unregisterUnsavedChanges;
|
|
1136
|
+
/** Set by Cancel, Delete and a finished Save: leaving is then intended, so the guard stays silent. */
|
|
1137
|
+
private leaveWithoutAsking;
|
|
1138
|
+
private rules;
|
|
1139
|
+
private readonly fieldsWithRuleErrors;
|
|
1140
|
+
private readonly ruleLoad$;
|
|
1141
|
+
private ruleSubscription;
|
|
1142
|
+
constructor();
|
|
1143
|
+
ngOnInit(): void;
|
|
1144
|
+
ngOnDestroy(): void;
|
|
1145
|
+
onCancel(): Promise<void>;
|
|
1146
|
+
/** Whether the row shown is a retired record of a shared type; it can be reinstated where the entity offers it. */
|
|
1147
|
+
isRetired: Signal<boolean>;
|
|
1148
|
+
canReinstate: Signal<boolean>;
|
|
1149
|
+
onReinstate(): Promise<void>;
|
|
1150
|
+
onDelete(): Promise<void>;
|
|
1151
|
+
onFieldBlur(): void;
|
|
1152
|
+
onSubmit(): Promise<void>;
|
|
1153
|
+
/** The route's `canDeactivate` question: asks the user before unsaved changes are thrown away. */
|
|
1154
|
+
confirmLeave(): Promise<boolean>;
|
|
1155
|
+
/**
|
|
1156
|
+
* Drops the embedded-child changes staged in this entity's document (see `BaseEntityStoreApi.stage`) by
|
|
1157
|
+
* re-reading it, so an abandoned edit cannot later pass for a saved one. A new object has no document yet.
|
|
1158
|
+
*/
|
|
1159
|
+
private discardStagedChanges;
|
|
1160
|
+
/**
|
|
1161
|
+
* Leaving an embedded child goes to the form of the entity that contains it. Only a fallback: a drill-down
|
|
1162
|
+
* already records where it came from. It is a page opened straight on its URL — a deep link, a reload —
|
|
1163
|
+
* that has nothing recorded, and would otherwise land on the child's own list.
|
|
1164
|
+
*
|
|
1165
|
+
* The navigator's entity name is re-claimed first: it is a singleton, and an embedded child opened below
|
|
1166
|
+
* this form — which outlives the child, so `ngOnInit` does not run again — leaves the child's name behind.
|
|
1167
|
+
* The list fallback would then aim at the child's list, which an embedded type does not have.
|
|
1168
|
+
*/
|
|
1169
|
+
private navigateBack;
|
|
1170
|
+
private evaluateRules;
|
|
1171
|
+
private applyFieldRuleErrors;
|
|
1172
|
+
private clearFieldRuleErrors;
|
|
1173
|
+
private loadRules;
|
|
1174
|
+
/**
|
|
1175
|
+
* A key chosen at creation is fixed once the entity exists. Disabled controls are left out of the save, so the
|
|
1176
|
+
* key is not sent again, and the backend keeps the one it stored.
|
|
1177
|
+
*/
|
|
1178
|
+
private disableCreateOnlyAttributes;
|
|
1179
|
+
private registerEffects;
|
|
1180
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormComponent<any>, never>;
|
|
1181
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityFormComponent<any>, "base-form", never, {
|
|
1182
|
+
"entityId": {
|
|
1183
|
+
"alias": "entityId";
|
|
834
1184
|
"required": true;
|
|
835
1185
|
"isSignal": true;
|
|
836
1186
|
};
|
|
837
1187
|
}, {}, never, never, true, never>;
|
|
838
1188
|
}
|
|
1189
|
+
/** The suggestion source of the realm's role catalog, for attributes that hold role names. */
|
|
1190
|
+
export declare const REALM_ROLE_SUGGESTIONS = "realm-roles";
|
|
1191
|
+
/**
|
|
1192
|
+
* Where a `TAGS` control gets values to offer, named by the attribute's `tagSuggestions`.
|
|
1193
|
+
*
|
|
1194
|
+
* Suggestions only help: the control still accepts any text, so a source that fails or answers empty
|
|
1195
|
+
* leaves a plain free-text control. base-entity names no source itself — the application binds the ones
|
|
1196
|
+
* it has, with `multi: true`, for example the role catalog under {@link REALM_ROLE_SUGGESTIONS}.
|
|
1197
|
+
*/
|
|
1198
|
+
interface TagSuggestionSource {
|
|
1199
|
+
readonly key: string;
|
|
1200
|
+
suggestions(): Observable<readonly string[]>;
|
|
1201
|
+
}
|
|
1202
|
+
export declare const TAG_SUGGESTION_SOURCES: InjectionToken<readonly TagSuggestionSource[]>;
|
|
839
1203
|
/**
|
|
840
1204
|
* To-many **containment** whose parts live in a table of their own — the child is persisted through its own
|
|
841
1205
|
* endpoint and points back at this entity through the foreign key named by
|
|
@@ -897,41 +1261,6 @@ type EmbeddedPath = readonly EmbeddedPathStep[];
|
|
|
897
1261
|
* property is an optional `id`, so TypeScript's weak-type rule rejects exactly those rows.
|
|
898
1262
|
*/
|
|
899
1263
|
type EmbeddedRow = BaseEntity | Record<string, unknown>;
|
|
900
|
-
type Payload = Record<string, unknown>;
|
|
901
|
-
/**
|
|
902
|
-
* An embedded child has no table of its own, so it is addressed by its **position** inside the root's
|
|
903
|
-
* payload — `regions[0].navItems[2]` — rather than by a globally unique id. These functions are the only
|
|
904
|
-
* place that knows how to read and write such a position; everything above them (the service, the list
|
|
905
|
-
* control, the route context) works in terms of a path.
|
|
906
|
-
*
|
|
907
|
-
* They are deliberately free of Angular and of the store: an aggregate is a plain payload, and keeping the
|
|
908
|
-
* arithmetic pure is what makes the nested and id-less cases cheap to test.
|
|
909
|
-
*/
|
|
910
|
-
/** Resolves the object a path points at, or `undefined` when any hop is missing. */
|
|
911
|
-
declare function readOwner(root: unknown, path: EmbeddedPath): Payload | undefined;
|
|
912
|
-
/** The rows of one `EMBEDDED_COMPONENTS` attribute; an empty array when the attribute is unset. */
|
|
913
|
-
declare function readRows(root: unknown, path: EmbeddedPath, attrName: string): EmbeddedRow[];
|
|
914
|
-
/**
|
|
915
|
-
* A copy of `root` whose owner carries `rows` under `attrName`, sharing every untouched branch. The
|
|
916
|
-
* aggregate is persisted by replacing the root document wholesale, so a write has to rebuild only the spine
|
|
917
|
-
* from the root down to the owner.
|
|
918
|
-
*/
|
|
919
|
-
declare function writeRows(root: unknown, path: EmbeddedPath, attrName: string, rows: readonly EmbeddedRow[]): Payload;
|
|
920
|
-
/**
|
|
921
|
-
* Position of the row identified by `id`, or `-1`. Resolved through {@link rowId} rather than by comparing
|
|
922
|
-
* `id` directly, so that a lookup and the URL segment that arrives back cannot drift apart on an entity
|
|
923
|
-
* keyed by something else — `App Region` has no `id` at all and is identified by `type`.
|
|
924
|
-
*/
|
|
925
|
-
declare function indexOfRow(rows: readonly EmbeddedRow[], id: string, referenceIdField?: string): number;
|
|
926
|
-
declare function findRow(rows: readonly EmbeddedRow[], id: string, referenceIdField?: string): EmbeddedRow | undefined;
|
|
927
|
-
/** The value that identifies `row` in a URL segment — its `referenceIdField`, defaulting to `id`. */
|
|
928
|
-
declare function rowId(row: EmbeddedRow, referenceIdField?: string): string;
|
|
929
|
-
declare function appendRow(rows: readonly EmbeddedRow[], row: EmbeddedRow): EmbeddedRow[];
|
|
930
|
-
/** Replaces the row identified by `id`; appends when it is not there yet, so an add and a re-save agree. */
|
|
931
|
-
declare function replaceRow(rows: readonly EmbeddedRow[], id: string, row: EmbeddedRow, referenceIdField?: string): EmbeddedRow[];
|
|
932
|
-
declare function removeRow(rows: readonly EmbeddedRow[], id: string, referenceIdField?: string): EmbeddedRow[];
|
|
933
|
-
/** Widens a row to the shape the store's API is written in; embedded rows always carry their key field. */
|
|
934
|
-
declare function asPersisted<Entity extends BaseEntity>(row: EmbeddedRow): PersistedEntity<Entity>;
|
|
935
1264
|
/**
|
|
936
1265
|
* To-many **containment** whose parts have no table of their own — the child's payload travels inside this
|
|
937
1266
|
* entity's payload, the way a sub-document does in a document store.
|
|
@@ -943,7 +1272,7 @@ declare function asPersisted<Entity extends BaseEntity>(row: EmbeddedRow): Persi
|
|
|
943
1272
|
* The rows come from the child's own store, which reads them out of this entity's payload
|
|
944
1273
|
* (`EmbeddedEntityService`), so adding, editing and deleting a child all go through the same
|
|
945
1274
|
* List → Store → Service path as any other entity. What differs is only where that service writes: the
|
|
946
|
-
* containing document, saved as a whole. For a part that is persisted through an endpoint of its own, see
|
|
1275
|
+
* containing document, staged in its store and saved as a whole by this entity's own Save. For a part that is persisted through an endpoint of its own, see
|
|
947
1276
|
* `COMPONENTS`; for one that merely points at an independent entity, `RELATED_ENTITIES`.
|
|
948
1277
|
*/
|
|
949
1278
|
export declare class EmbeddedComponentsListComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
@@ -955,7 +1284,22 @@ export declare class EmbeddedComponentsListComponent<Entity extends BaseEntity>
|
|
|
955
1284
|
* The child's store holds exactly this attribute's rows: it resolves them from the containing document
|
|
956
1285
|
* through the route, so it is already scoped to the entity this form is editing.
|
|
957
1286
|
*/
|
|
1287
|
+
private readonly storedRows;
|
|
1288
|
+
/**
|
|
1289
|
+
* The row keys in the order the user arranged them, until the owner is saved. `undefined` means the stored
|
|
1290
|
+
* order stands.
|
|
1291
|
+
*
|
|
1292
|
+
* A key order rather than the rows themselves, so that a child saved or deleted in the meantime — which
|
|
1293
|
+
* rewrites the stored rows — is picked up without losing the arrangement.
|
|
1294
|
+
*/
|
|
1295
|
+
private readonly pendingOrder;
|
|
1296
|
+
/** The rows as listed: the child store's, in the pending order if the user has rearranged them. */
|
|
958
1297
|
readonly rows: Signal<EmbeddedRow[]>;
|
|
1298
|
+
/** Only an `ordered` attribute of an editable form offers reordering, and only once there is something to order. */
|
|
1299
|
+
/** Whether the rows are listed. Shown by default; the user may fold a long list away, which changes nothing but the display. */
|
|
1300
|
+
readonly listVisible: import("@angular/core").WritableSignal<boolean>;
|
|
1301
|
+
toggleList(): void;
|
|
1302
|
+
readonly reorderable: Signal<boolean>;
|
|
959
1303
|
constructor();
|
|
960
1304
|
ngOnInit(): void;
|
|
961
1305
|
rowKey(row: EmbeddedRow): string;
|
|
@@ -978,6 +1322,13 @@ export declare class EmbeddedComponentsListComponent<Entity extends BaseEntity>
|
|
|
978
1322
|
addComponent(): void;
|
|
979
1323
|
/** Destroys the child — an embedded component has no existence outside this payload — after confirmation. */
|
|
980
1324
|
deleteComponent(row: EmbeddedRow): void;
|
|
1325
|
+
/**
|
|
1326
|
+
* Repositions a row. Like adding, editing or deleting a child, it is persisted by the owner's Save; unlike
|
|
1327
|
+
* them it does not go through the child's store at all — the order is an attribute *of the owner* — so it
|
|
1328
|
+
* is kept as a pending arrangement and only dirties the owner's form.
|
|
1329
|
+
*/
|
|
1330
|
+
moveComponent(row: EmbeddedRow, toIndex: number): void;
|
|
1331
|
+
dropComponent(event: CdkDragDrop<unknown>): void;
|
|
981
1332
|
/**
|
|
982
1333
|
* Both declarations — this attribute's control type and the child's own descriptor — are written by hand
|
|
983
1334
|
* and have to agree; checking at first render names both sides instead of silently rendering a list whose
|
|
@@ -994,23 +1345,38 @@ export declare class EmbeddedComponentsListComponent<Entity extends BaseEntity>
|
|
|
994
1345
|
*/
|
|
995
1346
|
private registerRowReload;
|
|
996
1347
|
/**
|
|
997
|
-
* Mirrors the rows into this attribute's control. A child's save
|
|
998
|
-
* the control would otherwise still hold the array as it looked when the form was built — and the
|
|
999
|
-
* own save, which merges `form.value` over the entity, would write that stale array back.
|
|
1348
|
+
* Mirrors the rows into this attribute's control. A child's save stages the containing document in its
|
|
1349
|
+
* store, so the control would otherwise still hold the array as it looked when the form was built — and the
|
|
1350
|
+
* owner's own save, which merges `form.value` over the entity, would write that stale array back.
|
|
1351
|
+
*
|
|
1352
|
+
* While the document holds staged child changes the control is also dirtied: they are edits the owner's
|
|
1353
|
+
* Save still has to carry, and the Save button is what tells the user so. Rows merely loaded from the
|
|
1354
|
+
* server leave it pristine.
|
|
1000
1355
|
*/
|
|
1001
1356
|
private registerFormControlSync;
|
|
1357
|
+
/** Whether the document these rows live in holds child changes its Save has not persisted yet. */
|
|
1358
|
+
private documentHasStagedChanges;
|
|
1002
1359
|
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedComponentsListComponent<any>, never>;
|
|
1003
1360
|
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedComponentsListComponent<any>, "app-embedded-components-list", never, {}, {}, never, never, true, never>;
|
|
1004
1361
|
}
|
|
1005
1362
|
/**
|
|
1006
|
-
* One row of {@link EmbeddedComponentsListComponent}. Presentation only: opening
|
|
1007
|
-
* the list, which is the side that knows where the row sits in the containing document.
|
|
1363
|
+
* One row of {@link EmbeddedComponentsListComponent}. Presentation only: opening, deleting and moving all
|
|
1364
|
+
* belong to the list, which is the side that knows where the row sits in the containing document.
|
|
1365
|
+
*
|
|
1366
|
+
* An `ordered` row carries a drag handle — the list is the drop target — and move up / down buttons, which
|
|
1367
|
+
* are what a keyboard or screen-reader user reorders with, since dragging needs a pointer.
|
|
1008
1368
|
*/
|
|
1009
1369
|
export declare class EmbeddedComponentRefComponent {
|
|
1010
1370
|
displayName: InputSignal<string>;
|
|
1011
1371
|
disabled: InputSignal<boolean>;
|
|
1372
|
+
/** Offers the drag handle and the move buttons. */
|
|
1373
|
+
ordered: InputSignal<boolean>;
|
|
1374
|
+
first: InputSignal<boolean>;
|
|
1375
|
+
last: InputSignal<boolean>;
|
|
1012
1376
|
readonly openRequested: import("@angular/core").OutputEmitterRef<void>;
|
|
1013
1377
|
readonly deleteRequested: import("@angular/core").OutputEmitterRef<void>;
|
|
1378
|
+
readonly moveUpRequested: import("@angular/core").OutputEmitterRef<void>;
|
|
1379
|
+
readonly moveDownRequested: import("@angular/core").OutputEmitterRef<void>;
|
|
1014
1380
|
requestOpen(event: Event): void;
|
|
1015
1381
|
requestDelete(): void;
|
|
1016
1382
|
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedComponentRefComponent, never>;
|
|
@@ -1025,88 +1391,500 @@ export declare class EmbeddedComponentRefComponent {
|
|
|
1025
1391
|
"required": false;
|
|
1026
1392
|
"isSignal": true;
|
|
1027
1393
|
};
|
|
1394
|
+
"ordered": {
|
|
1395
|
+
"alias": "ordered";
|
|
1396
|
+
"required": false;
|
|
1397
|
+
"isSignal": true;
|
|
1398
|
+
};
|
|
1399
|
+
"first": {
|
|
1400
|
+
"alias": "first";
|
|
1401
|
+
"required": false;
|
|
1402
|
+
"isSignal": true;
|
|
1403
|
+
};
|
|
1404
|
+
"last": {
|
|
1405
|
+
"alias": "last";
|
|
1406
|
+
"required": false;
|
|
1407
|
+
"isSignal": true;
|
|
1408
|
+
};
|
|
1028
1409
|
}, {
|
|
1029
1410
|
"openRequested": "openRequested";
|
|
1030
1411
|
"deleteRequested": "deleteRequested";
|
|
1412
|
+
"moveUpRequested": "moveUpRequested";
|
|
1413
|
+
"moveDownRequested": "moveDownRequested";
|
|
1031
1414
|
}, never, never, true, never>;
|
|
1032
1415
|
}
|
|
1416
|
+
interface EmbeddedListItem {
|
|
1417
|
+
id: string;
|
|
1418
|
+
formGroup: FormGroup;
|
|
1419
|
+
initialValue: Record<string, unknown>;
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* Form control for an array of structured objects (`EMBEDDED_LIST`).
|
|
1423
|
+
*
|
|
1424
|
+
* Renders each item in a collapsible expansion panel with drag reordering, move buttons, and delete.
|
|
1425
|
+
* New items can be added up to `maxOccurs` (derived from `maxItems`).
|
|
1426
|
+
* The collapsed panel is titled by the attribute named in `config().rowLabelAttr` (or the item's first
|
|
1427
|
+
* required string property).
|
|
1428
|
+
*/
|
|
1429
|
+
export declare class EmbeddedListComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1430
|
+
readonly rows: import("@angular/core").WritableSignal<EmbeddedListItem[]>;
|
|
1431
|
+
ngOnInit(): void;
|
|
1432
|
+
addRow(): void;
|
|
1433
|
+
deleteRow(index: number): void;
|
|
1434
|
+
moveRow(fromIndex: number, toIndex: number): void;
|
|
1435
|
+
dropRow(event: CdkDragDrop<EmbeddedListItem[]>): void;
|
|
1436
|
+
private getFormArray;
|
|
1437
|
+
rowLabel(row: EmbeddedListItem, index: number): string;
|
|
1438
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedListComponent<any>, never>;
|
|
1439
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedListComponent<any>, "app-embedded-list", never, {}, {}, never, never, true, never>;
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* Renders an embedded object as an inline fieldset whose child controls are built from
|
|
1443
|
+
* `config().childDescriptors`.
|
|
1444
|
+
*
|
|
1445
|
+
* Unlike {@link EmbeddedComponentsListComponent}, this operates on a pure value structure rather than
|
|
1446
|
+
* an entity with its own route, store, and identity: edits live directly in a nested `FormGroup` within
|
|
1447
|
+
* the owner form, and validity bubbles up naturally.
|
|
1448
|
+
*/
|
|
1449
|
+
export declare class EmbeddedObjectComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1450
|
+
childGroup: FormGroup;
|
|
1451
|
+
readonly childInitialValues: import("@angular/core").WritableSignal<Record<string, unknown>>;
|
|
1452
|
+
ngOnInit(): void;
|
|
1453
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedObjectComponent<any>, never>;
|
|
1454
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedObjectComponent<any>, "app-embedded-object", never, {}, {}, never, never, true, never>;
|
|
1455
|
+
}
|
|
1033
1456
|
interface RelatedEntityNameAttr {
|
|
1034
1457
|
attrName: string;
|
|
1035
1458
|
name: string;
|
|
1036
1459
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
private
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1460
|
+
/**
|
|
1461
|
+
* To-many **association**: the rows point at entities that exist independently of this one, so adding
|
|
1462
|
+
* picks an existing entity from the related list and deleting only detaches the reference. Containment —
|
|
1463
|
+
* where the related entity has exactly one owner and dies with the reference — is a different control type
|
|
1464
|
+
* (`COMPONENTS`), so do not extend this one with delete-the-entity behavior.
|
|
1465
|
+
*/
|
|
1466
|
+
export declare class RelatedEntitiesListComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1467
|
+
ngOnInit(): void;
|
|
1468
|
+
relatedEntityNameAttr(): RelatedEntityNameAttr;
|
|
1469
|
+
relatedEntities(): PersistedEntity<BaseEntity>[];
|
|
1470
|
+
addRelatedEntityTitle(): string;
|
|
1471
|
+
navigateToRelatedList(): void;
|
|
1472
|
+
private addSelectedEntityFromNavigatorResponse;
|
|
1473
|
+
private describeFormState;
|
|
1474
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RelatedEntitiesListComponent<any>, never>;
|
|
1475
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RelatedEntitiesListComponent<any>, "app-related-entities-list", never, {}, {}, never, never, true, never>;
|
|
1476
|
+
}
|
|
1477
|
+
/** Rich text as Tiptap's JSON document — `{ type: 'doc', content: [...] }` — the format it is stored in. */
|
|
1478
|
+
type RichTextContent = JSONContent;
|
|
1479
|
+
/** What an editor without content of its own starts with: one empty paragraph, so the caret has a home. */
|
|
1480
|
+
export declare const EMPTY_RICH_TEXT: RichTextContent;
|
|
1481
|
+
/** True when the document holds no text and no leaf node such as a horizontal rule — what an untouched editor holds. */
|
|
1482
|
+
export declare function isRichTextEmpty(content: RichTextContent | null | undefined): boolean;
|
|
1483
|
+
/**
|
|
1484
|
+
* One Tiptap `Editor` on StarterKit, with the formatting toolbar above it while it is editable.
|
|
1485
|
+
*
|
|
1486
|
+
* Content travels as Tiptap JSON rather than HTML: it is stored that way, and rendering it back through an
|
|
1487
|
+
* editor means only nodes StarterKit (plus `extensions`) defines can ever appear — there is no markup to
|
|
1488
|
+
* sanitize. With `editable` off the same component is the read-only rendering, without the toolbar.
|
|
1489
|
+
*
|
|
1490
|
+
* The toolbar sits in the flow rather than over the text, as base-document's floating one does: in a narrow form
|
|
1491
|
+
* column it wraps onto a second row, and a floating bar would then cover the first line being typed.
|
|
1492
|
+
*
|
|
1493
|
+
* `content` is the initial document and may be replaced later; a value equal to what the editor already holds
|
|
1494
|
+
* is ignored, so feeding `contentChange` straight back does not reset the caret.
|
|
1495
|
+
*/
|
|
1496
|
+
export declare class RichTextEditorComponent implements AfterViewInit, OnDestroy {
|
|
1497
|
+
readonly content: import("@angular/core").InputSignal<JSONContent | null | undefined>;
|
|
1498
|
+
readonly editable: import("@angular/core").InputSignal<boolean>;
|
|
1499
|
+
readonly placeholder: import("@angular/core").InputSignal<string>;
|
|
1500
|
+
/** Added to StarterKit — e.g. base-document's widget embed. Read once, when the editor is created. */
|
|
1501
|
+
readonly extensions: import("@angular/core").InputSignal<Extensions>;
|
|
1502
|
+
/** Leading part of the test ids: `<prefix>-content` here, `<prefix>-toolbar`, `<prefix>-bold`, … on the toolbar. */
|
|
1503
|
+
readonly testIdPrefix: import("@angular/core").InputSignal<string>;
|
|
1504
|
+
readonly contentChange: import("@angular/core").OutputEmitterRef<JSONContent>;
|
|
1505
|
+
/** Set once the Editor exists, so the toolbar — which needs one — can only render after ngAfterViewInit. */
|
|
1506
|
+
protected readonly editorInstance: import("@angular/core").WritableSignal<Editor | null>;
|
|
1507
|
+
protected readonly isEmpty: import("@angular/core").WritableSignal<boolean>;
|
|
1508
|
+
protected readonly isToolbarVisible: import("@angular/core").Signal<boolean>;
|
|
1509
|
+
protected readonly isPlaceholderVisible: import("@angular/core").Signal<boolean>;
|
|
1510
|
+
private readonly editorHost;
|
|
1511
|
+
constructor();
|
|
1512
|
+
ngAfterViewInit(): void;
|
|
1513
|
+
ngOnDestroy(): void;
|
|
1514
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RichTextEditorComponent, never>;
|
|
1515
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RichTextEditorComponent, "pp-rich-text-editor", never, {
|
|
1516
|
+
"content": {
|
|
1517
|
+
"alias": "content";
|
|
1518
|
+
"required": false;
|
|
1059
1519
|
"isSignal": true;
|
|
1060
1520
|
};
|
|
1061
|
-
"
|
|
1062
|
-
"alias": "
|
|
1063
|
-
"required":
|
|
1521
|
+
"editable": {
|
|
1522
|
+
"alias": "editable";
|
|
1523
|
+
"required": false;
|
|
1064
1524
|
"isSignal": true;
|
|
1065
1525
|
};
|
|
1066
|
-
"
|
|
1067
|
-
"alias": "
|
|
1068
|
-
"required":
|
|
1526
|
+
"placeholder": {
|
|
1527
|
+
"alias": "placeholder";
|
|
1528
|
+
"required": false;
|
|
1069
1529
|
"isSignal": true;
|
|
1070
1530
|
};
|
|
1071
|
-
"
|
|
1072
|
-
"alias": "
|
|
1531
|
+
"extensions": {
|
|
1532
|
+
"alias": "extensions";
|
|
1073
1533
|
"required": false;
|
|
1074
1534
|
"isSignal": true;
|
|
1075
1535
|
};
|
|
1076
|
-
"
|
|
1077
|
-
"alias": "
|
|
1536
|
+
"testIdPrefix": {
|
|
1537
|
+
"alias": "testIdPrefix";
|
|
1078
1538
|
"required": false;
|
|
1079
1539
|
"isSignal": true;
|
|
1080
1540
|
};
|
|
1081
|
-
|
|
1082
|
-
|
|
1541
|
+
}, {
|
|
1542
|
+
"contentChange": "contentChange";
|
|
1543
|
+
}, never, never, true, never>;
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* One entry of a `COMMENTS` attribute, whose value is an array of these, oldest first.
|
|
1547
|
+
*
|
|
1548
|
+
* The same shape the backend validates and the seed data holds: `content` is Tiptap JSON, `createdAt` an
|
|
1549
|
+
* ISO-8601 instant. The history is append-only — the backend rejects a save that changes, drops or reorders a
|
|
1550
|
+
* stored entry — so nothing here is ever edited after it was saved.
|
|
1551
|
+
*/
|
|
1552
|
+
interface EntityComment {
|
|
1553
|
+
/** The name the comment is shown under, as it was when the comment was written. */
|
|
1554
|
+
author: string;
|
|
1555
|
+
/** The author's user id, when the host knows one. */
|
|
1556
|
+
authorId?: string;
|
|
1557
|
+
createdAt: string;
|
|
1558
|
+
content: RichTextContent;
|
|
1559
|
+
}
|
|
1560
|
+
/** The value of a `COMMENTS` attribute as a list — anything that is not an array holds no comments. */
|
|
1561
|
+
export declare function commentsOf(value: unknown): EntityComment[];
|
|
1562
|
+
/**
|
|
1563
|
+
* A `COMMENTS` attribute: the saved comments as a read-only history, and below it an editor for a new one.
|
|
1564
|
+
*
|
|
1565
|
+
* There is no "Add" button — a comment is written into the editor and saved with the record. While the draft
|
|
1566
|
+
* holds text the control's value is the history plus one entry stamped with the current user and the time of
|
|
1567
|
+
* the last keystroke, and the control is dirty, so the form's Save carries it. Emptying the draft puts the
|
|
1568
|
+
* history back. Once saved, the form is rebuilt from the stored record and the draft has become a history card.
|
|
1569
|
+
*
|
|
1570
|
+
* The history is the value the form was built with and is never written to, so the control can only append —
|
|
1571
|
+
* the backend enforces the same rule for every other client.
|
|
1572
|
+
*/
|
|
1573
|
+
export declare class CommentsComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> {
|
|
1574
|
+
protected readonly unknownAuthorKey = "base_entity.comments.unknown_author";
|
|
1575
|
+
protected readonly timestampFormat: DateFormat;
|
|
1576
|
+
/** The comments saved with the record — the value the form was built with, never the draft. */
|
|
1577
|
+
readonly history: import("@angular/core").Signal<EntityComment[]>;
|
|
1578
|
+
readonly draft: import("@angular/core").WritableSignal<import("@tiptap/core").JSONContent | null>;
|
|
1579
|
+
private readonly userContext;
|
|
1580
|
+
private readonly transloco;
|
|
1581
|
+
/** A disabled attribute or control shows the history alone. */
|
|
1582
|
+
isEditable(): boolean;
|
|
1583
|
+
onDraftChange(content: RichTextContent): void;
|
|
1584
|
+
private stamp;
|
|
1585
|
+
/** Stamped rather than left blank: an entry needs an author, and a reader needs more than an empty line. */
|
|
1586
|
+
private unknownAuthor;
|
|
1587
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommentsComponent<any>, never>;
|
|
1588
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CommentsComponent<any>, "base-comments", never, {}, {}, never, never, true, never>;
|
|
1589
|
+
}
|
|
1590
|
+
/**
|
|
1591
|
+
* The seam between base-entity and the host application's session: who is editing, for the controls that
|
|
1592
|
+
* record it — today the COMMENTS control, which stamps each comment with its author.
|
|
1593
|
+
*
|
|
1594
|
+
* base-entity cannot ask `@processpuzzle/auth` itself: auth depends on base-entity, not the other way round. So it
|
|
1595
|
+
* reads util's `SessionUser`, which auth keeps current — nothing to wire in a host that uses auth. A host
|
|
1596
|
+
* without it may call {@link set}, which then takes precedence, or provide its own implementation.
|
|
1597
|
+
*
|
|
1598
|
+
* Without either, a comment is attributed to an unknown author.
|
|
1599
|
+
*/
|
|
1600
|
+
export declare class EntityUserContext {
|
|
1601
|
+
private readonly sessionUser;
|
|
1602
|
+
private readonly _session;
|
|
1603
|
+
/** Empty when nobody is signed in. */
|
|
1604
|
+
readonly userId: import("@angular/core").Signal<string>;
|
|
1605
|
+
/** The name a reader recognizes the user by — empty when the host does not know one. */
|
|
1606
|
+
readonly displayName: import("@angular/core").Signal<string>;
|
|
1607
|
+
/** For a host whose session is not auth's — overrides `SessionUser` from then on. */
|
|
1608
|
+
set(session: {
|
|
1609
|
+
userId: string;
|
|
1610
|
+
displayName?: string;
|
|
1611
|
+
}): void;
|
|
1612
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityUserContext, never>;
|
|
1613
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* The ISO 3166-1 alpha-2 country codes an `ADDRESS` attribute offers.
|
|
1617
|
+
*
|
|
1618
|
+
* A static list rather than a seeded entity: the codes are a standard, not tenant data, and the browser
|
|
1619
|
+
* already knows every country's name in every language through `Intl.DisplayNames` — so the lookup needs no
|
|
1620
|
+
* backend, works the same against REST and json-server, and is translated for free.
|
|
1621
|
+
*/
|
|
1622
|
+
export declare const COUNTRY_CODES: readonly string[];
|
|
1623
|
+
interface CountryOption {
|
|
1624
|
+
code: string;
|
|
1625
|
+
name: string;
|
|
1626
|
+
}
|
|
1627
|
+
/** The country's name in `language`, or the code itself where the runtime cannot name it. */
|
|
1628
|
+
export declare function countryName(code: string, language: string): string;
|
|
1629
|
+
/**
|
|
1630
|
+
* Every country, named in `language` and sorted the way a reader of that language expects. A language the
|
|
1631
|
+
* runtime rejects gets the codes themselves, in code order.
|
|
1632
|
+
*/
|
|
1633
|
+
export declare function countryOptions(language: string): CountryOption[];
|
|
1634
|
+
type AddressFields = {
|
|
1635
|
+
country: FormControl<string | null>;
|
|
1636
|
+
street: FormControl<string | null>;
|
|
1637
|
+
addressLine2: FormControl<string | null>;
|
|
1638
|
+
postalCode: FormControl<string | null>;
|
|
1639
|
+
city: FormControl<string | null>;
|
|
1640
|
+
region: FormControl<string | null>;
|
|
1641
|
+
latitude: FormControl<number | null>;
|
|
1642
|
+
longitude: FormControl<number | null>;
|
|
1643
|
+
};
|
|
1644
|
+
/**
|
|
1645
|
+
* An `ADDRESS` attribute: a country, and below it the address fields that country writes, in its order.
|
|
1646
|
+
*
|
|
1647
|
+
* The attribute is one form control holding a {@link PostalAddress}; the fields are a form group of this
|
|
1648
|
+
* component's own, published to that control on every change. Only the fields the selected country uses are
|
|
1649
|
+
* published, so switching countries drops what the new layout has no place for — and switching back restores
|
|
1650
|
+
* it, since the group still holds it. An address without a single line of text publishes `null`: the country a
|
|
1651
|
+
* new address starts with is a convenience, not a value.
|
|
1652
|
+
*
|
|
1653
|
+
* With `showMap` the address is also shown on a map. Its coordinates are derived from the address when an
|
|
1654
|
+
* address field is left or the country changes, and can be edited; once the user types a coordinate the pin is
|
|
1655
|
+
* theirs, and only the Locate button derives it again. A click on the map opens the location in Google Maps.
|
|
1656
|
+
*/
|
|
1657
|
+
export declare class AddressComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1658
|
+
readonly fields: FormGroup<AddressFields>;
|
|
1659
|
+
readonly locating: import("@angular/core").WritableSignal<boolean>;
|
|
1660
|
+
readonly notFound: import("@angular/core").WritableSignal<boolean>;
|
|
1661
|
+
private readonly activeLang;
|
|
1662
|
+
private readonly geocoder;
|
|
1663
|
+
private readonly destroyRef;
|
|
1664
|
+
private readonly country;
|
|
1665
|
+
private readonly location;
|
|
1666
|
+
private locationSource;
|
|
1667
|
+
/** The address the coordinates were last derived for — leaving a field without changing it asks nobody. */
|
|
1668
|
+
private geocodedFor;
|
|
1669
|
+
readonly format: import("@angular/core").Signal<import("@processpuzzle/base-entity").AddressFormat>;
|
|
1670
|
+
readonly countries: import("@angular/core").Signal<CountryOption[]>;
|
|
1671
|
+
readonly mapUrl: import("@angular/core").Signal<string | undefined>;
|
|
1672
|
+
readonly openUrl: import("@angular/core").Signal<string | undefined>;
|
|
1673
|
+
private readonly mapFrame;
|
|
1674
|
+
constructor();
|
|
1675
|
+
ngOnInit(): void;
|
|
1676
|
+
/** A disabled attribute or control shows the address without a Locate button. */
|
|
1677
|
+
isEditable(): boolean;
|
|
1678
|
+
/** An address field was left or the country changed — the moment to place the pin, if it is ours to place. */
|
|
1679
|
+
onAddressChanged(): void;
|
|
1680
|
+
/** The user typed a coordinate: from now on the pin stays where they put it. */
|
|
1681
|
+
onCoordinateTyped(): void;
|
|
1682
|
+
/**
|
|
1683
|
+
* Derives the coordinates from the address. Pressed as the Locate button (`force`), it also takes the pin
|
|
1684
|
+
* back from the user; called after a field was left, it gives up if the user typed a coordinate meanwhile.
|
|
1685
|
+
*/
|
|
1686
|
+
locate(force?: boolean): Promise<void>;
|
|
1687
|
+
private readonly fieldsValidator;
|
|
1688
|
+
private control;
|
|
1689
|
+
private publish;
|
|
1690
|
+
/** What the fields hold, reduced to the parts the selected country uses — the value the attribute is saved with. */
|
|
1691
|
+
private currentAddress;
|
|
1692
|
+
private queryOf;
|
|
1693
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AddressComponent<any>, never>;
|
|
1694
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AddressComponent<any>, "base-address", never, {}, {}, never, never, true, never>;
|
|
1695
|
+
}
|
|
1696
|
+
/** The i18n keys, under `base_entity.address.`, a field may be labelled with. */
|
|
1697
|
+
type AddressFieldLabel = 'street' | 'address_line2' | 'postal_code' | 'zip_code' | 'postcode' | 'city' | 'town' | 'region' | 'state' | 'province' | 'county' | 'prefecture' | 'canton';
|
|
1698
|
+
interface AddressFieldLayout {
|
|
1699
|
+
field: AddressLineField;
|
|
1700
|
+
label: AddressFieldLabel;
|
|
1701
|
+
/** Share of the row's width, as a flex-grow factor — a postal code is narrower than a city. */
|
|
1702
|
+
grow: number;
|
|
1703
|
+
}
|
|
1704
|
+
/**
|
|
1705
|
+
* How one country writes its addresses: the lines in the order they are written, each a row of fields.
|
|
1706
|
+
*
|
|
1707
|
+
* A field a country does not use — a region in Germany, say — is simply not in its layout, and so not offered.
|
|
1708
|
+
* The same layout orders the one-line rendering lists and PDF exports show.
|
|
1709
|
+
*/
|
|
1710
|
+
interface AddressFormat {
|
|
1711
|
+
lines: AddressFieldLayout[][];
|
|
1712
|
+
}
|
|
1713
|
+
/** The format of a country, by its ISO 3166-1 alpha-2 code; the international default for any other. */
|
|
1714
|
+
export declare function addressFormatOf(country: string | undefined): AddressFormat;
|
|
1715
|
+
/**
|
|
1716
|
+
* The address on one line, in the order its country writes it, with the country's name last — for list
|
|
1717
|
+
* cells, PDF exports and a geocoder's free-text query. Empty when the address holds nothing.
|
|
1718
|
+
*/
|
|
1719
|
+
export declare function formatAddress(address: PostalAddress, countryName?: (code: string) => string): string;
|
|
1720
|
+
/**
|
|
1721
|
+
* An `ADDRESS` value on one line, in its country's order, the country named in the active language.
|
|
1722
|
+
*
|
|
1723
|
+
* Usage: `{{ row[attr.attrName] | ppAddress }}`. Impure so it re-renders on a language switch, as `ppDate` does.
|
|
1724
|
+
*/
|
|
1725
|
+
export declare class AddressPipe implements PipeTransform {
|
|
1726
|
+
private readonly activeLang;
|
|
1727
|
+
transform(value: unknown): string;
|
|
1728
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AddressPipe, never>;
|
|
1729
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<AddressPipe, "ppAddress", true>;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Finds the coordinates of an address — how an `ADDRESS` attribute with a map places its pin.
|
|
1733
|
+
*
|
|
1734
|
+
* The default asks OpenStreetMap's public Nominatim service. A host that needs another geocoder — its own
|
|
1735
|
+
* Nominatim, Google's Geocoding API — provides a replacement:
|
|
1736
|
+
*
|
|
1737
|
+
* ```ts
|
|
1738
|
+
* providers: [{ provide: AddressGeocoder, useClass: MyGeocoder }]
|
|
1739
|
+
* ```
|
|
1740
|
+
*
|
|
1741
|
+
* Nominatim's usage policy allows about one request a second and no autocomplete, which is why the control
|
|
1742
|
+
* geocodes when an address field is left rather than on every keystroke.
|
|
1743
|
+
*/
|
|
1744
|
+
export declare class AddressGeocoder {
|
|
1745
|
+
protected readonly endpoint: string;
|
|
1746
|
+
/** The address's coordinates, or `undefined` when it cannot be found or the service does not answer. */
|
|
1747
|
+
geocode(address: PostalAddress, language?: string): Promise<GeoPoint | undefined>;
|
|
1748
|
+
/** Nominatim's structured query: one parameter per address part rather than a free-text string. */
|
|
1749
|
+
protected query(address: PostalAddress, language?: string): string;
|
|
1750
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AddressGeocoder, never>;
|
|
1751
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* The value of a `GEO_LOCATION` attribute: where the device was when the user pressed the control's button.
|
|
1755
|
+
*
|
|
1756
|
+
* `accuracy` is the radius of the device's uncertainty in metres, `capturedAt` the ISO 8601 instant of the
|
|
1757
|
+
* reading. Both come from the browser's Geolocation API; neither is typed by a user.
|
|
1758
|
+
*/
|
|
1759
|
+
interface GeoLocation extends GeoPoint {
|
|
1760
|
+
accuracy?: number;
|
|
1761
|
+
capturedAt?: string;
|
|
1762
|
+
}
|
|
1763
|
+
/** The value of a `GEO_LOCATION` attribute as a location — anything without two valid coordinates holds none. */
|
|
1764
|
+
export declare function geoLocationOf(value: unknown): GeoLocation | undefined;
|
|
1765
|
+
/** The coordinates on one line — `47.497900, 19.040200 (±12 m)` — or an empty string when the value holds none. */
|
|
1766
|
+
export declare function formatGeoLocation(value: unknown): string;
|
|
1767
|
+
/** Why a reading failed — the codes of `GeolocationPositionError`, plus `UNAVAILABLE` for a browser without the API. */
|
|
1768
|
+
type GeoLocatorError = 'PERMISSION_DENIED' | 'POSITION_UNAVAILABLE' | 'TIMEOUT' | 'UNAVAILABLE';
|
|
1769
|
+
export declare class GeoLocatorFailure extends Error {
|
|
1770
|
+
readonly reason: GeoLocatorError;
|
|
1771
|
+
constructor(reason: GeoLocatorError);
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* Reads the device's current location — how a `GEO_LOCATION` attribute fills itself.
|
|
1775
|
+
*
|
|
1776
|
+
* The default asks the browser's Geolocation API, which only exists in a secure context (HTTPS or localhost).
|
|
1777
|
+
* A host that knows the location otherwise — a native shell, a fixed kiosk position — provides a replacement:
|
|
1778
|
+
*
|
|
1779
|
+
* ```ts
|
|
1780
|
+
* providers: [{ provide: GeoLocator, useClass: MyGeoLocator }]
|
|
1781
|
+
* ```
|
|
1782
|
+
*/
|
|
1783
|
+
export declare class GeoLocator {
|
|
1784
|
+
/** Whether a location can be asked for at all: the API exists here. The user may still refuse it. */
|
|
1785
|
+
isAvailable(): boolean;
|
|
1786
|
+
/**
|
|
1787
|
+
* Whether the user has already refused location access for this site. Resolves `false` when the browser
|
|
1788
|
+
* cannot tell — the request itself then finds out. `onChange` is called when the user changes their mind.
|
|
1789
|
+
*/
|
|
1790
|
+
isDenied(onChange?: (denied: boolean) => void): Promise<boolean>;
|
|
1791
|
+
/** The current location, or a {@link GeoLocatorFailure} saying why there is none. */
|
|
1792
|
+
locate(): Promise<GeoLocation>;
|
|
1793
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GeoLocator, never>;
|
|
1794
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* A `GEO_LOCATION` attribute: the device's location at the moment the user pressed the button.
|
|
1798
|
+
*
|
|
1799
|
+
* The location is shown, never typed — coordinates are what the device read, not what someone claims. Pressing
|
|
1800
|
+
* the button again replaces it with a fresh reading, and the new value dirties the form, so Save is offered.
|
|
1801
|
+
* The button is disabled where no location can be had: a browser without the Geolocation API, an insecure
|
|
1802
|
+
* origin, or a user who has refused this site location access.
|
|
1803
|
+
*/
|
|
1804
|
+
export declare class GeoLocationComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1805
|
+
readonly capturedAtFormat: Readonly<Required<import("@processpuzzle/base-entity").DateFormat>>;
|
|
1806
|
+
readonly locating: import("@angular/core").WritableSignal<boolean>;
|
|
1807
|
+
readonly failure: import("@angular/core").WritableSignal<GeoLocatorError | undefined>;
|
|
1808
|
+
readonly location: import("@angular/core").WritableSignal<GeoLocation | undefined>;
|
|
1809
|
+
readonly text: import("@angular/core").Signal<string>;
|
|
1810
|
+
readonly openUrl: import("@angular/core").Signal<string | undefined>;
|
|
1811
|
+
private readonly locator;
|
|
1812
|
+
private readonly destroyRef;
|
|
1813
|
+
private readonly denied;
|
|
1814
|
+
private readonly available;
|
|
1815
|
+
/** No API, or a refusal the user has to lift in the browser's site settings — pressing would do nothing. */
|
|
1816
|
+
readonly unavailable: import("@angular/core").Signal<boolean>;
|
|
1817
|
+
ngOnInit(): void;
|
|
1818
|
+
/** A disabled attribute or control shows the location without the button. */
|
|
1819
|
+
isEditable(): boolean;
|
|
1820
|
+
/** Reads the current location and makes it the attribute's value, replacing any earlier one. */
|
|
1821
|
+
capture(): Promise<void>;
|
|
1822
|
+
private control;
|
|
1823
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GeoLocationComponent<any>, never>;
|
|
1824
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<GeoLocationComponent<any>, "base-geo-location", never, {}, {}, never, never, true, never>;
|
|
1825
|
+
}
|
|
1826
|
+
/** A `GEO_LOCATION` value on one line. Usage: `{{ row[attr.attrName] | ppGeoLocation }}`. */
|
|
1827
|
+
export declare class GeoLocationPipe implements PipeTransform {
|
|
1828
|
+
transform(value: unknown): string;
|
|
1829
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GeoLocationPipe, never>;
|
|
1830
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<GeoLocationPipe, "ppGeoLocation", true>;
|
|
1831
|
+
}
|
|
1832
|
+
/** One button: what it looks like, when it is lit, and what it does to the block being edited. */
|
|
1833
|
+
interface ToolbarAction {
|
|
1834
|
+
/** Doubles as the i18n key under `base_entity.rich_text.toolbar` and as the test-id suffix. */
|
|
1835
|
+
readonly name: string;
|
|
1836
|
+
readonly icon: string;
|
|
1837
|
+
/** Absent for actions with no on/off state — undo has nothing to be "on". */
|
|
1838
|
+
readonly activeWhen?: (editor: Editor) => boolean;
|
|
1839
|
+
/** Absent for actions that are always available. */
|
|
1840
|
+
readonly enabledWhen?: (editor: Editor) => boolean;
|
|
1841
|
+
readonly apply: (editor: Editor) => void;
|
|
1842
|
+
/** Draws a separator before this button, grouping marks / blocks / lists / history. */
|
|
1843
|
+
readonly startsGroup?: boolean;
|
|
1844
|
+
}
|
|
1845
|
+
/**
|
|
1846
|
+
* The formatting bar of one Tiptap `Editor` — a document's TEXT block, a comment being written. It is per
|
|
1847
|
+
* editor rather than one bar per page because every command it issues targets a single `Editor`: a page-level
|
|
1848
|
+
* bar would have to track which of N editors last had the caret, and would sit a screen away from it. Absolutely
|
|
1849
|
+
* positioned, so a host either reserves a strip above the editor to draw it into — base-document's blocks do, and
|
|
1850
|
+
* appearing shifts nothing — or puts it back in the flow, as RichTextEditorComponent does.
|
|
1851
|
+
*
|
|
1852
|
+
* Lives in base-entity rather than base-document because both features edit rich text and base-entity is the
|
|
1853
|
+
* one the other depends on. `testIdPrefix` keeps the test ids each caller's e2e suite already selects by.
|
|
1854
|
+
*
|
|
1855
|
+
* `mousedown` is cancelled on every button: pressing one must not move focus out of the editor, or the command
|
|
1856
|
+
* would run against a collapsed, blurred selection and the caret would be lost after each click.
|
|
1857
|
+
*/
|
|
1858
|
+
export declare class RichTextToolbarComponent {
|
|
1859
|
+
readonly editor: import("@angular/core").InputSignal<Editor>;
|
|
1860
|
+
/** Leading part of every test id: `<prefix>-toolbar`, `<prefix>-bold`, … */
|
|
1861
|
+
readonly testIdPrefix: import("@angular/core").InputSignal<string>;
|
|
1862
|
+
protected readonly actions: readonly ToolbarAction[];
|
|
1863
|
+
/**
|
|
1864
|
+
* Bumped on every ProseMirror transaction, which is what makes the lit buttons follow the caret: Tiptap's
|
|
1865
|
+
* state lives outside Angular, so `isActive` has nothing to depend on until a signal stands in for it.
|
|
1866
|
+
*/
|
|
1867
|
+
private readonly revision;
|
|
1868
|
+
constructor();
|
|
1869
|
+
protected readonly activeActions: import("@angular/core").Signal<Set<string>>;
|
|
1870
|
+
protected readonly disabledActions: import("@angular/core").Signal<Set<string>>;
|
|
1871
|
+
protected testIdOf(action: ToolbarAction): string;
|
|
1872
|
+
protected onApply(action: ToolbarAction): void;
|
|
1873
|
+
private namesMatching;
|
|
1874
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RichTextToolbarComponent, never>;
|
|
1875
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RichTextToolbarComponent, "pp-rich-text-toolbar", never, {
|
|
1876
|
+
"editor": {
|
|
1877
|
+
"alias": "editor";
|
|
1083
1878
|
"required": true;
|
|
1084
1879
|
"isSignal": true;
|
|
1085
1880
|
};
|
|
1086
|
-
"
|
|
1087
|
-
"alias": "
|
|
1088
|
-
"required":
|
|
1881
|
+
"testIdPrefix": {
|
|
1882
|
+
"alias": "testIdPrefix";
|
|
1883
|
+
"required": false;
|
|
1089
1884
|
"isSignal": true;
|
|
1090
1885
|
};
|
|
1091
1886
|
}, {}, never, never, true, never>;
|
|
1092
1887
|
}
|
|
1093
|
-
/**
|
|
1094
|
-
* To-many **association**: the rows point at entities that exist independently of this one, so adding
|
|
1095
|
-
* picks an existing entity from the related list and deleting only detaches the reference. Containment —
|
|
1096
|
-
* where the related entity has exactly one owner and dies with the reference — is a different control type
|
|
1097
|
-
* (`COMPONENTS`), so do not extend this one with delete-the-entity behavior.
|
|
1098
|
-
*/
|
|
1099
|
-
export declare class RelatedEntitiesListComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1100
|
-
ngOnInit(): void;
|
|
1101
|
-
relatedEntityNameAttr(): RelatedEntityNameAttr;
|
|
1102
|
-
relatedEntities(): PersistedEntity<BaseEntity>[];
|
|
1103
|
-
addRelatedEntityTitle(): string;
|
|
1104
|
-
navigateToRelatedList(): void;
|
|
1105
|
-
private addSelectedEntityFromNavigatorResponse;
|
|
1106
|
-
private describeFormState;
|
|
1107
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<RelatedEntitiesListComponent<any>, never>;
|
|
1108
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<RelatedEntitiesListComponent<any>, "app-related-entities-list", never, {}, {}, never, never, true, never>;
|
|
1109
|
-
}
|
|
1110
1888
|
/**
|
|
1111
1889
|
* Resolves `key` through Transloco, returning `fallback` when the key is absent or unresolved. Shared
|
|
1112
1890
|
* by {@link EntityLabelPipe} and the components that need the resolved label as a translation
|
|
@@ -1128,18 +1906,123 @@ export declare function translateLabel(transloco: TranslocoService, key: string
|
|
|
1128
1906
|
* `undefined` (no i18nScope declared) or the key is missing from the loaded translations, the
|
|
1129
1907
|
* `fallback` — the raw name held on the descriptor — is returned unchanged.
|
|
1130
1908
|
*
|
|
1131
|
-
* Impure so it re-evaluates when the active language or a lazy scope finishes loading.
|
|
1909
|
+
* Impure so it re-evaluates when the active language or a lazy scope finishes loading.
|
|
1910
|
+
*/
|
|
1911
|
+
export declare class EntityLabelPipe implements PipeTransform, OnDestroy {
|
|
1912
|
+
private readonly transloco;
|
|
1913
|
+
private readonly changeDetectorRef;
|
|
1914
|
+
private readonly subscription;
|
|
1915
|
+
constructor();
|
|
1916
|
+
transform(key: string | undefined, fallback: string): string;
|
|
1917
|
+
ngOnDestroy(): void;
|
|
1918
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityLabelPipe, never>;
|
|
1919
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<EntityLabelPipe, "ppLabel", true>;
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Renders a DATE / DATE_TIME value in its attribute's {@link DateFormat}, in the active language.
|
|
1923
|
+
*
|
|
1924
|
+
* Usage: `{{ row[attr.attrName] | ppDate: attr.dateFormat }}`. A value that is not a date passes through.
|
|
1925
|
+
*
|
|
1926
|
+
* Impure so it re-renders on a language switch; reading the language signal inside `transform` is what
|
|
1927
|
+
* marks the view for check when it changes.
|
|
1928
|
+
*/
|
|
1929
|
+
export declare class DateFormatPipe implements PipeTransform {
|
|
1930
|
+
private readonly activeLang;
|
|
1931
|
+
transform(value: unknown, dateFormat?: DateFormat): unknown;
|
|
1932
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DateFormatPipe, never>;
|
|
1933
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<DateFormatPipe, "ppDate", true>;
|
|
1934
|
+
}
|
|
1935
|
+
/**
|
|
1936
|
+
* A {@link NativeDateAdapter} that reads typed dates the way the active locale writes them.
|
|
1937
|
+
*
|
|
1938
|
+
* The native adapter parses with `Date.parse`, which only understands ISO and US-ordered input: `09.12.1960`
|
|
1939
|
+
* typed under `de` comes back invalid, and `1960. 12. 09.` under `hu` too. This one accepts, in order:
|
|
1940
|
+
* ISO (`1960-12-09`, `1960-12-09T10:00:00Z`), then numbers in the locale's year/month/day order with any
|
|
1941
|
+
* separators, a month written as a name (`9. Dez. 1960`, `1960. dec. 9.`) included. Anything else falls back
|
|
1942
|
+
* to the native parse. Formatting is the native adapter's already: it calls `Intl` with the display options.
|
|
1943
|
+
*/
|
|
1944
|
+
export declare class LocaleDateAdapter extends NativeDateAdapter {
|
|
1945
|
+
parse(value: unknown, parseFormat?: unknown): Date | null;
|
|
1946
|
+
/** `YYYY-MM-DD` as local midnight; the native adapter reads it as UTC midnight, the day before west of Greenwich. */
|
|
1947
|
+
deserialize(value: unknown): Date | null;
|
|
1948
|
+
private parseLocaleOrdered;
|
|
1949
|
+
private partOrder;
|
|
1950
|
+
/** The month index a word names in the locale, by its long or short name; weekday names match nothing. */
|
|
1951
|
+
private monthOf;
|
|
1952
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocaleDateAdapter, never>;
|
|
1953
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1954
|
+
}
|
|
1955
|
+
/**
|
|
1956
|
+
* Registers {@link LocaleDateAdapter} in place of `provideNativeDateAdapter()`, and keeps its locale on the
|
|
1957
|
+
* active Transloco language, so an open datepicker re-renders on a language switch. Without Transloco the
|
|
1958
|
+
* adapter keeps `MAT_DATE_LOCALE`.
|
|
1959
|
+
*/
|
|
1960
|
+
export declare function provideLocaleDateAdapter(): EnvironmentProviders;
|
|
1961
|
+
/** What a route's list is pre-filtered with, as the route declares it. */
|
|
1962
|
+
interface RouteListFilter {
|
|
1963
|
+
/** Raw RSQL the list is always filtered by. */
|
|
1964
|
+
rsqlFilter?: string;
|
|
1965
|
+
/** The working context whose active entity the list can be narrowed to. */
|
|
1966
|
+
filterByContext?: string;
|
|
1967
|
+
}
|
|
1968
|
+
/**
|
|
1969
|
+
* Metadata of a **working context**: an entity the user picks once and then works inside, instead of passing
|
|
1970
|
+
* through List → Form on every visit. Nothing in the platform knows what the entity is — a Customer, a Warehouse,
|
|
1971
|
+
* an Order — it only reads this declaration.
|
|
1972
|
+
*
|
|
1973
|
+
* See `docs/active-entity-concept/working-context-spec.md`.
|
|
1132
1974
|
*/
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1975
|
+
interface WorkingContextDefinition {
|
|
1976
|
+
/** The context's name, and its URL segment: `ctx/<name>/<id>/...`. Lower-case, no slashes. */
|
|
1977
|
+
name: string;
|
|
1978
|
+
/** Entity type acting as the context root. Any entity with a registered descriptor and store may be named. */
|
|
1979
|
+
entityName: string;
|
|
1980
|
+
/**
|
|
1981
|
+
* True for a **context object**: the entity is an aggregate whose own URL carries the context (`<aggregate>/<id>/<embedded>/list`),
|
|
1982
|
+
* derived from its descriptor's `canContextObject` rather than declared. Such a context has no `ctx` segment, parent or base path.
|
|
1983
|
+
*/
|
|
1984
|
+
aggregate?: boolean;
|
|
1985
|
+
/** A parent context. Selecting another parent clears this context, because its routes nest below the parent's. */
|
|
1986
|
+
parent?: string;
|
|
1987
|
+
/**
|
|
1988
|
+
* Absolute path the `ctx/<name>` routes are mounted under, for selecting from a screen outside them — the
|
|
1989
|
+
* entity's own list. Inside a context route the URL already says where it is, and that wins.
|
|
1990
|
+
*/
|
|
1991
|
+
basePath?: string;
|
|
1992
|
+
picker?: WorkingContextPicker;
|
|
1993
|
+
display?: WorkingContextDisplay;
|
|
1994
|
+
/**
|
|
1995
|
+
* Conditions on the **active** entity that make switching away from it — or clearing it — ask first. Keys are
|
|
1996
|
+
* attribute names; `state` names the entity's STATE attribute when it has no attribute of that name. A value
|
|
1997
|
+
* may be a list of alternatives. `{ state: 'Running' }`.
|
|
1998
|
+
*/
|
|
1999
|
+
confirmSwitchWhen?: Record<string, unknown>;
|
|
2000
|
+
/** `url-local-storage` (default) restores the last context when a context view is opened without one. */
|
|
2001
|
+
persist?: WorkingContextPersistence;
|
|
1142
2002
|
}
|
|
2003
|
+
type WorkingContextPersistence = 'url' | 'url-local-storage';
|
|
2004
|
+
interface WorkingContextPicker {
|
|
2005
|
+
/** Attributes the picker's search matches against; the entity's title attribute when omitted. */
|
|
2006
|
+
searchFields?: string[];
|
|
2007
|
+
/** How many recently active entities the picker offers on top. Default 3; 0 turns the section off. */
|
|
2008
|
+
recent?: number;
|
|
2009
|
+
}
|
|
2010
|
+
/** What the status bar shows of the active entity. Templates use `{{attr}}` / `{{attr.nested}}` placeholders. */
|
|
2011
|
+
interface WorkingContextDisplay {
|
|
2012
|
+
/** The crumb's text; the entity's title attribute when omitted. */
|
|
2013
|
+
label?: string;
|
|
2014
|
+
/** Attribute rendered as a badge; `state` names the STATE attribute, as in {@link WorkingContextDefinition.confirmSwitchWhen}. */
|
|
2015
|
+
badge?: string;
|
|
2016
|
+
/** A second, quieter piece of text after the label — the current step, say. */
|
|
2017
|
+
extra?: string;
|
|
2018
|
+
}
|
|
2019
|
+
export declare const DEFAULT_RECENT_CONTEXTS = 3;
|
|
2020
|
+
export declare const WORKING_CONTEXT_DEFINITIONS: InjectionToken<WorkingContextDefinition[][]>;
|
|
2021
|
+
/**
|
|
2022
|
+
* Declares working contexts. May be called more than once — an application and each module it mounts can
|
|
2023
|
+
* contribute their own — and the declarations add up.
|
|
2024
|
+
*/
|
|
2025
|
+
export declare function provideWorkingContexts(...definitions: WorkingContextDefinition[]): EnvironmentProviders;
|
|
1143
2026
|
export declare const BASE_LIST_DESCRIPTORS: InjectionToken<string[]>;
|
|
1144
2027
|
export declare class BaseEntityListComponent<Entity extends BaseEntity> implements AfterViewInit, OnInit {
|
|
1145
2028
|
dataSource: MatTableDataSource<PersistedEntity<Entity>>;
|
|
@@ -1148,6 +2031,25 @@ export declare class BaseEntityListComponent<Entity extends BaseEntity> implemen
|
|
|
1148
2031
|
private readonly logger;
|
|
1149
2032
|
private readonly formNavigator;
|
|
1150
2033
|
private readonly objectStoreService;
|
|
2034
|
+
private readonly foreignKeyLabels;
|
|
2035
|
+
private readonly route;
|
|
2036
|
+
/** The filters this list's route declares: its RSQL, and the working context it may be narrowed to. */
|
|
2037
|
+
protected readonly routeFilter: RouteListFilter;
|
|
2038
|
+
/** The active entity of the context the list may be narrowed to; `undefined` when none is active. */
|
|
2039
|
+
protected readonly contextEntityId: Signal<string | undefined>;
|
|
2040
|
+
/** Narrowing to the active entity: on by default, as the spec's optional view offers it. */
|
|
2041
|
+
protected readonly onlyActiveContext: import("@angular/core").WritableSignal<boolean>;
|
|
2042
|
+
/** Whether the retired records of a shared type are listed too, marked as such. Off by default, like every list and picker. */
|
|
2043
|
+
protected readonly showRetired: import("@angular/core").WritableSignal<boolean>;
|
|
2044
|
+
/** An entity whose records can be retired is one that can reinstate them: a shared type. */
|
|
2045
|
+
protected readonly canShowRetired: Signal<boolean>;
|
|
2046
|
+
/** Whether the toggle is shown: the list may be narrowed, and there is something to narrow it to. */
|
|
2047
|
+
protected readonly showsContextToggle: Signal<boolean>;
|
|
2048
|
+
/** Set once the first load is made, so that a context change before it does not load twice. */
|
|
2049
|
+
private viewReady;
|
|
2050
|
+
private readonly workingContext;
|
|
2051
|
+
/** The working contexts this entity is the root of. They add a "Set as context object" button below the list, enabled while exactly one row is selected. */
|
|
2052
|
+
protected readonly workingContexts: Signal<WorkingContextDefinition[]>;
|
|
1151
2053
|
columnDescriptors: Signal<BaseEntityAttrDescriptor[]>;
|
|
1152
2054
|
displayedColumns: Signal<string[]>;
|
|
1153
2055
|
sort: MatSort;
|
|
@@ -1155,6 +2057,8 @@ export declare class BaseEntityListComponent<Entity extends BaseEntity> implemen
|
|
|
1155
2057
|
store: BaseEntityStoreApi<PersistedEntity<Entity>>;
|
|
1156
2058
|
protected selectOrCreateMode: import("@angular/core").WritableSignal<boolean>;
|
|
1157
2059
|
private requestPayload?;
|
|
2060
|
+
/** The URL a user was sent away from for lack of a context object, which choosing one continues to; `undefined` otherwise. */
|
|
2061
|
+
protected readonly pendingTarget: Signal<string | undefined>;
|
|
1158
2062
|
constructor();
|
|
1159
2063
|
ngAfterViewInit(): void;
|
|
1160
2064
|
ngOnInit(): void;
|
|
@@ -1162,14 +2066,34 @@ export declare class BaseEntityListComponent<Entity extends BaseEntity> implemen
|
|
|
1162
2066
|
onNavigateToDetails(entity: PersistedEntity<Entity>): void;
|
|
1163
2067
|
onNavigateToRelated(config: BaseEntityAttrDescriptor, entity: PersistedEntity<Entity>): void;
|
|
1164
2068
|
onRowClick(entity: PersistedEntity<Entity>): void;
|
|
2069
|
+
/** Enter on a row of a context entity makes it the active one, as double-click does; elsewhere it selects. */
|
|
2070
|
+
onRowEnter(entity: PersistedEntity<Entity>): void;
|
|
2071
|
+
onRowDoubleClick(entity: PersistedEntity<Entity>): void;
|
|
2072
|
+
onSetActive(definition: WorkingContextDefinition, entity: PersistedEntity<Entity>): Promise<void>;
|
|
2073
|
+
/** Makes the one selected row the context object. */
|
|
2074
|
+
onSetSelectedAsContext(): Promise<void>;
|
|
2075
|
+
canSetContextObject(): boolean;
|
|
2076
|
+
/** A FOREIGN_KEY cell shows the linked object's identifying attribute, as the form does, not its id. */
|
|
2077
|
+
foreignKeyLabel(config: BaseEntityAttrDescriptor, entity: PersistedEntity<Entity>): string;
|
|
2078
|
+
/** An ARTIFACT cell's value as a list: a multi-valued attribute holds an array, a single-valued one an object. */
|
|
2079
|
+
artifactsOf(value: unknown): ArtifactAttr[];
|
|
2080
|
+
/** A COMMENTS cell shows how many comments the record has, not the comments. */
|
|
2081
|
+
commentCount(value: unknown): number;
|
|
1165
2082
|
onDownloadObject(artifact: ArtifactAttr, event?: MouseEvent): void;
|
|
1166
2083
|
onToggleAllRows(): void;
|
|
1167
2084
|
onCancelSelectOrCreate(): Promise<void>;
|
|
1168
2085
|
onSelectEntity(): Promise<void>;
|
|
2086
|
+
/** The row's key as its store knows it: an embedded row is keyed by its `referenceIdField`, which is not always `id`. */
|
|
2087
|
+
private keyOf;
|
|
1169
2088
|
private cancelSelections;
|
|
1170
2089
|
private doFilter;
|
|
1171
2090
|
private getPropertyValue;
|
|
2091
|
+
/** Narrows the list to the active entity, or shows every row of the entity again. */
|
|
2092
|
+
protected onToggleContextFilter(on: boolean): void;
|
|
2093
|
+
protected onToggleRetired(on: boolean): void;
|
|
2094
|
+
protected isRetired(row: unknown): boolean;
|
|
1172
2095
|
private loadAllData;
|
|
2096
|
+
private rsqlQuery;
|
|
1173
2097
|
protected registerEffects(): void;
|
|
1174
2098
|
isAllSelected(): boolean;
|
|
1175
2099
|
isSelected(row: PersistedEntity<Entity>): boolean;
|
|
@@ -1178,10 +2102,6 @@ export declare class BaseEntityListComponent<Entity extends BaseEntity> implemen
|
|
|
1178
2102
|
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityListComponent<any>, "base-list", never, {}, {}, never, never, true, never>;
|
|
1179
2103
|
}
|
|
1180
2104
|
export declare const ACTIVE_ENTITY_FACADE: InjectionToken<BaseEntityFacade<BaseEntity>>;
|
|
1181
|
-
interface EntityTabsState {
|
|
1182
|
-
activeTabs: string[];
|
|
1183
|
-
currentTab: string | undefined;
|
|
1184
|
-
}
|
|
1185
2105
|
export declare function BaseEntityTabsStore(): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
1186
2106
|
state: {
|
|
1187
2107
|
activeTabs: string[];
|
|
@@ -1227,8 +2147,23 @@ export declare class EntityRegistryComponent {
|
|
|
1227
2147
|
* `formControlType` enum is a superset of `FormControlType`, its `code`s are what the descriptor calls
|
|
1228
2148
|
* entity *names* — the translation is the descriptor factory's job and is documented there.
|
|
1229
2149
|
*/
|
|
1230
|
-
/**
|
|
2150
|
+
/**
|
|
2151
|
+
* `EntityDefinitionStatus` of the contract: the definition's lifecycle, as its designer decides it. Whether it is
|
|
2152
|
+
* live is its {@link ReleaseState}. `DRAFT` is retired — the backend stores it as `ACTIVE` — and is kept in the type
|
|
2153
|
+
* only for what an older backend may still answer.
|
|
2154
|
+
*/
|
|
1231
2155
|
type EntityDefinitionStatus = 'DRAFT' | 'ACTIVE' | 'DEPRECATED';
|
|
2156
|
+
/** `EntitySharing` of the contract: the policy of a type a common shares with the organizations of its starter. */
|
|
2157
|
+
interface EntitySharing {
|
|
2158
|
+
write: 'COMMON_ADMIN' | 'OWNER_ORG' | 'SELF';
|
|
2159
|
+
visibility: 'PUBLIC' | 'OWNER_ONLY';
|
|
2160
|
+
/** Limits a PUBLIC type: non-owners see a record only in these states of its state machine. */
|
|
2161
|
+
visibleWhen?: {
|
|
2162
|
+
state: string[];
|
|
2163
|
+
};
|
|
2164
|
+
/** The REFERENCE attribute whose record this type's records follow: owner and visibility are that record's. */
|
|
2165
|
+
from?: string;
|
|
2166
|
+
}
|
|
1232
2167
|
/** `ValueKind` of the contract: what the attribute's value *is*, as opposed to how it is edited. */
|
|
1233
2168
|
type EntityValueKind = 'TEXT' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'DATE_TIME' | 'ENUM' | 'REFERENCE';
|
|
1234
2169
|
/**
|
|
@@ -1275,12 +2210,23 @@ export declare class EntityAttributeDefinition implements BaseEntity {
|
|
|
1275
2210
|
displayOrder?: number;
|
|
1276
2211
|
valueKind?: EntityValueKind;
|
|
1277
2212
|
formControlType: string;
|
|
1278
|
-
|
|
2213
|
+
/** How many values the attribute holds; absent means a single value — the descriptor's `multiplicity`. */
|
|
2214
|
+
multiplicity?: Multiplicity;
|
|
2215
|
+
/** Upper bound of the `x` multiplicities (`0..x`, `1..x`). */
|
|
2216
|
+
maxOccurs?: number;
|
|
1279
2217
|
required?: boolean;
|
|
1280
2218
|
indexed?: boolean;
|
|
1281
2219
|
defaultValue?: unknown;
|
|
1282
2220
|
/** Only meaningful for `valueKind: ENUM`; becomes the dropdown's options. */
|
|
1283
2221
|
enumValues?: string[];
|
|
2222
|
+
/** Only meaningful for `valueKind: DATE / DATE_TIME`: the named style the value is shown and edited in. */
|
|
2223
|
+
dateFormat?: DateFormat;
|
|
2224
|
+
/**
|
|
2225
|
+
* The authoring form's flat view of {@link dateFormat}: the form builder binds one control per attribute
|
|
2226
|
+
* name and cannot reach into a nested object. The authoring mapper folds the two back on save.
|
|
2227
|
+
*/
|
|
2228
|
+
dateStyle?: DateStyle;
|
|
2229
|
+
timeStyle?: TimeStyle;
|
|
1284
2230
|
/**
|
|
1285
2231
|
* **Code** of the definition this attribute points at — a child carried inline
|
|
1286
2232
|
* (`EMBEDDED_COMPONENTS`) or a parent referenced by key (`FOREIGN_KEY`). The descriptor's
|
|
@@ -1289,6 +2235,16 @@ export declare class EntityAttributeDefinition implements BaseEntity {
|
|
|
1289
2235
|
linkedEntityType?: string;
|
|
1290
2236
|
/** Marks the attribute that titles an instance — the descriptor's `isLinkToDetails`. */
|
|
1291
2237
|
isLinkToDetails?: boolean;
|
|
2238
|
+
/** The list column hugs its content instead of filling the remaining width — the descriptor's `autosizeColumn`. */
|
|
2239
|
+
autosizeColumn?: boolean;
|
|
2240
|
+
/** Predefined avatar icon or image URL fallback for AVATAR form control. */
|
|
2241
|
+
defaultAvatar?: string;
|
|
2242
|
+
/** `ADDRESS` only: show the address on a map — the descriptor's `showMap`. */
|
|
2243
|
+
showMap?: boolean;
|
|
2244
|
+
/** `ADDRESS` only: who draws the map; OpenStreetMap when absent. */
|
|
2245
|
+
mapProvider?: MapProvider;
|
|
2246
|
+
/** `ADDRESS` only: the ISO 3166-1 alpha-2 code a new address starts with. */
|
|
2247
|
+
defaultCountry?: string;
|
|
1292
2248
|
constructor(init?: Partial<EntityAttributeDefinition>);
|
|
1293
2249
|
}
|
|
1294
2250
|
/**
|
|
@@ -1310,10 +2266,23 @@ export declare class EntityDefinition implements BaseEntity {
|
|
|
1310
2266
|
name: string;
|
|
1311
2267
|
description?: string;
|
|
1312
2268
|
status?: EntityDefinitionStatus;
|
|
2269
|
+
/** Where this draft stands against the release; reported by the backend, never sent back. */
|
|
2270
|
+
releaseState?: ReleaseState;
|
|
1313
2271
|
/** **Codes** of the definitions that may aggregate this one; empty for a stand-alone entity. */
|
|
1314
2272
|
componentParents?: string[];
|
|
1315
2273
|
/** True when this definition's payload travels inside its parent's and it has no rows of its own. */
|
|
1316
2274
|
isEmbedded?: boolean;
|
|
2275
|
+
/** True when a user can pick one object of this type as the context object; see `BaseEntityDescriptorOptions.canContextObject`. */
|
|
2276
|
+
canContextObject?: boolean;
|
|
2277
|
+
/** Set on a type of a common: shared with every organization of its starter. Kept as read so a save does not drop it. */
|
|
2278
|
+
sharing?: EntitySharing;
|
|
2279
|
+
/** Natural keys: attribute codes whose values together are unique among the type's non-retired records. Kept as read. */
|
|
2280
|
+
identifiers?: string[][];
|
|
2281
|
+
/**
|
|
2282
|
+
* Set on a type this organization reads but does not own: the key of the common that shares it. Such a type is
|
|
2283
|
+
* released, shown read-only, and neither changed nor deleted from here. Reported by the backend, never sent back.
|
|
2284
|
+
*/
|
|
2285
|
+
sharedFrom?: string;
|
|
1317
2286
|
attributes?: EntityAttributeDefinition[];
|
|
1318
2287
|
version?: number;
|
|
1319
2288
|
createdAt?: string;
|
|
@@ -1335,14 +2304,10 @@ export declare class EntityDefinition implements BaseEntity {
|
|
|
1335
2304
|
interface DynamicEntity {
|
|
1336
2305
|
id?: string;
|
|
1337
2306
|
version?: number;
|
|
2307
|
+
/** When the record of a shared type was retired — it still resolves, but lists leave it out. */
|
|
2308
|
+
retiredAt?: string;
|
|
1338
2309
|
[attrName: string]: unknown;
|
|
1339
2310
|
}
|
|
1340
|
-
/** The `content` page every list endpoint of the contract answers with. */
|
|
1341
|
-
interface EntityDefinitionPage {
|
|
1342
|
-
content?: EntityDefinition[];
|
|
1343
|
-
}
|
|
1344
|
-
/** Only an `ACTIVE` definition is rendered; a draft is being authored and a deprecated one is on its way out. */
|
|
1345
|
-
declare function isRenderable(definition: EntityDefinition): boolean;
|
|
1346
2311
|
/** `BaseConfiguration` key naming the org-scoped root of the base-entity endpoints. */
|
|
1347
2312
|
export declare const ENTITY_SERVICE_ROOT_KEY = "ENTITY_SERVICE_ROOT";
|
|
1348
2313
|
/**
|
|
@@ -1533,6 +2498,8 @@ export declare class DynamicEntityService extends BaseEntityRestService<DynamicE
|
|
|
1533
2498
|
protected readonly filterParamName = "rsql";
|
|
1534
2499
|
protected readonly sortParamName = "sort";
|
|
1535
2500
|
constructor(entityDefinitionCode: string);
|
|
2501
|
+
/** Takes a retired record of a shared type back, so lists show it again. Only the common's own members may. */
|
|
2502
|
+
reinstate(id: string): Observable<unknown>;
|
|
1536
2503
|
}
|
|
1537
2504
|
/**
|
|
1538
2505
|
* Facade of an entity whose payload lives inside another entity's document. Everything but the repository
|
|
@@ -1545,6 +2512,7 @@ export declare class DynamicEntityService extends BaseEntityRestService<DynamicE
|
|
|
1545
2512
|
*/
|
|
1546
2513
|
export declare abstract class EmbeddedEntityFacade<Entity extends BaseEntity> extends BaseEntityFacade<Entity> {
|
|
1547
2514
|
private _accessor?;
|
|
2515
|
+
private _directWriter?;
|
|
1548
2516
|
/** Takes no mapper: an embedded row is carried, and mapped, by the containing entity's payload. */
|
|
1549
2517
|
protected createService(): BaseEntityService<Entity>;
|
|
1550
2518
|
/**
|
|
@@ -1561,6 +2529,7 @@ export declare abstract class EmbeddedEntityFacade<Entity extends BaseEntity> ex
|
|
|
1561
2529
|
*/
|
|
1562
2530
|
protected createStoreClass(): Type<unknown>;
|
|
1563
2531
|
private readonly rowKeyOf;
|
|
2532
|
+
private get directWriter();
|
|
1564
2533
|
private get accessor();
|
|
1565
2534
|
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedEntityFacade<any>, never>;
|
|
1566
2535
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
@@ -1707,6 +2676,25 @@ export declare class DynamicEntityRegistry {
|
|
|
1707
2676
|
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicEntityRegistry, never>;
|
|
1708
2677
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1709
2678
|
}
|
|
2679
|
+
/**
|
|
2680
|
+
* Whether the screens of the organization's own entity types — the ones built at run time from definitions — are
|
|
2681
|
+
* read-only in this page. A host sets it while it shows *draft* definitions: there the screens are a preview of
|
|
2682
|
+
* definitions not yet released, over the organization's real objects, and a save through a draft's attributes and
|
|
2683
|
+
* rules would write live data the running application does not yet expect.
|
|
2684
|
+
*
|
|
2685
|
+
* `false` unless a host provides it. The designer's own screens are never affected: they are compiled into the
|
|
2686
|
+
* application, not built from definitions.
|
|
2687
|
+
*/
|
|
2688
|
+
export declare const ENTITY_PREVIEW_READ_ONLY: InjectionToken<boolean>;
|
|
2689
|
+
/** Answers, per entity type, whether its screens may only be looked at; see {@link ENTITY_PREVIEW_READ_ONLY}. */
|
|
2690
|
+
export declare class EntityPreviewMode {
|
|
2691
|
+
private readonly previewReadOnly;
|
|
2692
|
+
private readonly dynamicEntities;
|
|
2693
|
+
/** True for an entity type built from a definition, while the host previews drafts. */
|
|
2694
|
+
isReadOnly(entityName: string | undefined): boolean;
|
|
2695
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityPreviewMode, never>;
|
|
2696
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2697
|
+
}
|
|
1710
2698
|
/**
|
|
1711
2699
|
* An embedded child to mount under an entity's details route. The entity's descriptor has to reference it
|
|
1712
2700
|
* with `FormControlType.EMBEDDED_COMPONENTS`, and the child's own descriptor has to name the entity as a
|
|
@@ -1736,7 +2724,11 @@ interface EmbeddedChildRoute {
|
|
|
1736
2724
|
* navigation. A child that names itself would otherwise be an infinite structure; lazily, it is finite at
|
|
1737
2725
|
* any moment and Angular memoizes each level it has expanded.
|
|
1738
2726
|
*/
|
|
1739
|
-
export declare function baseEntityRoutes(embeddedChildren?: EmbeddedChildRoute[], extraTabs?: EntityTabDescriptor[]): Routes;
|
|
2727
|
+
export declare function baseEntityRoutes(embeddedChildren?: EmbeddedChildRoute[], extraTabs?: EntityTabDescriptor[], contextObject?: ContextObjectRoutes): Routes;
|
|
2728
|
+
/** An entity that `canContextObject`: what its routes need to know to address the parts through the picked object. */
|
|
2729
|
+
interface ContextObjectRoutes {
|
|
2730
|
+
entityName: string;
|
|
2731
|
+
}
|
|
1740
2732
|
/** The stand-alone entity routes, unchanged for every caller that has no embedded children to mount. */
|
|
1741
2733
|
export declare const BASE_ENTITY_ROUTES: Routes;
|
|
1742
2734
|
/** Everything needed to mount one entity's List and Details screens somewhere. */
|
|
@@ -1770,8 +2762,24 @@ export declare class EntityScreenResolver {
|
|
|
1770
2762
|
private readonly dynamicRegistry;
|
|
1771
2763
|
private readonly injector;
|
|
1772
2764
|
private readonly tabContributors;
|
|
2765
|
+
private readonly stateControl;
|
|
2766
|
+
private readonly calculatedControl;
|
|
1773
2767
|
/** `undefined` when neither a facade nor a definition answers to `entityName`. */
|
|
1774
2768
|
resolve(entityName: string | undefined): Promise<EntityScreens | undefined>;
|
|
2769
|
+
/**
|
|
2770
|
+
* Turns the attribute a state machine governs into a {@link FormControlType.STATE} control, so the form offers
|
|
2771
|
+
* the allowed transitions instead of a free edit of the value. Idempotent, which matters for the same reason as
|
|
2772
|
+
* in {@link extraTabsOf}: a compile-time descriptor is a singleton resolved more than once. A provider that
|
|
2773
|
+
* throws leaves the descriptor as it was — the attribute stays editable, as it was before base-state existed.
|
|
2774
|
+
*/
|
|
2775
|
+
private markStateAttribute;
|
|
2776
|
+
/**
|
|
2777
|
+
* Turns the attributes a calculation writes into {@link FormControlType.CALCULATED} controls, so the form shows
|
|
2778
|
+
* them read-only and recomputed instead of offering a free edit that the backend would discard. Same contract as
|
|
2779
|
+
* {@link markStateAttribute}: idempotent, a provider that throws leaves the descriptor as it was, and an attribute
|
|
2780
|
+
* a state machine governs stays STATE.
|
|
2781
|
+
*/
|
|
2782
|
+
private markCalculatedAttributes;
|
|
1775
2783
|
/**
|
|
1776
2784
|
* The descriptor's extra tabs after every contributor has been asked — and **written back onto the
|
|
1777
2785
|
* descriptor**, because that is what `BaseEntityTabsComponent` renders the links from. The routes are
|
|
@@ -1843,6 +2851,44 @@ interface EntityTabContributor {
|
|
|
1843
2851
|
* reader injects it optionally.
|
|
1844
2852
|
*/
|
|
1845
2853
|
export declare const ENTITY_TAB_CONTRIBUTORS: InjectionToken<readonly EntityTabContributor[]>;
|
|
2854
|
+
/**
|
|
2855
|
+
* What renders a {@link FormControlType.STATE} attribute, and which attribute of an entity is one.
|
|
2856
|
+
*
|
|
2857
|
+
* base-entity knows that some attribute *holds* a state; it cannot know the machine behind it — that is
|
|
2858
|
+
* base-state's, and base-entity does not depend on it. So the feature that owns the machines registers this,
|
|
2859
|
+
* the same way it contributes its tab through `ENTITY_TAB_CONTRIBUTORS`, and nothing on either side names the
|
|
2860
|
+
* other. Without a registration a STATE attribute is shown read-only as a label.
|
|
2861
|
+
*/
|
|
2862
|
+
interface EntityStateControl {
|
|
2863
|
+
/** A `BaseFormControlComponent` subclass. Typed loosely: a stricter type would close an import cycle. */
|
|
2864
|
+
component: Type<unknown>;
|
|
2865
|
+
/**
|
|
2866
|
+
* The name of the attribute holding the state of `descriptor`'s objects, or `undefined` when no machine
|
|
2867
|
+
* governs that entity — by far the common answer. {@link EntityScreenResolver} asks this once per resolved
|
|
2868
|
+
* entity and turns that attribute into a STATE control, so a governed entity needs no descriptor change.
|
|
2869
|
+
*/
|
|
2870
|
+
stateAttributeOf(descriptor: BaseEntityDescriptor): Promise<string | undefined> | string | undefined;
|
|
2871
|
+
}
|
|
2872
|
+
export declare const ENTITY_STATE_CONTROL: InjectionToken<EntityStateControl>;
|
|
2873
|
+
/**
|
|
2874
|
+
* What renders a {@link FormControlType.CALCULATED} attribute, and which attributes of an entity are one.
|
|
2875
|
+
*
|
|
2876
|
+
* base-entity knows that some attribute *holds* a derived value; it cannot know the calculation behind it —
|
|
2877
|
+
* that is base-calculation's, and base-entity does not depend on it. So the feature that owns the calculations
|
|
2878
|
+
* registers this, the way base-state registers {@link ENTITY_STATE_CONTROL}, and nothing on either side names
|
|
2879
|
+
* the other. Without a registration a CALCULATED attribute is shown read-only as a label.
|
|
2880
|
+
*/
|
|
2881
|
+
interface EntityCalculatedControl {
|
|
2882
|
+
/** A `BaseFormControlComponent` subclass. Typed loosely: a stricter type would close an import cycle. */
|
|
2883
|
+
component: Type<unknown>;
|
|
2884
|
+
/**
|
|
2885
|
+
* The names of the attributes of `descriptor`'s objects that a calculation writes — usually none.
|
|
2886
|
+
* {@link EntityScreenResolver} asks this once per resolved entity and turns each into a CALCULATED control,
|
|
2887
|
+
* so an entity authored before the calculation existed needs no descriptor change.
|
|
2888
|
+
*/
|
|
2889
|
+
calculatedAttributesOf(descriptor: BaseEntityDescriptor): Promise<string[]> | string[];
|
|
2890
|
+
}
|
|
2891
|
+
export declare const ENTITY_CALCULATED_CONTROL: InjectionToken<EntityCalculatedControl>;
|
|
1846
2892
|
interface EntityScreenRouteOptions {
|
|
1847
2893
|
/** Entity whose screens to mount, by descriptor name. */
|
|
1848
2894
|
entityName: string | undefined;
|
|
@@ -1874,8 +2920,13 @@ interface EntityScreenRouteOptions {
|
|
|
1874
2920
|
* every tab click and row link do nothing at all — see {@link entityScreenChildren}.
|
|
1875
2921
|
*/
|
|
1876
2922
|
export declare function entityScreenRoute({ entityName, screens, hostPath, data }: EntityScreenRouteOptions): Route;
|
|
1877
|
-
/**
|
|
2923
|
+
/**
|
|
2924
|
+
* Route data keys of an entity's screens. Kept apart from the screens component, which pulls in the whole entity
|
|
2925
|
+
* container, so that the list can read them without importing the screens back.
|
|
2926
|
+
*/
|
|
1878
2927
|
export declare const ENTITY_DESCRIPTOR_ROUTE_DATA_KEY = "entityDescriptor";
|
|
2928
|
+
export declare const REQUESTED_ENTITY_ROUTE_DATA_KEY = "requestedEntityName";
|
|
2929
|
+
/** Route `data` key under which {@link entityScreenRoute} puts the descriptor to render. */
|
|
1879
2930
|
/**
|
|
1880
2931
|
* Route `data` key naming the entity the route *asked* for — which is all this component needs, and needs
|
|
1881
2932
|
* even when nothing answered to it.
|
|
@@ -1884,7 +2935,6 @@ export declare const ENTITY_DESCRIPTOR_ROUTE_DATA_KEY = "entityDescriptor";
|
|
|
1884
2935
|
* and everything that reads it — `readEmbeddedBreadcrumb`, `EntityRouteRegistry` — would take this route to
|
|
1885
2936
|
* be that one. See the note in {@link entityScreenRoute}.
|
|
1886
2937
|
*/
|
|
1887
|
-
export declare const REQUESTED_ENTITY_ROUTE_DATA_KEY = "requestedEntityName";
|
|
1888
2938
|
/**
|
|
1889
2939
|
* Hosts one entity's generated screens at a route: List and Details, with the tab bar, toolbar and status
|
|
1890
2940
|
* bar `BaseEntityTabsComponent` brings, and the outlet its own child routes render in.
|
|
@@ -1915,6 +2965,12 @@ interface EmbeddedRouteLevel {
|
|
|
1915
2965
|
entityName: string;
|
|
1916
2966
|
/** `undefined` on a list route, {@link BaseUrlSegments.NewEntity} for a row being created. */
|
|
1917
2967
|
entityId: string | undefined;
|
|
2968
|
+
/**
|
|
2969
|
+
* Set when this level is a **working context's** entity — `ctx/<name>/<id>` — rather than an entity's own route. It is
|
|
2970
|
+
* the root of the aggregate all the same: the rows below it are addressed through the URL exactly as below an entity's
|
|
2971
|
+
* details form, but saved through the item endpoints, as no form of the whole entity is open to save them.
|
|
2972
|
+
*/
|
|
2973
|
+
workingContext?: string;
|
|
1918
2974
|
}
|
|
1919
2975
|
/** A {@link EmbeddedRouteLevel} with the two URLs the level can be navigated by. */
|
|
1920
2976
|
interface EmbeddedBreadcrumbLevel extends EmbeddedRouteLevel {
|
|
@@ -1927,6 +2983,8 @@ interface EmbeddedBreadcrumbLevel extends EmbeddedRouteLevel {
|
|
|
1927
2983
|
interface EmbeddedRouteContext {
|
|
1928
2984
|
rootEntityName: string;
|
|
1929
2985
|
rootId: string;
|
|
2986
|
+
/** The working context the aggregate's root is the entity of, when it is one. See {@link EmbeddedRouteLevel.workingContext}. */
|
|
2987
|
+
viaWorkingContext?: string;
|
|
1930
2988
|
/** Hops from the root down to the **owner** of these rows; `[]` when the owner is the root itself. */
|
|
1931
2989
|
path: EmbeddedPath;
|
|
1932
2990
|
/** The owner's attribute carrying these rows. */
|
|
@@ -1934,59 +2992,6 @@ interface EmbeddedRouteContext {
|
|
|
1934
2992
|
entityName: string;
|
|
1935
2993
|
referenceIdField?: string;
|
|
1936
2994
|
}
|
|
1937
|
-
/**
|
|
1938
|
-
* The chain of entities the URL walks through, outermost first — `Test Entity/1`, then
|
|
1939
|
-
* `Embedded Component/embedded_1_1`, and so on. It reads the URL only, which is what makes a deep link and a
|
|
1940
|
-
* page refresh resolve to the same row as a drill-down.
|
|
1941
|
-
*
|
|
1942
|
-
* The entity name sits on the container route and the id on its `:entityId/details` child, and the router
|
|
1943
|
-
* hands both **down** to the routes nested below them. Three rules undo that inheritance:
|
|
1944
|
-
*
|
|
1945
|
-
* - a name counts only from the route that *declares* it in its config, not from every descendant that
|
|
1946
|
-
* inherited it — see {@link declaredEntityName};
|
|
1947
|
-
* - a name repeated while the level below it still has no id is that level's own details route echoing its
|
|
1948
|
-
* container, not a new level — whereas a repeat *after* an id is a genuinely self-nesting child
|
|
1949
|
-
* (`app-nav-item/a/details/app-nav-item/b/details`), which `App Nav Item` needs;
|
|
1950
|
-
* - an id counts only from the route that actually declares `:entityId`, so a nested branch does not adopt
|
|
1951
|
-
* the id of the entity it hangs under.
|
|
1952
|
-
*/
|
|
1953
|
-
declare function readEmbeddedRouteChain(snapshot: ActivatedRouteSnapshot | null): EmbeddedRouteLevel[];
|
|
1954
|
-
/**
|
|
1955
|
-
* The same chain, each level carrying the URL of its own screen — which is what turns it into a
|
|
1956
|
-
* breadcrumb the user can walk back up.
|
|
1957
|
-
*
|
|
1958
|
-
* The URL is accumulated from the segments of the routes the walk passes, so a level's `url` ends at the
|
|
1959
|
-
* last route that belongs to *it*: `<owner>/<id>/details` for a level a row is named on. `baseUrl` stops
|
|
1960
|
-
* one step earlier, before the level's own entity segment, and is what a sibling list or details URL is
|
|
1961
|
-
* built on.
|
|
1962
|
-
*/
|
|
1963
|
-
declare function readEmbeddedBreadcrumb(snapshot: ActivatedRouteSnapshot | null): EmbeddedBreadcrumbLevel[];
|
|
1964
|
-
/**
|
|
1965
|
-
* The part of a URL chain that is **one aggregate**: the longest tail in which every level is an embedded
|
|
1966
|
-
* component of the level above it.
|
|
1967
|
-
*
|
|
1968
|
-
* A URL may walk through entities that have nothing to do with each other. The designer's Preview tab is the
|
|
1969
|
-
* case that forced this: a previewed application's screens are mounted *below* `app-definition/<id>`, so an
|
|
1970
|
-
* order line's chain reads `App Definition` -> `Order` -> `Order Line`. Taking the outermost level as the
|
|
1971
|
-
* aggregate root then asks `App Definition` for an embedded `Order` it has never heard of, and nothing
|
|
1972
|
-
* resolves — which showed up as every embedded list in a previewed application coming up empty, and every
|
|
1973
|
-
* link into an embedded row bouncing back to the form it was clicked on.
|
|
1974
|
-
*
|
|
1975
|
-
* Walking back from the deepest level and stopping at the first pair that is not a containment expresses
|
|
1976
|
-
* "one aggregate" without needing to know *why* the outer levels are there. For an ordinary authoring URL,
|
|
1977
|
-
* where the whole chain is one aggregate, it stops at the root and changes nothing.
|
|
1978
|
-
*/
|
|
1979
|
-
declare function aggregateChainOf<Level extends EmbeddedRouteLevel>(levels: readonly Level[], descriptorOf: (entityName: string) => BaseEntityDescriptor | undefined): Level[];
|
|
1980
|
-
/**
|
|
1981
|
-
* Turns the URL chain into a path into the root's payload. Resolving the hops needs the payload itself,
|
|
1982
|
-
* because a row's position is what addresses it — the URL carries the row's *key*, and only the aggregate
|
|
1983
|
-
* knows where that key currently sits.
|
|
1984
|
-
*
|
|
1985
|
-
* Returns `undefined` when the chain names no embedded level, when a descriptor is missing, or when an
|
|
1986
|
-
* intermediate row cannot be found — a stale deep link, which the caller turns into a redirect rather than
|
|
1987
|
-
* into a form bound to the wrong row.
|
|
1988
|
-
*/
|
|
1989
|
-
declare function resolveEmbeddedRouteContext(levels: readonly EmbeddedRouteLevel[], rootPayload: unknown, descriptorOf: (entityName: string) => BaseEntityDescriptor | undefined): EmbeddedRouteContext | undefined;
|
|
1990
2995
|
/** An embedded level resolved against the live aggregate: where its rows are, and who owns the document. */
|
|
1991
2996
|
interface ResolvedEmbeddedAggregate {
|
|
1992
2997
|
context: EmbeddedRouteContext;
|
|
@@ -2013,8 +3018,13 @@ export declare class EmbeddedAggregateAccessor {
|
|
|
2013
3018
|
* them has to be told when that document arrives or changes.
|
|
2014
3019
|
*/
|
|
2015
3020
|
rootStoreFor(entityName: string): BaseEntityStoreApi<BaseEntity> | undefined;
|
|
2016
|
-
/**
|
|
2017
|
-
|
|
3021
|
+
/**
|
|
3022
|
+
* Stages the aggregate with `rootPayload` replaced — an embedded row has no endpoint of its own, and it is
|
|
3023
|
+
* not persisted on its own either: the root's Save writes the whole document once the user is back on it.
|
|
3024
|
+
* Persisting each child step would put the document's own rules in the way of building it — an order's
|
|
3025
|
+
* total cannot match its lines while a line is being added — and leave half-finished documents behind.
|
|
3026
|
+
*/
|
|
3027
|
+
stageRoot(resolved: ResolvedEmbeddedAggregate, rootPayload: Record<string, unknown>): void;
|
|
2018
3028
|
/**
|
|
2019
3029
|
* The URL chain, ending at `entityName`.
|
|
2020
3030
|
*
|
|
@@ -2030,6 +3040,83 @@ export declare class EmbeddedAggregateAccessor {
|
|
|
2030
3040
|
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedAggregateAccessor, never>;
|
|
2031
3041
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2032
3042
|
}
|
|
3043
|
+
/**
|
|
3044
|
+
* One item of an embedded collection. Free-form, as the entity's payload is. `id` identifies it, and `itemVersion` counts
|
|
3045
|
+
* the changes made through the item endpoints — the server keeps both, so neither is sent back as a change.
|
|
3046
|
+
*/
|
|
3047
|
+
type CollectionItem = Record<string, unknown>;
|
|
3048
|
+
/** What a read answers: the items, and the version of the object they were read from. */
|
|
3049
|
+
interface CollectionRead {
|
|
3050
|
+
items: CollectionItem[];
|
|
3051
|
+
/** `undefined` when the server sent no `ETag`. */
|
|
3052
|
+
version: string | undefined;
|
|
3053
|
+
}
|
|
3054
|
+
/**
|
|
3055
|
+
* Reads and changes **one item** of an embedded collection of an entity instance — `entities/<type>/<id>/<attr>[/<itemId>]`
|
|
3056
|
+
* — so that adding a zone to a warehouse sends the zone, not the warehouse.
|
|
3057
|
+
*
|
|
3058
|
+
* The object's version travels as an `ETag`: every answer carries it, and a change that names it back as `If-Match` is
|
|
3059
|
+
* refused with a 409 when someone else saved in between. A change that names none applies to whatever is stored.
|
|
3060
|
+
*/
|
|
3061
|
+
export declare class EmbeddedCollectionService {
|
|
3062
|
+
private readonly http;
|
|
3063
|
+
private readonly definitions;
|
|
3064
|
+
private readonly root;
|
|
3065
|
+
list(entityName: string, id: string, attrName: string): Promise<CollectionRead>;
|
|
3066
|
+
/** The item as stored — with the `id` the server assigned. */
|
|
3067
|
+
append(entityName: string, id: string, attrName: string, item: CollectionItem): Promise<CollectionItem>;
|
|
3068
|
+
/**
|
|
3069
|
+
* A merge patch: members present replace the stored ones, a `null` member is removed. `version` is the item's own version
|
|
3070
|
+
* as last read; the server refuses the change with a 409 when the item has changed since.
|
|
3071
|
+
*/
|
|
3072
|
+
patch(entityName: string, id: string, attrName: string, itemId: string, patch: CollectionItem, version?: string): Promise<CollectionItem>;
|
|
3073
|
+
remove(entityName: string, id: string, attrName: string, itemId: string, version?: string): Promise<void>;
|
|
3074
|
+
/**
|
|
3075
|
+
* A collection nested in an item of another: the `childAttrName` collection of the item `itemId` of `attrName`. The same
|
|
3076
|
+
* operations as above, one level down.
|
|
3077
|
+
*/
|
|
3078
|
+
listNested(entityName: string, id: string, attrName: string, itemId: string, childAttrName: string): Promise<CollectionRead>;
|
|
3079
|
+
appendNested(entityName: string, id: string, attrName: string, itemId: string, childAttrName: string, item: CollectionItem): Promise<CollectionItem>;
|
|
3080
|
+
patchNested(entityName: string, id: string, attrName: string, itemId: string, childAttrName: string, childItemId: string, patch: CollectionItem, version?: string): Promise<CollectionItem>;
|
|
3081
|
+
removeNested(entityName: string, id: string, attrName: string, itemId: string, childAttrName: string, childItemId: string, version?: string): Promise<void>;
|
|
3082
|
+
/** The URL of the collection or item at the given path: `attrName`, then alternately an item id and an attribute. */
|
|
3083
|
+
private url;
|
|
3084
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedCollectionService, never>;
|
|
3085
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
3086
|
+
}
|
|
3087
|
+
/**
|
|
3088
|
+
* The merge patch that turns `before` into `after`: the members that changed, and `null` for those that were removed.
|
|
3089
|
+
* An unchanged item makes an empty patch, which the caller can skip.
|
|
3090
|
+
*/
|
|
3091
|
+
export declare function mergePatch(before: CollectionItem, after: CollectionItem): CollectionItem;
|
|
3092
|
+
/**
|
|
3093
|
+
* Saves an embedded row **straight through the item endpoints**, for an aggregate whose root is a working context.
|
|
3094
|
+
*
|
|
3095
|
+
* An entity's own form stages a row in the whole document and the form's Save persists it. A working context has no form
|
|
3096
|
+
* of the whole entity — that is the point of it — so there is nothing to Save: each row goes to the server as the row, under
|
|
3097
|
+
* its own version, and the root is read again so every screen shows what is stored.
|
|
3098
|
+
*
|
|
3099
|
+
* The backend addresses a collection one level below the entity's own, and the row inside it, by `id`. A row nested deeper
|
|
3100
|
+
* has no endpoint yet, and a row stored before ids existed has none to address it by; both say so rather than guess.
|
|
3101
|
+
*/
|
|
3102
|
+
declare class DirectEmbeddedWriter {
|
|
3103
|
+
private readonly collections;
|
|
3104
|
+
/** Whether this aggregate is saved here rather than staged in the root document. */
|
|
3105
|
+
handles(resolved: ResolvedEmbeddedAggregate): boolean;
|
|
3106
|
+
/** The row as stored: with the `id` and `itemVersion` the server assigned. */
|
|
3107
|
+
append(resolved: ResolvedEmbeddedAggregate, row: EmbeddedRow): Promise<CollectionItem>;
|
|
3108
|
+
/** Sends only what changed, against the row's own version; the row unchanged when nothing did. */
|
|
3109
|
+
patch(resolved: ResolvedEmbeddedAggregate, before: EmbeddedRow, after: EmbeddedRow): Promise<CollectionItem>;
|
|
3110
|
+
remove(resolved: ResolvedEmbeddedAggregate, before: EmbeddedRow): Promise<void>;
|
|
3111
|
+
private target;
|
|
3112
|
+
/** The row the collection is nested in, when it is: its attribute at the top, and its `id`. */
|
|
3113
|
+
private ownerOf;
|
|
3114
|
+
private itemIdOf;
|
|
3115
|
+
/** Reads the root again, so the rows every screen lists are the stored ones. */
|
|
3116
|
+
private refresh;
|
|
3117
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DirectEmbeddedWriter, never>;
|
|
3118
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
3119
|
+
}
|
|
2033
3120
|
/**
|
|
2034
3121
|
* The repository of an **embedded** entity: one that has no endpoint of its own because its payload travels
|
|
2035
3122
|
* inside its parent's document.
|
|
@@ -2039,13 +3126,18 @@ export declare class EmbeddedAggregateAccessor {
|
|
|
2039
3126
|
* enough — the child's `BaseEntityListComponent` and `BaseEntityFormComponent`, and the store between them,
|
|
2040
3127
|
* are the stock ones and know nothing about any of this.
|
|
2041
3128
|
*
|
|
2042
|
-
* A write is a write of the whole root document
|
|
2043
|
-
*
|
|
3129
|
+
* A write is a write of the whole root document, **staged** in the root's store rather than persisted (see
|
|
3130
|
+
* {@link EmbeddedAggregateAccessor.stageRoot}): a child's Save, Add or Delete changes the document the root's
|
|
3131
|
+
* form is editing, and the root's own Save — or Cancel — commits or discards all of it at once.
|
|
2044
3132
|
*/
|
|
2045
3133
|
export declare class EmbeddedEntityService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
2046
3134
|
private readonly entityName;
|
|
2047
3135
|
private readonly accessor;
|
|
2048
|
-
|
|
3136
|
+
/** Saves a row on its own where the aggregate's root is a working context; absent, every write is staged. */
|
|
3137
|
+
private readonly direct?;
|
|
3138
|
+
constructor(entityName: string, accessor: EmbeddedAggregateAccessor,
|
|
3139
|
+
/** Saves a row on its own where the aggregate's root is a working context; absent, every write is staged. */
|
|
3140
|
+
direct?: DirectEmbeddedWriter | undefined);
|
|
2049
3141
|
/**
|
|
2050
3142
|
* The row arrives with its key already set — `createEntity()` mints one for an `id`-bearing child, and a
|
|
2051
3143
|
* child keyed by something else (`App Region` by `type`) gets it from the form — so there is no
|
|
@@ -2153,7 +3245,10 @@ interface NavigationState {
|
|
|
2153
3245
|
responsePayloads: Map<string, NavigationPayload>;
|
|
2154
3246
|
requestPayloads: Map<string, NavigationPayload>;
|
|
2155
3247
|
returnTo: string;
|
|
2156
|
-
|
|
3248
|
+
/** The values each form left for a round trip, keyed by the entity of the form that left them: each takes its own. */
|
|
3249
|
+
formSnapshots: Record<string, Record<string, unknown>>;
|
|
3250
|
+
/** Set when a picker sends the user to a list to choose from, until the router navigates on its own. */
|
|
3251
|
+
roundTripOpen: boolean;
|
|
2157
3252
|
}
|
|
2158
3253
|
export declare function snakeCaseName(entityName: string): string;
|
|
2159
3254
|
export declare const BaseFormNavigatorSingletonStore: import("@angular/core").Type<{
|
|
@@ -2167,8 +3262,8 @@ export declare const BaseFormNavigatorSingletonStore: import("@angular/core").Ty
|
|
|
2167
3262
|
responsePayloads: import("@angular/core").Signal<Map<string, NavigationPayload>>;
|
|
2168
3263
|
requestPayloads: import("@angular/core").Signal<Map<string, NavigationPayload>>;
|
|
2169
3264
|
returnTo: import("@angular/core").Signal<string>;
|
|
2170
|
-
|
|
2171
|
-
|
|
3265
|
+
formSnapshots: import("@angular/core").Signal<Record<string, Record<string, unknown>>>;
|
|
3266
|
+
roundTripOpen: import("@angular/core").Signal<boolean>;
|
|
2172
3267
|
determineCurrentUrl: () => string;
|
|
2173
3268
|
determineOwnerUrl: () => string;
|
|
2174
3269
|
determineActiveRouteSegment: () => void;
|
|
@@ -2185,7 +3280,10 @@ export declare const BaseFormNavigatorSingletonStore: import("@angular/core").Ty
|
|
|
2185
3280
|
showsScreenOf: (entityName: string) => boolean;
|
|
2186
3281
|
destroyNavigationTracking: () => void;
|
|
2187
3282
|
initializeNavigationTracking: () => void;
|
|
2188
|
-
|
|
3283
|
+
beginRoundTrip: () => void;
|
|
3284
|
+
hasRoundTrip: () => boolean;
|
|
3285
|
+
keepFormSnapshot: (owner: string, values: Record<string, unknown>) => void;
|
|
3286
|
+
popFormSnapshot: (owner: string) => Record<string, unknown> | undefined;
|
|
2189
3287
|
popRequestPayload: (attrName?: string) => NavigationPayload | undefined;
|
|
2190
3288
|
popResponsePayload: (attrName?: string) => NavigationPayload | undefined;
|
|
2191
3289
|
pushResponsePayload: (payload: NavigationPayload) => void;
|
|
@@ -2201,7 +3299,8 @@ export declare const BaseFormNavigatorSingletonStore: import("@angular/core").Ty
|
|
|
2201
3299
|
responsePayloads: Map<string, NavigationPayload>;
|
|
2202
3300
|
requestPayloads: Map<string, NavigationPayload>;
|
|
2203
3301
|
returnTo: string;
|
|
2204
|
-
|
|
3302
|
+
formSnapshots: Record<string, Record<string, unknown>>;
|
|
3303
|
+
roundTripOpen: boolean;
|
|
2205
3304
|
}>>;
|
|
2206
3305
|
export declare function BaseFormNavigatorStore(entityName: string): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
2207
3306
|
state: {};
|
|
@@ -2253,122 +3352,6 @@ export declare class EntityRouteRegistry {
|
|
|
2253
3352
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2254
3353
|
}
|
|
2255
3354
|
export declare function provideEntityRouteRegistry(): EnvironmentProviders;
|
|
2256
|
-
/**
|
|
2257
|
-
* Talks to Firestore straight from the browser, bypassing the OpenAPI contract entirely.
|
|
2258
|
-
*
|
|
2259
|
-
* @deprecated Use `BaseEntityRestService` against the contract. This adapter is kept for consumers
|
|
2260
|
-
* who deploy on Firestore; ProcessPuzzle itself no longer does, so it is no longer exercised by any
|
|
2261
|
-
* environment here.
|
|
2262
|
-
*
|
|
2263
|
-
* Why this path is being retired rather than kept as an option:
|
|
2264
|
-
* - **It is a second seam.** With an adapter chosen in the client, every feature has to be built
|
|
2265
|
-
* twice, and only the REST half is covered by a contract test. Drift on this side is undetectable
|
|
2266
|
-
* until it reaches a user.
|
|
2267
|
-
* - **Its paging is a fiction.** `findByQueryAsync` reports `totalPages: 1` and
|
|
2268
|
-
* `totalElements: content.length`, so a paginator tells the truth on REST and guesses here.
|
|
2269
|
-
* - **Firestore cannot answer the query language.** `createQuery` maps a
|
|
2270
|
-
* {@link BaseEntityQueryCondition} onto Firestore constraints, which have no substring or
|
|
2271
|
-
* case-insensitive compare, and silently drop documents that lack the `orderBy` field.
|
|
2272
|
-
* - **Authorization ends up in two dialects** — `firestore.rules` here, server-side policy there —
|
|
2273
|
-
* so tenant isolation has to be got right twice.
|
|
2274
|
-
*
|
|
2275
|
-
* Nothing about it is broken today and no removal date is set, but only one call site is left to
|
|
2276
|
-
* migrate before it can go: `BaseEntityFacade.createService` still returns it when
|
|
2277
|
-
* `BACKEND_SERVICE_PROVIDER` is not `rest`. `ApplicationPropertyService` in `base-widget` no longer
|
|
2278
|
-
* extends it, and the testbed's own Firestore sample is gone — its entities are served through the
|
|
2279
|
-
* contract like every other deployment's.
|
|
2280
|
-
*
|
|
2281
|
-
* Both of its dependencies on `@angular/fire` are injected rather than imported: the instance as
|
|
2282
|
-
* {@link FIRESTORE} rather than the `Firestore` class, and the module functions as {@link FIRESTORE_API}.
|
|
2283
|
-
* Each token's own file says which testability problem it solves.
|
|
2284
|
-
*/
|
|
2285
|
-
export declare class BaseEntityFirestoreService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
2286
|
-
protected entityMapper: BaseEntityMapper<Entity>;
|
|
2287
|
-
protected collectionName: string;
|
|
2288
|
-
protected collection: import("@firebase/firestore").CollectionReference<DocumentData, DocumentData>;
|
|
2289
|
-
protected readonly firestore: import("@angular/fire/firestore").Firestore;
|
|
2290
|
-
protected readonly firestoreApi: import("@processpuzzle/base-entity").FirestoreApi;
|
|
2291
|
-
constructor(entityMapper: BaseEntityMapper<Entity>, collectionName: string);
|
|
2292
|
-
add(entity: Entity): Observable<PersistedEntity<Entity>>;
|
|
2293
|
-
delete(id: string): Observable<unknown>;
|
|
2294
|
-
deleteAll(): Observable<unknown>;
|
|
2295
|
-
findAll(page?: number, pageSize?: number): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[]>;
|
|
2296
|
-
findById(id: string): Observable<PersistedEntity<Entity> | void>;
|
|
2297
|
-
findByQuery(queryCondition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[]>;
|
|
2298
|
-
update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
|
|
2299
|
-
protected addAsync(entity: Entity): Promise<PersistedEntity<Entity>>;
|
|
2300
|
-
protected createQuery(queryCondition: BaseEntityQueryCondition): import("@firebase/firestore").Query<DocumentData, DocumentData>;
|
|
2301
|
-
protected findByQueryAsync(queryCondition: BaseEntityQueryCondition): Promise<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[]>;
|
|
2302
|
-
protected mapCollection(source: Observable<unknown[]>): PersistedEntity<Entity>[];
|
|
2303
|
-
protected mapDocument(docData: unknown): PersistedEntity<Entity>;
|
|
2304
|
-
private mapEntity;
|
|
2305
|
-
private updateAsync;
|
|
2306
|
-
}
|
|
2307
|
-
/**
|
|
2308
|
-
* The Firestore instance {@link BaseEntityFirestoreService} reads and writes through.
|
|
2309
|
-
*
|
|
2310
|
-
* The service used to inject `@angular/fire`'s `Firestore` class directly. Angular matches providers by
|
|
2311
|
-
* object identity, and a bare specifier does not always resolve to one object: mock the barrel, or let a
|
|
2312
|
-
* build inline it on one side of the graph and import it on the other, and the module the service imports
|
|
2313
|
-
* is a second instance of the same file. The class is then two distinct tokens — one registered, the other
|
|
2314
|
-
* asked for — and DI fails with `NG0201: No provider found for Firestore`.
|
|
2315
|
-
*
|
|
2316
|
-
* An `InjectionToken` declared here is a single object owned by this library. Note the `import type`: it
|
|
2317
|
-
* carries no runtime dependency on `@angular/fire/firestore`, which is what keeps this module out of the
|
|
2318
|
-
* blast radius when a test replaces the barrel, and so keeps the token one object.
|
|
2319
|
-
*
|
|
2320
|
-
* Applications that deploy on Firestore bind it with `provideFirestoreToken()`, next to their existing
|
|
2321
|
-
* `provideFirestore(...)` call.
|
|
2322
|
-
*/
|
|
2323
|
-
export declare const FIRESTORE: InjectionToken<Firestore>;
|
|
2324
|
-
/**
|
|
2325
|
-
* The subset of the Firestore module API that {@link BaseEntityFirestoreService} calls.
|
|
2326
|
-
*/
|
|
2327
|
-
interface FirestoreApi {
|
|
2328
|
-
readonly collection: typeof collection;
|
|
2329
|
-
readonly deleteDoc: typeof deleteDoc;
|
|
2330
|
-
readonly doc: typeof doc;
|
|
2331
|
-
readonly getDoc: typeof getDoc;
|
|
2332
|
-
readonly getDocs: typeof getDocs;
|
|
2333
|
-
readonly limit: typeof limit;
|
|
2334
|
-
readonly orderBy: typeof orderBy;
|
|
2335
|
-
readonly query: typeof query;
|
|
2336
|
-
readonly setDoc: typeof setDoc;
|
|
2337
|
-
readonly updateDoc: typeof updateDoc;
|
|
2338
|
-
readonly where: typeof where;
|
|
2339
|
-
}
|
|
2340
|
-
/**
|
|
2341
|
-
* Firestore's free functions, reached through DI instead of imported at each call site.
|
|
2342
|
-
*
|
|
2343
|
-
* This exists so the adapter can be tested deterministically, and the indirection is the only way to get
|
|
2344
|
-
* that here. The suite used to `vi.mock('@angular/fire/firestore')` and assert on the mocked functions.
|
|
2345
|
-
* That is a bare specifier, which the Angular unit-test system does allow — but whether the replacement
|
|
2346
|
-
* reaches *this library's* modules is not stable: the builder may inline the barrel into the source bundle,
|
|
2347
|
-
* where a mock cannot touch it. The suite consequently passed or failed at roughly even odds on an
|
|
2348
|
-
* unchanged commit — surfacing either as the real `collection()` rejecting a plain object, or, since the
|
|
2349
|
-
* real `Firestore` class then became the token the service asked for, as
|
|
2350
|
-
* `NG0201: No provider found for Firestore`. CI failed on the coin flip.
|
|
2351
|
-
*
|
|
2352
|
-
* Nor can the barrel be hidden behind a relative re-export and that mocked instead: the runner rejects it
|
|
2353
|
-
* outright — *"vi.mock and related methods are not supported for relative imports with the Angular
|
|
2354
|
-
* unit-test system. Please use Angular TestBed for mocking dependencies."* This token is that advice taken.
|
|
2355
|
-
*
|
|
2356
|
-
* The default factory returns the real functions, so an application binds nothing.
|
|
2357
|
-
*/
|
|
2358
|
-
export declare const FIRESTORE_API: InjectionToken<FirestoreApi>;
|
|
2359
|
-
/**
|
|
2360
|
-
* Binds {@link FIRESTORE} to the instance `provideFirestore(...)` registered, for an application that
|
|
2361
|
-
* deploys `BaseEntityFirestoreService` against a real Firestore.
|
|
2362
|
-
*
|
|
2363
|
-
* One line next to the `provideFirestore(...)` call:
|
|
2364
|
-
* ```ts
|
|
2365
|
-
* providers: [provideFirebaseApp(() => initializeApp(config)), provideFirestore(() => getFirestore()), provideFirestoreToken()]
|
|
2366
|
-
* ```
|
|
2367
|
-
*
|
|
2368
|
-
* It lives in its own file on purpose. `firestore.token.ts` must not import `@angular/fire/firestore` at
|
|
2369
|
-
* run-time — see the note there — and this is where the one import that has to exist is confined.
|
|
2370
|
-
*/
|
|
2371
|
-
export declare function provideFirestoreToken(): Provider;
|
|
2372
3355
|
export declare enum FlexDirection {
|
|
2373
3356
|
CONTAINER = 0,
|
|
2374
3357
|
COLUMN = 1,
|
|
@@ -2441,6 +3424,21 @@ interface LookupTable extends BaseEntity {
|
|
|
2441
3424
|
value: string | number;
|
|
2442
3425
|
description?: string;
|
|
2443
3426
|
}
|
|
3427
|
+
/**
|
|
3428
|
+
* Knows which of the open entity forms hold edits that have not been saved.
|
|
3429
|
+
*
|
|
3430
|
+
* An embedded child's form and its owner's stay alive together, and the owner is what has to be saved even when
|
|
3431
|
+
* the edit was made in the child — so the status bar asks here rather than any one form.
|
|
3432
|
+
*/
|
|
3433
|
+
export declare class UnsavedChangesRegistry {
|
|
3434
|
+
private readonly sources;
|
|
3435
|
+
/** True while any registered form has unsaved changes. */
|
|
3436
|
+
readonly hasUnsavedChanges: Signal<boolean>;
|
|
3437
|
+
/** Registers a form's own "has unsaved changes" signal; the returned function unregisters it. */
|
|
3438
|
+
register(source: Signal<boolean>): () => void;
|
|
3439
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UnsavedChangesRegistry, never>;
|
|
3440
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
3441
|
+
}
|
|
2444
3442
|
/**
|
|
2445
3443
|
* Defines a single column in the exported PDF table.
|
|
2446
3444
|
* Maps directly from your entity descriptor's field definitions.
|
|
@@ -2483,6 +3481,11 @@ interface PdfExportOptions {
|
|
|
2483
3481
|
* Defaults to true.
|
|
2484
3482
|
*/
|
|
2485
3483
|
includeFooter?: boolean;
|
|
3484
|
+
/**
|
|
3485
|
+
* Language dates and numbers are written in — the active Transloco language. Defaults to the browser's,
|
|
3486
|
+
* which is what a user who switched the application's language does not expect.
|
|
3487
|
+
*/
|
|
3488
|
+
locale?: string;
|
|
2486
3489
|
}
|
|
2487
3490
|
interface PdfExportResult {
|
|
2488
3491
|
success: boolean;
|
|
@@ -2548,9 +3551,10 @@ export declare class PdfExportService {
|
|
|
2548
3551
|
* the PDF.
|
|
2549
3552
|
*
|
|
2550
3553
|
* Type-appropriate alignment and value formatters are derived from `formControlType` so
|
|
2551
|
-
* booleans, dates, tags and artifacts render sensibly without per-field configuration.
|
|
3554
|
+
* booleans, dates, tags and artifacts render sensibly without per-field configuration. A date is written in
|
|
3555
|
+
* its attribute's `dateFormat` and `locale` — the active language, as the list shows it — not the browser's.
|
|
2552
3556
|
*/
|
|
2553
|
-
export declare function entityDescriptorToPdfColumns(descriptors: AbstractAttrDescriptor[]): PdfColumnDefinition[];
|
|
3557
|
+
export declare function entityDescriptorToPdfColumns(descriptors: AbstractAttrDescriptor[], locale?: string): PdfColumnDefinition[];
|
|
2554
3558
|
type PdfExportDialogResult = Pick<PdfExportOptions, 'orientation' | 'pageSize' | 'includeFooter'>;
|
|
2555
3559
|
/**
|
|
2556
3560
|
* Asks the user for the few PDF layout choices we expose — orientation, page size and
|
|
@@ -2664,14 +3668,16 @@ export declare const BASE_ENTITY_AUTHORING_ENTITY_FACADES: BaseEntityFacadeRegis
|
|
|
2664
3668
|
*/
|
|
2665
3669
|
export declare const ENTITY_DEFINITION_ENTITY_NAME = "Entity Definition";
|
|
2666
3670
|
export declare const ENTITY_ATTRIBUTE_ENTITY_NAME = "Entity Attribute";
|
|
2667
|
-
|
|
3671
|
+
/** @param entityCodes the codes Component Parents may pick from; see {@link EntityDefinitionOptions.codes} */
|
|
3672
|
+
export declare function createEntityDefinitionDescriptor(entityCodes?: () => Selectable[]): BaseEntityDescriptor;
|
|
2668
3673
|
/**
|
|
2669
3674
|
* An `EntityAttributeDefinition` is identified by `code`, unique within its definition — the contract
|
|
2670
3675
|
* gives it a read-only uuid nothing addresses it by. Referencing attributes therefore have to set
|
|
2671
3676
|
* `referenceIdField = 'code'`; see the `attributes` attribute of the `Entity Definition` descriptor.
|
|
2672
3677
|
*/
|
|
2673
3678
|
export declare const ENTITY_ATTRIBUTE_ID_FIELD = "code";
|
|
2674
|
-
|
|
3679
|
+
/** @param entityCodes the codes the Linked Entity dropdown offers; see {@link EntityDefinitionOptions.codes} */
|
|
3680
|
+
export declare function createEntityAttributeDescriptor(entityCodes?: () => Selectable[]): BaseEntityDescriptor;
|
|
2675
3681
|
/** `BaseEntityAttributeInput` of `base-entity-api.yaml`, plus the `id` a response carries. */
|
|
2676
3682
|
interface EntityAttributeDto {
|
|
2677
3683
|
id?: string;
|
|
@@ -2681,13 +3687,20 @@ interface EntityAttributeDto {
|
|
|
2681
3687
|
displayOrder?: number;
|
|
2682
3688
|
valueKind?: EntityValueKind;
|
|
2683
3689
|
formControlType?: string;
|
|
2684
|
-
|
|
3690
|
+
multiplicity?: Multiplicity;
|
|
3691
|
+
maxOccurs?: number;
|
|
2685
3692
|
required?: boolean;
|
|
2686
3693
|
indexed?: boolean;
|
|
2687
3694
|
defaultValue?: unknown;
|
|
2688
3695
|
enumValues?: string[];
|
|
3696
|
+
dateFormat?: DateFormat;
|
|
2689
3697
|
linkedEntityType?: string;
|
|
2690
3698
|
isLinkToDetails?: boolean;
|
|
3699
|
+
autosizeColumn?: boolean;
|
|
3700
|
+
defaultAvatar?: string;
|
|
3701
|
+
showMap?: boolean;
|
|
3702
|
+
mapProvider?: MapProvider;
|
|
3703
|
+
defaultCountry?: string;
|
|
2691
3704
|
}
|
|
2692
3705
|
/** `BaseEntityDefinition` on the way in, `BaseEntityDefinitionInput` on the way out. */
|
|
2693
3706
|
interface EntityDefinitionDto {
|
|
@@ -2696,8 +3709,13 @@ interface EntityDefinitionDto {
|
|
|
2696
3709
|
name?: string;
|
|
2697
3710
|
description?: string;
|
|
2698
3711
|
status?: EntityDefinitionStatus;
|
|
3712
|
+
releaseState?: ReleaseState;
|
|
2699
3713
|
componentParents?: string[];
|
|
2700
3714
|
isEmbedded?: boolean;
|
|
3715
|
+
canContextObject?: boolean;
|
|
3716
|
+
sharing?: EntitySharing;
|
|
3717
|
+
identifiers?: string[][];
|
|
3718
|
+
sharedFrom?: string;
|
|
2701
3719
|
attributes?: EntityAttributeDto[];
|
|
2702
3720
|
version?: number;
|
|
2703
3721
|
createdAt?: string;
|
|
@@ -2724,7 +3742,7 @@ interface EntityDefinitionDto {
|
|
|
2724
3742
|
*
|
|
2725
3743
|
* **`PUT /entity-definitions/{code}` is a full replacement**, so `toDto` emits `attributes` unconditionally
|
|
2726
3744
|
* — an absent list is an emptied definition, not an untouched one. The three fields the contract marks
|
|
2727
|
-
* `readOnly` (`version`, `createdAt`, `updatedAt`) are for the same reason *not* emitted: the form shows
|
|
3745
|
+
* `readOnly` (`version`, `createdAt`, `updatedAt`, and `releaseState`) are for the same reason *not* emitted: the form shows
|
|
2728
3746
|
* them disabled, and sending a value back would be claiming to own something the backend assigns.
|
|
2729
3747
|
*/
|
|
2730
3748
|
export declare class EntityDefinitionMapper implements BaseEntityMapper<EntityDefinition> {
|
|
@@ -2780,6 +3798,7 @@ export declare const EntityDefinitionStore: import("@angular/core").Type<{
|
|
|
2780
3798
|
isLoading: import("@angular/core").Signal<boolean>;
|
|
2781
3799
|
error: import("@angular/core").Signal<string | undefined>;
|
|
2782
3800
|
selectedEntities: import("@angular/core").Signal<EntityDefinition[]>;
|
|
3801
|
+
stagedIds: import("@angular/core").Signal<string[]>;
|
|
2783
3802
|
activeTabs: import("@angular/core").Signal<string[]>;
|
|
2784
3803
|
currentTab: import("@angular/core").Signal<string | undefined>;
|
|
2785
3804
|
filterKey: import("@angular/core").Signal<string | undefined>;
|
|
@@ -2789,14 +3808,18 @@ export declare const EntityDefinitionStore: import("@angular/core").Type<{
|
|
|
2789
3808
|
createEntity: () => EntityDefinition;
|
|
2790
3809
|
add: (entity: EntityDefinition) => Promise<import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition> | undefined>;
|
|
2791
3810
|
delete: (id: string) => Promise<void>;
|
|
3811
|
+
keyOf: EntityKeyResolver<EntityDefinition>;
|
|
3812
|
+
hasStagedChanges: (id: string) => boolean;
|
|
2792
3813
|
deleteAll: import("@ngrx/signals/rxjs-interop").RxMethod<void>;
|
|
2793
3814
|
deselectAll: () => void;
|
|
2794
3815
|
deselectEntity: (id: string) => void;
|
|
2795
3816
|
load: import("@ngrx/signals/rxjs-interop").RxMethod<import("@processpuzzle/base-entity").BaseEntityQueryCondition>;
|
|
2796
3817
|
loadById: (id: string) => EntityDefinition | undefined;
|
|
3818
|
+
reload: (id: string) => Promise<import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition> | undefined>;
|
|
2797
3819
|
resetErrorState: () => void;
|
|
2798
3820
|
selectEntity: (id: string) => void;
|
|
2799
3821
|
setCurrentEntity: (id: string | undefined) => void;
|
|
3822
|
+
stage: (entity: import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition>) => void;
|
|
2800
3823
|
update: (entity: import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition>) => Promise<import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition> | undefined>;
|
|
2801
3824
|
reset: () => void;
|
|
2802
3825
|
tabIsActive: (tabName: string) => void;
|
|
@@ -2813,6 +3836,7 @@ export declare const EntityDefinitionStore: import("@angular/core").Type<{
|
|
|
2813
3836
|
isLoading: boolean;
|
|
2814
3837
|
error: string | undefined;
|
|
2815
3838
|
selectedEntities: EntityDefinition[];
|
|
3839
|
+
stagedIds: string[];
|
|
2816
3840
|
activeTabs: string[];
|
|
2817
3841
|
currentTab: string | undefined;
|
|
2818
3842
|
filterKey: string | undefined;
|
|
@@ -2882,5 +3906,439 @@ export declare class EntityDefinitionContainerComponent implements OnDestroy {
|
|
|
2882
3906
|
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionContainerComponent, never>;
|
|
2883
3907
|
static ɵcmp: i0.ɵɵComponentDeclaration<EntityDefinitionContainerComponent, "pp-entity-definition-container", never, {}, {}, never, never, true, never>;
|
|
2884
3908
|
}
|
|
2885
|
-
|
|
3909
|
+
/** One transition the entity can take from its current state, as a button or a menu entry shows it. */
|
|
3910
|
+
interface EntityStateTransition {
|
|
3911
|
+
/** The trigger that fires it — what a route's or widget's `triggers` list names. */
|
|
3912
|
+
key: string;
|
|
3913
|
+
/** The transition's own name when the machine gives it one, the trigger otherwise. */
|
|
3914
|
+
label: string;
|
|
3915
|
+
/** False while a guard refuses it; {@link blockedReason} may say why. */
|
|
3916
|
+
enabled: boolean;
|
|
3917
|
+
blockedReason?: string;
|
|
3918
|
+
}
|
|
3919
|
+
/** What is known of an entity's state: where it is, and where it can go. */
|
|
3920
|
+
interface EntityStateSnapshot {
|
|
3921
|
+
/** The attribute of the entity that holds the state, as the machine names it. */
|
|
3922
|
+
stateAttribute?: string;
|
|
3923
|
+
currentKey: string;
|
|
3924
|
+
/** The current state's name, which is what a badge shows. */
|
|
3925
|
+
currentLabel: string;
|
|
3926
|
+
transitions: EntityStateTransition[];
|
|
3927
|
+
}
|
|
3928
|
+
interface EntityStateFireResult {
|
|
3929
|
+
success: boolean;
|
|
3930
|
+
/** Already translated, for the user: the new state, or why the transition was refused. */
|
|
3931
|
+
message: string;
|
|
3932
|
+
}
|
|
3933
|
+
/**
|
|
3934
|
+
* The state machine operations a working context needs, supplied by the state feature (`provideEntityStateControl`
|
|
3935
|
+
* in base-state-frontend) rather than called from here, so base-entity does not depend on it. Without a provider
|
|
3936
|
+
* a context simply has no state to show and no transitions to offer.
|
|
3937
|
+
*/
|
|
3938
|
+
interface EntityStateActions {
|
|
3939
|
+
/** `undefined` for an entity no state machine governs. */
|
|
3940
|
+
stateOf(entityName: string, id: string): Promise<EntityStateSnapshot | undefined>;
|
|
3941
|
+
fire(entityName: string, id: string, triggerKey: string, version: number): Promise<EntityStateFireResult>;
|
|
3942
|
+
}
|
|
3943
|
+
export declare const ENTITY_STATE_ACTIONS: InjectionToken<EntityStateActions>;
|
|
3944
|
+
/** A context the URL currently names, with what is known about its entity. */
|
|
3945
|
+
interface ActiveWorkingContext {
|
|
3946
|
+
name: string;
|
|
3947
|
+
id: string;
|
|
3948
|
+
definition: WorkingContextDefinition;
|
|
3949
|
+
descriptor: BaseEntityDescriptor | undefined;
|
|
3950
|
+
/** The entity as its store holds it now — so an edit saved in its form shows at once. `undefined` while loading. */
|
|
3951
|
+
entity: Record<string, unknown> | undefined;
|
|
3952
|
+
/** The URL of the context's root, `…/ctx/<name>/<id>`. */
|
|
3953
|
+
url: string;
|
|
3954
|
+
}
|
|
3955
|
+
/**
|
|
3956
|
+
* Holds the active working contexts. **The URL is the source of truth**: what this service reports is read off
|
|
3957
|
+
* the current route (`ctx/<name>/<id>/...`), so a refresh, a deep link and a second device need nothing extra.
|
|
3958
|
+
* localStorage keeps the last id per context, as the fallback a context view opened without one restores, and the
|
|
3959
|
+
* recently active ids the picker offers.
|
|
3960
|
+
*
|
|
3961
|
+
* Selecting and clearing are navigations: they change the URL, and the route guards and this service follow it.
|
|
3962
|
+
*/
|
|
3963
|
+
export declare class WorkingContextService {
|
|
3964
|
+
private readonly router;
|
|
3965
|
+
private readonly dialog;
|
|
3966
|
+
private readonly descriptorRegistry;
|
|
3967
|
+
private readonly declared;
|
|
3968
|
+
private readonly registered;
|
|
3969
|
+
private readonly levels;
|
|
3970
|
+
private readonly stateActions;
|
|
3971
|
+
private readonly snackBar;
|
|
3972
|
+
/** What is known of each active entity's state, by `<entity>/<id>`, with the entity version it was read at. */
|
|
3973
|
+
private readonly snapshots;
|
|
3974
|
+
private readonly snapshotsLoading;
|
|
3975
|
+
private readonly entityRoutes;
|
|
3976
|
+
/** Where the user was heading when no context object was known, by context name — see {@link rememberTarget}. */
|
|
3977
|
+
private readonly pendingTargets;
|
|
3978
|
+
/** Bumped whenever the remembered ids change, so {@link lastId} can be read reactively. */
|
|
3979
|
+
private readonly rememberedVersion;
|
|
3980
|
+
/** True while a transition is being fired, so a second click does not fire another. */
|
|
3981
|
+
readonly firing: import("@angular/core").WritableSignal<boolean>;
|
|
3982
|
+
/**
|
|
3983
|
+
* True while an application shell shows the contexts in a status bar of its own. The status bar inside the
|
|
3984
|
+
* entity tabs then leaves them out rather than showing them a second time.
|
|
3985
|
+
*/
|
|
3986
|
+
readonly statusbarHostedByShell: import("@angular/core").WritableSignal<boolean>;
|
|
3987
|
+
/** Every declared context. A later registration of a name replaces an earlier one. */
|
|
3988
|
+
readonly definitions: Signal<WorkingContextDefinition[]>;
|
|
3989
|
+
/** The contexts the URL names an entity for, outermost first. */
|
|
3990
|
+
readonly active: Signal<ActiveWorkingContext[]>;
|
|
3991
|
+
constructor();
|
|
3992
|
+
/** Adds contexts declared at run-time — by an application definition loaded after bootstrap. Returns the undo. */
|
|
3993
|
+
register(definitions: WorkingContextDefinition[]): () => void;
|
|
3994
|
+
/**
|
|
3995
|
+
* The context of an entity that `canContextObject`: named like its URL segment, and addressed by its own URL
|
|
3996
|
+
* (`<aggregate>/<id>/<embedded>/list`) rather than a `ctx` segment. Created on first ask and then kept.
|
|
3997
|
+
*/
|
|
3998
|
+
ensureAggregate(entityName: string): WorkingContextDefinition;
|
|
3999
|
+
/** Remembers the URL a user asked for while no context object was known; {@link takeTarget} hands it back once one is chosen. */
|
|
4000
|
+
rememberTarget(name: string, url: string): void;
|
|
4001
|
+
/** The URL waiting for a context object, without consuming it — the list says where the user is headed. */
|
|
4002
|
+
pendingTarget(name: string): string | undefined;
|
|
4003
|
+
private takeTarget;
|
|
4004
|
+
definitionOf(name: string): WorkingContextDefinition | undefined;
|
|
4005
|
+
/** The contexts an entity type is the root of — what decides whether its list offers "Set as active". */
|
|
4006
|
+
definitionsForEntity(entityName: string): WorkingContextDefinition[];
|
|
4007
|
+
current(name: string): ActiveWorkingContext | undefined;
|
|
4008
|
+
/** The entity behind an id, from its store or — when the store does not hold it yet — loaded into it. */
|
|
4009
|
+
load(name: string, id: string): Promise<Record<string, unknown> | undefined>;
|
|
4010
|
+
/**
|
|
4011
|
+
* Makes `id` the active entity of the context, by navigating to it. Inside the context the user stays on the
|
|
4012
|
+
* view they are on; from outside it they land on the context's first view. Selecting a parent drops its child
|
|
4013
|
+
* contexts from the URL, because their entities belong to the parent being left.
|
|
4014
|
+
*
|
|
4015
|
+
* Resolves `false` when the user declined the switch, or when the context cannot be addressed from here — a
|
|
4016
|
+
* child context while its parent is not active.
|
|
4017
|
+
*/
|
|
4018
|
+
select(name: string, id: string): Promise<boolean>;
|
|
4019
|
+
/** Leaves the context: the view stays, showing its empty state. The stored fallback is dropped with it. */
|
|
4020
|
+
clear(name: string): Promise<boolean>;
|
|
4021
|
+
/** Whether leaving the active entity of the context should be confirmed first — see `confirmSwitchWhen`. */
|
|
4022
|
+
needsConfirmation(context: ActiveWorkingContext): boolean;
|
|
4023
|
+
/** The active entity's state and the transitions it can take; `undefined` until known, or when no state machine governs it. */
|
|
4024
|
+
stateOf(name: string): EntityStateSnapshot | undefined;
|
|
4025
|
+
/** The attribute holding the entity's state, as its state machine names it — what `state` in a declaration means. */
|
|
4026
|
+
stateAttributeOf(context: ActiveWorkingContext): string | undefined;
|
|
4027
|
+
/**
|
|
4028
|
+
* Fires a transition of the active entity of the context, tells the user what came of it and reloads the entity —
|
|
4029
|
+
* which refreshes the badge and the transitions on offer, since both follow the entity's version.
|
|
4030
|
+
* Resolves `true` when the transition ran.
|
|
4031
|
+
*/
|
|
4032
|
+
fire(name: string, triggerKey: string): Promise<boolean>;
|
|
4033
|
+
/** The ids of the context's recently active entities, most recent first. */
|
|
4034
|
+
recent(name: string): string[];
|
|
4035
|
+
/** The id a context view opened without a context restores, when the context persists to localStorage. */
|
|
4036
|
+
lastId(name: string): string | undefined;
|
|
4037
|
+
remember(name: string, id: string): void;
|
|
4038
|
+
/** Drops an id that no longer resolves, so neither the fallback nor the picker offers it again. */
|
|
4039
|
+
forget(name: string, id: string): void;
|
|
4040
|
+
private stateKey;
|
|
4041
|
+
private loadState;
|
|
4042
|
+
private readUrl;
|
|
4043
|
+
private storeOf;
|
|
4044
|
+
private urlFor;
|
|
4045
|
+
/**
|
|
4046
|
+
* Where choosing `id` leads: back to the URL the user was refused at while none was known; otherwise the view they are on,
|
|
4047
|
+
* for another object; otherwise `null` — nowhere, the choice is only remembered.
|
|
4048
|
+
*/
|
|
4049
|
+
private aggregateUrlFor;
|
|
4050
|
+
/** The first segment of the view inside a context — not a nested `ctx`, which belongs to the entity being left. */
|
|
4051
|
+
private viewOf;
|
|
4052
|
+
private confirmLeaving;
|
|
4053
|
+
private forgetLast;
|
|
4054
|
+
private readList;
|
|
4055
|
+
/** localStorage, or nothing where there is none (server rendering) or it is blocked. */
|
|
4056
|
+
private storage;
|
|
4057
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WorkingContextService, never>;
|
|
4058
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
4059
|
+
}
|
|
4060
|
+
/** What a working context's entity is made of, for the routes that open its embedded rows. */
|
|
4061
|
+
interface WorkingContextAggregate {
|
|
4062
|
+
/** The context's entity type. With it, the context's route is the root of the URL chain its embedded screens read. */
|
|
4063
|
+
entityName?: string;
|
|
4064
|
+
/** The embedded children of that entity, as the entity's own details route mounts them; derived from its descriptor. */
|
|
4065
|
+
embeddedChildren?: EmbeddedChildRoute[];
|
|
4066
|
+
}
|
|
4067
|
+
/**
|
|
4068
|
+
* The routes of `routes` bound to the context `contextName`, mounted twice:
|
|
4069
|
+
*
|
|
4070
|
+
* - `ctx/<name>/:contextId/<route>` resolves the active entity, through {@link workingContextGuard}. A bare
|
|
4071
|
+
* `ctx/<name>/<id>` lands on the first route.
|
|
4072
|
+
* - `ctx/<name>/<route>` is the same view **without** a context. It renders the "Select a …" empty state with
|
|
4073
|
+
* the picker embedded instead of the view — it never redirects to a list — and restores the last active
|
|
4074
|
+
* entity first when the context persists to localStorage.
|
|
4075
|
+
*
|
|
4076
|
+
* The id branch refuses an id that equals the first segment of one of the views, which is what keeps
|
|
4077
|
+
* `ctx/warehouse/zones` the empty state rather than a warehouse called `zones`.
|
|
4078
|
+
*
|
|
4079
|
+
* Nest a child context by calling this again inside `routes`; its URL then reads
|
|
4080
|
+
* `ctx/site/<id>/ctx/warehouse/<id>/...`.
|
|
4081
|
+
*/
|
|
4082
|
+
export declare function workingContextRoutes(contextName: string, routes: Routes, aggregate?: WorkingContextAggregate): Routes;
|
|
4083
|
+
/**
|
|
4084
|
+
* Makes the entity named in the URL the active one. An id the entity's store cannot load is not an error page:
|
|
4085
|
+
* the same view is shown without a context, so the user can pick another.
|
|
4086
|
+
*/
|
|
4087
|
+
export declare const workingContextGuard: CanActivateFn;
|
|
4088
|
+
/** A context view opened without a context continues with the last active entity, when the context persists it. */
|
|
4089
|
+
export declare const restoreWorkingContextGuard: CanActivateFn;
|
|
4090
|
+
/** The URL segment every context route starts with: `ctx/<name>/<id>/...`. */
|
|
4091
|
+
export declare const WORKING_CONTEXT_SEGMENT = "ctx";
|
|
4092
|
+
/** Route data naming the context a route belongs to. Read from the route's own config, never inherited. */
|
|
4093
|
+
export declare const WORKING_CONTEXT_ROUTE_DATA_KEY = "workingContext";
|
|
4094
|
+
export declare const WORKING_CONTEXT_ID_PARAM = "contextId";
|
|
4095
|
+
/** One context the URL walks through. `id` is undefined on the empty-state branch — a context view opened without one. */
|
|
4096
|
+
interface WorkingContextRouteLevel {
|
|
4097
|
+
name: string;
|
|
4098
|
+
/** True for a context object: the id segment of an aggregate's own URL, not an application's `ctx/<name>/<id>`. */
|
|
4099
|
+
aggregate: boolean;
|
|
4100
|
+
id: string | undefined;
|
|
4101
|
+
/** The URL up to and including this level's `ctx/<name>[/<id>]` segments. */
|
|
4102
|
+
url: string;
|
|
4103
|
+
/** The URL before this level's `ctx` segment, which a sibling context URL is built on. */
|
|
4104
|
+
baseUrl: string;
|
|
4105
|
+
/** What follows this level in the current URL — the view inside the context, with a leading `/`, or `''`. */
|
|
4106
|
+
rest: string;
|
|
4107
|
+
}
|
|
4108
|
+
/**
|
|
4109
|
+
* The contexts the URL walks through, outermost first. Read from the route configs the snapshot passes, so a
|
|
4110
|
+
* refresh and a deep link describe the same contexts as a selection does.
|
|
4111
|
+
*/
|
|
4112
|
+
export declare function readWorkingContextLevels(snapshot: ActivatedRouteSnapshot | null): WorkingContextRouteLevel[];
|
|
4113
|
+
interface PickerRow {
|
|
4114
|
+
id: string;
|
|
4115
|
+
label: string;
|
|
4116
|
+
isActive: boolean;
|
|
4117
|
+
}
|
|
4118
|
+
/**
|
|
4119
|
+
* Picks the entity of a working context: a search over the context's `picker.searchFields` with the recently
|
|
4120
|
+
* active entities on top. Used inline by the empty state and inside the status bar's drawer, so it is a light
|
|
4121
|
+
* list of its own rather than the entity's full List view, which is bound to the router outlet it is shown in.
|
|
4122
|
+
*/
|
|
4123
|
+
export declare class WorkingContextPickerComponent implements OnInit {
|
|
4124
|
+
readonly contextName: import("@angular/core").InputSignal<string>;
|
|
4125
|
+
/** Emits once the selection went through — not when the user declined a confirmation. */
|
|
4126
|
+
readonly picked: import("@angular/core").OutputEmitterRef<string>;
|
|
4127
|
+
protected readonly searchKey: import("@angular/core").WritableSignal<string>;
|
|
4128
|
+
private readonly service;
|
|
4129
|
+
private readonly descriptorRegistry;
|
|
4130
|
+
private readonly definition;
|
|
4131
|
+
private readonly descriptor;
|
|
4132
|
+
private readonly store;
|
|
4133
|
+
private readonly activeId;
|
|
4134
|
+
private readonly allRows;
|
|
4135
|
+
protected readonly rows: import("@angular/core").Signal<PickerRow[]>;
|
|
4136
|
+
/** Recent ids the store still holds — a recent entity that has since been deleted is not offered. */
|
|
4137
|
+
protected readonly recentRows: import("@angular/core").Signal<PickerRow[]>;
|
|
4138
|
+
ngOnInit(): void;
|
|
4139
|
+
protected onSearch(event: Event): void;
|
|
4140
|
+
protected onPick(id: string): Promise<void>;
|
|
4141
|
+
protected testId(suffix: string): string;
|
|
4142
|
+
private rowOf;
|
|
4143
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WorkingContextPickerComponent, never>;
|
|
4144
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WorkingContextPickerComponent, "pp-working-context-picker", never, {
|
|
4145
|
+
"contextName": {
|
|
4146
|
+
"alias": "contextName";
|
|
4147
|
+
"required": true;
|
|
4148
|
+
"isSignal": true;
|
|
4149
|
+
};
|
|
4150
|
+
}, {
|
|
4151
|
+
"picked": "picked";
|
|
4152
|
+
}, never, never, true, never>;
|
|
4153
|
+
}
|
|
4154
|
+
/**
|
|
4155
|
+
* What a view that requires a context shows without one: "Select a …", with the picker right there. Picking
|
|
4156
|
+
* stays on the same view — the URL gains the context's id — so the user never takes a detour through a list.
|
|
4157
|
+
*/
|
|
4158
|
+
export declare class WorkingContextEmptyStateComponent {
|
|
4159
|
+
protected readonly contextName: string;
|
|
4160
|
+
private readonly service;
|
|
4161
|
+
private readonly descriptorRegistry;
|
|
4162
|
+
private readonly transloco;
|
|
4163
|
+
protected readonly entityLabel: import("@angular/core").Signal<string>;
|
|
4164
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WorkingContextEmptyStateComponent, never>;
|
|
4165
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WorkingContextEmptyStateComponent, "pp-working-context-empty-state", never, {}, {}, never, never, true, never>;
|
|
4166
|
+
}
|
|
4167
|
+
interface WorkingContextPickerDialogData {
|
|
4168
|
+
contextName: string;
|
|
4169
|
+
/** The translated entity name, for the title. */
|
|
4170
|
+
entityLabel: string;
|
|
4171
|
+
}
|
|
4172
|
+
/** Dialog configuration that turns the picker into a full-height drawer on the right edge. */
|
|
4173
|
+
export declare const WORKING_CONTEXT_DRAWER_CONFIG: {
|
|
4174
|
+
readonly position: {
|
|
4175
|
+
readonly right: "0";
|
|
4176
|
+
readonly top: "0";
|
|
4177
|
+
};
|
|
4178
|
+
readonly height: "100%";
|
|
4179
|
+
readonly maxHeight: "100vh";
|
|
4180
|
+
readonly width: "420px";
|
|
4181
|
+
readonly maxWidth: "100vw";
|
|
4182
|
+
readonly panelClass: "pp-working-context-drawer";
|
|
4183
|
+
};
|
|
4184
|
+
/** The picker in a drawer, which the status bar's context crumb opens to switch. */
|
|
4185
|
+
export declare class WorkingContextPickerDialog {
|
|
4186
|
+
protected readonly data: WorkingContextPickerDialogData;
|
|
4187
|
+
protected readonly dialogRef: MatDialogRef<any, any>;
|
|
4188
|
+
private readonly router;
|
|
4189
|
+
private readonly routes;
|
|
4190
|
+
private readonly service;
|
|
4191
|
+
/** Where the context entity's own list is, when it has one. */
|
|
4192
|
+
protected listPath(): string | undefined;
|
|
4193
|
+
/** Leaves the drawer for the full list of the context's entity. */
|
|
4194
|
+
protected onShowList(): Promise<void>;
|
|
4195
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WorkingContextPickerDialog, never>;
|
|
4196
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WorkingContextPickerDialog, "pp-working-context-picker-dialog", never, {}, {}, never, never, true, never>;
|
|
4197
|
+
}
|
|
4198
|
+
/** An active working context as it is rendered: one crumb, with its badge and its extra text. */
|
|
4199
|
+
interface ContextCrumb {
|
|
4200
|
+
context: ActiveWorkingContext;
|
|
4201
|
+
title: string;
|
|
4202
|
+
/** The entity's translated name, shown as the crumb's tooltip. */
|
|
4203
|
+
label: string;
|
|
4204
|
+
badge: string | undefined;
|
|
4205
|
+
extra: string | undefined;
|
|
4206
|
+
/** What the entity can do next, from its state machine; empty when none governs it. */
|
|
4207
|
+
transitions: EntityStateTransition[];
|
|
4208
|
+
testId: string;
|
|
4209
|
+
}
|
|
4210
|
+
/**
|
|
4211
|
+
* The active working contexts, outermost first, as crumbs: the label, a badge, an extra text, and a menu to
|
|
4212
|
+
* switch (the picker as a drawer), open the entity for editing, or clear the context.
|
|
4213
|
+
*
|
|
4214
|
+
* It is the root of the status bar's breadcrumb — `BaseEntityStatusbarComponent` renders it before the entity
|
|
4215
|
+
* levels — and, in an application shell with a `statusbar` region, the whole content of that region, so the
|
|
4216
|
+
* context is visible on pages that have no entity form at all.
|
|
4217
|
+
*/
|
|
4218
|
+
export declare class WorkingContextCrumbsComponent {
|
|
4219
|
+
readonly crumbs: Signal<ContextCrumb[]>;
|
|
4220
|
+
private readonly workingContext;
|
|
4221
|
+
protected readonly firing: import("@angular/core").WritableSignal<boolean>;
|
|
4222
|
+
private readonly dialog;
|
|
4223
|
+
private readonly router;
|
|
4224
|
+
private readonly entityRouteRegistry;
|
|
4225
|
+
private readonly transloco;
|
|
4226
|
+
/** Opens the context's picker as a drawer; picking in it switches, and closes it. */
|
|
4227
|
+
protected onSwitch(crumb: ContextCrumb): void;
|
|
4228
|
+
/** The context's entity in its own form, for editing it — the context stays active. */
|
|
4229
|
+
protected onOpen(crumb: ContextCrumb): Promise<void>;
|
|
4230
|
+
protected onFire(crumb: ContextCrumb, transition: EntityStateTransition): Promise<void>;
|
|
4231
|
+
protected onClear(crumb: ContextCrumb): Promise<void>;
|
|
4232
|
+
/** `badge: state` shows the state's name — "Running", not the key a machine stores — when the machine is known. */
|
|
4233
|
+
private badgeOf;
|
|
4234
|
+
private crumbOf;
|
|
4235
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WorkingContextCrumbsComponent, never>;
|
|
4236
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WorkingContextCrumbsComponent, "pp-working-context-crumbs", never, {}, {}, never, never, true, never>;
|
|
4237
|
+
}
|
|
4238
|
+
/**
|
|
4239
|
+
* The status bar of an application shell (its `statusbar` region): the active working contexts, on every page,
|
|
4240
|
+
* whether or not an entity form is open. Shown only while a context is active — an empty strip would be clutter.
|
|
4241
|
+
*
|
|
4242
|
+
* While it is on screen the status bar inside the entity tabs leaves the contexts to it, so they are not shown
|
|
4243
|
+
* twice; see {@link WorkingContextService.statusbarHostedByShell}.
|
|
4244
|
+
*/
|
|
4245
|
+
export declare class WorkingContextStatusbarComponent {
|
|
4246
|
+
private readonly workingContext;
|
|
4247
|
+
protected readonly isVisible: import("@angular/core").Signal<boolean>;
|
|
4248
|
+
constructor();
|
|
4249
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WorkingContextStatusbarComponent, never>;
|
|
4250
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WorkingContextStatusbarComponent, "pp-working-context-statusbar", never, {}, {}, never, never, true, never>;
|
|
4251
|
+
}
|
|
4252
|
+
/** Route data: the context the collection belongs to. */
|
|
4253
|
+
export declare const CONTEXT_COLLECTION_CONTEXT_KEY = "collectionContext";
|
|
4254
|
+
/** Route data: the attribute of the context's entity that carries the collection. */
|
|
4255
|
+
export declare const CONTEXT_COLLECTION_PATH_KEY = "collectionPath";
|
|
4256
|
+
/** Route data: the embedded entity type of the collection's items. */
|
|
4257
|
+
export declare const CONTEXT_COLLECTION_ENTITY_KEY = "collectionEntity";
|
|
4258
|
+
/**
|
|
4259
|
+
* A list of the embedded collection of the **active** entity of a working context — the zones of the active
|
|
4260
|
+
* warehouse — with add, edit and remove acting on that entity alone: the user never selects a warehouse here, and a change sends
|
|
4261
|
+
* the item rather than the warehouse (see {@link EmbeddedCollectionService}).
|
|
4262
|
+
*
|
|
4263
|
+
* Everything comes from metadata: the route data names the context, the attribute and the item type, and the item
|
|
4264
|
+
* type's descriptor gives the columns and, in the dialog, the form. Without an active context the route never gets here —
|
|
4265
|
+
* `workingContextRoutes` shows its empty state instead.
|
|
4266
|
+
*/
|
|
4267
|
+
export declare class ContextCollectionComponent {
|
|
4268
|
+
private readonly data;
|
|
4269
|
+
private readonly contextName;
|
|
4270
|
+
private readonly attrName;
|
|
4271
|
+
private readonly entityName;
|
|
4272
|
+
private readonly service;
|
|
4273
|
+
private readonly workingContext;
|
|
4274
|
+
private readonly descriptorRegistry;
|
|
4275
|
+
private readonly dialog;
|
|
4276
|
+
private readonly formNavigator;
|
|
4277
|
+
private readonly transloco;
|
|
4278
|
+
private readonly activeLang;
|
|
4279
|
+
protected readonly rows: import("@angular/core").WritableSignal<CollectionItem[]>;
|
|
4280
|
+
protected readonly isLoading: import("@angular/core").WritableSignal<boolean>;
|
|
4281
|
+
protected readonly error: import("@angular/core").WritableSignal<string | undefined>;
|
|
4282
|
+
private readonly context;
|
|
4283
|
+
private readonly descriptor;
|
|
4284
|
+
protected readonly columns: import("@angular/core").Signal<BaseEntityAttrDescriptor[]>;
|
|
4285
|
+
protected readonly displayedColumns: import("@angular/core").Signal<string[]>;
|
|
4286
|
+
protected readonly canChange: import("@angular/core").Signal<boolean>;
|
|
4287
|
+
/** Reloads whenever another entity becomes the active one — the list follows the context, not the other way round. */
|
|
4288
|
+
private readonly reloadOnContextChange;
|
|
4289
|
+
/** Opens a new row's form below the context; it saves the row on its own and returns here. */
|
|
4290
|
+
protected onAdd(): Promise<void>;
|
|
4291
|
+
/** Opens the row's own form — the screen its entity type has everywhere — below the context, with the owner in the URL. */
|
|
4292
|
+
protected onEdit(row: CollectionItem): Promise<void>;
|
|
4293
|
+
protected onDelete(row: CollectionItem): Promise<void>;
|
|
4294
|
+
protected testId(suffix: string): string;
|
|
4295
|
+
protected display(column: BaseEntityAttrDescriptor, row: CollectionItem): string;
|
|
4296
|
+
private rootEntityName;
|
|
4297
|
+
/**
|
|
4298
|
+
* The embedded form of a row: `<context url>/<item type>/<key>/details`, the URL chain the embedded screens read their
|
|
4299
|
+
* aggregate from. The navigator keeps the list's URL as where to return to.
|
|
4300
|
+
*/
|
|
4301
|
+
private openForm;
|
|
4302
|
+
/** The key the URL addresses a row by: the attribute the owner's descriptor says identifies it, `id` otherwise. */
|
|
4303
|
+
private rowKey;
|
|
4304
|
+
/** Runs one change against the active entity, then shows what is stored now — the server's answer is the truth, also after a conflict. */
|
|
4305
|
+
private change;
|
|
4306
|
+
private reload;
|
|
4307
|
+
private messageOf;
|
|
4308
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ContextCollectionComponent, never>;
|
|
4309
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ContextCollectionComponent, "pp-context-collection", never, {}, {}, never, never, true, never>;
|
|
4310
|
+
}
|
|
4311
|
+
/**
|
|
4312
|
+
* The transitions the **active** entity of a working context can take — Open, Close — as buttons. Placed on
|
|
4313
|
+
* a page that declares them, so the user acts on the entity without reaching for the status bar's menu.
|
|
4314
|
+
*
|
|
4315
|
+
* It shows nothing without an active context, and nothing for an entity no state machine governs. `triggers` narrows the
|
|
4316
|
+
* offer to the named triggers, in that order; without it every transition the entity can take is offered. A transition a
|
|
4317
|
+
* guard refuses is shown disabled, with the reason as its tooltip.
|
|
4318
|
+
*/
|
|
4319
|
+
export declare class WorkingContextActionsComponent {
|
|
4320
|
+
/** The context whose active entity the buttons act on. */
|
|
4321
|
+
readonly context: import("@angular/core").InputSignal<string>;
|
|
4322
|
+
/** The triggers to offer, in order; every available transition when absent. */
|
|
4323
|
+
readonly triggers: import("@angular/core").InputSignal<string[] | undefined>;
|
|
4324
|
+
private readonly workingContext;
|
|
4325
|
+
protected readonly firing: import("@angular/core").WritableSignal<boolean>;
|
|
4326
|
+
protected readonly transitions: import("@angular/core").Signal<import("@processpuzzle/base-entity").EntityStateTransition[]>;
|
|
4327
|
+
protected onFire(triggerKey: string): Promise<void>;
|
|
4328
|
+
protected testId(triggerKey: string): string;
|
|
4329
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WorkingContextActionsComponent, never>;
|
|
4330
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WorkingContextActionsComponent, "pp-working-context-actions", never, {
|
|
4331
|
+
"context": {
|
|
4332
|
+
"alias": "context";
|
|
4333
|
+
"required": true;
|
|
4334
|
+
"isSignal": true;
|
|
4335
|
+
};
|
|
4336
|
+
"triggers": {
|
|
4337
|
+
"alias": "triggers";
|
|
4338
|
+
"required": false;
|
|
4339
|
+
"isSignal": true;
|
|
4340
|
+
};
|
|
4341
|
+
}, {}, never, never, true, never>;
|
|
4342
|
+
}
|
|
4343
|
+
export type { ActiveWorkingContext, AddressFormat, ArtifactAttr, BaseEntity, BaseEntityDescriptorOptions, BaseEntityFacadeRegistry, BaseEntityLoadResponse, BaseEntityMapper, BaseEntityQueryCondition, CollectionItem, CollectionRead, DateFormat, DateStyle, DefinitionLookup, DynamicEntity, EmbeddedBreadcrumbLevel, EmbeddedChildRoute, EmbeddedPath, EmbeddedPathStep, EmbeddedRouteContext, EmbeddedRouteLevel, EmbeddedRow, EntityCalculatedControl, EntityComment, EntityDefinitionStatus, EntityOptions, EntityScreenRouteOptions, EntityScreens, EntityStateActions, EntityStateControl, EntityStateFireResult, EntityStateSnapshot, EntityStateTransition, EntityTabContributor, EntityTabDescriptor, EntityValueKind, EvaluatableRule, FilterCondition, FilterOperator, GeoLocation, GeoLocatorError, GeoPoint, HasUnsavedChanges, LocationSource, LookupTable, MapProvider, Multiplicity, MultiplicityHolder, NavigationPayload, NavigationState, ObjectUriResponse, OrderByCondition, PdfColumnDefinition, PdfExportDialogResult, PdfExportOptions, PdfExportResult, PersistedBaseEntity, PersistedEntity, PostalAddress, ResolvedDynamicEntity, ResolvedEmbeddedAggregate, RichTextContent, RuleEngine, RuleEvaluationResult, RuleSeverity, Selectable, SelectablesInput, TagSuggestionSource, TimeStyle, WorkingContextAggregate, WorkingContextDefinition, WorkingContextDisplay, WorkingContextPersistence, WorkingContextPicker, WorkingContextPickerDialogData, WorkingContextRouteLevel };
|
|
2886
4344
|
//# sourceMappingURL=processpuzzle-base-entity.d.ts.map
|