@processpuzzle/base-entity 1.2.2 → 1.4.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 +116 -15
- package/assets/i18n/base_entity/de.json +166 -1
- package/assets/i18n/base_entity/en.json +166 -1
- package/assets/i18n/base_entity/es.json +166 -1
- package/assets/i18n/base_entity/fr.json +166 -1
- package/assets/i18n/base_entity/hu.json +166 -1
- package/fesm2022/processpuzzle-base-entity.mjs +15154 -4329
- package/fesm2022/processpuzzle-base-entity.mjs.map +1 -1
- package/package.json +5 -2
- package/types/processpuzzle-base-entity.d.ts +3835 -795
- package/types/processpuzzle-base-entity.d.ts.map +1 -1
|
@@ -1,831 +1,3544 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import { HttpClient, HttpHeaders } from
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { AfterViewInit, EnvironmentProviders, InjectionToken, Injector, InputSignal, OnDestroy, OnInit, PipeTransform, Provider, ProviderToken, Signal, TemplateRef, Type, ViewContainerRef, WritableSignal } from "@angular/core";
|
|
3
|
+
import { FormControl, FormGroup } from "@angular/forms";
|
|
4
|
+
import { NGXLogger } from "ngx-logging-kit";
|
|
5
|
+
import { ActivatedRouteSnapshot, CanActivateFn, Route, Routes } from "@angular/router";
|
|
6
|
+
import { WritableStateSource } from "@ngrx/signals";
|
|
7
|
+
import { MatTableDataSource } from "@angular/material/table";
|
|
8
|
+
import { DocumentData, DocumentSnapshot, Firestore, WhereFilterOp, collection, deleteDoc, doc, getDoc, getDocs, limit, orderBy, query, setDoc, updateDoc, where } from "@angular/fire/firestore";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
import { MatSnackBar } from "@angular/material/snack-bar";
|
|
11
|
+
import { HttpClient, HttpContext, HttpHeaders } from "@angular/common/http";
|
|
12
|
+
import { CdkDragDrop } from "@angular/cdk/drag-drop";
|
|
13
|
+
import { Editor, Extensions, JSONContent } from "@tiptap/core";
|
|
14
|
+
import { TranslocoService } from "@jsverse/transloco";
|
|
15
|
+
import { NativeDateAdapter } from "@angular/material/core";
|
|
16
|
+
import { MatSort } from "@angular/material/sort";
|
|
17
|
+
import { MatPaginator } from "@angular/material/paginator";
|
|
18
|
+
import { SelectionModel } from "@angular/cdk/collections";
|
|
19
|
+
import { ReleaseState, TranslationSource } from "@processpuzzle/util";
|
|
20
|
+
import "reflect-metadata";
|
|
21
|
+
export declare enum FormControlType {
|
|
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",
|
|
28
|
+
ARTIFACT = "ARTIFACT",
|
|
29
|
+
AVATAR = "AVATAR",
|
|
30
|
+
CHECKBOX = "CHECKBOX",
|
|
31
|
+
/**
|
|
32
|
+
* An append-only history of rich-text comments, each stamped with its author and time — the value is an
|
|
33
|
+
* array of `EntityComment`, oldest first. A new comment is written below the history and saved with the record.
|
|
34
|
+
*/
|
|
35
|
+
COMMENTS = "COMMENTS",
|
|
36
|
+
COMPONENTS = "COMPONENTS",
|
|
37
|
+
/** Rendered by the descriptor's own `component` — the extension point for controls base-entity cannot know. */
|
|
38
|
+
CUSTOM = "CUSTOM",
|
|
39
|
+
DATE = "DATE",
|
|
40
|
+
DROPDOWN = "DROPDOWN",
|
|
41
|
+
/**
|
|
42
|
+
* Where the device was when the user pressed the control's button — the value is one `GeoLocation` object.
|
|
43
|
+
* Shown read-only; pressing the button again replaces it. Disabled where the browser offers no location.
|
|
44
|
+
*/
|
|
45
|
+
GEO_LOCATION = "GEO_LOCATION",
|
|
46
|
+
EMBEDDED_COMPONENTS = "EMBEDDED_COMPONENTS",
|
|
47
|
+
EMBEDDED_LIST = "EMBEDDED_LIST",
|
|
48
|
+
EMBEDDED_OBJECT = "EMBEDDED_OBJECT",
|
|
49
|
+
FLEX_BOX = "FLEX_BOX",
|
|
50
|
+
FOREIGN_KEY = "FOREIGN_KEY",
|
|
51
|
+
LABEL = "LABEL",
|
|
52
|
+
LOOKUP = "LOOKUP",
|
|
53
|
+
RADIO = "RADIO",
|
|
54
|
+
RELATED_ENTITIES = "RELATED_ENTITIES",
|
|
55
|
+
/**
|
|
56
|
+
* The attribute a state machine governs. Shows the current state and offers only the transitions allowed from
|
|
57
|
+
* it; rendered by the component registered under `ENTITY_STATE_CONTROL`, read-only as a label without one.
|
|
58
|
+
*/
|
|
59
|
+
STATE = "STATE",
|
|
60
|
+
TAGS = "TAGS",
|
|
61
|
+
TITLE = "TITLE",
|
|
62
|
+
TEXT_BOX = "TEXT_BOX",
|
|
63
|
+
TEXTAREA = "TEXTAREA"
|
|
64
|
+
}
|
|
65
|
+
export declare abstract class AbstractAttrDescriptor {
|
|
66
|
+
attrName: string;
|
|
67
|
+
formControlType: FormControlType;
|
|
68
|
+
disabled: boolean;
|
|
69
|
+
style: {
|
|
70
|
+
[p: string]: unknown;
|
|
71
|
+
} | null | undefined;
|
|
72
|
+
/** Optional override for the transloco key segment of this attribute. Defaults to {@link attrName}. */
|
|
73
|
+
labelKey?: string;
|
|
74
|
+
private _scopeRoot?;
|
|
75
|
+
protected constructor(attrName: string, formControlType: FormControlType);
|
|
76
|
+
/**
|
|
77
|
+
* Called by the owning {@link BaseEntityDescriptor} to stamp the entity's transloco key root
|
|
78
|
+
* (`i18nScope` override, or the value derived from the entity name) onto this attribute.
|
|
79
|
+
*/
|
|
80
|
+
setI18nContext(scopeRoot: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Full transloco key for this attribute's label: `<scopeRoot>.<labelKey|attrName>`. The root
|
|
83
|
+
* identifies the entity (see {@link BaseEntityDescriptor.i18nKey}). Returns `undefined` until the
|
|
84
|
+
* owning descriptor has stamped the context — a bare `attrName` would be a root-level key and could
|
|
85
|
+
* collide with an unrelated translation in the consuming app.
|
|
86
|
+
*/
|
|
87
|
+
i18nKey(): string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Transloco key of the tooltip the generated form shows on this attribute's control:
|
|
90
|
+
* `<scopeRoot>._tooltips.<labelKey|attrName>`. Under a `_tooltips` node of its own — the `_` prefix
|
|
91
|
+
* like `_self` — so it can never collide with an attribute that happens to be called `tooltips`.
|
|
92
|
+
* `undefined` for the same reason as {@link i18nKey}.
|
|
93
|
+
*/
|
|
94
|
+
tooltipI18nKey(): string | undefined;
|
|
95
|
+
}
|
|
96
|
+
interface BaseEntity {
|
|
97
|
+
readonly id?: string;
|
|
98
|
+
}
|
|
99
|
+
interface PersistedBaseEntity extends BaseEntity {
|
|
100
|
+
readonly id: string;
|
|
101
|
+
}
|
|
102
|
+
type PersistedEntity<Entity extends BaseEntity> = Entity & PersistedBaseEntity;
|
|
103
|
+
declare function assertPersistedEntity<Entity extends BaseEntity>(entity: Entity): asserts entity is PersistedEntity<Entity>;
|
|
104
|
+
/**
|
|
105
|
+
* The named display style of a DATE / DATE_TIME attribute.
|
|
106
|
+
*
|
|
107
|
+
* A designer picks a style, not a pattern: the style is rendered with `Intl.DateTimeFormat` in the *active*
|
|
108
|
+
* language, so `short` reads `09.12.1960` under `de` and `1960. 12. 09.` under `hu` without anyone authoring
|
|
109
|
+
* either. Mirrors the contract's `AttributeDateFormat`.
|
|
110
|
+
*/
|
|
111
|
+
type DateStyle = 'none' | 'short' | 'medium' | 'long' | 'full';
|
|
112
|
+
type TimeStyle = 'none' | 'short' | 'medium' | 'long';
|
|
113
|
+
type DateFormat = {
|
|
114
|
+
dateStyle?: DateStyle;
|
|
115
|
+
timeStyle?: TimeStyle;
|
|
116
|
+
};
|
|
117
|
+
export declare const DATE_STYLES: readonly DateStyle[];
|
|
118
|
+
export declare const TIME_STYLES: readonly TimeStyle[];
|
|
119
|
+
export declare const DEFAULT_DATE_FORMAT: Readonly<Required<DateFormat>>;
|
|
120
|
+
export declare const DEFAULT_DATE_TIME_FORMAT: Readonly<Required<DateFormat>>;
|
|
121
|
+
/**
|
|
122
|
+
* The format an attribute is rendered with: its own `dateFormat`, each missing style filled from the value
|
|
123
|
+
* kind's default. A descriptor carries no value kind, so a hand-written DATE control defaults to a date; the
|
|
124
|
+
* metadata path resolves DATE_TIME here before the descriptor is built (see `attrDescriptorOf`).
|
|
125
|
+
*/
|
|
126
|
+
export declare function effectiveDateFormat(attr: {
|
|
127
|
+
dateFormat?: DateFormat;
|
|
128
|
+
} | undefined, valueKind?: 'DATE' | 'DATE_TIME'): Required<DateFormat>;
|
|
129
|
+
/** Whether the format edits a calendar day only, stored as a local `YYYY-MM-DD` rather than an instant. */
|
|
130
|
+
declare function isDateOnly(format: DateFormat): boolean;
|
|
131
|
+
/** The `Intl.DateTimeFormat` options of a format; a `none` style is left out rather than passed through. */
|
|
132
|
+
export declare function intlOptionsOf(format: DateFormat): Intl.DateTimeFormatOptions;
|
|
133
|
+
/**
|
|
134
|
+
* A stored value as a `Date`, or `undefined` when it is not one. A bare `YYYY-MM-DD` is read as *local*
|
|
135
|
+
* midnight: `new Date('1960-12-09')` is UTC midnight, which west of Greenwich is the evening before.
|
|
136
|
+
*/
|
|
137
|
+
declare function toDateValue(value: unknown): Date | undefined;
|
|
138
|
+
/** A picked date in the shape it is saved in: a local `YYYY-MM-DD` for a date-only format, the instant otherwise. */
|
|
139
|
+
declare function toStoredDate(date: Date, format: DateFormat): string | Date;
|
|
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;
|
|
151
|
+
}
|
|
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;
|
|
179
|
+
}
|
|
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
|
+
declare const ADDRESS_LINE_FIELDS: readonly AddressLineField[];
|
|
183
|
+
interface GeoPoint {
|
|
184
|
+
latitude: number;
|
|
185
|
+
longitude: number;
|
|
186
|
+
}
|
|
187
|
+
/** The value of an `ADDRESS` attribute as an address — anything that is not an object holds none. */
|
|
188
|
+
export declare function addressOf(value: unknown): PostalAddress;
|
|
189
|
+
/** True when no line of the address holds text — a country alone, or coordinates alone, are no address. */
|
|
190
|
+
export declare function isAddressEmpty(address: PostalAddress): boolean;
|
|
191
|
+
/** The coordinates of the address, when it has both. */
|
|
192
|
+
export declare function geoPointOf(address: PostalAddress): GeoPoint | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* Who draws the map of an `ADDRESS` attribute. OpenStreetMap is the default: its embed needs no API key.
|
|
195
|
+
* Whichever draws it, a click on the map opens the location in Google Maps.
|
|
196
|
+
*/
|
|
197
|
+
type MapProvider = 'OPENSTREETMAP' | 'GOOGLE';
|
|
198
|
+
export declare const MAP_PROVIDERS: readonly MapProvider[];
|
|
199
|
+
export declare const DEFAULT_MAP_PROVIDER: MapProvider;
|
|
200
|
+
/** The URL of an embeddable map centred on `point`, with a marker on it. */
|
|
201
|
+
export declare function mapEmbedUrl(provider: MapProvider, point: GeoPoint): string;
|
|
202
|
+
/** The location in Google Maps, which is what a click on the map opens. */
|
|
203
|
+
export declare function googleMapsUrl(point: GeoPoint): string;
|
|
204
|
+
type Selectable = {
|
|
205
|
+
key: string;
|
|
206
|
+
value: unknown;
|
|
207
|
+
};
|
|
208
|
+
type SelectablesInput = Array<Selectable> | (() => Array<Selectable>);
|
|
209
|
+
export declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
210
|
+
description?: string;
|
|
211
|
+
styleClass?: string | undefined;
|
|
212
|
+
labelClass?: string;
|
|
213
|
+
format?: string;
|
|
214
|
+
/**
|
|
215
|
+
* `DATE` only: the named style the value is shown and edited in, rendered in the active language. Absent
|
|
216
|
+
* styles fall back to the defaults of `effectiveDateFormat`; a `timeStyle` other than `none` adds a time
|
|
217
|
+
* field and makes the value an instant rather than a calendar day.
|
|
218
|
+
*/
|
|
219
|
+
dateFormat?: DateFormat;
|
|
220
|
+
isLinkToDetails?: boolean;
|
|
221
|
+
selectables?: SelectablesInput;
|
|
222
|
+
visible: boolean;
|
|
223
|
+
showThumbnail?: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* `AVATAR` only: the icon name (e.g. `'person'`, `'sailing'`) or image URL shown as placeholder before an image is uploaded.
|
|
226
|
+
* If omitted, defaults to `'person'`.
|
|
227
|
+
*/
|
|
228
|
+
defaultAvatar?: string;
|
|
229
|
+
/**
|
|
230
|
+
* `ADDRESS` only: show the address on a map, with editable coordinates derived from the address. Off by
|
|
231
|
+
* default — geocoding asks a third-party service, which an attribute has to opt into.
|
|
232
|
+
*/
|
|
233
|
+
showMap?: boolean;
|
|
234
|
+
/** `ADDRESS` only: who draws the map when {@link showMap} is set; OpenStreetMap when absent. */
|
|
235
|
+
mapProvider?: MapProvider;
|
|
236
|
+
/**
|
|
237
|
+
* `ADDRESS` only: the ISO 3166-1 alpha-2 code a new address starts with. When absent, the country of the
|
|
238
|
+
* browser's locale, if it names one.
|
|
239
|
+
*/
|
|
240
|
+
defaultCountry?: string;
|
|
241
|
+
hideInTable?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* The list column hugs its content instead of sharing the space left over. Meant for short values — an id,
|
|
244
|
+
* a status, a date. A hugging cell never grows past 60% of the table's width; longer content is cut off
|
|
245
|
+
* with an ellipsis. Columns that are not autosized fill the remaining width and wrap.
|
|
246
|
+
*/
|
|
247
|
+
autosizeColumn?: boolean;
|
|
248
|
+
isHeading?: boolean;
|
|
249
|
+
placeholder?: string;
|
|
250
|
+
lines?: number;
|
|
251
|
+
options: {
|
|
252
|
+
inputType: 'text';
|
|
253
|
+
};
|
|
254
|
+
required: boolean;
|
|
255
|
+
/** Child attribute descriptors for nested forms (`EMBEDDED_OBJECT`, `EMBEDDED_LIST`). */
|
|
256
|
+
childDescriptors?: AbstractAttrDescriptor[];
|
|
257
|
+
/** `EMBEDDED_LIST` only: the attribute whose value titles a collapsed row. */
|
|
258
|
+
rowLabelAttr?: string;
|
|
259
|
+
/**
|
|
260
|
+
* Regular-expression source the value has to match, applied as `Validators.pattern` and anchored by
|
|
261
|
+
* Angular at both ends.
|
|
262
|
+
*
|
|
263
|
+
* For a field the backend constrains beyond "not empty" — a URL slug, a locale tag, an identifier — so the
|
|
264
|
+
* form rejects it where the user typed it rather than letting the save come back a 400 with a message from
|
|
265
|
+
* the server's validation locale. Write the source without delimiters, exactly as the contract's `pattern`
|
|
266
|
+
* gives it: `'^[a-z0-9]+(-[a-z0-9]+)*$'`.
|
|
267
|
+
*/
|
|
268
|
+
pattern?: string;
|
|
269
|
+
referenceIdField?: string;
|
|
270
|
+
/**
|
|
271
|
+
* `EMBEDDED_COMPONENTS` only: the rows' order means something — widgets render in it, nav items are listed
|
|
272
|
+
* in it — so the list lets the user reorder them. The order is the array's, so it needs nothing from the
|
|
273
|
+
* backend beyond keeping the array as sent.
|
|
274
|
+
*/
|
|
275
|
+
ordered: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* How many values the attribute holds — see {@link Multiplicity}. Absent means a single value. Only
|
|
278
|
+
* `ARTIFACT` acts on it today: with an upper bound above 1 the value is an array and uploads append.
|
|
279
|
+
* Counts are not validated; `required` stays a separate flag.
|
|
280
|
+
*/
|
|
281
|
+
multiplicity?: Multiplicity;
|
|
282
|
+
/** The upper bound of the `x` multiplicities (`0..x`, `1..x`); ignored for the others. */
|
|
283
|
+
maxOccurs?: number;
|
|
284
|
+
/**
|
|
285
|
+
* The control of a {@link FormControlType.CUSTOM} attribute: a `BaseFormControlComponent` subclass the form
|
|
286
|
+
* builder creates like any built-in control. Typed loosely because the base class is generic over the entity
|
|
287
|
+
* and lives in the form layer, which this descriptor must not import.
|
|
288
|
+
*/
|
|
289
|
+
component?: Type<unknown>;
|
|
290
|
+
private _label?;
|
|
291
|
+
private _linkedEntityType?;
|
|
292
|
+
constructor(attrName: string, formControlType: FormControlType, label?: string, selectables?: SelectablesInput, isLinkToDetails?: boolean, options?: object);
|
|
293
|
+
getSelectables(): Array<Selectable> | undefined;
|
|
294
|
+
get label(): string;
|
|
295
|
+
set label(label: string);
|
|
296
|
+
get linkedEntityType(): string | undefined;
|
|
297
|
+
set linkedEntityType(linkedEntityType: string | undefined);
|
|
298
|
+
}
|
|
299
|
+
type EntityTitle = string | (() => string);
|
|
300
|
+
type ExtraFormActionsTemplate = () => TemplateRef<unknown> | undefined;
|
|
301
|
+
/**
|
|
302
|
+
* A screen of this entity beyond the generic List and Details, contributed by the feature that owns the
|
|
303
|
+
* entity: `Document` adds a content editor, and a workflow definition is expected to add its diagram.
|
|
304
|
+
*
|
|
305
|
+
* Declared on the descriptor rather than wired into `BaseEntityTabsComponent` so the framework stays
|
|
306
|
+
* ignorant of what any one feature needs a third screen *for* — the same reason
|
|
307
|
+
* {@link ExtraFormActionsTemplate} lives here. One and the same value has to be handed to
|
|
308
|
+
* `baseEntityRoutes` (which mounts `:entityId/<segment>`) and to the descriptor (which renders the link),
|
|
309
|
+
* so that the URL a tab navigates to and the URL that resolves a component cannot drift apart.
|
|
310
|
+
*/
|
|
311
|
+
interface EntityTabDescriptor {
|
|
312
|
+
/** Last URL segment of the tab's route, appended to `<entity>/<id>/`. Lower-case, no slashes. */
|
|
313
|
+
segment: string;
|
|
314
|
+
/** Transloco key of the tab's label. Resolved with `{ entity }`, as the generic tab labels are. */
|
|
315
|
+
i18nKey: string;
|
|
316
|
+
/** Component the route mounts. */
|
|
317
|
+
component: Type<unknown>;
|
|
318
|
+
/** Suffix for the link's `data-testid`; defaults to `show-<segment>`. */
|
|
319
|
+
testIdSuffix?: string;
|
|
320
|
+
/**
|
|
321
|
+
* Routes to nest **below** the tab's own route, so the tab's component can host a `<router-outlet>` and
|
|
322
|
+
* the screens inside it get URLs of their own. Only a tab that is itself a container needs this; a leaf
|
|
323
|
+
* tab leaves it undefined and gets exactly the route it always did.
|
|
324
|
+
*
|
|
325
|
+
* Pass `[]` when the children are not known until navigation — they are read fresh from the route on
|
|
326
|
+
* every recognition, so a {@link canMatch} guard may fill them in. See `appShellRoutesGuard` in
|
|
327
|
+
* base-app, which builds an application's routes out of its `AppDefinition` that way.
|
|
328
|
+
*/
|
|
329
|
+
children?: Routes;
|
|
330
|
+
/**
|
|
331
|
+
* Guards deciding whether the tab's route matches. Runs during recognition, before the router reads
|
|
332
|
+
* {@link children}, and may be asynchronous — which is what makes the deferred-children pattern above
|
|
333
|
+
* work on a deep link rather than only after a click.
|
|
334
|
+
*/
|
|
335
|
+
canMatch?: Route['canMatch'];
|
|
336
|
+
}
|
|
337
|
+
interface BaseEntityDescriptorOptions {
|
|
338
|
+
store?: unknown;
|
|
339
|
+
attrDescriptors: AbstractAttrDescriptor[];
|
|
340
|
+
entityName: string;
|
|
341
|
+
entityTitle?: EntityTitle;
|
|
342
|
+
extraFormActionsTemplate?: ExtraFormActionsTemplate;
|
|
343
|
+
/** Screens beyond List and Details. See {@link EntityTabDescriptor}. */
|
|
344
|
+
extraTabs?: EntityTabDescriptor[];
|
|
345
|
+
/**
|
|
346
|
+
* Optional override for the transloco key root of this entity and its attributes. Defaults to the
|
|
347
|
+
* value derived from {@link entityName} (`"Base Entity"` → `base_entity`); set it only when the
|
|
348
|
+
* registered transloco scope differs from that convention.
|
|
349
|
+
*/
|
|
350
|
+
i18nScope?: string;
|
|
351
|
+
/**
|
|
352
|
+
* Name of the attribute whose value identifies the selected entity in the
|
|
353
|
+
* {@link BaseEntityStatusbarComponent}. Defaults to the `isLinkToDetails` attribute
|
|
354
|
+
* (see {@link componentIdentification}).
|
|
355
|
+
*/
|
|
356
|
+
titleKey?: string;
|
|
357
|
+
isAbstract?: boolean;
|
|
358
|
+
/**
|
|
359
|
+
* True for an entity whose screens only look: the toolbar offers neither New nor Delete and the form cannot
|
|
360
|
+
* be saved. For rows the server alone writes — issued documents, say. Distinct from {@link isAbstract}, which
|
|
361
|
+
* is about inheritance, and from the preview mode, which is a host's decision about definitions built at run time.
|
|
362
|
+
*/
|
|
363
|
+
isReadOnly?: boolean;
|
|
364
|
+
/** Name of the entity this one inherits from. Unrelated to {@link componentParent}. */
|
|
365
|
+
parentEntity?: string;
|
|
366
|
+
route?: string;
|
|
367
|
+
/**
|
|
368
|
+
* Entity name(s) that may aggregate this one as a component. A component *instance* belongs to exactly
|
|
369
|
+
* one parent (1:N containment) — it is created from the parent's form, edited in its own form and
|
|
370
|
+
* deleted outright when removed there. A list is allowed because one component *type* can be hosted by
|
|
371
|
+
* several parent types (an `App Widget` sits under `App Region`, `App Page` and `App Widget`).
|
|
372
|
+
* Leave undefined for a stand-alone entity. Not to be confused with {@link parentEntity}, which is the
|
|
373
|
+
* inheritance supertype.
|
|
374
|
+
*/
|
|
375
|
+
componentParent?: string | string[];
|
|
376
|
+
/**
|
|
377
|
+
* True when the component's payload is carried inside its parent's payload — it has no endpoint and no
|
|
378
|
+
* store of its own, and the parent's save persists it. False (the default) when the component is
|
|
379
|
+
* persisted on its own and points back at its parent through a foreign-key attribute. Meaningless
|
|
380
|
+
* without {@link componentParent}, and rejected without it.
|
|
381
|
+
*/
|
|
382
|
+
isEmbedded?: boolean;
|
|
383
|
+
}
|
|
384
|
+
export declare class BaseEntityDescriptor {
|
|
385
|
+
store: unknown;
|
|
386
|
+
attrDescriptors: AbstractAttrDescriptor[];
|
|
387
|
+
entityName: string;
|
|
388
|
+
entityTitle: EntityTitle;
|
|
389
|
+
extraFormActionsTemplate?: ExtraFormActionsTemplate;
|
|
390
|
+
extraTabs: EntityTabDescriptor[];
|
|
391
|
+
i18nScope?: string;
|
|
392
|
+
titleKey?: string;
|
|
393
|
+
parentEntity: string | undefined;
|
|
394
|
+
readonly isAbstract: boolean;
|
|
395
|
+
readonly isReadOnly: boolean;
|
|
396
|
+
route: string | undefined;
|
|
397
|
+
/** Normalized {@link BaseEntityDescriptorOptions.componentParent}; empty when this is not a component. */
|
|
398
|
+
readonly componentParents: readonly string[];
|
|
399
|
+
readonly isEmbedded: boolean;
|
|
400
|
+
constructor({ store, attrDescriptors, entityName, entityTitle, extraFormActionsTemplate, extraTabs, i18nScope, titleKey, isAbstract, isReadOnly, parentEntity, route, componentParent, isEmbedded }: BaseEntityDescriptorOptions);
|
|
401
|
+
createTestId(suffix: string): string;
|
|
402
|
+
/** Transloco key root for this entity, derived from {@link entityName} unless {@link i18nScope} overrides it. */
|
|
403
|
+
scopeRoot(): string;
|
|
404
|
+
/**
|
|
405
|
+
* Full transloco key for the entity name: `<scopeRoot>._self`. The reserved `_self` segment keeps the
|
|
406
|
+
* entity name in the same object as its attribute labels without the two colliding.
|
|
407
|
+
*/
|
|
408
|
+
i18nKey(): string;
|
|
409
|
+
/** True when this entity is a part of another one rather than a stand-alone aggregate root. */
|
|
410
|
+
isComponent(): boolean;
|
|
411
|
+
isComponentOf(entityName: string): boolean;
|
|
412
|
+
/**
|
|
413
|
+
* Attribute holding this component's reference back to its parent — the `FOREIGN_KEY` attribute whose
|
|
414
|
+
* `linkedEntityType` names one of {@link componentParents}. Returns `undefined` for a stand-alone entity
|
|
415
|
+
* and for an embedded component, neither of which carries such a reference: an embedded component is
|
|
416
|
+
* located by its position in the parent's payload, not by a foreign key.
|
|
417
|
+
*/
|
|
418
|
+
parentReferenceAttrName(): string | undefined;
|
|
419
|
+
componentIdentification(): string;
|
|
420
|
+
/** The attributes that carry embedded children — one route branch, and one row list, per entry. */
|
|
421
|
+
embeddedAttrDescriptors(): BaseEntityAttrDescriptor[];
|
|
422
|
+
/**
|
|
423
|
+
* The attribute carrying `entityName`'s rows. An embedded child is addressed in the URL by its entity
|
|
424
|
+
* name, so two attributes offering the same child type would make that segment ambiguous — hence the
|
|
425
|
+
* error rather than a silent first-match.
|
|
426
|
+
*/
|
|
427
|
+
embeddedAttrFor(entityName: string): BaseEntityAttrDescriptor | undefined;
|
|
428
|
+
/** Name of the attribute whose value labels the selected entity in the status bar. */
|
|
429
|
+
titleAttrName(): string;
|
|
430
|
+
overwriteLinkedEntityAttr(attrName: string, linkedEntityName: string): void;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Resolves an entity's descriptor and store **by name**, whichever world the entity comes from: a
|
|
434
|
+
* compile-time `BaseEntityFacade` registered in `BASE_ENTITY_FACADE_REGISTRY`, or a `BaseEntityDefinition`
|
|
435
|
+
* synthesized at run-time by `DynamicEntityRegistry` and published into {@link ResolvedEntityCache}.
|
|
436
|
+
*
|
|
437
|
+
* Being the single lookup surface is what makes the metadata-defined case cost the rest of the library
|
|
438
|
+
* nothing. `EmbeddedAggregateAccessor` asks here for the root store of an aggregate and for the descriptor
|
|
439
|
+
* of every level below it; `resolveEmbeddedRouteContext` walks the containment graph through the
|
|
440
|
+
* descriptors it gets back; the embedded form controls read their child's label the same way. None of them
|
|
441
|
+
* changed, and none of them can tell the difference.
|
|
442
|
+
*
|
|
443
|
+
* Compile-time first. A host application that registered a facade did so on purpose — it may carry extra
|
|
444
|
+
* tabs, a hand-tuned layout or a Firestore repository — and a definition of the same name does not
|
|
445
|
+
* override that decision. The dynamic side is a fallback, in both senses.
|
|
446
|
+
*
|
|
447
|
+
* The synthesized side is read out of a cache rather than from the registry that builds it, so that this
|
|
448
|
+
* class — injected by half the library — does not depend on the facades, and through them on every
|
|
449
|
+
* repository implementation there is. See {@link ResolvedEntityCache}.
|
|
450
|
+
*/
|
|
451
|
+
export declare class BaseEntityDescriptorRegistry {
|
|
452
|
+
private readonly registry;
|
|
453
|
+
private readonly resolvedEntities;
|
|
454
|
+
private readonly injector;
|
|
455
|
+
getDescriptor(entityName: string | undefined): BaseEntityDescriptor | undefined;
|
|
456
|
+
/**
|
|
457
|
+
* An embedded entity has a store too — see `EmbeddedEntityFacade`. It reads and writes the containing
|
|
458
|
+
* entity's document rather than an endpoint of its own, which is invisible from here.
|
|
459
|
+
*/
|
|
460
|
+
getStore<Store = unknown>(entityName: string | undefined): Store | undefined;
|
|
461
|
+
private resolveFacade;
|
|
462
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityDescriptorRegistry, never>;
|
|
463
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
464
|
+
}
|
|
465
|
+
interface WhereCondition<Entity extends BaseEntity> {
|
|
466
|
+
field: keyof Entity;
|
|
467
|
+
operator: WhereFilterOp;
|
|
468
|
+
value: Entity[keyof Entity];
|
|
469
|
+
}
|
|
470
|
+
interface OrderByCondition<Entity extends BaseEntity> {
|
|
471
|
+
field: keyof Entity;
|
|
472
|
+
order?: OrderByDirection;
|
|
473
|
+
}
|
|
474
|
+
interface FilterCondition {
|
|
475
|
+
property: string;
|
|
476
|
+
operator: WhereFilterOp;
|
|
477
|
+
value: string;
|
|
478
|
+
}
|
|
479
|
+
type LogicalOperator = 'AND' | 'OR';
|
|
480
|
+
interface FilterGroup {
|
|
481
|
+
operator: LogicalOperator;
|
|
482
|
+
conditions: Array<FilterCondition | FilterGroup>;
|
|
483
|
+
}
|
|
484
|
+
declare function isFilterGroup(node: FilterCondition | FilterGroup): node is FilterGroup;
|
|
485
|
+
export declare enum OrderByDirection {
|
|
486
|
+
ASC = "asc",
|
|
487
|
+
DESC = "desc"
|
|
488
|
+
}
|
|
489
|
+
interface OrderBy {
|
|
490
|
+
property: string;
|
|
491
|
+
direction: string;
|
|
492
|
+
}
|
|
493
|
+
interface BaseEntityQueryCondition {
|
|
494
|
+
path?: string;
|
|
495
|
+
hash?: string;
|
|
496
|
+
page?: number;
|
|
497
|
+
pageSize?: number;
|
|
498
|
+
pathParams?: Map<string, string>;
|
|
499
|
+
filters?: FilterCondition[];
|
|
500
|
+
filterGroup?: FilterGroup;
|
|
501
|
+
orderBys?: OrderBy[];
|
|
502
|
+
query?: string;
|
|
503
|
+
}
|
|
504
|
+
interface FirestoreQuery<Entity extends BaseEntity> {
|
|
505
|
+
limit?: number;
|
|
506
|
+
startAt?: number | string | DocumentSnapshot<Entity>;
|
|
507
|
+
startAfter?: number | string | DocumentSnapshot<Entity> | null;
|
|
508
|
+
endAt?: number | DocumentSnapshot<Entity>;
|
|
509
|
+
endBefore?: number | DocumentSnapshot<Entity>;
|
|
510
|
+
orderBy?: OrderByCondition<Entity>[];
|
|
511
|
+
where?: WhereCondition<Entity>[];
|
|
512
|
+
}
|
|
513
|
+
interface BaseEntityLoadResponse<Entity extends BaseEntity> {
|
|
514
|
+
number: number | undefined;
|
|
515
|
+
size: number | undefined;
|
|
516
|
+
totalElements: number | undefined;
|
|
517
|
+
totalPages: number | undefined;
|
|
518
|
+
content: Entity[];
|
|
519
|
+
}
|
|
520
|
+
export declare const BASE_ENTITY_SERVICE: InjectionToken<BaseEntityService<BaseEntity>>;
|
|
521
|
+
interface BaseEntityService<Entity extends BaseEntity> {
|
|
522
|
+
add(entity: Entity, id?: number): Observable<PersistedEntity<Entity>>;
|
|
523
|
+
delete(id: string): Observable<unknown>;
|
|
524
|
+
deleteAll(): Observable<unknown>;
|
|
525
|
+
findAll(page?: number, pageSize?: number): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
|
|
526
|
+
findById(id: string): Observable<PersistedEntity<Entity> | void>;
|
|
527
|
+
findByQuery(condition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
|
|
528
|
+
update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
|
|
529
|
+
}
|
|
530
|
+
export declare const BASE_ENTITY_STORE: InjectionToken<unknown>;
|
|
531
|
+
interface EntityStoreState<Entity extends BaseEntity> {
|
|
532
|
+
entities: Entity[];
|
|
533
|
+
number: number;
|
|
534
|
+
size: number;
|
|
535
|
+
totalElements: number;
|
|
536
|
+
totalPages: number;
|
|
537
|
+
currentId: string | undefined;
|
|
538
|
+
currentEntity: Entity | undefined;
|
|
539
|
+
isLoading: boolean;
|
|
540
|
+
error: string | undefined;
|
|
541
|
+
selectedEntities: Array<Entity>;
|
|
542
|
+
/** Keys of rows changed in this store but not yet persisted — see {@link BaseEntityStoreApi.stage}. */
|
|
543
|
+
stagedIds: string[];
|
|
544
|
+
}
|
|
545
|
+
type EntityStoreHandle<Entity extends BaseEntity> = WritableStateSource<EntityStoreState<Entity>> & {
|
|
546
|
+
entities: Signal<Entity[]>;
|
|
547
|
+
selectedEntities: Signal<Entity[]>;
|
|
548
|
+
stagedIds: Signal<string[]>;
|
|
549
|
+
};
|
|
550
|
+
interface BaseEntityStoreApi<Entity extends BaseEntity> {
|
|
551
|
+
entities: Signal<Entity[]>;
|
|
552
|
+
selectedEntities: Signal<Entity[]>;
|
|
553
|
+
stagedIds: Signal<string[]>;
|
|
554
|
+
currentEntity: Signal<Entity | undefined>;
|
|
555
|
+
currentId: Signal<string | undefined>;
|
|
556
|
+
isLoading: Signal<boolean>;
|
|
557
|
+
error: Signal<string | undefined>;
|
|
558
|
+
number: Signal<number>;
|
|
559
|
+
size: Signal<number>;
|
|
560
|
+
totalElements: Signal<number>;
|
|
561
|
+
totalPages: Signal<number>;
|
|
562
|
+
filterKey: Signal<string | undefined>;
|
|
563
|
+
activeTabs: Signal<string[]>;
|
|
564
|
+
currentTab: Signal<string | undefined>;
|
|
565
|
+
countOfEntities: Signal<number>;
|
|
566
|
+
matTableDataSource: Signal<MatTableDataSource<Entity>>;
|
|
567
|
+
add(entity: Entity): Promise<PersistedEntity<Entity> | undefined>;
|
|
568
|
+
delete(id: string): Promise<void>;
|
|
569
|
+
deleteAll(input?: void): void;
|
|
570
|
+
deselectAll(): void;
|
|
571
|
+
deselectEntity(id: string): void;
|
|
572
|
+
load(query: BaseEntityQueryCondition): void;
|
|
573
|
+
loadById(id: string): Entity | undefined;
|
|
574
|
+
/**
|
|
575
|
+
* Re-reads one row from the repository — after something other than this store changed it on the server.
|
|
576
|
+
* Also how staged changes are discarded: the row is replaced by what the server holds.
|
|
577
|
+
*/
|
|
578
|
+
reload(id: string): Promise<PersistedEntity<Entity> | undefined>;
|
|
579
|
+
resetErrorState(): void;
|
|
580
|
+
selectEntity(id: string): void;
|
|
581
|
+
setCurrentEntity(id: string | undefined): void;
|
|
582
|
+
/**
|
|
583
|
+
* Replaces a row in this store **without** persisting it, and remembers that it is unsaved. An embedded
|
|
584
|
+
* child's Save lands here: its row lives inside this entity's document, which is only written when the
|
|
585
|
+
* document's own Save runs — so a rule spanning the document (an order's total against its lines) judges
|
|
586
|
+
* the finished document, not each step towards it. `update` persists and clears the mark; `reload` discards.
|
|
587
|
+
*/
|
|
588
|
+
stage(entity: PersistedEntity<Entity>): void;
|
|
589
|
+
hasStagedChanges(id: string): boolean;
|
|
590
|
+
update(entity: PersistedEntity<Entity>): Promise<PersistedEntity<Entity> | undefined>;
|
|
591
|
+
clearCurrentEntity(): void;
|
|
592
|
+
createEntity(): Entity;
|
|
593
|
+
doFilter(filterKey: string): void;
|
|
594
|
+
reset(): void;
|
|
595
|
+
tabIsActive(tabName: string): void;
|
|
596
|
+
tabIsInactive(tabName: string): void;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* What identifies a row of this store, as it appears in a URL segment.
|
|
600
|
+
*
|
|
601
|
+
* Defaults to {@link entityKeyById}, and every entity persisted through an endpoint of its own keeps
|
|
602
|
+
* that default. An **embedded** entity may be keyed by something else — `App Region` has no `id` at all
|
|
603
|
+
* and is identified by `type` — and its store is built with a resolver reading the `referenceIdField`
|
|
604
|
+
* its owner's attribute declares. See `EmbeddedEntityFacade`.
|
|
605
|
+
*/
|
|
606
|
+
type EntityKeyResolver<Entity extends BaseEntity> = (entity: Entity) => string | undefined;
|
|
607
|
+
declare const entityKeyById: <Entity extends BaseEntity>(entity: Entity) => string | undefined;
|
|
608
|
+
export declare function BaseEntityStore<Entity extends BaseEntity>(entityType: new () => Entity, getRepository: () => BaseEntityService<Entity>, keyOf?: EntityKeyResolver<Entity>): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
609
|
+
state: {
|
|
610
|
+
entities: Entity[];
|
|
611
|
+
number: number;
|
|
612
|
+
size: number;
|
|
613
|
+
totalElements: number;
|
|
614
|
+
totalPages: number;
|
|
615
|
+
currentId: string | undefined;
|
|
616
|
+
currentEntity: Entity | undefined;
|
|
617
|
+
isLoading: boolean;
|
|
618
|
+
error: string | undefined;
|
|
619
|
+
selectedEntities: Entity[];
|
|
620
|
+
stagedIds: string[];
|
|
621
|
+
};
|
|
622
|
+
props: {
|
|
623
|
+
countOfEntities: Signal<number>;
|
|
624
|
+
matTableDataSource: Signal<MatTableDataSource<Entity, import("@angular/material/paginator").MatPaginator>>;
|
|
625
|
+
};
|
|
626
|
+
methods: {
|
|
627
|
+
clearCurrentEntity: () => void;
|
|
628
|
+
createEntity: () => Entity;
|
|
629
|
+
add: (entity: Entity) => Promise<PersistedEntity<Entity> | undefined>;
|
|
630
|
+
delete: (id: string) => Promise<void>;
|
|
631
|
+
hasStagedChanges: (id: string) => boolean;
|
|
632
|
+
deleteAll: import("@ngrx/signals/rxjs-interop").RxMethod<void>;
|
|
633
|
+
deselectAll: () => void;
|
|
634
|
+
deselectEntity: (id: string) => void;
|
|
635
|
+
load: import("@ngrx/signals/rxjs-interop").RxMethod<BaseEntityQueryCondition>;
|
|
636
|
+
loadById: (id: string) => Entity | undefined;
|
|
637
|
+
reload: (id: string) => Promise<PersistedEntity<Entity> | undefined>;
|
|
638
|
+
resetErrorState: () => void;
|
|
639
|
+
selectEntity: (id: string) => void;
|
|
640
|
+
setCurrentEntity: (id: string | undefined) => void;
|
|
641
|
+
stage: (entity: PersistedEntity<Entity>) => void;
|
|
642
|
+
update: (entity: PersistedEntity<Entity>) => Promise<PersistedEntity<Entity> | undefined>;
|
|
643
|
+
};
|
|
644
|
+
}>;
|
|
645
|
+
declare class BaseEntityFormBuilder<Entity extends BaseEntity> {
|
|
646
|
+
private readonly logger;
|
|
647
|
+
private readonly transloco;
|
|
648
|
+
private readonly stateControl;
|
|
649
|
+
buildForm(viewContainerRef: ViewContainerRef, baseEntityForm: FormGroup, store: BaseEntityStoreApi<Entity>, attrDescriptors: AbstractAttrDescriptor[], entity: Signal<Entity>, entityName: string, initialValues?: Record<string, unknown>): void;
|
|
650
|
+
/**
|
|
651
|
+
* The tooltip of one control, attached to the control's host element so that every control type — the
|
|
652
|
+
* ones base-entity ships and the CUSTOM ones it cannot know — gets it without a template change.
|
|
653
|
+
*
|
|
654
|
+
* The message is read from {@link AbstractAttrDescriptor.tooltipI18nKey}, falling back to the
|
|
655
|
+
* descriptor's `description` (which is also what an entity authored as metadata carries). The binding is a
|
|
656
|
+
* getter, re-read on every change detection, so a language switch or a lazily-loaded scope shows up without
|
|
657
|
+
* rebuilding the form. An attribute with neither a key nor a description gets no tooltip directive at all;
|
|
658
|
+
* an empty message is one MatTooltip never opens.
|
|
659
|
+
*/
|
|
660
|
+
private tooltipFor;
|
|
661
|
+
private createFormControlFor;
|
|
662
|
+
private createFormControl;
|
|
663
|
+
private componentOf;
|
|
664
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormBuilder<any>, never>;
|
|
665
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
666
|
+
}
|
|
667
|
+
export declare abstract class BaseFormControlComponent<Entity extends BaseEntity> {
|
|
668
|
+
config: InputSignal<BaseEntityAttrDescriptor>;
|
|
669
|
+
entity: InputSignal<Entity>;
|
|
670
|
+
entityName: InputSignal<string>;
|
|
671
|
+
formGroup: FormGroup;
|
|
672
|
+
store: BaseEntityStoreApi<Entity>;
|
|
673
|
+
/**
|
|
674
|
+
* Set by {@link BaseEntityFormBuilder} on every control it creates, for the controls that build sub-forms of
|
|
675
|
+
* their own. Handed over rather than injected because the builder maps control types to these very component
|
|
676
|
+
* classes — injecting it here would close a runtime import cycle (NG0919). The import above is type-only.
|
|
677
|
+
*/
|
|
678
|
+
formBuilder: BaseEntityFormBuilder<Entity>;
|
|
679
|
+
style: import("@angular/core").Signal<{
|
|
680
|
+
[p: string]: unknown;
|
|
681
|
+
} | null | undefined>;
|
|
682
|
+
linkedEntityName: import("@angular/core").Signal<string>;
|
|
683
|
+
linkedEntityDescriptor: import("@angular/core").Signal<BaseEntityDescriptor | undefined>;
|
|
684
|
+
value: InputSignal<unknown>;
|
|
685
|
+
get testId(): string | null;
|
|
686
|
+
get hostStyle(): string | null;
|
|
687
|
+
protected readonly logger: NGXLogger;
|
|
688
|
+
protected readonly formNavigator: {
|
|
689
|
+
activeRouteSegment: import("@angular/core").Signal<import("@processpuzzle/base-entity").RouteSegments | undefined>;
|
|
690
|
+
activeTabSegment: import("@angular/core").Signal<string | undefined>;
|
|
691
|
+
tabSegments: import("@angular/core").Signal<string[]>;
|
|
692
|
+
breadcrumb: import("@angular/core").Signal<import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[]>;
|
|
693
|
+
entityName: import("@angular/core").Signal<string>;
|
|
694
|
+
navigationError?: import("@angular/core").Signal<string | undefined> | undefined;
|
|
695
|
+
navigateTo: import("@angular/core").Signal<string>;
|
|
696
|
+
responsePayloads: import("@angular/core").Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
697
|
+
requestPayloads: import("@angular/core").Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
698
|
+
returnTo: import("@angular/core").Signal<string>;
|
|
699
|
+
formSnapshot: import("@angular/core").Signal<Record<string, unknown> | undefined>;
|
|
700
|
+
captureFormSnapshot: (snapshot: Record<string, unknown>) => void;
|
|
701
|
+
determineCurrentUrl: () => string;
|
|
702
|
+
determineOwnerUrl: () => string;
|
|
703
|
+
determineActiveRouteSegment: () => void;
|
|
704
|
+
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
705
|
+
navigateToBreadcrumbLevel: (index: number) => Promise<void>;
|
|
706
|
+
navigateToDetails: (entityName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
707
|
+
navigateToEmbedded: (embeddedTypeName: string, id: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
708
|
+
navigateToList: (entityName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
709
|
+
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
710
|
+
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
711
|
+
navigateToTab: (entityName: string, id: string, segment: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
712
|
+
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
713
|
+
registerTabSegments: (segments: string[]) => void;
|
|
714
|
+
showsScreenOf: (entityName: string) => boolean;
|
|
715
|
+
destroyNavigationTracking: () => void;
|
|
716
|
+
initializeNavigationTracking: () => void;
|
|
717
|
+
popFormSnapshot: () => Record<string, unknown> | undefined;
|
|
718
|
+
popRequestPayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
719
|
+
popResponsePayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
720
|
+
pushResponsePayload: (payload: import("@processpuzzle/base-entity").NavigationPayload) => void;
|
|
721
|
+
setEntityName: (entityName: string) => void;
|
|
722
|
+
} & import("@ngrx/signals").StateSource<{
|
|
723
|
+
activeRouteSegment: import("@processpuzzle/base-entity").RouteSegments | undefined;
|
|
724
|
+
activeTabSegment: string | undefined;
|
|
725
|
+
tabSegments: string[];
|
|
726
|
+
breadcrumb: import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[];
|
|
727
|
+
entityName: string;
|
|
728
|
+
navigationError?: string | undefined;
|
|
729
|
+
navigateTo: string;
|
|
730
|
+
responsePayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
731
|
+
requestPayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
732
|
+
returnTo: string;
|
|
733
|
+
formSnapshot: Record<string, unknown> | undefined;
|
|
734
|
+
}>;
|
|
735
|
+
protected readonly descriptorRegistry: BaseEntityDescriptorRegistry;
|
|
736
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormControlComponent<any>, never>;
|
|
737
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseFormControlComponent<any>, "ng-component", never, {
|
|
738
|
+
"config": {
|
|
739
|
+
"alias": "config";
|
|
740
|
+
"required": true;
|
|
741
|
+
"isSignal": true;
|
|
742
|
+
};
|
|
743
|
+
"entity": {
|
|
744
|
+
"alias": "entity";
|
|
745
|
+
"required": true;
|
|
746
|
+
"isSignal": true;
|
|
747
|
+
};
|
|
748
|
+
"entityName": {
|
|
749
|
+
"alias": "entityName";
|
|
750
|
+
"required": true;
|
|
751
|
+
"isSignal": true;
|
|
752
|
+
};
|
|
753
|
+
"value": {
|
|
754
|
+
"alias": "value";
|
|
755
|
+
"required": true;
|
|
756
|
+
"isSignal": true;
|
|
757
|
+
};
|
|
758
|
+
}, {}, never, never, true, never>;
|
|
759
|
+
}
|
|
61
760
|
interface ArtifactAttr {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
761
|
+
readonly bucket: string;
|
|
762
|
+
readonly objectId: string;
|
|
763
|
+
readonly name: string;
|
|
764
|
+
readonly mimeType: string;
|
|
765
|
+
}
|
|
766
|
+
export declare class ArtifactComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
767
|
+
private readonly objectStoreService;
|
|
768
|
+
private readonly dialog;
|
|
769
|
+
private readonly destroyRef;
|
|
770
|
+
private readonly valueSignal;
|
|
771
|
+
/**
|
|
772
|
+
* With an upper bound above 1 (see `multiplicity`) the value is an `ArtifactAttr[]`, an upload appends and
|
|
773
|
+
* a delete removes one; otherwise it is a single `ArtifactAttr` and an upload replaces it.
|
|
774
|
+
*/
|
|
775
|
+
readonly multiValued: import("@angular/core").Signal<boolean>;
|
|
776
|
+
/** The artifacts shown, one row each — at most one when single-valued. */
|
|
777
|
+
readonly artifacts: import("@angular/core").Signal<ArtifactAttr[]>;
|
|
778
|
+
/** The single-valued view: the one artifact, or null. */
|
|
779
|
+
readonly artifact: import("@angular/core").Signal<ArtifactAttr>;
|
|
780
|
+
/** A single-valued control can always take an upload (it replaces); a multi-valued one until it is full. */
|
|
781
|
+
readonly canAdd: import("@angular/core").Signal<boolean>;
|
|
782
|
+
/** Signed thumbnail URIs by `objectId`; null where the store has none. */
|
|
783
|
+
private readonly thumbnailUrls;
|
|
784
|
+
ngOnInit(): void;
|
|
785
|
+
thumbnailUrlOf(artifact: ArtifactAttr): string | null;
|
|
786
|
+
/** Fetches a thumbnail once per image artifact and forgets those of artifacts no longer in the value. */
|
|
787
|
+
private refreshThumbnails;
|
|
788
|
+
private setThumbnailUrl;
|
|
789
|
+
mimeIcon(mimeType: string | undefined): string;
|
|
790
|
+
openArtifact(event: Event, artifact: ArtifactAttr): void;
|
|
791
|
+
onArtifactUploaded(artifact: ArtifactAttr): void;
|
|
792
|
+
/** Deletes `artifact` — the single one when omitted — after the user confirms. */
|
|
793
|
+
deleteArtifact(artifact?: ArtifactAttr | null): void;
|
|
794
|
+
private removeArtifact;
|
|
795
|
+
private writeValue;
|
|
796
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ArtifactComponent<any>, never>;
|
|
797
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ArtifactComponent<any>, "app-artifact", never, {}, {}, never, never, true, never>;
|
|
798
|
+
}
|
|
799
|
+
export declare class AvatarComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
800
|
+
private readonly objectStoreService;
|
|
801
|
+
private readonly dialog;
|
|
802
|
+
private readonly destroyRef;
|
|
803
|
+
private readonly valueSignal;
|
|
804
|
+
/** The single avatar artifact, or null if none uploaded. */
|
|
805
|
+
readonly artifact: import("@angular/core").Signal<ArtifactAttr | null>;
|
|
806
|
+
/** The fallback avatar (icon name or image URL) configured on the descriptor, defaulting to 'person'. */
|
|
807
|
+
readonly defaultAvatar: import("@angular/core").Signal<string>;
|
|
808
|
+
/** When not disabled, an upload can be performed to set or replace the avatar. */
|
|
809
|
+
readonly canAdd: import("@angular/core").Signal<boolean>;
|
|
810
|
+
/** Signed thumbnail URIs by `objectId`; null where the store has none. */
|
|
811
|
+
private readonly thumbnailUrls;
|
|
812
|
+
ngOnInit(): void;
|
|
813
|
+
isDefaultAvatarImage(avatar: string | undefined): boolean;
|
|
814
|
+
thumbnailUrlOf(artifact: ArtifactAttr): string | null;
|
|
815
|
+
private refreshThumbnails;
|
|
816
|
+
private setThumbnailUrl;
|
|
817
|
+
openArtifact(event: Event, artifact: ArtifactAttr): void;
|
|
818
|
+
onArtifactUploaded(artifact: ArtifactAttr): void;
|
|
819
|
+
deleteArtifact(artifact?: ArtifactAttr | null): void;
|
|
820
|
+
private writeValue;
|
|
821
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AvatarComponent<any>, never>;
|
|
822
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AvatarComponent<any>, "app-avatar", never, {}, {}, never, never, true, never>;
|
|
823
|
+
}
|
|
824
|
+
interface UploadObjectResponse {
|
|
825
|
+
objectID: string;
|
|
826
|
+
fileName: string;
|
|
827
|
+
mimeType: string;
|
|
828
|
+
bucketName?: string;
|
|
829
|
+
}
|
|
830
|
+
interface ObjectDownloadResponse {
|
|
831
|
+
data: Blob;
|
|
832
|
+
fileName?: string;
|
|
833
|
+
bucketName?: string;
|
|
834
|
+
}
|
|
835
|
+
interface ObjectUriResponse {
|
|
836
|
+
uri: string;
|
|
837
|
+
}
|
|
838
|
+
export declare class ObjectStoreService {
|
|
839
|
+
private readonly runtimeConfiguration;
|
|
840
|
+
private readonly httpClient;
|
|
841
|
+
private readonly baseUrl;
|
|
842
|
+
uploadObject(file: Blob, name: string, mimeType: string): Observable<UploadObjectResponse>;
|
|
843
|
+
getObjectByID(bucketName: string, objectID: string): Observable<ObjectDownloadResponse>;
|
|
844
|
+
deleteObjectByID(bucketName: string, objectID: string): Observable<void>;
|
|
845
|
+
getObjectUriByID(bucketName: string, objectID: string): Observable<ObjectUriResponse>;
|
|
846
|
+
getThumbnailUriByID(bucketName: string, objectID: string): Observable<ObjectUriResponse | null>;
|
|
847
|
+
private buildFullUrl;
|
|
848
|
+
private resolveBaseUrl;
|
|
849
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ObjectStoreService, never>;
|
|
850
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
851
|
+
}
|
|
852
|
+
declare const BASE_ENTITY_MAPPER: InjectionToken<BaseEntityMapper<BaseEntity>>;
|
|
853
|
+
interface BaseEntityMapper<Entity extends BaseEntity> {
|
|
854
|
+
fromDto(dto: unknown, index?: number): Entity;
|
|
855
|
+
toDto(entity: Entity): unknown;
|
|
856
|
+
}
|
|
857
|
+
export declare class SimpleEntityMapper<Entity extends BaseEntity> implements BaseEntityMapper<Entity> {
|
|
858
|
+
private readonly entityType;
|
|
859
|
+
constructor(entityType: new (...args: unknown[]) => Entity);
|
|
860
|
+
fromDto(dto: unknown): Entity;
|
|
861
|
+
toDto(entity: Entity): unknown;
|
|
862
|
+
}
|
|
863
|
+
export declare function getEnumKeyByValue<E>(myEnum: {
|
|
864
|
+
[key: number]: string;
|
|
865
|
+
}, enumValue: number): E | undefined;
|
|
866
|
+
export declare function getEnumValueByKey<E>(myEnum: {
|
|
867
|
+
[key: string]: E | string;
|
|
868
|
+
}, enumKey: string): E | undefined;
|
|
869
|
+
type EntityServiceKind = 'rest' | 'firestore';
|
|
870
|
+
export declare abstract class BaseEntityFacade<Entity extends BaseEntity> {
|
|
871
|
+
abstract readonly entityType: Type<Entity>;
|
|
872
|
+
protected readonly serviceKind: EntityServiceKind;
|
|
873
|
+
protected readonly endpoint?: string;
|
|
874
|
+
protected readonly backendRoot?: string;
|
|
875
|
+
protected readonly injector: Injector;
|
|
876
|
+
private _mapper?;
|
|
877
|
+
private _service?;
|
|
878
|
+
private _storeClass?;
|
|
879
|
+
private _storeInstance?;
|
|
880
|
+
private _descriptor?;
|
|
881
|
+
get mapper(): BaseEntityMapper<Entity>;
|
|
882
|
+
get service(): BaseEntityService<Entity>;
|
|
883
|
+
get storeClass(): Type<unknown>;
|
|
884
|
+
get store(): unknown;
|
|
885
|
+
get descriptor(): BaseEntityDescriptor;
|
|
886
|
+
/**
|
|
887
|
+
* Deliberately does not go through {@link descriptor}: the store is created with a repository, and a
|
|
888
|
+
* repository may need to know which entity it serves — as an embedded one does. Binding the store into the
|
|
889
|
+
* descriptor only when the descriptor itself is asked for keeps that from re-entering the store getter and
|
|
890
|
+
* building a second store.
|
|
891
|
+
*/
|
|
892
|
+
get entityName(): string;
|
|
893
|
+
get attrDescriptors(): AbstractAttrDescriptor[];
|
|
894
|
+
get entityTitle(): string;
|
|
895
|
+
protected createMapper(): BaseEntityMapper<Entity>;
|
|
896
|
+
protected createService(mapper: BaseEntityMapper<Entity>): BaseEntityService<Entity>;
|
|
897
|
+
/** The descriptor as declared, before the store is bound into it. See {@link entityName}. */
|
|
898
|
+
private declaredDescriptor;
|
|
899
|
+
protected createStoreClass(): Type<unknown>;
|
|
900
|
+
protected abstract createDescriptor(): BaseEntityDescriptor;
|
|
901
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFacade<any>, never>;
|
|
902
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
903
|
+
}
|
|
904
|
+
export declare class BaseEntityContainerComponent implements OnDestroy, OnInit {
|
|
905
|
+
entityDescriptor: import("@angular/core").InputSignal<BaseEntityDescriptor | undefined>;
|
|
906
|
+
facade: import("@angular/core").InputSignal<BaseEntityFacade<BaseEntity> | undefined>;
|
|
907
|
+
private readonly injectedFacade;
|
|
908
|
+
protected snackBar: MatSnackBar;
|
|
909
|
+
store: BaseEntityStoreApi<BaseEntity>;
|
|
910
|
+
protected activeFacade: import("@angular/core").Signal<BaseEntityFacade<BaseEntity> | undefined>;
|
|
911
|
+
protected resolvedDescriptor: import("@angular/core").Signal<BaseEntityDescriptor>;
|
|
912
|
+
constructor();
|
|
913
|
+
ngOnDestroy(): void;
|
|
914
|
+
ngOnInit(): void;
|
|
915
|
+
private registerEffects;
|
|
916
|
+
private registerFacadeDescriptorMerge;
|
|
917
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityContainerComponent, never>;
|
|
918
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityContainerComponent, "base-entity-container", never, {
|
|
919
|
+
"entityDescriptor": {
|
|
920
|
+
"alias": "entityDescriptor";
|
|
921
|
+
"required": false;
|
|
922
|
+
"isSignal": true;
|
|
923
|
+
};
|
|
924
|
+
"facade": {
|
|
925
|
+
"alias": "facade";
|
|
926
|
+
"required": false;
|
|
927
|
+
"isSignal": true;
|
|
928
|
+
};
|
|
929
|
+
}, {}, never, ["*"], true, never>;
|
|
930
|
+
}
|
|
931
|
+
interface EntityContainerState {
|
|
932
|
+
filterKey: string | undefined;
|
|
933
|
+
}
|
|
934
|
+
export declare function BaseEntityContainerStore(): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
935
|
+
state: {
|
|
936
|
+
filterKey: string | undefined;
|
|
937
|
+
};
|
|
938
|
+
props: {};
|
|
939
|
+
methods: {
|
|
940
|
+
doFilter: (filterKey: string) => void;
|
|
941
|
+
};
|
|
942
|
+
}>;
|
|
943
|
+
export declare class BaseEntityRestService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
944
|
+
protected entityMapper: BaseEntityMapper<Entity>;
|
|
945
|
+
protected urlProperty: string;
|
|
946
|
+
protected resourceUrl: string;
|
|
947
|
+
private readonly runtimeConfiguration;
|
|
948
|
+
private readonly baseUrl;
|
|
949
|
+
protected httpClient: HttpClient;
|
|
950
|
+
protected headers: HttpHeaders;
|
|
951
|
+
/**
|
|
952
|
+
* Names of the two query parameters a filtered, sorted collection read is built from. Overridable
|
|
953
|
+
* because the workspace's contracts do not agree on them: `shared-api.yaml` and every feature that
|
|
954
|
+
* refers to it say `where` / `order`, while base-entity's *instances* resource says `rsql` / `sort`
|
|
955
|
+
* (`base-entity-api.yaml`, `listEntities`). The RSQL and the sort expression themselves are identical,
|
|
956
|
+
* so a subclass renames rather than reimplements — see `DynamicEntityService`.
|
|
957
|
+
*/
|
|
958
|
+
protected readonly filterParamName: string;
|
|
959
|
+
protected readonly sortParamName: string;
|
|
960
|
+
constructor(entityMapper: BaseEntityMapper<Entity>, urlProperty: string, resourceUrl: string);
|
|
961
|
+
delete(id: string): Observable<unknown>;
|
|
962
|
+
deleteAll(): Observable<unknown>;
|
|
963
|
+
findAll(page?: number): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
|
|
964
|
+
findByQuery(queryCondition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
|
|
965
|
+
private isPagedResponse;
|
|
966
|
+
private isEmptyBody;
|
|
967
|
+
/**
|
|
968
|
+
* Reads one entity by id. The `/%{id}` suffix is what makes this a single-entity read: without it the
|
|
969
|
+
* URL is the collection's, and the response mapper then sees a list where it expects one record — the
|
|
970
|
+
* Firestore and embedded implementations of this interface address one document, and so does this one.
|
|
971
|
+
*/
|
|
972
|
+
findById(id: string): Observable<void | PersistedEntity<Entity>>;
|
|
973
|
+
add(entity: Entity, id?: number): Observable<PersistedEntity<Entity>>;
|
|
974
|
+
update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
|
|
975
|
+
/**
|
|
976
|
+
* The context the reads of this service carry; none by default. A service whose entities are *definitions*
|
|
977
|
+
* returns `definitionRead()`, so that a host's `definitionRevisionInterceptor` addresses its reads to the draft or
|
|
978
|
+
* the released revision — writes always go to the draft and carry nothing.
|
|
979
|
+
*/
|
|
980
|
+
protected readContext(): HttpContext | undefined;
|
|
981
|
+
protected buildFullUrl(resourceUri: string, queryCondition: BaseEntityQueryCondition): string | undefined;
|
|
982
|
+
protected buildRsql(queryCondition: BaseEntityQueryCondition): string | undefined;
|
|
983
|
+
private buildOrder;
|
|
984
|
+
private mapPagedResponse;
|
|
985
|
+
private mapSimpleResponse;
|
|
986
|
+
private mapEntityResponse;
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Turns a closed string enum from an API contract (`MATERIAL_THEMES`, `REGION_TYPES`, `PORT_TYPES`,
|
|
990
|
+
* …) into dropdown options. Lives here next to `Selectable` itself rather than in one feature lib,
|
|
991
|
+
* because every metadata-driven feature that has an enum-backed DROPDOWN needs it and none of them
|
|
992
|
+
* depend on each other — the same reason WIDGET_REGISTRY sits in this lib.
|
|
993
|
+
*/
|
|
994
|
+
export declare const toSelectables: (values: readonly string[]) => Array<Selectable>;
|
|
995
|
+
export declare class BaseFormHostDirective {
|
|
996
|
+
viewContainerRef: ViewContainerRef;
|
|
997
|
+
constructor(viewContainerRef: ViewContainerRef);
|
|
998
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormHostDirective, never>;
|
|
999
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseFormHostDirective, "[baseFormHost]", never, {}, {}, never, never, true, never>;
|
|
1000
|
+
}
|
|
1001
|
+
type RuleSeverity = 'ERROR' | 'WARNING' | 'INFO';
|
|
1002
|
+
interface EvaluatableRule {
|
|
1003
|
+
id: string;
|
|
1004
|
+
expression: string;
|
|
1005
|
+
severity: RuleSeverity;
|
|
1006
|
+
message?: string;
|
|
1007
|
+
translocoId?: string;
|
|
1008
|
+
enabled?: boolean;
|
|
1009
|
+
fields?: string[];
|
|
1010
|
+
}
|
|
1011
|
+
interface RuleEvaluationResult {
|
|
1012
|
+
ruleId: string;
|
|
1013
|
+
passed: boolean;
|
|
1014
|
+
severity: RuleSeverity;
|
|
1015
|
+
message?: string;
|
|
1016
|
+
translocoId?: string;
|
|
1017
|
+
error?: string;
|
|
1018
|
+
fields?: string[];
|
|
1019
|
+
}
|
|
1020
|
+
interface RuleEngine {
|
|
1021
|
+
loadRulesFor(context: string): Observable<EvaluatableRule[]>;
|
|
1022
|
+
evaluate(entity: unknown, rule: EvaluatableRule): RuleEvaluationResult;
|
|
1023
|
+
}
|
|
1024
|
+
export declare const RULE_ENGINE: InjectionToken<RuleEngine>;
|
|
1025
|
+
export declare class BaseEntityFormComponent<Entity extends BaseEntity> implements OnInit, OnDestroy {
|
|
1026
|
+
baseEntityForm: FormGroup;
|
|
1027
|
+
entityDescriptor: Signal<BaseEntityDescriptor>;
|
|
1028
|
+
entity: Signal<Entity>;
|
|
1029
|
+
entityId: InputSignal<string>;
|
|
1030
|
+
isAbstract: Signal<boolean>;
|
|
1031
|
+
/** A preview of draft definitions over live objects: shown, never saved or deleted — see EntityPreviewMode. */
|
|
1032
|
+
isReadOnly: Signal<boolean>;
|
|
1033
|
+
isNewObject: Signal<boolean>;
|
|
1034
|
+
store: Signal<BaseEntityStoreApi<Entity>>;
|
|
1035
|
+
componentHost: BaseFormHostDirective;
|
|
1036
|
+
/**
|
|
1037
|
+
* True while an embedded child's screen is open below this form. This form keeps running — that is what
|
|
1038
|
+
* carries its unsaved edits across the round trip — but it gives up the surface to the child.
|
|
1039
|
+
*/
|
|
1040
|
+
readonly hasActiveEmbeddedChild: WritableSignal<boolean>;
|
|
1041
|
+
violations: WritableSignal<RuleEvaluationResult[]>;
|
|
1042
|
+
hasErrorViolations: Signal<boolean>;
|
|
1043
|
+
saveDisabled: Signal<boolean>;
|
|
1044
|
+
private readonly entityFormBuilder;
|
|
1045
|
+
private readonly formBuilder;
|
|
1046
|
+
protected readonly formNavigator: {
|
|
1047
|
+
activeRouteSegment: Signal<import("@processpuzzle/base-entity").RouteSegments | undefined>;
|
|
1048
|
+
activeTabSegment: Signal<string | undefined>;
|
|
1049
|
+
tabSegments: Signal<string[]>;
|
|
1050
|
+
breadcrumb: Signal<import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[]>;
|
|
1051
|
+
entityName: Signal<string>;
|
|
1052
|
+
navigationError?: Signal<string | undefined> | undefined;
|
|
1053
|
+
navigateTo: Signal<string>;
|
|
1054
|
+
responsePayloads: Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
1055
|
+
requestPayloads: Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
|
|
1056
|
+
returnTo: Signal<string>;
|
|
1057
|
+
formSnapshot: Signal<Record<string, unknown> | undefined>;
|
|
1058
|
+
captureFormSnapshot: (snapshot: Record<string, unknown>) => void;
|
|
1059
|
+
determineCurrentUrl: () => string;
|
|
1060
|
+
determineOwnerUrl: () => string;
|
|
1061
|
+
determineActiveRouteSegment: () => void;
|
|
1062
|
+
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
1063
|
+
navigateToBreadcrumbLevel: (index: number) => Promise<void>;
|
|
1064
|
+
navigateToDetails: (entityName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
1065
|
+
navigateToEmbedded: (embeddedTypeName: string, id: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
1066
|
+
navigateToList: (entityName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
1067
|
+
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
1068
|
+
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
1069
|
+
navigateToTab: (entityName: string, id: string, segment: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
|
|
1070
|
+
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
1071
|
+
registerTabSegments: (segments: string[]) => void;
|
|
1072
|
+
showsScreenOf: (entityName: string) => boolean;
|
|
1073
|
+
destroyNavigationTracking: () => void;
|
|
1074
|
+
initializeNavigationTracking: () => void;
|
|
1075
|
+
popFormSnapshot: () => Record<string, unknown> | undefined;
|
|
1076
|
+
popRequestPayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
1077
|
+
popResponsePayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
|
|
1078
|
+
pushResponsePayload: (payload: import("@processpuzzle/base-entity").NavigationPayload) => void;
|
|
1079
|
+
setEntityName: (entityName: string) => void;
|
|
1080
|
+
} & import("@ngrx/signals").StateSource<{
|
|
1081
|
+
activeRouteSegment: import("@processpuzzle/base-entity").RouteSegments | undefined;
|
|
1082
|
+
activeTabSegment: string | undefined;
|
|
1083
|
+
tabSegments: string[];
|
|
1084
|
+
breadcrumb: import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[];
|
|
1085
|
+
entityName: string;
|
|
1086
|
+
navigationError?: string | undefined;
|
|
1087
|
+
navigateTo: string;
|
|
1088
|
+
responsePayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
1089
|
+
requestPayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
|
|
1090
|
+
returnTo: string;
|
|
1091
|
+
formSnapshot: Record<string, unknown> | undefined;
|
|
1092
|
+
}>;
|
|
1093
|
+
private readonly logger;
|
|
1094
|
+
private readonly ruleEngine;
|
|
1095
|
+
private readonly violationsStore;
|
|
1096
|
+
private readonly previewMode;
|
|
1097
|
+
private rules;
|
|
1098
|
+
private readonly fieldsWithRuleErrors;
|
|
1099
|
+
private readonly ruleLoad$;
|
|
1100
|
+
private ruleSubscription;
|
|
1101
|
+
constructor();
|
|
1102
|
+
ngOnInit(): void;
|
|
1103
|
+
ngOnDestroy(): void;
|
|
1104
|
+
onCancel(): Promise<void>;
|
|
1105
|
+
onDelete(): Promise<void>;
|
|
1106
|
+
onFieldBlur(): void;
|
|
1107
|
+
onSubmit(): Promise<void>;
|
|
1108
|
+
/**
|
|
1109
|
+
* Drops the embedded-child changes staged in this entity's document (see `BaseEntityStoreApi.stage`) by
|
|
1110
|
+
* re-reading it, so an abandoned edit cannot later pass for a saved one. A new object has no document yet.
|
|
1111
|
+
*/
|
|
1112
|
+
private discardStagedChanges;
|
|
1113
|
+
/**
|
|
1114
|
+
* Leaving an embedded child goes to the form of the entity that contains it. Only a fallback: a drill-down
|
|
1115
|
+
* already records where it came from. It is a page opened straight on its URL — a deep link, a reload —
|
|
1116
|
+
* that has nothing recorded, and would otherwise land on the child's own list.
|
|
1117
|
+
*
|
|
1118
|
+
* The navigator's entity name is re-claimed first: it is a singleton, and an embedded child opened below
|
|
1119
|
+
* this form — which outlives the child, so `ngOnInit` does not run again — leaves the child's name behind.
|
|
1120
|
+
* The list fallback would then aim at the child's list, which an embedded type does not have.
|
|
1121
|
+
*/
|
|
1122
|
+
private navigateBack;
|
|
1123
|
+
private evaluateRules;
|
|
1124
|
+
private applyFieldRuleErrors;
|
|
1125
|
+
private clearFieldRuleErrors;
|
|
1126
|
+
private loadRules;
|
|
1127
|
+
private registerEffects;
|
|
1128
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormComponent<any>, never>;
|
|
1129
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityFormComponent<any>, "base-form", never, {
|
|
1130
|
+
"entityId": {
|
|
1131
|
+
"alias": "entityId";
|
|
1132
|
+
"required": true;
|
|
1133
|
+
"isSignal": true;
|
|
1134
|
+
};
|
|
1135
|
+
}, {}, never, never, true, never>;
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* To-many **containment** whose parts live in a table of their own — the child is persisted through its own
|
|
1139
|
+
* endpoint and points back at this entity through the foreign key named by
|
|
1140
|
+
* {@link BaseEntityDescriptor.parentReferenceAttrName}. This attribute therefore holds child **ids**, and the
|
|
1141
|
+
* row text is resolved from the child's store.
|
|
1142
|
+
*
|
|
1143
|
+
* The difference from `RELATED_ENTITIES` is ownership, and it shows in what the buttons do: attaching a child
|
|
1144
|
+
* also stamps this entity's id into the child's foreign key, and deleting a row **destroys the child**
|
|
1145
|
+
* instead of merely detaching it. For a part that has no table of its own, see `EMBEDDED_COMPONENTS`.
|
|
1146
|
+
*/
|
|
1147
|
+
export declare class ComponentsListComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1148
|
+
private readonly dialog;
|
|
1149
|
+
private readonly componentStore;
|
|
1150
|
+
ngOnInit(): void;
|
|
1151
|
+
componentEntities(): PersistedEntity<BaseEntity>[];
|
|
1152
|
+
/**
|
|
1153
|
+
* The child's identifying text. A reference may still be stored as a whole object (seed data, a form
|
|
1154
|
+
* snapshot), so its own attribute wins; otherwise the child is looked up in its store, and the id is what
|
|
1155
|
+
* remains when the store has not loaded it.
|
|
1156
|
+
*/
|
|
1157
|
+
displayName(componentEntity: PersistedEntity<BaseEntity>): string;
|
|
1158
|
+
addComponentTitle(): string;
|
|
1159
|
+
navigateToComponentList(): void;
|
|
1160
|
+
/** Destroys the child — a component has no life outside its parent — after the user confirms. */
|
|
1161
|
+
deleteComponent(componentEntity: PersistedEntity<BaseEntity>): void;
|
|
1162
|
+
/**
|
|
1163
|
+
* The two declarations — this attribute's control type and the child's own descriptor — have to agree, and
|
|
1164
|
+
* they are both authored by hand. Checking at first render turns a silent mis-declaration (a list that
|
|
1165
|
+
* deletes what it should detach, or a child whose payload goes nowhere) into an error naming both sides.
|
|
1166
|
+
*/
|
|
1167
|
+
private assertContainmentContract;
|
|
1168
|
+
/**
|
|
1169
|
+
* The rows arrive as ids, so the child store has to hold the children for them to render as names. The
|
|
1170
|
+
* parent's form may well be the first screen the user opens, which is why the load happens here rather
|
|
1171
|
+
* than being left to the child's list page (`LookupComponent` loads its table the same way).
|
|
1172
|
+
*/
|
|
1173
|
+
private loadComponentEntities;
|
|
1174
|
+
private attachSelectedComponentFromNavigatorResponse;
|
|
1175
|
+
/** Stamps this entity's id into the child's foreign key, so the containment holds from the child's side too. */
|
|
1176
|
+
private adoptComponent;
|
|
1177
|
+
private storedComponent;
|
|
1178
|
+
/** Writes the references back as ids — the child's payload belongs to the child's own endpoint, not here. */
|
|
1179
|
+
private writeReferences;
|
|
1180
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComponentsListComponent<any>, never>;
|
|
1181
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ComponentsListComponent<any>, "app-components-list", never, {}, {}, never, never, true, never>;
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* One hop down an aggregate: the `EMBEDDED_COMPONENTS` attribute followed, and which of its rows.
|
|
1185
|
+
* A path is the list of hops from the aggregate root, so `[]` addresses the root itself.
|
|
1186
|
+
*/
|
|
1187
|
+
interface EmbeddedPathStep {
|
|
1188
|
+
attrName: string;
|
|
1189
|
+
index: number;
|
|
1190
|
+
}
|
|
1191
|
+
type EmbeddedPath = readonly EmbeddedPathStep[];
|
|
1192
|
+
/**
|
|
1193
|
+
* A row as it sits in the payload. Not `BaseEntity`: an embedded row is not guaranteed to carry an `id` —
|
|
1194
|
+
* `App Region` has none and is identified by `type` (see `referenceIdField`) — and `BaseEntity`'s only
|
|
1195
|
+
* property is an optional `id`, so TypeScript's weak-type rule rejects exactly those rows.
|
|
1196
|
+
*/
|
|
1197
|
+
type EmbeddedRow = BaseEntity | Record<string, unknown>;
|
|
1198
|
+
type Payload = Record<string, unknown>;
|
|
1199
|
+
/**
|
|
1200
|
+
* An embedded child has no table of its own, so it is addressed by its **position** inside the root's
|
|
1201
|
+
* payload — `regions[0].navItems[2]` — rather than by a globally unique id. These functions are the only
|
|
1202
|
+
* place that knows how to read and write such a position; everything above them (the service, the list
|
|
1203
|
+
* control, the route context) works in terms of a path.
|
|
1204
|
+
*
|
|
1205
|
+
* They are deliberately free of Angular and of the store: an aggregate is a plain payload, and keeping the
|
|
1206
|
+
* arithmetic pure is what makes the nested and id-less cases cheap to test.
|
|
1207
|
+
*/
|
|
1208
|
+
/** Resolves the object a path points at, or `undefined` when any hop is missing. */
|
|
1209
|
+
declare function readOwner(root: unknown, path: EmbeddedPath): Payload | undefined;
|
|
1210
|
+
/** The rows of one `EMBEDDED_COMPONENTS` attribute; an empty array when the attribute is unset. */
|
|
1211
|
+
declare function readRows(root: unknown, path: EmbeddedPath, attrName: string): EmbeddedRow[];
|
|
1212
|
+
/**
|
|
1213
|
+
* A copy of `root` whose owner carries `rows` under `attrName`, sharing every untouched branch. The
|
|
1214
|
+
* aggregate is persisted by replacing the root document wholesale, so a write has to rebuild only the spine
|
|
1215
|
+
* from the root down to the owner.
|
|
1216
|
+
*/
|
|
1217
|
+
declare function writeRows(root: unknown, path: EmbeddedPath, attrName: string, rows: readonly EmbeddedRow[]): Payload;
|
|
1218
|
+
/**
|
|
1219
|
+
* Position of the row identified by `id`, or `-1`. Resolved through {@link rowId} rather than by comparing
|
|
1220
|
+
* `id` directly, so that a lookup and the URL segment that arrives back cannot drift apart on an entity
|
|
1221
|
+
* keyed by something else — `App Region` has no `id` at all and is identified by `type`.
|
|
1222
|
+
*/
|
|
1223
|
+
declare function indexOfRow(rows: readonly EmbeddedRow[], id: string, referenceIdField?: string): number;
|
|
1224
|
+
declare function findRow(rows: readonly EmbeddedRow[], id: string, referenceIdField?: string): EmbeddedRow | undefined;
|
|
1225
|
+
/** The value that identifies `row` in a URL segment — its `referenceIdField`, defaulting to `id`. */
|
|
1226
|
+
declare function rowId(row: EmbeddedRow, referenceIdField?: string): string;
|
|
1227
|
+
declare function appendRow(rows: readonly EmbeddedRow[], row: EmbeddedRow): EmbeddedRow[];
|
|
1228
|
+
/** Replaces the row identified by `id`; appends when it is not there yet, so an add and a re-save agree. */
|
|
1229
|
+
declare function replaceRow(rows: readonly EmbeddedRow[], id: string, row: EmbeddedRow, referenceIdField?: string): EmbeddedRow[];
|
|
1230
|
+
declare function removeRow(rows: readonly EmbeddedRow[], id: string, referenceIdField?: string): EmbeddedRow[];
|
|
1231
|
+
/**
|
|
1232
|
+
* Moves the row identified by `id` to `toIndex`, shifting the rows in between. The array position *is* the
|
|
1233
|
+
* order: every aggregate persists its embedded rows as a JSON array, and the renderers walk it in sequence.
|
|
1234
|
+
* Used by an `ordered` list, which saves the result through its owner's form rather than writing it here.
|
|
1235
|
+
* An unknown id leaves the rows as they are; `toIndex` is clamped to the array.
|
|
1236
|
+
*/
|
|
1237
|
+
declare function moveRow(rows: readonly EmbeddedRow[], id: string, toIndex: number, referenceIdField?: string): EmbeddedRow[];
|
|
1238
|
+
/** Widens a row to the shape the store's API is written in; embedded rows always carry their key field. */
|
|
1239
|
+
declare function asPersisted<Entity extends BaseEntity>(row: EmbeddedRow): PersistedEntity<Entity>;
|
|
1240
|
+
/**
|
|
1241
|
+
* To-many **containment** whose parts have no table of their own — the child's payload travels inside this
|
|
1242
|
+
* entity's payload, the way a sub-document does in a document store.
|
|
1243
|
+
*
|
|
1244
|
+
* The rows are only listed here; a row opens the child's own form, on a route nested below this one. That is
|
|
1245
|
+
* what keeps a parent with many children, or with children that have children of their own, readable — and
|
|
1246
|
+
* the child gets the full generated form rather than a cramped inline copy of it.
|
|
1247
|
+
*
|
|
1248
|
+
* The rows come from the child's own store, which reads them out of this entity's payload
|
|
1249
|
+
* (`EmbeddedEntityService`), so adding, editing and deleting a child all go through the same
|
|
1250
|
+
* List → Store → Service path as any other entity. What differs is only where that service writes: the
|
|
1251
|
+
* 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
|
|
1252
|
+
* `COMPONENTS`; for one that merely points at an independent entity, `RELATED_ENTITIES`.
|
|
1253
|
+
*/
|
|
1254
|
+
export declare class EmbeddedComponentsListComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1255
|
+
private readonly dialog;
|
|
1256
|
+
private readonly transloco;
|
|
1257
|
+
private readonly aggregateAccessor;
|
|
1258
|
+
private readonly componentStore;
|
|
1259
|
+
/**
|
|
1260
|
+
* The child's store holds exactly this attribute's rows: it resolves them from the containing document
|
|
1261
|
+
* through the route, so it is already scoped to the entity this form is editing.
|
|
1262
|
+
*/
|
|
1263
|
+
private readonly storedRows;
|
|
1264
|
+
/**
|
|
1265
|
+
* The row keys in the order the user arranged them, until the owner is saved. `undefined` means the stored
|
|
1266
|
+
* order stands.
|
|
1267
|
+
*
|
|
1268
|
+
* A key order rather than the rows themselves, so that a child saved or deleted in the meantime — which
|
|
1269
|
+
* rewrites the stored rows — is picked up without losing the arrangement.
|
|
1270
|
+
*/
|
|
1271
|
+
private readonly pendingOrder;
|
|
1272
|
+
/** The rows as listed: the child store's, in the pending order if the user has rearranged them. */
|
|
1273
|
+
readonly rows: Signal<EmbeddedRow[]>;
|
|
1274
|
+
/** Only an `ordered` attribute of an editable form offers reordering, and only once there is something to order. */
|
|
1275
|
+
readonly reorderable: Signal<boolean>;
|
|
1276
|
+
constructor();
|
|
1277
|
+
ngOnInit(): void;
|
|
1278
|
+
rowKey(row: EmbeddedRow): string;
|
|
1279
|
+
/** The child's identifying text, falling back to whatever identifies it at all, then to its position. */
|
|
1280
|
+
displayName(row: EmbeddedRow, index: number): string;
|
|
1281
|
+
linkedEntityLabel(): string;
|
|
1282
|
+
addComponentTitle(): string;
|
|
1283
|
+
/**
|
|
1284
|
+
* An embedded row is stored inside its owner, so there is nowhere to put one until the owner exists.
|
|
1285
|
+
*
|
|
1286
|
+
* Read off the route rather than off the entity: an id is no evidence of a document, because an entity type
|
|
1287
|
+
* may well assign itself one at construction (`new TestEntity()` mints a uuid), which would make an unsaved
|
|
1288
|
+
* owner look persisted and offer an add button writing into a document that is not there. The URL is what
|
|
1289
|
+
* the child's own store resolves the rows through anyway, and it says `new` while the owner is unsaved.
|
|
1290
|
+
* The entity's id remains the fallback for an application whose routes carry no entity name.
|
|
1291
|
+
*/
|
|
1292
|
+
ownerIsPersisted(): boolean;
|
|
1293
|
+
openComponent(row: EmbeddedRow): void;
|
|
1294
|
+
/** A new child is created on its own form, the same way an existing one is edited. */
|
|
1295
|
+
addComponent(): void;
|
|
1296
|
+
/** Destroys the child — an embedded component has no existence outside this payload — after confirmation. */
|
|
1297
|
+
deleteComponent(row: EmbeddedRow): void;
|
|
1298
|
+
/**
|
|
1299
|
+
* Repositions a row. Like adding, editing or deleting a child, it is persisted by the owner's Save; unlike
|
|
1300
|
+
* them it does not go through the child's store at all — the order is an attribute *of the owner* — so it
|
|
1301
|
+
* is kept as a pending arrangement and only dirties the owner's form.
|
|
1302
|
+
*/
|
|
1303
|
+
moveComponent(row: EmbeddedRow, toIndex: number): void;
|
|
1304
|
+
dropComponent(event: CdkDragDrop<unknown>): void;
|
|
1305
|
+
/**
|
|
1306
|
+
* Both declarations — this attribute's control type and the child's own descriptor — are written by hand
|
|
1307
|
+
* and have to agree; checking at first render names both sides instead of silently rendering a list whose
|
|
1308
|
+
* rows go nowhere on save.
|
|
1309
|
+
*/
|
|
1310
|
+
private assertContainmentContract;
|
|
1311
|
+
/**
|
|
1312
|
+
* Re-reads the rows whenever the containing document changes.
|
|
1313
|
+
*
|
|
1314
|
+
* The child's store holds a projection of that document, and it is a root singleton shared by every owner
|
|
1315
|
+
* of this child type — so its rows are stale both before the document has loaded (a form opened directly on
|
|
1316
|
+
* a URL) and after the user moves to a different owner. Depending on the document itself covers both, and
|
|
1317
|
+
* cannot loop: the reload writes to the child's store, never to the root's.
|
|
1318
|
+
*/
|
|
1319
|
+
private registerRowReload;
|
|
1320
|
+
/**
|
|
1321
|
+
* Mirrors the rows into this attribute's control. A child's save stages the containing document in its
|
|
1322
|
+
* store, so the control would otherwise still hold the array as it looked when the form was built — and the
|
|
1323
|
+
* owner's own save, which merges `form.value` over the entity, would write that stale array back.
|
|
1324
|
+
*
|
|
1325
|
+
* While the document holds staged child changes the control is also dirtied: they are edits the owner's
|
|
1326
|
+
* Save still has to carry, and the Save button is what tells the user so. Rows merely loaded from the
|
|
1327
|
+
* server leave it pristine.
|
|
1328
|
+
*/
|
|
1329
|
+
private registerFormControlSync;
|
|
1330
|
+
/** Whether the document these rows live in holds child changes its Save has not persisted yet. */
|
|
1331
|
+
private documentHasStagedChanges;
|
|
1332
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedComponentsListComponent<any>, never>;
|
|
1333
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedComponentsListComponent<any>, "app-embedded-components-list", never, {}, {}, never, never, true, never>;
|
|
1334
|
+
}
|
|
1335
|
+
/**
|
|
1336
|
+
* One row of {@link EmbeddedComponentsListComponent}. Presentation only: opening, deleting and moving all
|
|
1337
|
+
* belong to the list, which is the side that knows where the row sits in the containing document.
|
|
1338
|
+
*
|
|
1339
|
+
* An `ordered` row carries a drag handle — the list is the drop target — and move up / down buttons, which
|
|
1340
|
+
* are what a keyboard or screen-reader user reorders with, since dragging needs a pointer.
|
|
1341
|
+
*/
|
|
1342
|
+
export declare class EmbeddedComponentRefComponent {
|
|
1343
|
+
displayName: InputSignal<string>;
|
|
1344
|
+
disabled: InputSignal<boolean>;
|
|
1345
|
+
/** Offers the drag handle and the move buttons. */
|
|
1346
|
+
ordered: InputSignal<boolean>;
|
|
1347
|
+
first: InputSignal<boolean>;
|
|
1348
|
+
last: InputSignal<boolean>;
|
|
1349
|
+
readonly openRequested: import("@angular/core").OutputEmitterRef<void>;
|
|
1350
|
+
readonly deleteRequested: import("@angular/core").OutputEmitterRef<void>;
|
|
1351
|
+
readonly moveUpRequested: import("@angular/core").OutputEmitterRef<void>;
|
|
1352
|
+
readonly moveDownRequested: import("@angular/core").OutputEmitterRef<void>;
|
|
1353
|
+
requestOpen(event: Event): void;
|
|
1354
|
+
requestDelete(): void;
|
|
1355
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedComponentRefComponent, never>;
|
|
1356
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedComponentRefComponent, "app-embedded-component-ref", never, {
|
|
1357
|
+
"displayName": {
|
|
1358
|
+
"alias": "displayName";
|
|
1359
|
+
"required": true;
|
|
1360
|
+
"isSignal": true;
|
|
1361
|
+
};
|
|
1362
|
+
"disabled": {
|
|
1363
|
+
"alias": "disabled";
|
|
1364
|
+
"required": false;
|
|
1365
|
+
"isSignal": true;
|
|
1366
|
+
};
|
|
1367
|
+
"ordered": {
|
|
1368
|
+
"alias": "ordered";
|
|
1369
|
+
"required": false;
|
|
1370
|
+
"isSignal": true;
|
|
1371
|
+
};
|
|
1372
|
+
"first": {
|
|
1373
|
+
"alias": "first";
|
|
1374
|
+
"required": false;
|
|
1375
|
+
"isSignal": true;
|
|
1376
|
+
};
|
|
1377
|
+
"last": {
|
|
1378
|
+
"alias": "last";
|
|
1379
|
+
"required": false;
|
|
1380
|
+
"isSignal": true;
|
|
1381
|
+
};
|
|
1382
|
+
}, {
|
|
1383
|
+
"openRequested": "openRequested";
|
|
1384
|
+
"deleteRequested": "deleteRequested";
|
|
1385
|
+
"moveUpRequested": "moveUpRequested";
|
|
1386
|
+
"moveDownRequested": "moveDownRequested";
|
|
1387
|
+
}, never, never, true, never>;
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Hosts the dynamic child form for a single row of an {@link EmbeddedListComponent}.
|
|
1391
|
+
*/
|
|
1392
|
+
declare class EmbeddedListRowComponent<Entity extends BaseEntity> implements OnInit {
|
|
1393
|
+
rowHost: ViewContainerRef;
|
|
1394
|
+
readonly rowGroup: import("@angular/core").InputSignal<FormGroup<any>>;
|
|
1395
|
+
readonly item: import("@angular/core").InputSignal<Record<string, unknown>>;
|
|
1396
|
+
readonly childDescriptors: import("@angular/core").InputSignal<AbstractAttrDescriptor[]>;
|
|
1397
|
+
readonly store: import("@angular/core").InputSignal<BaseEntityStoreApi<Entity>>;
|
|
1398
|
+
readonly formBuilder: import("@angular/core").InputSignal<BaseEntityFormBuilder<Entity>>;
|
|
1399
|
+
readonly entityName: import("@angular/core").InputSignal<string>;
|
|
1400
|
+
readonly disabled: import("@angular/core").InputSignal<boolean>;
|
|
1401
|
+
ngOnInit(): void;
|
|
1402
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedListRowComponent<any>, never>;
|
|
1403
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedListRowComponent<any>, "app-embedded-list-row", never, {
|
|
1404
|
+
"rowGroup": {
|
|
1405
|
+
"alias": "rowGroup";
|
|
1406
|
+
"required": true;
|
|
1407
|
+
"isSignal": true;
|
|
1408
|
+
};
|
|
1409
|
+
"item": {
|
|
1410
|
+
"alias": "item";
|
|
1411
|
+
"required": false;
|
|
1412
|
+
"isSignal": true;
|
|
1413
|
+
};
|
|
1414
|
+
"childDescriptors": {
|
|
1415
|
+
"alias": "childDescriptors";
|
|
1416
|
+
"required": true;
|
|
1417
|
+
"isSignal": true;
|
|
1418
|
+
};
|
|
1419
|
+
"store": {
|
|
1420
|
+
"alias": "store";
|
|
1421
|
+
"required": true;
|
|
1422
|
+
"isSignal": true;
|
|
1423
|
+
};
|
|
1424
|
+
"formBuilder": {
|
|
1425
|
+
"alias": "formBuilder";
|
|
1426
|
+
"required": true;
|
|
1427
|
+
"isSignal": true;
|
|
1428
|
+
};
|
|
1429
|
+
"entityName": {
|
|
1430
|
+
"alias": "entityName";
|
|
1431
|
+
"required": true;
|
|
1432
|
+
"isSignal": true;
|
|
1433
|
+
};
|
|
1434
|
+
"disabled": {
|
|
1435
|
+
"alias": "disabled";
|
|
1436
|
+
"required": false;
|
|
1437
|
+
"isSignal": true;
|
|
1438
|
+
};
|
|
1439
|
+
}, {}, never, never, true, never>;
|
|
1440
|
+
}
|
|
1441
|
+
interface EmbeddedListItem {
|
|
1442
|
+
id: string;
|
|
1443
|
+
formGroup: FormGroup;
|
|
1444
|
+
initialValue: Record<string, unknown>;
|
|
1445
|
+
}
|
|
1446
|
+
/**
|
|
1447
|
+
* Form control for an array of structured objects (`EMBEDDED_LIST`).
|
|
1448
|
+
*
|
|
1449
|
+
* Renders each item in a collapsible expansion panel with drag reordering, move buttons, and delete.
|
|
1450
|
+
* New items can be added up to `maxOccurs` (derived from `maxItems`).
|
|
1451
|
+
* The collapsed panel is titled by the attribute named in `config().rowLabelAttr` (or the item's first
|
|
1452
|
+
* required string property).
|
|
1453
|
+
*/
|
|
1454
|
+
export declare class EmbeddedListComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1455
|
+
readonly rows: import("@angular/core").WritableSignal<EmbeddedListItem[]>;
|
|
1456
|
+
ngOnInit(): void;
|
|
1457
|
+
addRow(): void;
|
|
1458
|
+
deleteRow(index: number): void;
|
|
1459
|
+
moveRow(fromIndex: number, toIndex: number): void;
|
|
1460
|
+
dropRow(event: CdkDragDrop<EmbeddedListItem[]>): void;
|
|
1461
|
+
private getFormArray;
|
|
1462
|
+
rowLabel(row: EmbeddedListItem, index: number): string;
|
|
1463
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedListComponent<any>, never>;
|
|
1464
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedListComponent<any>, "app-embedded-list", never, {}, {}, never, never, true, never>;
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* Hosts dynamic child form controls for {@link EmbeddedObjectComponent}.
|
|
1468
|
+
*/
|
|
1469
|
+
declare class EmbeddedObjectBodyComponent<Entity extends BaseEntity> implements OnInit {
|
|
1470
|
+
host: ViewContainerRef;
|
|
1471
|
+
readonly childGroup: import("@angular/core").InputSignal<FormGroup<any>>;
|
|
1472
|
+
readonly item: import("@angular/core").InputSignal<Record<string, unknown>>;
|
|
1473
|
+
readonly childDescriptors: import("@angular/core").InputSignal<AbstractAttrDescriptor[]>;
|
|
1474
|
+
readonly store: import("@angular/core").InputSignal<BaseEntityStoreApi<Entity>>;
|
|
1475
|
+
readonly formBuilder: import("@angular/core").InputSignal<BaseEntityFormBuilder<Entity>>;
|
|
1476
|
+
readonly entityName: import("@angular/core").InputSignal<string>;
|
|
1477
|
+
readonly disabled: import("@angular/core").InputSignal<boolean>;
|
|
1478
|
+
ngOnInit(): void;
|
|
1479
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedObjectBodyComponent<any>, never>;
|
|
1480
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedObjectBodyComponent<any>, "app-embedded-object-body", never, {
|
|
1481
|
+
"childGroup": {
|
|
1482
|
+
"alias": "childGroup";
|
|
1483
|
+
"required": true;
|
|
1484
|
+
"isSignal": true;
|
|
1485
|
+
};
|
|
1486
|
+
"item": {
|
|
1487
|
+
"alias": "item";
|
|
1488
|
+
"required": false;
|
|
1489
|
+
"isSignal": true;
|
|
1490
|
+
};
|
|
1491
|
+
"childDescriptors": {
|
|
1492
|
+
"alias": "childDescriptors";
|
|
1493
|
+
"required": true;
|
|
1494
|
+
"isSignal": true;
|
|
1495
|
+
};
|
|
1496
|
+
"store": {
|
|
1497
|
+
"alias": "store";
|
|
1498
|
+
"required": true;
|
|
1499
|
+
"isSignal": true;
|
|
1500
|
+
};
|
|
1501
|
+
"formBuilder": {
|
|
1502
|
+
"alias": "formBuilder";
|
|
1503
|
+
"required": true;
|
|
1504
|
+
"isSignal": true;
|
|
1505
|
+
};
|
|
1506
|
+
"entityName": {
|
|
1507
|
+
"alias": "entityName";
|
|
1508
|
+
"required": true;
|
|
1509
|
+
"isSignal": true;
|
|
1510
|
+
};
|
|
1511
|
+
"disabled": {
|
|
1512
|
+
"alias": "disabled";
|
|
1513
|
+
"required": false;
|
|
1514
|
+
"isSignal": true;
|
|
1515
|
+
};
|
|
1516
|
+
}, {}, never, never, true, never>;
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Renders an embedded object as an inline fieldset whose child controls are built from
|
|
1520
|
+
* `config().childDescriptors`.
|
|
1521
|
+
*
|
|
1522
|
+
* Unlike {@link EmbeddedComponentsListComponent}, this operates on a pure value structure rather than
|
|
1523
|
+
* an entity with its own route, store, and identity: edits live directly in a nested `FormGroup` within
|
|
1524
|
+
* the owner form, and validity bubbles up naturally.
|
|
1525
|
+
*/
|
|
1526
|
+
export declare class EmbeddedObjectComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1527
|
+
childGroup: FormGroup;
|
|
1528
|
+
readonly childInitialValues: import("@angular/core").WritableSignal<Record<string, unknown>>;
|
|
1529
|
+
ngOnInit(): void;
|
|
1530
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedObjectComponent<any>, never>;
|
|
1531
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedObjectComponent<any>, "app-embedded-object", never, {}, {}, never, never, true, never>;
|
|
1532
|
+
}
|
|
1533
|
+
interface RelatedEntityNameAttr {
|
|
1534
|
+
attrName: string;
|
|
1535
|
+
name: string;
|
|
1536
|
+
}
|
|
1537
|
+
declare class RelatedEntityRefComponent<Entity extends BaseEntity, RelatedEntity extends BaseEntity> {
|
|
1538
|
+
entity: InputSignal<Entity>;
|
|
1539
|
+
relatedEntity: InputSignal<PersistedEntity<RelatedEntity>>;
|
|
1540
|
+
relatedEntityNameAttr: InputSignal<RelatedEntityNameAttr>;
|
|
1541
|
+
disabled: InputSignal<boolean>;
|
|
1542
|
+
/**
|
|
1543
|
+
* Which field of a raw row carries the id, when it is not `id` — the owning attribute's
|
|
1544
|
+
* `referenceIdField`. Needed on this component and not only on the list, because removal filters the
|
|
1545
|
+
* attribute's raw value and has to resolve each item's id the same way the rendering did.
|
|
1546
|
+
*/
|
|
1547
|
+
referenceIdField: InputSignal<string | undefined>;
|
|
1548
|
+
formGroup: InputSignal<FormGroup>;
|
|
1549
|
+
linkedEntityType: InputSignal<string>;
|
|
1550
|
+
private readonly formNavigator;
|
|
1551
|
+
relatedEntityName(): string;
|
|
1552
|
+
navigateToRelated(event: Event): void;
|
|
1553
|
+
removeRelatedEntity(): void;
|
|
1554
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RelatedEntityRefComponent<any, any>, never>;
|
|
1555
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RelatedEntityRefComponent<any, any>, "app-related-entity-ref", never, {
|
|
1556
|
+
"entity": {
|
|
1557
|
+
"alias": "entity";
|
|
1558
|
+
"required": true;
|
|
1559
|
+
"isSignal": true;
|
|
1560
|
+
};
|
|
1561
|
+
"relatedEntity": {
|
|
1562
|
+
"alias": "relatedEntity";
|
|
1563
|
+
"required": true;
|
|
1564
|
+
"isSignal": true;
|
|
1565
|
+
};
|
|
1566
|
+
"relatedEntityNameAttr": {
|
|
1567
|
+
"alias": "relatedEntityNameAttr";
|
|
1568
|
+
"required": true;
|
|
1569
|
+
"isSignal": true;
|
|
1570
|
+
};
|
|
1571
|
+
"disabled": {
|
|
1572
|
+
"alias": "disabled";
|
|
1573
|
+
"required": false;
|
|
1574
|
+
"isSignal": true;
|
|
1575
|
+
};
|
|
1576
|
+
"referenceIdField": {
|
|
1577
|
+
"alias": "referenceIdField";
|
|
1578
|
+
"required": false;
|
|
1579
|
+
"isSignal": true;
|
|
1580
|
+
};
|
|
1581
|
+
"formGroup": {
|
|
1582
|
+
"alias": "formGroup";
|
|
1583
|
+
"required": true;
|
|
1584
|
+
"isSignal": true;
|
|
1585
|
+
};
|
|
1586
|
+
"linkedEntityType": {
|
|
1587
|
+
"alias": "linkedEntityType";
|
|
1588
|
+
"required": true;
|
|
1589
|
+
"isSignal": true;
|
|
1590
|
+
};
|
|
1591
|
+
}, {}, never, never, true, never>;
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* To-many **association**: the rows point at entities that exist independently of this one, so adding
|
|
1595
|
+
* picks an existing entity from the related list and deleting only detaches the reference. Containment —
|
|
1596
|
+
* where the related entity has exactly one owner and dies with the reference — is a different control type
|
|
1597
|
+
* (`COMPONENTS`), so do not extend this one with delete-the-entity behavior.
|
|
1598
|
+
*/
|
|
1599
|
+
export declare class RelatedEntitiesListComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1600
|
+
ngOnInit(): void;
|
|
1601
|
+
relatedEntityNameAttr(): RelatedEntityNameAttr;
|
|
1602
|
+
relatedEntities(): PersistedEntity<BaseEntity>[];
|
|
1603
|
+
addRelatedEntityTitle(): string;
|
|
1604
|
+
navigateToRelatedList(): void;
|
|
1605
|
+
private addSelectedEntityFromNavigatorResponse;
|
|
1606
|
+
private describeFormState;
|
|
1607
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RelatedEntitiesListComponent<any>, never>;
|
|
1608
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RelatedEntitiesListComponent<any>, "app-related-entities-list", never, {}, {}, never, never, true, never>;
|
|
1609
|
+
}
|
|
1610
|
+
/** Rich text as Tiptap's JSON document — `{ type: 'doc', content: [...] }` — the format it is stored in. */
|
|
1611
|
+
type RichTextContent = JSONContent;
|
|
1612
|
+
/** What an editor without content of its own starts with: one empty paragraph, so the caret has a home. */
|
|
1613
|
+
export declare const EMPTY_RICH_TEXT: RichTextContent;
|
|
1614
|
+
/** True when the document holds no text and no leaf node such as a horizontal rule — what an untouched editor holds. */
|
|
1615
|
+
export declare function isRichTextEmpty(content: RichTextContent | null | undefined): boolean;
|
|
1616
|
+
/**
|
|
1617
|
+
* One Tiptap `Editor` on StarterKit, with the formatting toolbar above it while it is editable.
|
|
1618
|
+
*
|
|
1619
|
+
* Content travels as Tiptap JSON rather than HTML: it is stored that way, and rendering it back through an
|
|
1620
|
+
* editor means only nodes StarterKit (plus `extensions`) defines can ever appear — there is no markup to
|
|
1621
|
+
* sanitize. With `editable` off the same component is the read-only rendering, without the toolbar.
|
|
1622
|
+
*
|
|
1623
|
+
* The toolbar sits in the flow rather than over the text, as base-document's floating one does: in a narrow form
|
|
1624
|
+
* column it wraps onto a second row, and a floating bar would then cover the first line being typed.
|
|
1625
|
+
*
|
|
1626
|
+
* `content` is the initial document and may be replaced later; a value equal to what the editor already holds
|
|
1627
|
+
* is ignored, so feeding `contentChange` straight back does not reset the caret.
|
|
1628
|
+
*/
|
|
1629
|
+
export declare class RichTextEditorComponent implements AfterViewInit, OnDestroy {
|
|
1630
|
+
readonly content: import("@angular/core").InputSignal<JSONContent | null | undefined>;
|
|
1631
|
+
readonly editable: import("@angular/core").InputSignal<boolean>;
|
|
1632
|
+
readonly placeholder: import("@angular/core").InputSignal<string>;
|
|
1633
|
+
/** Added to StarterKit — e.g. base-document's widget embed. Read once, when the editor is created. */
|
|
1634
|
+
readonly extensions: import("@angular/core").InputSignal<Extensions>;
|
|
1635
|
+
/** Leading part of the test ids: `<prefix>-content` here, `<prefix>-toolbar`, `<prefix>-bold`, … on the toolbar. */
|
|
1636
|
+
readonly testIdPrefix: import("@angular/core").InputSignal<string>;
|
|
1637
|
+
readonly contentChange: import("@angular/core").OutputEmitterRef<JSONContent>;
|
|
1638
|
+
/** Set once the Editor exists, so the toolbar — which needs one — can only render after ngAfterViewInit. */
|
|
1639
|
+
protected readonly editorInstance: import("@angular/core").WritableSignal<Editor | null>;
|
|
1640
|
+
protected readonly isEmpty: import("@angular/core").WritableSignal<boolean>;
|
|
1641
|
+
protected readonly isToolbarVisible: import("@angular/core").Signal<boolean>;
|
|
1642
|
+
protected readonly isPlaceholderVisible: import("@angular/core").Signal<boolean>;
|
|
1643
|
+
private readonly editorHost;
|
|
1644
|
+
constructor();
|
|
1645
|
+
ngAfterViewInit(): void;
|
|
1646
|
+
ngOnDestroy(): void;
|
|
1647
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RichTextEditorComponent, never>;
|
|
1648
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RichTextEditorComponent, "pp-rich-text-editor", never, {
|
|
1649
|
+
"content": {
|
|
1650
|
+
"alias": "content";
|
|
1651
|
+
"required": false;
|
|
1652
|
+
"isSignal": true;
|
|
1653
|
+
};
|
|
1654
|
+
"editable": {
|
|
1655
|
+
"alias": "editable";
|
|
1656
|
+
"required": false;
|
|
1657
|
+
"isSignal": true;
|
|
1658
|
+
};
|
|
1659
|
+
"placeholder": {
|
|
1660
|
+
"alias": "placeholder";
|
|
1661
|
+
"required": false;
|
|
1662
|
+
"isSignal": true;
|
|
1663
|
+
};
|
|
1664
|
+
"extensions": {
|
|
1665
|
+
"alias": "extensions";
|
|
1666
|
+
"required": false;
|
|
1667
|
+
"isSignal": true;
|
|
1668
|
+
};
|
|
1669
|
+
"testIdPrefix": {
|
|
1670
|
+
"alias": "testIdPrefix";
|
|
1671
|
+
"required": false;
|
|
1672
|
+
"isSignal": true;
|
|
1673
|
+
};
|
|
1674
|
+
}, {
|
|
1675
|
+
"contentChange": "contentChange";
|
|
1676
|
+
}, never, never, true, never>;
|
|
1677
|
+
}
|
|
1678
|
+
/**
|
|
1679
|
+
* One entry of a `COMMENTS` attribute, whose value is an array of these, oldest first.
|
|
1680
|
+
*
|
|
1681
|
+
* The same shape the backend validates and the seed data holds: `content` is Tiptap JSON, `createdAt` an
|
|
1682
|
+
* ISO-8601 instant. The history is append-only — the backend rejects a save that changes, drops or reorders a
|
|
1683
|
+
* stored entry — so nothing here is ever edited after it was saved.
|
|
1684
|
+
*/
|
|
1685
|
+
interface EntityComment {
|
|
1686
|
+
/** The name the comment is shown under, as it was when the comment was written. */
|
|
1687
|
+
author: string;
|
|
1688
|
+
/** The author's user id, when the host knows one. */
|
|
1689
|
+
authorId?: string;
|
|
1690
|
+
createdAt: string;
|
|
1691
|
+
content: RichTextContent;
|
|
1692
|
+
}
|
|
1693
|
+
/** The value of a `COMMENTS` attribute as a list — anything that is not an array holds no comments. */
|
|
1694
|
+
export declare function commentsOf(value: unknown): EntityComment[];
|
|
1695
|
+
/**
|
|
1696
|
+
* A `COMMENTS` attribute: the saved comments as a read-only history, and below it an editor for a new one.
|
|
1697
|
+
*
|
|
1698
|
+
* There is no "Add" button — a comment is written into the editor and saved with the record. While the draft
|
|
1699
|
+
* holds text the control's value is the history plus one entry stamped with the current user and the time of
|
|
1700
|
+
* the last keystroke, and the control is dirty, so the form's Save carries it. Emptying the draft puts the
|
|
1701
|
+
* history back. Once saved, the form is rebuilt from the stored record and the draft has become a history card.
|
|
1702
|
+
*
|
|
1703
|
+
* The history is the value the form was built with and is never written to, so the control can only append —
|
|
1704
|
+
* the backend enforces the same rule for every other client.
|
|
1705
|
+
*/
|
|
1706
|
+
export declare class CommentsComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> {
|
|
1707
|
+
protected readonly unknownAuthorKey = "base_entity.comments.unknown_author";
|
|
1708
|
+
protected readonly timestampFormat: DateFormat;
|
|
1709
|
+
/** The comments saved with the record — the value the form was built with, never the draft. */
|
|
1710
|
+
readonly history: import("@angular/core").Signal<EntityComment[]>;
|
|
1711
|
+
readonly draft: import("@angular/core").WritableSignal<import("@tiptap/core").JSONContent | null>;
|
|
1712
|
+
private readonly userContext;
|
|
1713
|
+
private readonly transloco;
|
|
1714
|
+
/** A disabled attribute or control shows the history alone. */
|
|
1715
|
+
isEditable(): boolean;
|
|
1716
|
+
onDraftChange(content: RichTextContent): void;
|
|
1717
|
+
private stamp;
|
|
1718
|
+
/** Stamped rather than left blank: an entry needs an author, and a reader needs more than an empty line. */
|
|
1719
|
+
private unknownAuthor;
|
|
1720
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommentsComponent<any>, never>;
|
|
1721
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CommentsComponent<any>, "base-comments", never, {}, {}, never, never, true, never>;
|
|
1722
|
+
}
|
|
1723
|
+
/**
|
|
1724
|
+
* The seam between base-entity and the host application's session: who is editing, for the controls that
|
|
1725
|
+
* record it — today the COMMENTS control, which stamps each comment with its author.
|
|
1726
|
+
*
|
|
1727
|
+
* base-entity cannot ask `@processpuzzle/auth` itself: auth depends on base-entity, not the other way round. So it
|
|
1728
|
+
* reads util's `SessionUser`, which auth keeps current — nothing to wire in a host that uses auth. A host
|
|
1729
|
+
* without it may call {@link set}, which then takes precedence, or provide its own implementation.
|
|
1730
|
+
*
|
|
1731
|
+
* Without either, a comment is attributed to an unknown author.
|
|
1732
|
+
*/
|
|
1733
|
+
export declare class EntityUserContext {
|
|
1734
|
+
private readonly sessionUser;
|
|
1735
|
+
private readonly _session;
|
|
1736
|
+
/** Empty when nobody is signed in. */
|
|
1737
|
+
readonly userId: import("@angular/core").Signal<string>;
|
|
1738
|
+
/** The name a reader recognizes the user by — empty when the host does not know one. */
|
|
1739
|
+
readonly displayName: import("@angular/core").Signal<string>;
|
|
1740
|
+
/** For a host whose session is not auth's — overrides `SessionUser` from then on. */
|
|
1741
|
+
set(session: {
|
|
1742
|
+
userId: string;
|
|
1743
|
+
displayName?: string;
|
|
1744
|
+
}): void;
|
|
1745
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityUserContext, never>;
|
|
1746
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* The ISO 3166-1 alpha-2 country codes an `ADDRESS` attribute offers.
|
|
1750
|
+
*
|
|
1751
|
+
* A static list rather than a seeded entity: the codes are a standard, not tenant data, and the browser
|
|
1752
|
+
* already knows every country's name in every language through `Intl.DisplayNames` — so the lookup needs no
|
|
1753
|
+
* backend, works the same against REST, json-server and Firestore, and is translated for free.
|
|
1754
|
+
*/
|
|
1755
|
+
export declare const COUNTRY_CODES: readonly string[];
|
|
1756
|
+
interface CountryOption {
|
|
1757
|
+
code: string;
|
|
1758
|
+
name: string;
|
|
1759
|
+
}
|
|
1760
|
+
/** The country's name in `language`, or the code itself where the runtime cannot name it. */
|
|
1761
|
+
export declare function countryName(code: string, language: string): string;
|
|
1762
|
+
/**
|
|
1763
|
+
* Every country, named in `language` and sorted the way a reader of that language expects. A language the
|
|
1764
|
+
* runtime rejects gets the codes themselves, in code order.
|
|
1765
|
+
*/
|
|
1766
|
+
export declare function countryOptions(language: string): CountryOption[];
|
|
1767
|
+
/** The region of a BCP 47 language tag (`hu-HU` → `HU`), when it names one this list knows. */
|
|
1768
|
+
declare function countryOfLanguageTag(tag: string | undefined): string | undefined;
|
|
1769
|
+
type AddressFields = {
|
|
1770
|
+
country: FormControl<string | null>;
|
|
1771
|
+
street: FormControl<string | null>;
|
|
1772
|
+
addressLine2: FormControl<string | null>;
|
|
1773
|
+
postalCode: FormControl<string | null>;
|
|
1774
|
+
city: FormControl<string | null>;
|
|
1775
|
+
region: FormControl<string | null>;
|
|
1776
|
+
latitude: FormControl<number | null>;
|
|
1777
|
+
longitude: FormControl<number | null>;
|
|
1778
|
+
};
|
|
1779
|
+
/**
|
|
1780
|
+
* An `ADDRESS` attribute: a country, and below it the address fields that country writes, in its order.
|
|
1781
|
+
*
|
|
1782
|
+
* The attribute is one form control holding a {@link PostalAddress}; the fields are a form group of this
|
|
1783
|
+
* component's own, published to that control on every change. Only the fields the selected country uses are
|
|
1784
|
+
* published, so switching countries drops what the new layout has no place for — and switching back restores
|
|
1785
|
+
* it, since the group still holds it. An address without a single line of text publishes `null`: the country a
|
|
1786
|
+
* new address starts with is a convenience, not a value.
|
|
1787
|
+
*
|
|
1788
|
+
* With `showMap` the address is also shown on a map. Its coordinates are derived from the address when an
|
|
1789
|
+
* address field is left or the country changes, and can be edited; once the user types a coordinate the pin is
|
|
1790
|
+
* theirs, and only the Locate button derives it again. A click on the map opens the location in Google Maps.
|
|
1791
|
+
*/
|
|
1792
|
+
export declare class AddressComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1793
|
+
readonly fields: FormGroup<AddressFields>;
|
|
1794
|
+
readonly locating: import("@angular/core").WritableSignal<boolean>;
|
|
1795
|
+
readonly notFound: import("@angular/core").WritableSignal<boolean>;
|
|
1796
|
+
private readonly activeLang;
|
|
1797
|
+
private readonly geocoder;
|
|
1798
|
+
private readonly destroyRef;
|
|
1799
|
+
private readonly country;
|
|
1800
|
+
private readonly location;
|
|
1801
|
+
private locationSource;
|
|
1802
|
+
/** The address the coordinates were last derived for — leaving a field without changing it asks nobody. */
|
|
1803
|
+
private geocodedFor;
|
|
1804
|
+
readonly format: import("@angular/core").Signal<import("@processpuzzle/base-entity").AddressFormat>;
|
|
1805
|
+
readonly countries: import("@angular/core").Signal<CountryOption[]>;
|
|
1806
|
+
readonly mapUrl: import("@angular/core").Signal<string | undefined>;
|
|
1807
|
+
readonly openUrl: import("@angular/core").Signal<string | undefined>;
|
|
1808
|
+
private readonly mapFrame;
|
|
1809
|
+
constructor();
|
|
1810
|
+
ngOnInit(): void;
|
|
1811
|
+
/** A disabled attribute or control shows the address without a Locate button. */
|
|
1812
|
+
isEditable(): boolean;
|
|
1813
|
+
/** An address field was left or the country changed — the moment to place the pin, if it is ours to place. */
|
|
1814
|
+
onAddressChanged(): void;
|
|
1815
|
+
/** The user typed a coordinate: from now on the pin stays where they put it. */
|
|
1816
|
+
onCoordinateTyped(): void;
|
|
1817
|
+
/**
|
|
1818
|
+
* Derives the coordinates from the address. Pressed as the Locate button (`force`), it also takes the pin
|
|
1819
|
+
* back from the user; called after a field was left, it gives up if the user typed a coordinate meanwhile.
|
|
1820
|
+
*/
|
|
1821
|
+
locate(force?: boolean): Promise<void>;
|
|
1822
|
+
private readonly fieldsValidator;
|
|
1823
|
+
private control;
|
|
1824
|
+
private publish;
|
|
1825
|
+
/** What the fields hold, reduced to the parts the selected country uses — the value the attribute is saved with. */
|
|
1826
|
+
private currentAddress;
|
|
1827
|
+
private queryOf;
|
|
1828
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AddressComponent<any>, never>;
|
|
1829
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AddressComponent<any>, "base-address", never, {}, {}, never, never, true, never>;
|
|
1830
|
+
}
|
|
1831
|
+
/** The i18n keys, under `base_entity.address.`, a field may be labelled with. */
|
|
1832
|
+
type AddressFieldLabel = 'street' | 'address_line2' | 'postal_code' | 'zip_code' | 'postcode' | 'city' | 'town' | 'region' | 'state' | 'province' | 'county' | 'prefecture' | 'canton';
|
|
1833
|
+
interface AddressFieldLayout {
|
|
1834
|
+
field: AddressLineField;
|
|
1835
|
+
label: AddressFieldLabel;
|
|
1836
|
+
/** Share of the row's width, as a flex-grow factor — a postal code is narrower than a city. */
|
|
1837
|
+
grow: number;
|
|
1838
|
+
}
|
|
1839
|
+
/**
|
|
1840
|
+
* How one country writes its addresses: the lines in the order they are written, each a row of fields.
|
|
1841
|
+
*
|
|
1842
|
+
* A field a country does not use — a region in Germany, say — is simply not in its layout, and so not offered.
|
|
1843
|
+
* The same layout orders the one-line rendering lists and PDF exports show.
|
|
1844
|
+
*/
|
|
1845
|
+
interface AddressFormat {
|
|
1846
|
+
lines: AddressFieldLayout[][];
|
|
1847
|
+
}
|
|
1848
|
+
/** For a country without a format of its own: every field, international order. */
|
|
1849
|
+
declare const DEFAULT_ADDRESS_FORMAT: AddressFormat;
|
|
1850
|
+
/** The format of a country, by its ISO 3166-1 alpha-2 code; the international default for any other. */
|
|
1851
|
+
export declare function addressFormatOf(country: string | undefined): AddressFormat;
|
|
1852
|
+
/**
|
|
1853
|
+
* The address on one line, in the order its country writes it, with the country's name last — for list
|
|
1854
|
+
* cells, PDF exports and a geocoder's free-text query. Empty when the address holds nothing.
|
|
1855
|
+
*/
|
|
1856
|
+
export declare function formatAddress(address: PostalAddress, countryName?: (code: string) => string): string;
|
|
1857
|
+
/**
|
|
1858
|
+
* An `ADDRESS` value on one line, in its country's order, the country named in the active language.
|
|
1859
|
+
*
|
|
1860
|
+
* Usage: `{{ row[attr.attrName] | ppAddress }}`. Impure so it re-renders on a language switch, as `ppDate` does.
|
|
1861
|
+
*/
|
|
1862
|
+
export declare class AddressPipe implements PipeTransform {
|
|
1863
|
+
private readonly activeLang;
|
|
1864
|
+
transform(value: unknown): string;
|
|
1865
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AddressPipe, never>;
|
|
1866
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<AddressPipe, "ppAddress", true>;
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* Finds the coordinates of an address — how an `ADDRESS` attribute with a map places its pin.
|
|
1870
|
+
*
|
|
1871
|
+
* The default asks OpenStreetMap's public Nominatim service. A host that needs another geocoder — its own
|
|
1872
|
+
* Nominatim, Google's Geocoding API — provides a replacement:
|
|
1873
|
+
*
|
|
1874
|
+
* ```ts
|
|
1875
|
+
* providers: [{ provide: AddressGeocoder, useClass: MyGeocoder }]
|
|
1876
|
+
* ```
|
|
1877
|
+
*
|
|
1878
|
+
* Nominatim's usage policy allows about one request a second and no autocomplete, which is why the control
|
|
1879
|
+
* geocodes when an address field is left rather than on every keystroke.
|
|
1880
|
+
*/
|
|
1881
|
+
export declare class AddressGeocoder {
|
|
1882
|
+
protected readonly endpoint: string;
|
|
1883
|
+
/** The address's coordinates, or `undefined` when it cannot be found or the service does not answer. */
|
|
1884
|
+
geocode(address: PostalAddress, language?: string): Promise<GeoPoint | undefined>;
|
|
1885
|
+
/** Nominatim's structured query: one parameter per address part rather than a free-text string. */
|
|
1886
|
+
protected query(address: PostalAddress, language?: string): string;
|
|
1887
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AddressGeocoder, never>;
|
|
1888
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* The value of a `GEO_LOCATION` attribute: where the device was when the user pressed the control's button.
|
|
1892
|
+
*
|
|
1893
|
+
* `accuracy` is the radius of the device's uncertainty in metres, `capturedAt` the ISO 8601 instant of the
|
|
1894
|
+
* reading. Both come from the browser's Geolocation API; neither is typed by a user.
|
|
1895
|
+
*/
|
|
1896
|
+
interface GeoLocation extends GeoPoint {
|
|
1897
|
+
accuracy?: number;
|
|
1898
|
+
capturedAt?: string;
|
|
1899
|
+
}
|
|
1900
|
+
/** The value of a `GEO_LOCATION` attribute as a location — anything without two valid coordinates holds none. */
|
|
1901
|
+
export declare function geoLocationOf(value: unknown): GeoLocation | undefined;
|
|
1902
|
+
/** The coordinates on one line — `47.497900, 19.040200 (±12 m)` — or an empty string when the value holds none. */
|
|
1903
|
+
export declare function formatGeoLocation(value: unknown): string;
|
|
1904
|
+
/** Why a reading failed — the codes of `GeolocationPositionError`, plus `UNAVAILABLE` for a browser without the API. */
|
|
1905
|
+
type GeoLocatorError = 'PERMISSION_DENIED' | 'POSITION_UNAVAILABLE' | 'TIMEOUT' | 'UNAVAILABLE';
|
|
1906
|
+
export declare class GeoLocatorFailure extends Error {
|
|
1907
|
+
readonly reason: GeoLocatorError;
|
|
1908
|
+
constructor(reason: GeoLocatorError);
|
|
1909
|
+
}
|
|
1910
|
+
/**
|
|
1911
|
+
* Reads the device's current location — how a `GEO_LOCATION` attribute fills itself.
|
|
1912
|
+
*
|
|
1913
|
+
* The default asks the browser's Geolocation API, which only exists in a secure context (HTTPS or localhost).
|
|
1914
|
+
* A host that knows the location otherwise — a native shell, a fixed kiosk position — provides a replacement:
|
|
1915
|
+
*
|
|
1916
|
+
* ```ts
|
|
1917
|
+
* providers: [{ provide: GeoLocator, useClass: MyGeoLocator }]
|
|
1918
|
+
* ```
|
|
1919
|
+
*/
|
|
1920
|
+
export declare class GeoLocator {
|
|
1921
|
+
/** Whether a location can be asked for at all: the API exists here. The user may still refuse it. */
|
|
1922
|
+
isAvailable(): boolean;
|
|
1923
|
+
/**
|
|
1924
|
+
* Whether the user has already refused location access for this site. Resolves `false` when the browser
|
|
1925
|
+
* cannot tell — the request itself then finds out. `onChange` is called when the user changes their mind.
|
|
1926
|
+
*/
|
|
1927
|
+
isDenied(onChange?: (denied: boolean) => void): Promise<boolean>;
|
|
1928
|
+
/** The current location, or a {@link GeoLocatorFailure} saying why there is none. */
|
|
1929
|
+
locate(): Promise<GeoLocation>;
|
|
1930
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GeoLocator, never>;
|
|
1931
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1932
|
+
}
|
|
1933
|
+
/**
|
|
1934
|
+
* A `GEO_LOCATION` attribute: the device's location at the moment the user pressed the button.
|
|
1935
|
+
*
|
|
1936
|
+
* The location is shown, never typed — coordinates are what the device read, not what someone claims. Pressing
|
|
1937
|
+
* the button again replaces it with a fresh reading, and the new value dirties the form, so Save is offered.
|
|
1938
|
+
* The button is disabled where no location can be had: a browser without the Geolocation API, an insecure
|
|
1939
|
+
* origin, or a user who has refused this site location access.
|
|
1940
|
+
*/
|
|
1941
|
+
export declare class GeoLocationComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
|
|
1942
|
+
readonly capturedAtFormat: Readonly<Required<import("@processpuzzle/base-entity").DateFormat>>;
|
|
1943
|
+
readonly locating: import("@angular/core").WritableSignal<boolean>;
|
|
1944
|
+
readonly failure: import("@angular/core").WritableSignal<GeoLocatorError | undefined>;
|
|
1945
|
+
readonly location: import("@angular/core").WritableSignal<GeoLocation | undefined>;
|
|
1946
|
+
readonly text: import("@angular/core").Signal<string>;
|
|
1947
|
+
readonly openUrl: import("@angular/core").Signal<string | undefined>;
|
|
1948
|
+
private readonly locator;
|
|
1949
|
+
private readonly destroyRef;
|
|
1950
|
+
private readonly denied;
|
|
1951
|
+
private readonly available;
|
|
1952
|
+
/** No API, or a refusal the user has to lift in the browser's site settings — pressing would do nothing. */
|
|
1953
|
+
readonly unavailable: import("@angular/core").Signal<boolean>;
|
|
1954
|
+
ngOnInit(): void;
|
|
1955
|
+
/** A disabled attribute or control shows the location without the button. */
|
|
1956
|
+
isEditable(): boolean;
|
|
1957
|
+
/** Reads the current location and makes it the attribute's value, replacing any earlier one. */
|
|
1958
|
+
capture(): Promise<void>;
|
|
1959
|
+
private control;
|
|
1960
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GeoLocationComponent<any>, never>;
|
|
1961
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<GeoLocationComponent<any>, "base-geo-location", never, {}, {}, never, never, true, never>;
|
|
1962
|
+
}
|
|
1963
|
+
/** A `GEO_LOCATION` value on one line. Usage: `{{ row[attr.attrName] | ppGeoLocation }}`. */
|
|
1964
|
+
export declare class GeoLocationPipe implements PipeTransform {
|
|
1965
|
+
transform(value: unknown): string;
|
|
1966
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GeoLocationPipe, never>;
|
|
1967
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<GeoLocationPipe, "ppGeoLocation", true>;
|
|
1968
|
+
}
|
|
1969
|
+
/** One button: what it looks like, when it is lit, and what it does to the block being edited. */
|
|
1970
|
+
interface ToolbarAction {
|
|
1971
|
+
/** Doubles as the i18n key under `base_entity.rich_text.toolbar` and as the test-id suffix. */
|
|
1972
|
+
readonly name: string;
|
|
1973
|
+
readonly icon: string;
|
|
1974
|
+
/** Absent for actions with no on/off state — undo has nothing to be "on". */
|
|
1975
|
+
readonly activeWhen?: (editor: Editor) => boolean;
|
|
1976
|
+
/** Absent for actions that are always available. */
|
|
1977
|
+
readonly enabledWhen?: (editor: Editor) => boolean;
|
|
1978
|
+
readonly apply: (editor: Editor) => void;
|
|
1979
|
+
/** Draws a separator before this button, grouping marks / blocks / lists / history. */
|
|
1980
|
+
readonly startsGroup?: boolean;
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* The formatting bar of one Tiptap `Editor` — a document's TEXT block, a comment being written. It is per
|
|
1984
|
+
* editor rather than one bar per page because every command it issues targets a single `Editor`: a page-level
|
|
1985
|
+
* bar would have to track which of N editors last had the caret, and would sit a screen away from it. Absolutely
|
|
1986
|
+
* positioned, so a host either reserves a strip above the editor to draw it into — base-document's blocks do, and
|
|
1987
|
+
* appearing shifts nothing — or puts it back in the flow, as RichTextEditorComponent does.
|
|
1988
|
+
*
|
|
1989
|
+
* Lives in base-entity rather than base-document because both features edit rich text and base-entity is the
|
|
1990
|
+
* one the other depends on. `testIdPrefix` keeps the test ids each caller's e2e suite already selects by.
|
|
1991
|
+
*
|
|
1992
|
+
* `mousedown` is cancelled on every button: pressing one must not move focus out of the editor, or the command
|
|
1993
|
+
* would run against a collapsed, blurred selection and the caret would be lost after each click.
|
|
1994
|
+
*/
|
|
1995
|
+
export declare class RichTextToolbarComponent {
|
|
1996
|
+
readonly editor: import("@angular/core").InputSignal<Editor>;
|
|
1997
|
+
/** Leading part of every test id: `<prefix>-toolbar`, `<prefix>-bold`, … */
|
|
1998
|
+
readonly testIdPrefix: import("@angular/core").InputSignal<string>;
|
|
1999
|
+
protected readonly actions: readonly ToolbarAction[];
|
|
2000
|
+
/**
|
|
2001
|
+
* Bumped on every ProseMirror transaction, which is what makes the lit buttons follow the caret: Tiptap's
|
|
2002
|
+
* state lives outside Angular, so `isActive` has nothing to depend on until a signal stands in for it.
|
|
2003
|
+
*/
|
|
2004
|
+
private readonly revision;
|
|
2005
|
+
constructor();
|
|
2006
|
+
protected readonly activeActions: import("@angular/core").Signal<Set<string>>;
|
|
2007
|
+
protected readonly disabledActions: import("@angular/core").Signal<Set<string>>;
|
|
2008
|
+
protected testIdOf(action: ToolbarAction): string;
|
|
2009
|
+
protected onApply(action: ToolbarAction): void;
|
|
2010
|
+
private namesMatching;
|
|
2011
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RichTextToolbarComponent, never>;
|
|
2012
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RichTextToolbarComponent, "pp-rich-text-toolbar", never, {
|
|
2013
|
+
"editor": {
|
|
2014
|
+
"alias": "editor";
|
|
2015
|
+
"required": true;
|
|
2016
|
+
"isSignal": true;
|
|
2017
|
+
};
|
|
2018
|
+
"testIdPrefix": {
|
|
2019
|
+
"alias": "testIdPrefix";
|
|
2020
|
+
"required": false;
|
|
2021
|
+
"isSignal": true;
|
|
2022
|
+
};
|
|
2023
|
+
}, {}, never, never, true, never>;
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* Resolves `key` through Transloco, returning `fallback` when the key is absent or unresolved. Shared
|
|
2027
|
+
* by {@link EntityLabelPipe} and the components that need the resolved label as a translation
|
|
2028
|
+
* parameter rather than as rendered text.
|
|
2029
|
+
*
|
|
2030
|
+
* The loaded translation is consulted before `translate()` — the same lookup transloco itself
|
|
2031
|
+
* performs — because an absent key would otherwise go through the missing-key handler, which logs a
|
|
2032
|
+
* warning. Falling back is normal here, not a defect: a descriptor may declare no `i18nScope` at all,
|
|
2033
|
+
* and a lazily-loaded scope is still absent on the renders that precede its load.
|
|
2034
|
+
*/
|
|
2035
|
+
export declare function translateLabel(transloco: TranslocoService, key: string | undefined, fallback: string): string;
|
|
2036
|
+
/**
|
|
2037
|
+
* Translates an entity/attribute name and falls back to the descriptor-provided name.
|
|
2038
|
+
*
|
|
2039
|
+
* Usage: `{{ descriptor.i18nKey() | ppLabel: descriptor.label }}`.
|
|
2040
|
+
*
|
|
2041
|
+
* `key` is the full transloco key (`<scope>.<entity>[.<attr>]`) produced by
|
|
2042
|
+
* {@link BaseEntityDescriptor.i18nKey} / {@link AbstractAttrDescriptor.i18nKey}. When it is
|
|
2043
|
+
* `undefined` (no i18nScope declared) or the key is missing from the loaded translations, the
|
|
2044
|
+
* `fallback` — the raw name held on the descriptor — is returned unchanged.
|
|
2045
|
+
*
|
|
2046
|
+
* Impure so it re-evaluates when the active language or a lazy scope finishes loading.
|
|
2047
|
+
*/
|
|
2048
|
+
export declare class EntityLabelPipe implements PipeTransform, OnDestroy {
|
|
2049
|
+
private readonly transloco;
|
|
2050
|
+
private readonly changeDetectorRef;
|
|
2051
|
+
private readonly subscription;
|
|
2052
|
+
constructor();
|
|
2053
|
+
transform(key: string | undefined, fallback: string): string;
|
|
2054
|
+
ngOnDestroy(): void;
|
|
2055
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityLabelPipe, never>;
|
|
2056
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<EntityLabelPipe, "ppLabel", true>;
|
|
2057
|
+
}
|
|
2058
|
+
/**
|
|
2059
|
+
* Renders a DATE / DATE_TIME value in its attribute's {@link DateFormat}, in the active language.
|
|
2060
|
+
*
|
|
2061
|
+
* Usage: `{{ row[attr.attrName] | ppDate: attr.dateFormat }}`. A value that is not a date passes through.
|
|
2062
|
+
*
|
|
2063
|
+
* Impure so it re-renders on a language switch; reading the language signal inside `transform` is what
|
|
2064
|
+
* marks the view for check when it changes.
|
|
2065
|
+
*/
|
|
2066
|
+
export declare class DateFormatPipe implements PipeTransform {
|
|
2067
|
+
private readonly activeLang;
|
|
2068
|
+
transform(value: unknown, dateFormat?: DateFormat): unknown;
|
|
2069
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DateFormatPipe, never>;
|
|
2070
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<DateFormatPipe, "ppDate", true>;
|
|
2071
|
+
}
|
|
2072
|
+
/**
|
|
2073
|
+
* A {@link NativeDateAdapter} that reads typed dates the way the active locale writes them.
|
|
2074
|
+
*
|
|
2075
|
+
* The native adapter parses with `Date.parse`, which only understands ISO and US-ordered input: `09.12.1960`
|
|
2076
|
+
* typed under `de` comes back invalid, and `1960. 12. 09.` under `hu` too. This one accepts, in order:
|
|
2077
|
+
* ISO (`1960-12-09`, `1960-12-09T10:00:00Z`), then numbers in the locale's year/month/day order with any
|
|
2078
|
+
* separators, a month written as a name (`9. Dez. 1960`, `1960. dec. 9.`) included. Anything else falls back
|
|
2079
|
+
* to the native parse. Formatting is the native adapter's already: it calls `Intl` with the display options.
|
|
2080
|
+
*/
|
|
2081
|
+
export declare class LocaleDateAdapter extends NativeDateAdapter {
|
|
2082
|
+
parse(value: unknown, parseFormat?: unknown): Date | null;
|
|
2083
|
+
/** `YYYY-MM-DD` as local midnight; the native adapter reads it as UTC midnight, the day before west of Greenwich. */
|
|
2084
|
+
deserialize(value: unknown): Date | null;
|
|
2085
|
+
private parseLocaleOrdered;
|
|
2086
|
+
private partOrder;
|
|
2087
|
+
/** The month index a word names in the locale, by its long or short name; weekday names match nothing. */
|
|
2088
|
+
private monthOf;
|
|
2089
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocaleDateAdapter, never>;
|
|
2090
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2091
|
+
}
|
|
2092
|
+
/**
|
|
2093
|
+
* Registers {@link LocaleDateAdapter} in place of `provideNativeDateAdapter()`, and keeps its locale on the
|
|
2094
|
+
* active Transloco language, so an open datepicker re-renders on a language switch. Without Transloco the
|
|
2095
|
+
* adapter keeps `MAT_DATE_LOCALE`.
|
|
2096
|
+
*/
|
|
2097
|
+
export declare function provideLocaleDateAdapter(): EnvironmentProviders;
|
|
2098
|
+
export declare const BASE_LIST_DESCRIPTORS: InjectionToken<string[]>;
|
|
2099
|
+
export declare class BaseEntityListComponent<Entity extends BaseEntity> implements AfterViewInit, OnInit {
|
|
2100
|
+
dataSource: MatTableDataSource<PersistedEntity<Entity>>;
|
|
2101
|
+
selection: SelectionModel<PersistedEntity<Entity>>;
|
|
2102
|
+
protected readonly entityDescriptor: Signal<BaseEntityDescriptor>;
|
|
2103
|
+
private readonly logger;
|
|
2104
|
+
private readonly formNavigator;
|
|
2105
|
+
private readonly objectStoreService;
|
|
2106
|
+
private readonly foreignKeyLabels;
|
|
2107
|
+
columnDescriptors: Signal<BaseEntityAttrDescriptor[]>;
|
|
2108
|
+
displayedColumns: Signal<string[]>;
|
|
2109
|
+
sort: MatSort;
|
|
2110
|
+
paginator: MatPaginator;
|
|
2111
|
+
store: BaseEntityStoreApi<PersistedEntity<Entity>>;
|
|
2112
|
+
protected selectOrCreateMode: import("@angular/core").WritableSignal<boolean>;
|
|
2113
|
+
private requestPayload?;
|
|
2114
|
+
constructor();
|
|
2115
|
+
ngAfterViewInit(): void;
|
|
2116
|
+
ngOnInit(): void;
|
|
2117
|
+
onChangeSelection(entity?: PersistedEntity<Entity>): void;
|
|
2118
|
+
onNavigateToDetails(entity: PersistedEntity<Entity>): void;
|
|
2119
|
+
onNavigateToRelated(config: BaseEntityAttrDescriptor, entity: PersistedEntity<Entity>): void;
|
|
2120
|
+
onRowClick(entity: PersistedEntity<Entity>): void;
|
|
2121
|
+
/** A FOREIGN_KEY cell shows the linked object's identifying attribute, as the form does, not its id. */
|
|
2122
|
+
foreignKeyLabel(config: BaseEntityAttrDescriptor, entity: PersistedEntity<Entity>): string;
|
|
2123
|
+
/** An ARTIFACT cell's value as a list: a multi-valued attribute holds an array, a single-valued one an object. */
|
|
2124
|
+
artifactsOf(value: unknown): ArtifactAttr[];
|
|
2125
|
+
/** A COMMENTS cell shows how many comments the record has, not the comments. */
|
|
2126
|
+
commentCount(value: unknown): number;
|
|
2127
|
+
onDownloadObject(artifact: ArtifactAttr, event?: MouseEvent): void;
|
|
2128
|
+
onToggleAllRows(): void;
|
|
2129
|
+
onCancelSelectOrCreate(): Promise<void>;
|
|
2130
|
+
onSelectEntity(): Promise<void>;
|
|
2131
|
+
private cancelSelections;
|
|
2132
|
+
private doFilter;
|
|
2133
|
+
private getPropertyValue;
|
|
2134
|
+
private loadAllData;
|
|
2135
|
+
protected registerEffects(): void;
|
|
2136
|
+
isAllSelected(): boolean;
|
|
2137
|
+
isSelected(row: PersistedEntity<Entity>): boolean;
|
|
2138
|
+
canSelectEntity(): boolean;
|
|
2139
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityListComponent<any>, never>;
|
|
2140
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityListComponent<any>, "base-list", never, {}, {}, never, never, true, never>;
|
|
2141
|
+
}
|
|
2142
|
+
export declare const ACTIVE_ENTITY_FACADE: InjectionToken<BaseEntityFacade<BaseEntity>>;
|
|
2143
|
+
interface EntityTabsState {
|
|
2144
|
+
activeTabs: string[];
|
|
2145
|
+
currentTab: string | undefined;
|
|
2146
|
+
}
|
|
2147
|
+
export declare function BaseEntityTabsStore(): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
2148
|
+
state: {
|
|
2149
|
+
activeTabs: string[];
|
|
2150
|
+
currentTab: string | undefined;
|
|
2151
|
+
};
|
|
2152
|
+
props: {};
|
|
2153
|
+
methods: {
|
|
2154
|
+
reset: () => void;
|
|
2155
|
+
tabIsActive: (tabName: string) => void;
|
|
2156
|
+
tabIsInactive: (tabName: string) => void;
|
|
2157
|
+
};
|
|
2158
|
+
}>;
|
|
2159
|
+
type BaseEntityFacadeRegistry = Record<string, ProviderToken<BaseEntityFacade<BaseEntity>>>;
|
|
2160
|
+
export declare const BASE_ENTITY_FACADE_REGISTRY: InjectionToken<BaseEntityFacadeRegistry>;
|
|
2161
|
+
export declare class EntityRegistryComponent {
|
|
2162
|
+
private readonly registry;
|
|
2163
|
+
private readonly injector;
|
|
2164
|
+
private readonly entityRouteRegistry;
|
|
2165
|
+
private readonly queryParams;
|
|
2166
|
+
private readonly descriptors;
|
|
2167
|
+
protected registryJson: import("@angular/core").Signal<string>;
|
|
2168
|
+
private buildDescriptors;
|
|
2169
|
+
private serializeAttr;
|
|
2170
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityRegistryComponent, never>;
|
|
2171
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EntityRegistryComponent, "pp-entity-registry", never, {}, {}, never, never, true, never>;
|
|
2172
|
+
}
|
|
2173
|
+
/**
|
|
2174
|
+
* The knowledge layer of `base-entity-api.yaml` as the frontend reads it: what an entity *type* is,
|
|
2175
|
+
* declared as data rather than as a TypeScript class with a `BaseEntityFacade` beside it.
|
|
2176
|
+
*
|
|
2177
|
+
* The model is read by two surfaces and it is deliberately one model for both. At **run time** a
|
|
2178
|
+
* definition arrives as JSON and is turned into a `BaseEntityDescriptor` by
|
|
2179
|
+
* `dynamic-entity.descriptor.ts`, so the descriptor is the thing the framework already knows how to
|
|
2180
|
+
* render. In the **designer** the very same rows are the entity being edited — see
|
|
2181
|
+
* `base-entity-authoring/` — which is what keeps the modelling tool and the runtime from drifting apart.
|
|
2182
|
+
*
|
|
2183
|
+
* Classes rather than interfaces, and only because of that second surface: `BaseEntityStore.createEntity()`
|
|
2184
|
+
* mints the blank row an `Add` opens a form on, and that needs a constructor. They stay plain data — a
|
|
2185
|
+
* definition read by `EntityDefinitionService` is the parsed JSON, never an instance of these classes, so
|
|
2186
|
+
* nothing may rely on `instanceof` or on a method.
|
|
2187
|
+
*
|
|
2188
|
+
* Field names mirror the contract exactly. Where the contract and the frontend disagree — its
|
|
2189
|
+
* `formControlType` enum is a superset of `FormControlType`, its `code`s are what the descriptor calls
|
|
2190
|
+
* entity *names* — the translation is the descriptor factory's job and is documented there.
|
|
2191
|
+
*/
|
|
2192
|
+
/**
|
|
2193
|
+
* `EntityDefinitionStatus` of the contract: the definition's lifecycle, as its designer decides it. Whether it is
|
|
2194
|
+
* live is its {@link ReleaseState}. `DRAFT` is retired — the backend stores it as `ACTIVE` — and is kept in the type
|
|
2195
|
+
* only for what an older backend may still answer.
|
|
2196
|
+
*/
|
|
2197
|
+
type EntityDefinitionStatus = 'DRAFT' | 'ACTIVE' | 'DEPRECATED';
|
|
2198
|
+
/** `ValueKind` of the contract: what the attribute's value *is*, as opposed to how it is edited. */
|
|
2199
|
+
type EntityValueKind = 'TEXT' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'DATE_TIME' | 'ENUM' | 'REFERENCE';
|
|
2200
|
+
/**
|
|
2201
|
+
* The three enums of the contract, as the authoring form's dropdown options.
|
|
2202
|
+
*
|
|
2203
|
+
* Spelled out next to the types they enumerate rather than derived from anything: a TypeScript union has
|
|
2204
|
+
* no run-time representation, so the list and the type have to be written twice — declaring them side by
|
|
2205
|
+
* side is what makes a divergence visible in one diff.
|
|
2206
|
+
*
|
|
2207
|
+
* {@link ENTITY_FORM_CONTROL_TYPES} is the **contract's** `FormControlType`, which is what the backend
|
|
2208
|
+
* validates a definition against — not the `FormControlType` of `abstact-attr.descriptor.ts`, whose extra
|
|
2209
|
+
* members (`ADDITIONAL_PROPERTIES`, `FLEX_BOX`, `LABEL`, `TAGS`, `TITLE`) are rendering concerns a
|
|
2210
|
+
* definition cannot name. `CONTROL_TYPES` in `dynamic-entity.descriptor.ts` maps one onto the other.
|
|
2211
|
+
*/
|
|
2212
|
+
export declare const ENTITY_DEFINITION_STATUSES: readonly EntityDefinitionStatus[];
|
|
2213
|
+
export declare const ENTITY_VALUE_KINDS: readonly EntityValueKind[];
|
|
2214
|
+
export declare const ENTITY_FORM_CONTROL_TYPES: readonly string[];
|
|
2215
|
+
/**
|
|
2216
|
+
* One attribute of a definition — the contract's `BaseEntityAttribute`.
|
|
2217
|
+
*
|
|
2218
|
+
* `formControlType` is a plain string rather than the frontend's `FormControlType` enum: the contract
|
|
2219
|
+
* declares control types the frontend has no component for (`TEXT`, `NUMBER`, `ENUM_SELECT`, …), and
|
|
2220
|
+
* narrowing here would push the mapping into a cast at the parse boundary, where there is nothing
|
|
2221
|
+
* sensible to do about a value that does not fit.
|
|
2222
|
+
*/
|
|
2223
|
+
export declare class EntityAttributeDefinition implements BaseEntity {
|
|
2224
|
+
/**
|
|
2225
|
+
* Declared, never assigned. The contract does give an attribute a read-only `id`, but nothing addresses
|
|
2226
|
+
* one by it: `code` is unique within the definition, it is the path segment of
|
|
2227
|
+
* `PUT .../attributes/{attributeCode}`, and it is what `ENTITY_ATTRIBUTE_ID_FIELD` points the embedded
|
|
2228
|
+
* list at. `BaseEntity`'s only property is an optional `id` and TypeScript's weak-type rule rejects a
|
|
2229
|
+
* type sharing no property with it, so the field is declared to satisfy that — `declare` emits nothing,
|
|
2230
|
+
* and the payload stays exactly the shape `BaseEntityAttributeInput` describes.
|
|
2231
|
+
*/
|
|
2232
|
+
readonly id?: string;
|
|
2233
|
+
code: string;
|
|
2234
|
+
name?: string;
|
|
2235
|
+
/**
|
|
2236
|
+
* Not part of the contract's `BaseEntityAttributeInput`, and therefore not authorable: the attribute
|
|
2237
|
+
* form offers no control for it, because a value typed into one would be dropped by the next save. Kept
|
|
2238
|
+
* on the model so that a backend which gains the field round-trips it untouched.
|
|
2239
|
+
*/
|
|
2240
|
+
description?: string;
|
|
2241
|
+
displayOrder?: number;
|
|
2242
|
+
valueKind?: EntityValueKind;
|
|
2243
|
+
formControlType: string;
|
|
2244
|
+
/** How many values the attribute holds; absent means a single value — the descriptor's `multiplicity`. */
|
|
2245
|
+
multiplicity?: Multiplicity;
|
|
2246
|
+
/** Upper bound of the `x` multiplicities (`0..x`, `1..x`). */
|
|
2247
|
+
maxOccurs?: number;
|
|
2248
|
+
required?: boolean;
|
|
2249
|
+
indexed?: boolean;
|
|
2250
|
+
defaultValue?: unknown;
|
|
2251
|
+
/** Only meaningful for `valueKind: ENUM`; becomes the dropdown's options. */
|
|
2252
|
+
enumValues?: string[];
|
|
2253
|
+
/** Only meaningful for `valueKind: DATE / DATE_TIME`: the named style the value is shown and edited in. */
|
|
2254
|
+
dateFormat?: DateFormat;
|
|
2255
|
+
/**
|
|
2256
|
+
* The authoring form's flat view of {@link dateFormat}: the form builder binds one control per attribute
|
|
2257
|
+
* name and cannot reach into a nested object. The authoring mapper folds the two back on save.
|
|
2258
|
+
*/
|
|
2259
|
+
dateStyle?: DateStyle;
|
|
2260
|
+
timeStyle?: TimeStyle;
|
|
2261
|
+
/**
|
|
2262
|
+
* **Code** of the definition this attribute points at — a child carried inline
|
|
2263
|
+
* (`EMBEDDED_COMPONENTS`) or a parent referenced by key (`FOREIGN_KEY`). The descriptor's
|
|
2264
|
+
* `linkedEntityType` holds the entity *name* of the same definition.
|
|
2265
|
+
*/
|
|
2266
|
+
linkedEntityType?: string;
|
|
2267
|
+
/** Marks the attribute that titles an instance — the descriptor's `isLinkToDetails`. */
|
|
2268
|
+
isLinkToDetails?: boolean;
|
|
2269
|
+
/** The list column hugs its content instead of filling the remaining width — the descriptor's `autosizeColumn`. */
|
|
2270
|
+
autosizeColumn?: boolean;
|
|
2271
|
+
/** Predefined avatar icon or image URL fallback for AVATAR form control. */
|
|
2272
|
+
defaultAvatar?: string;
|
|
2273
|
+
/** `ADDRESS` only: show the address on a map — the descriptor's `showMap`. */
|
|
2274
|
+
showMap?: boolean;
|
|
2275
|
+
/** `ADDRESS` only: who draws the map; OpenStreetMap when absent. */
|
|
2276
|
+
mapProvider?: MapProvider;
|
|
2277
|
+
/** `ADDRESS` only: the ISO 3166-1 alpha-2 code a new address starts with. */
|
|
2278
|
+
defaultCountry?: string;
|
|
2279
|
+
constructor(init?: Partial<EntityAttributeDefinition>);
|
|
2280
|
+
}
|
|
2281
|
+
/**
|
|
2282
|
+
* An entity type — the contract's `BaseEntityDefinition`.
|
|
2283
|
+
*
|
|
2284
|
+
* {@link id} is a **mirror of {@link code}** rather than an independent field, maintained by
|
|
2285
|
+
* `EntityDefinitionMapper`. The contract addresses a definition by `code`
|
|
2286
|
+
* (`/entity-definitions/{code}`) while the generated screens address a record by `id`: every
|
|
2287
|
+
* single-record URL `BaseEntityRestService` builds comes from `id`, and so does the details link
|
|
2288
|
+
* `BaseFormNavigatorSingletonStore` renders. Mirroring the two in the mapper is what lets the stock
|
|
2289
|
+
* screens author definitions unchanged — the same arrangement `StateMachineDefinition` uses for its
|
|
2290
|
+
* `entityName`. The read-only uuid the contract also calls `id` is not carried: nothing addresses a
|
|
2291
|
+
* definition by it, and `BaseEntityDefinitionInput` has no field to send it back in.
|
|
2292
|
+
*/
|
|
2293
|
+
export declare class EntityDefinition implements BaseEntity {
|
|
2294
|
+
/** Mirror of {@link code}; maintained by the mapper and never edited. See the class comment. */
|
|
2295
|
+
id?: string;
|
|
2296
|
+
code: string;
|
|
2297
|
+
name: string;
|
|
2298
|
+
description?: string;
|
|
2299
|
+
status?: EntityDefinitionStatus;
|
|
2300
|
+
/** Where this draft stands against the release; reported by the backend, never sent back. */
|
|
2301
|
+
releaseState?: ReleaseState;
|
|
2302
|
+
/** **Codes** of the definitions that may aggregate this one; empty for a stand-alone entity. */
|
|
2303
|
+
componentParents?: string[];
|
|
2304
|
+
/** True when this definition's payload travels inside its parent's and it has no rows of its own. */
|
|
2305
|
+
isEmbedded?: boolean;
|
|
2306
|
+
attributes?: EntityAttributeDefinition[];
|
|
2307
|
+
version?: number;
|
|
2308
|
+
createdAt?: string;
|
|
2309
|
+
updatedAt?: string;
|
|
2310
|
+
constructor(init?: Partial<EntityDefinition>);
|
|
2311
|
+
}
|
|
2312
|
+
/**
|
|
2313
|
+
* An instance of a metadata-defined entity, as the framework's components see it: **flat**.
|
|
2314
|
+
*
|
|
2315
|
+
* The contract keeps the attribute values in a nested `payload` (`EntityObject`), which no generated
|
|
2316
|
+
* form or table could bind to — `BaseEntityFormBuilder` addresses a control by `attrName` on the entity
|
|
2317
|
+
* itself, and `BaseEntityListComponent` reads a cell the same way. `DynamicEntityMapper` flattens on the
|
|
2318
|
+
* way in and re-nests on the way out, so this shape is what the whole frontend works with and the
|
|
2319
|
+
* envelope never leaks past the repository.
|
|
2320
|
+
*
|
|
2321
|
+
* `version` rides along because the update endpoint requires it for optimistic locking; it is a property
|
|
2322
|
+
* of the row, not of the entity's metadata, which is why no attribute descriptor ever names it.
|
|
2323
|
+
*/
|
|
2324
|
+
interface DynamicEntity {
|
|
2325
|
+
id?: string;
|
|
2326
|
+
version?: number;
|
|
2327
|
+
[attrName: string]: unknown;
|
|
2328
|
+
}
|
|
2329
|
+
/** The `content` page every list endpoint of the contract answers with. */
|
|
2330
|
+
interface EntityDefinitionPage {
|
|
2331
|
+
content?: EntityDefinition[];
|
|
2332
|
+
}
|
|
2333
|
+
/**
|
|
2334
|
+
* A deprecated definition is not rendered. Which definitions the running application has at all is the release's
|
|
2335
|
+
* business: it reads the released rows. (`DRAFT` is not rendered either, for an older backend that still answers it.)
|
|
2336
|
+
*/
|
|
2337
|
+
declare function isRenderable(definition: EntityDefinition): boolean;
|
|
2338
|
+
/** `BaseConfiguration` key naming the org-scoped root of the base-entity endpoints. */
|
|
2339
|
+
export declare const ENTITY_SERVICE_ROOT_KEY = "ENTITY_SERVICE_ROOT";
|
|
2340
|
+
/**
|
|
2341
|
+
* Reads the tenant's entity definitions — `GET /organizations/{orgKey}/entity-definitions`.
|
|
2342
|
+
*
|
|
2343
|
+
* **All of them in one call**, rather than one call per entity the shell happens to need. Two things need
|
|
2344
|
+
* the whole set: an `AppDefinition` route names an entity by its `name` while a definition is keyed by
|
|
2345
|
+
* `code`, and an `EMBEDDED_COMPONENTS` attribute names its child by `code` too — so both lookups are
|
|
2346
|
+
* over the collection. Fetching by code would mean a request per level of every aggregate.
|
|
2347
|
+
*
|
|
2348
|
+
* Not a `BaseEntityRestService` subclass, unlike every other service in this library: those exist to give
|
|
2349
|
+
* an entity a *store* whose rows the generated screens edit, and a definition is not edited here — it is
|
|
2350
|
+
* read once and turned into a descriptor. The designer's own CRUD over definitions is a separate surface
|
|
2351
|
+
* with its own facade.
|
|
2352
|
+
*
|
|
2353
|
+
* A failure resolves to `[]` rather than propagating. The root falls back to `BACKEND_SERVICE_ROOT` (see
|
|
2354
|
+
* {@link serviceRootOf}) and a deployment may point that at a host which does not serve this resource at
|
|
2355
|
+
* all — the json-server mock does not — so "no definitions" has to be an ordinary answer. What the caller
|
|
2356
|
+
* renders then is the same "no entity type registered" state as for an unknown entity, which is the truth.
|
|
2357
|
+
*/
|
|
2358
|
+
export declare class EntityDefinitionService {
|
|
2359
|
+
private readonly httpClient;
|
|
2360
|
+
private readonly runtimeConfiguration;
|
|
2361
|
+
findAll(): Observable<EntityDefinition[]>;
|
|
2362
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionService, never>;
|
|
2363
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2364
|
+
}
|
|
2365
|
+
/**
|
|
2366
|
+
* The tenant's entity definitions, fetched once and indexed both ways.
|
|
2367
|
+
*
|
|
2368
|
+
* **The one place that knows a definition's `code` and its entity `name` are different things.** A
|
|
2369
|
+
* definition is keyed by `code` (`order`) — that is what the instance endpoints take as a path segment and
|
|
2370
|
+
* what an `EMBEDDED_COMPONENTS` attribute names its child by. A `BaseEntityDescriptor` is keyed by
|
|
2371
|
+
* `entityName` (`Order`) — that is what an `AppDefinition` route names, what `BASE_ENTITY_FACADE_REGISTRY`
|
|
2372
|
+
* is keyed by, and what `BaseFormNavigatorSingletonStore` builds URLs from. Everything downstream of this
|
|
2373
|
+
* class works in names; everything upstream in codes.
|
|
2374
|
+
*
|
|
2375
|
+
* The fetch is memoized as a **promise**, not as its result: several `ENTITY` routes of one application
|
|
2376
|
+
* resolve concurrently while its routes are being built, and awaiting the same in-flight request is what
|
|
2377
|
+
* keeps that one request rather than one per route.
|
|
2378
|
+
*/
|
|
2379
|
+
export declare class EntityDefinitionRegistry {
|
|
2380
|
+
private readonly service;
|
|
2381
|
+
private definitions?;
|
|
2382
|
+
/** Every renderable definition, by `code`. */
|
|
2383
|
+
load(): Promise<ReadonlyMap<string, EntityDefinition>>;
|
|
2384
|
+
/** The definition named `entityName`, i.e. whose `name` is that. */
|
|
2385
|
+
byName(entityName: string | undefined): Promise<EntityDefinition | undefined>;
|
|
2386
|
+
/** The definition with this `code` — how an embedded child and a foreign key name their target. */
|
|
2387
|
+
byCode(code: string | undefined): Promise<EntityDefinition | undefined>;
|
|
2388
|
+
/**
|
|
2389
|
+
* Discards the cache, so the next read fetches again.
|
|
2390
|
+
*
|
|
2391
|
+
* For the designer: a definition edited through its own CRUD screens changes what the previewed
|
|
2392
|
+
* application should render, and nothing else would ever invalidate a session-long cache.
|
|
2393
|
+
*/
|
|
2394
|
+
reset(): void;
|
|
2395
|
+
private fetch;
|
|
2396
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionRegistry, never>;
|
|
2397
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
2398
|
+
}
|
|
2399
|
+
/**
|
|
2400
|
+
* Resolves a definition by its `code` — how an attribute names an embedded child or a foreign-key target.
|
|
2401
|
+
* Supplied by the caller rather than injected, so this module stays a pure function of its inputs.
|
|
2402
|
+
*/
|
|
2403
|
+
type DefinitionLookup = (code: string) => EntityDefinition | undefined;
|
|
2404
|
+
/**
|
|
2405
|
+
* A control type the frontend can render.
|
|
2406
|
+
*
|
|
2407
|
+
* An unrecognized value falls back to `TEXT_BOX` rather than throwing. A definition may name a control the
|
|
2408
|
+
* running frontend has not caught up to — the same situation an `AppDefinition` naming an unknown route
|
|
2409
|
+
* kind is in, and treated the same way: degrade at the one field concerned instead of taking a screen
|
|
2410
|
+
* down. A text box shows the value and lets it be edited, which is the least wrong thing to do with an
|
|
2411
|
+
* attribute nobody has a widget for.
|
|
2412
|
+
*/
|
|
2413
|
+
export declare function controlTypeOf(attribute: EntityAttributeDefinition): FormControlType;
|
|
2414
|
+
/**
|
|
2415
|
+
* Turns one entity definition into the descriptor the generated screens render from.
|
|
2416
|
+
*
|
|
2417
|
+
* The result is an ordinary {@link BaseEntityDescriptor} — the same object a hand-written
|
|
2418
|
+
* `createDescriptor()` returns — which is the whole point: nothing downstream of here can tell a
|
|
2419
|
+
* metadata-defined entity from a compiled one. `store` is left unset; the facade binds it (see
|
|
2420
|
+
* `BaseEntityFacade.descriptor`).
|
|
2421
|
+
*
|
|
2422
|
+
* Three translations happen here, all of them from the contract's vocabulary to the descriptor's:
|
|
2423
|
+
* - **code → name.** `componentParents` and every `linkedEntityType` name a definition by `code`, while
|
|
2424
|
+
* the descriptor's equivalents name an entity by `entityName`. A code with no definition behind it is
|
|
2425
|
+
* dropped rather than passed through: `embeddedAttrFor()` and `isComponentOf()` compare against names,
|
|
2426
|
+
* so a stray code would silently match nothing anyway, and dropping it keeps a broken reference from
|
|
2427
|
+
* also breaking `isEmbedded`'s "must name a parent" invariant.
|
|
2428
|
+
* - **`enumValues` → `selectables`.** Through `toSelectables`, so the options are keyed exactly as a
|
|
2429
|
+
* hand-written descriptor's are.
|
|
2430
|
+
* - **child `isLinkToDetails` → `referenceIdField`.** See {@link referenceIdFieldOf}.
|
|
2431
|
+
*
|
|
2432
|
+
* Attributes are ordered by `displayOrder`, which is the authored field order and therefore the form's
|
|
2433
|
+
* and the table's column order. Ties keep the order the backend sent, so a definition that sets no
|
|
2434
|
+
* `displayOrder` at all still renders in its declared order.
|
|
2435
|
+
*/
|
|
2436
|
+
export declare function descriptorOf(definition: EntityDefinition, lookup: DefinitionLookup): BaseEntityDescriptor;
|
|
2437
|
+
/**
|
|
2438
|
+
* What identifies one embedded row in a URL segment.
|
|
2439
|
+
*
|
|
2440
|
+
* An embedded row has no `id` — it is addressed by its position in the owner's payload, and the URL
|
|
2441
|
+
* carries a *key* that `indexOfRow` looks that position up by. The contract has no `referenceIdField`, so
|
|
2442
|
+
* it is derived: the child definition's `isLinkToDetails` attribute is by construction the one that
|
|
2443
|
+
* titles a row, and therefore the one a user would recognize in a URL.
|
|
2444
|
+
*
|
|
2445
|
+
* **Not cosmetic.** With no `referenceIdField`, `rowId()` reads `row['id']`, which an embedded row does
|
|
2446
|
+
* not have, and returns `''` — whereupon `indexOfRow` answers `-1` for every row and no embedded form can
|
|
2447
|
+
* be opened at all. So the fallback for a child that declares no title attribute matters, and it depends
|
|
2448
|
+
* on what kind of child it is:
|
|
2449
|
+
* - **embedded** — its leading attribute, the first by `displayOrder`. Authoring the flag is one
|
|
2450
|
+
* checkbox, and forgetting it would otherwise make every row of that definition silently unopenable:
|
|
2451
|
+
* the list renders, the rows are there, clicking one does nothing. The leading field is what the row's
|
|
2452
|
+
* list entry is labelled with anyway, so it is also the segment a user would expect in the URL.
|
|
2453
|
+
* - **not embedded** — `'id'`, the default, which is right for a child that does carry ids.
|
|
2454
|
+
*
|
|
2455
|
+
* A heuristic either way, and the same one twice over: uniqueness among sibling rows is the author's to
|
|
2456
|
+
* guarantee, exactly as it already is for an `isLinkToDetails` attribute.
|
|
2457
|
+
*/
|
|
2458
|
+
export declare function referenceIdFieldOf(attribute: EntityAttributeDefinition, lookup: DefinitionLookup): string;
|
|
2459
|
+
/**
|
|
2460
|
+
* Between the contract's `EntityObject` envelope and the flat entity the generated screens bind to.
|
|
2461
|
+
*
|
|
2462
|
+
* The contract nests the attribute values in `payload`, keyed by attribute code. Nothing in the framework
|
|
2463
|
+
* can bind to that: `BaseEntityFormBuilder` adds a control per `attrName` and reads its initial value with
|
|
2464
|
+
* `Reflect.get(entity, attrName)`, `BaseEntityListComponent` reads a cell the same way, and RSQL filters
|
|
2465
|
+
* are built from `attrName` too. So the envelope is opened here, at the repository boundary, and closed
|
|
2466
|
+
* again on the way out — which is the only reason `BaseEntityListComponent` and `BaseEntityFormComponent`
|
|
2467
|
+
* need no knowledge of metadata-defined entities at all.
|
|
2468
|
+
*
|
|
2469
|
+
* `id` and `version` travel on the flat entity beside the attributes. `id` because `PersistedEntity`
|
|
2470
|
+
* requires it and the store keys rows by it; `version` because the update endpoint rejects a payload whose
|
|
2471
|
+
* version does not match the stored one, and the only place to carry it between a read and a write is the
|
|
2472
|
+
* entity the form edited. Neither can collide with an attribute unless a definition declares an attribute
|
|
2473
|
+
* of that name, in which case the envelope wins — see {@link fromDto}.
|
|
2474
|
+
*/
|
|
2475
|
+
export declare class DynamicEntityMapper implements BaseEntityMapper<DynamicEntity> {
|
|
2476
|
+
private readonly entityDefinitionCode;
|
|
2477
|
+
constructor(entityDefinitionCode: string);
|
|
2478
|
+
/**
|
|
2479
|
+
* `{id, version, payload: {...}}` → `{id, version, ...payload}`.
|
|
2480
|
+
*
|
|
2481
|
+
* The envelope is spread **after** the payload, so an attribute that happens to be called `id` or
|
|
2482
|
+
* `version` cannot shadow the row's identity or its lock. A tenant is free to declare such an attribute
|
|
2483
|
+
* — the backend stores it in the payload without complaint — and losing the real id to it would make the
|
|
2484
|
+
* row unaddressable.
|
|
2485
|
+
*
|
|
2486
|
+
* A response that is not an object yields an empty entity rather than throwing: `assertPersistedEntity`
|
|
2487
|
+
* in `BaseEntityRestService` is the check that turns a nonsense response into an error, and it gives a
|
|
2488
|
+
* better message than a `TypeError` from here.
|
|
2489
|
+
*/
|
|
2490
|
+
fromDto(dto: unknown): DynamicEntity;
|
|
2491
|
+
/**
|
|
2492
|
+
* `{id, version, ...attributes}` → `{entityDefinitionCode, version, payload: {...attributes}}`.
|
|
2493
|
+
*
|
|
2494
|
+
* One shape for both verbs, though the contract declares two: `EntityObjectInput` (POST) has
|
|
2495
|
+
* `entityDefinitionCode` + `payload`, `EntityObjectUpdate` (PUT) has `version` + `payload`. Emitting the
|
|
2496
|
+
* union sends each endpoint one field it does not declare, which Jackson ignores — Spring Boot leaves
|
|
2497
|
+
* `FAIL_ON_UNKNOWN_PROPERTIES` off. The alternative is a mapper that knows which verb is about to be
|
|
2498
|
+
* used, which `BaseEntityMapper` has no way to tell it and which would put HTTP knowledge in a mapper.
|
|
2499
|
+
*
|
|
2500
|
+
* `id` is deliberately **not** sent: it is a path segment on update and assigned by the server on
|
|
2501
|
+
* create, so a body carrying it could only ever disagree with the URL.
|
|
2502
|
+
*/
|
|
2503
|
+
toDto(entity: DynamicEntity): unknown;
|
|
66
2504
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
route?: string;
|
|
91
|
-
}
|
|
92
|
-
declare class BaseEntityDescriptor {
|
|
93
|
-
store: unknown;
|
|
94
|
-
attrDescriptors: AbstractAttrDescriptor[];
|
|
95
|
-
entityName: string;
|
|
96
|
-
entityTitle: EntityTitle;
|
|
97
|
-
extraFormActionsTemplate?: ExtraFormActionsTemplate;
|
|
98
|
-
i18nScope?: string;
|
|
99
|
-
titleKey?: string;
|
|
100
|
-
parentEntity: string | undefined;
|
|
101
|
-
readonly isAbstract: boolean;
|
|
102
|
-
route: string | undefined;
|
|
103
|
-
constructor({ store, attrDescriptors, entityName, entityTitle, extraFormActionsTemplate, i18nScope, titleKey, isAbstract, parentEntity, route }: BaseEntityDescriptorOptions);
|
|
104
|
-
createTestId(suffix: string): string;
|
|
105
|
-
/** Transloco key root for this entity, derived from {@link entityName} unless {@link i18nScope} overrides it. */
|
|
106
|
-
scopeRoot(): string;
|
|
107
|
-
/**
|
|
108
|
-
* Full transloco key for the entity name: `<scopeRoot>._self`. The reserved `_self` segment keeps the
|
|
109
|
-
* entity name in the same object as its attribute labels without the two colliding.
|
|
110
|
-
*/
|
|
111
|
-
i18nKey(): string;
|
|
112
|
-
componentIdentification(): string;
|
|
113
|
-
/** Name of the attribute whose value labels the selected entity in the status bar. */
|
|
114
|
-
titleAttrName(): string;
|
|
115
|
-
overwriteLinkedEntityAttr(attrName: string, linkedEntityName: string): void;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
interface BaseEntity {
|
|
119
|
-
readonly id?: string;
|
|
2505
|
+
/**
|
|
2506
|
+
* The repository of one metadata-defined entity type —
|
|
2507
|
+
* `/organizations/{orgKey}/entities/{entityDefinitionCode}`.
|
|
2508
|
+
*
|
|
2509
|
+
* A plain `BaseEntityRestService`, which is the point: the operation layer of the contract is an ordinary
|
|
2510
|
+
* paged collection with an RSQL filter, so nothing about reading, filtering, paging or writing needs new
|
|
2511
|
+
* code. Two details differ from the rest of the workspace, and only two:
|
|
2512
|
+
*
|
|
2513
|
+
* - **The collection is per definition.** `entities/order` and `entities/dynamic-entity` are different
|
|
2514
|
+
* resources, so the definition code is part of the resource URL rather than a query parameter, and one
|
|
2515
|
+
* service instance serves one entity type — exactly as a hand-written service does.
|
|
2516
|
+
* - **The query parameters are named differently.** `listEntities` in `base-entity-api.yaml` calls them
|
|
2517
|
+
* `rsql` and `sort` where `shared-api.yaml` and every feature built on it say `where` and `order`. The
|
|
2518
|
+
* expressions are the same; only the names differ, hence the two overrides.
|
|
2519
|
+
*
|
|
2520
|
+
* Constructed directly by `DynamicEntityFacade` rather than provided, so the definition code can be a
|
|
2521
|
+
* constructor argument. It must be constructed inside an injection context — the base class injects
|
|
2522
|
+
* `HttpClient` and `RUNTIME_CONFIGURATION` in field initializers.
|
|
2523
|
+
*/
|
|
2524
|
+
export declare class DynamicEntityService extends BaseEntityRestService<DynamicEntity> {
|
|
2525
|
+
protected readonly filterParamName = "rsql";
|
|
2526
|
+
protected readonly sortParamName = "sort";
|
|
2527
|
+
constructor(entityDefinitionCode: string);
|
|
120
2528
|
}
|
|
121
|
-
|
|
122
|
-
|
|
2529
|
+
/**
|
|
2530
|
+
* Facade of an entity whose payload lives inside another entity's document. Everything but the repository
|
|
2531
|
+
* and the store's notion of a key is inherited: the descriptor, the tabs, the container state — so an
|
|
2532
|
+
* embedded entity registers in `BASE_ENTITY_FACADE_REGISTRY` alongside the routable ones and its list and
|
|
2533
|
+
* form are the stock components.
|
|
2534
|
+
*
|
|
2535
|
+
* The descriptor still has to declare `componentParent` and `isEmbedded`, and the containing entity still
|
|
2536
|
+
* has to reference it with `FormControlType.EMBEDDED_COMPONENTS`; the form control checks both agree.
|
|
2537
|
+
*/
|
|
2538
|
+
export declare abstract class EmbeddedEntityFacade<Entity extends BaseEntity> extends BaseEntityFacade<Entity> {
|
|
2539
|
+
private _accessor?;
|
|
2540
|
+
/** Takes no mapper: an embedded row is carried, and mapped, by the containing entity's payload. */
|
|
2541
|
+
protected createService(): BaseEntityService<Entity>;
|
|
2542
|
+
/**
|
|
2543
|
+
* The generic store, keyed by whatever identifies an embedded row rather than by `id`.
|
|
2544
|
+
*
|
|
2545
|
+
* An embedded child is not guaranteed to have one — `App Region` is identified by `type`, the contract
|
|
2546
|
+
* giving a region no id — and the store is what the details form reads its row from (`loadById`) and
|
|
2547
|
+
* what a delete removes it from. Keyed by `id` alone those would silently miss every such row, or, since
|
|
2548
|
+
* `undefined === undefined`, hit the wrong one.
|
|
2549
|
+
*
|
|
2550
|
+
* The field is read per call rather than captured, for the same reason the accessor resolves per call:
|
|
2551
|
+
* one store serves every owner of this child type, and which attribute's rows it stands for is decided
|
|
2552
|
+
* by the route that is open.
|
|
2553
|
+
*/
|
|
2554
|
+
protected createStoreClass(): Type<unknown>;
|
|
2555
|
+
private readonly rowKeyOf;
|
|
2556
|
+
private get accessor();
|
|
2557
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedEntityFacade<any>, never>;
|
|
2558
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
123
2559
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
2560
|
+
/**
|
|
2561
|
+
* The class a metadata-defined entity's store instantiates for a new row.
|
|
2562
|
+
*
|
|
2563
|
+
* A class rather than an object literal because `BaseEntityFacade` needs a `Type<Entity>`: the store calls
|
|
2564
|
+
* `new entityType()` in `createEntity()`, and `entityNameFromType()` reads `.name` off it for the devtools
|
|
2565
|
+
* label. One class per definition, named after it, so two entities do not share a devtools store name.
|
|
2566
|
+
*
|
|
2567
|
+
* The constructor seeds the attributes' authored `defaultValue`s, which is what makes a new-row form open
|
|
2568
|
+
* with `status: DRAFT` rather than empty — `BaseEntityFormBuilder` reads each control's initial value off
|
|
2569
|
+
* the entity the store created.
|
|
2570
|
+
*/
|
|
2571
|
+
export declare function dynamicEntityTypeOf(definition: EntityDefinition): Type<DynamicEntity>;
|
|
2572
|
+
/**
|
|
2573
|
+
* Facade of an entity that exists only as metadata.
|
|
2574
|
+
*
|
|
2575
|
+
* Everything a hand-written facade contributes is contributed here from a `BaseEntityDefinition` instead:
|
|
2576
|
+
* the descriptor (synthesized by `descriptorOf`), the repository (`DynamicEntityService` over the
|
|
2577
|
+
* definition's own collection) and — inherited untouched — the signal store with its tabs and container
|
|
2578
|
+
* state. That is what lets `BaseEntityContainerComponent`, the list, the form, the toolbar and the status
|
|
2579
|
+
* bar work on a designer-created entity with no change of their own.
|
|
2580
|
+
*
|
|
2581
|
+
* Instantiated by `DynamicEntityRegistry` rather than provided as a token, because there is no token to
|
|
2582
|
+
* declare at compile time: which entities exist is a fact about the tenant's data. It must be constructed
|
|
2583
|
+
* inside an injection context (`runInInjectionContext`) — the base class injects `Injector` in a field
|
|
2584
|
+
* initializer.
|
|
2585
|
+
*
|
|
2586
|
+
* Deliberately **not** `@Injectable()`, unlike every hand-written facade: its constructor parameters are a
|
|
2587
|
+
* definition and a descriptor, which are not injection tokens, and the decorator makes the compiler demand
|
|
2588
|
+
* that they be (NG2003). Nothing is lost — the decorator is what lets Angular *construct* a class, and this
|
|
2589
|
+
* one is constructed by hand.
|
|
2590
|
+
*/
|
|
2591
|
+
export declare class DynamicEntityFacade extends BaseEntityFacade<DynamicEntity> {
|
|
2592
|
+
private readonly definition;
|
|
2593
|
+
private readonly synthesizedDescriptor;
|
|
2594
|
+
readonly entityType: Type<DynamicEntity>;
|
|
2595
|
+
constructor(definition: EntityDefinition, synthesizedDescriptor: BaseEntityDescriptor);
|
|
2596
|
+
/** The `entities/{code}` collection. Bypasses the base class's `backendRoot`/`endpoint` pair, which
|
|
2597
|
+
* expects the two to be declared as fields by a subclass written by hand. */
|
|
2598
|
+
protected createService(): BaseEntityService<DynamicEntity>;
|
|
2599
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
129
2600
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
2601
|
+
/**
|
|
2602
|
+
* Facade of a metadata-defined entity whose payload travels inside its parent's — an
|
|
2603
|
+
* `isEmbedded: true` definition.
|
|
2604
|
+
*
|
|
2605
|
+
* Differs from {@link DynamicEntityFacade} in exactly what `EmbeddedEntityFacade` already differs in: the
|
|
2606
|
+
* repository reads and writes the containing entity's document rather than a collection of its own, and
|
|
2607
|
+
* the store is keyed by the row's `referenceIdField` rather than by `id`. Both come from the base class;
|
|
2608
|
+
* this only supplies the descriptor and the row type.
|
|
2609
|
+
*
|
|
2610
|
+
* Undecorated for the same reason as {@link DynamicEntityFacade}.
|
|
2611
|
+
*/
|
|
2612
|
+
export declare class DynamicEmbeddedEntityFacade extends EmbeddedEntityFacade<DynamicEntity> {
|
|
2613
|
+
private readonly synthesizedDescriptor;
|
|
2614
|
+
readonly entityType: Type<DynamicEntity>;
|
|
2615
|
+
constructor(definition: EntityDefinition, synthesizedDescriptor: BaseEntityDescriptor);
|
|
2616
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
135
2617
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
2618
|
+
/** One metadata-defined entity, ready to render. */
|
|
2619
|
+
interface ResolvedDynamicEntity {
|
|
2620
|
+
entityName: string;
|
|
2621
|
+
descriptor: BaseEntityDescriptor;
|
|
2622
|
+
facade: BaseEntityFacade<BaseEntity>;
|
|
2623
|
+
/**
|
|
2624
|
+
* Token the facade answers to. `EmbeddedChildRoute.facade` and `ACTIVE_ENTITY_FACADE` are
|
|
2625
|
+
* `ProviderToken`s, so a facade that was never declared as a provider still needs one — see
|
|
2626
|
+
* {@link DynamicEntityRegistry.tokenFor}.
|
|
2627
|
+
*/
|
|
2628
|
+
facadeToken: ProviderToken<BaseEntityFacade<BaseEntity>>;
|
|
146
2629
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
2630
|
+
/**
|
|
2631
|
+
* Builds and holds the facades of metadata-defined entities — the counterpart of
|
|
2632
|
+
* `BASE_ENTITY_FACADE_REGISTRY` for entity types that exist only as `BaseEntityDefinition` rows.
|
|
2633
|
+
*
|
|
2634
|
+
* `resolve` is async because the definitions have to be fetched; everything after that is synchronous, and
|
|
2635
|
+
* deliberately so. Once an entity is resolved, `descriptorOf` and `storeOf` answer immediately, which is
|
|
2636
|
+
* what lets `BaseEntityDescriptorRegistry` — and through it `EmbeddedAggregateAccessor`, the embedded route
|
|
2637
|
+
* context and every embedded form control — keep the synchronous signature they already have.
|
|
2638
|
+
*
|
|
2639
|
+
* **Resolving an entity resolves its whole aggregate.** An `EMBEDDED_COMPONENTS` attribute names a child
|
|
2640
|
+
* definition, and that child needs a descriptor and a store of its own before its rows can be listed on the
|
|
2641
|
+
* parent's form. Doing it here, in one pass, is what makes the parent's form work on the first render
|
|
2642
|
+
* rather than after a second navigation.
|
|
2643
|
+
*
|
|
2644
|
+
* Everything is created inside `runInInjectionContext`: facades inject `Injector`, the REST service injects
|
|
2645
|
+
* `HttpClient`, and `resolve` is called from a route builder that has already awaited — at which point the
|
|
2646
|
+
* ambient injection context is gone.
|
|
2647
|
+
*/
|
|
2648
|
+
export declare class DynamicEntityRegistry {
|
|
2649
|
+
private readonly definitions;
|
|
2650
|
+
private readonly resolvedEntities;
|
|
2651
|
+
private readonly injector;
|
|
2652
|
+
private readonly resolved;
|
|
2653
|
+
private readonly tokens;
|
|
2654
|
+
/**
|
|
2655
|
+
* The entity named `entityName`, or `undefined` when this tenant has no such definition — which is an
|
|
2656
|
+
* ordinary answer, not an error: an `AppDefinition` may name an entity that has been renamed or deleted,
|
|
2657
|
+
* and the caller renders "no entity type registered" for it.
|
|
2658
|
+
*/
|
|
2659
|
+
resolve(entityName: string | undefined): Promise<ResolvedDynamicEntity | undefined>;
|
|
2660
|
+
/** The descriptor of an already-resolved entity. Synchronous; `undefined` before {@link resolve}. */
|
|
2661
|
+
descriptorOf(entityName: string | undefined): BaseEntityDescriptor | undefined;
|
|
2662
|
+
/** The store of an already-resolved entity, bound into its descriptor by the facade. */
|
|
2663
|
+
storeOf(entityName: string | undefined): unknown;
|
|
2664
|
+
/**
|
|
2665
|
+
* Token the facade of an already-resolved entity answers to, for a caller that has to *provide* it — a
|
|
2666
|
+
* route branch binding `ACTIVE_ENTITY_FACADE`. `undefined` before {@link resolve}, so that nothing can
|
|
2667
|
+
* hand the router a token whose factory would throw on the first navigation into it.
|
|
2668
|
+
*/
|
|
2669
|
+
facadeTokenOf(entityName: string | undefined): ProviderToken<BaseEntityFacade<BaseEntity>> | undefined;
|
|
2670
|
+
/**
|
|
2671
|
+
* Discards every built facade, so the next `resolve` rebuilds from freshly fetched definitions.
|
|
2672
|
+
*
|
|
2673
|
+
* For the designer: an edited definition means a different descriptor. The tokens are kept — an
|
|
2674
|
+
* `InjectionToken`'s root factory is called once and its result cached by the injector, so a token
|
|
2675
|
+
* handed out earlier has to keep answering; it reads through {@link resolved}, which is why replacing
|
|
2676
|
+
* the entry is enough.
|
|
2677
|
+
*/
|
|
2678
|
+
reset(): void;
|
|
2679
|
+
/**
|
|
2680
|
+
* The facade of `entityName` as a token.
|
|
2681
|
+
*
|
|
2682
|
+
* One token per entity name, created once and kept: `EmbeddedChildRoute.facade` is a `ProviderToken` that
|
|
2683
|
+
* `baseEntityRoutes` turns into `{ provide: ACTIVE_ENTITY_FACADE, useExisting: token }`, and a second
|
|
2684
|
+
* token for the same entity would give the same routes two facades and therefore two stores.
|
|
2685
|
+
*
|
|
2686
|
+
* The factory reads through {@link resolved} rather than closing over the facade, so that a `reset()`
|
|
2687
|
+
* followed by a re-`resolve` is visible through a token the router still holds.
|
|
2688
|
+
*/
|
|
2689
|
+
private tokenFor;
|
|
2690
|
+
/**
|
|
2691
|
+
* Synthesizes one definition's descriptor and facade, then recurses into the children its
|
|
2692
|
+
* `EMBEDDED_COMPONENTS` attributes name.
|
|
2693
|
+
*
|
|
2694
|
+
* `building` guards the recursion: an embedded child may nest inside itself (base-app's `App Nav Item`
|
|
2695
|
+
* does), which is a finite definition graph but an infinite tree. The child is registered before the
|
|
2696
|
+
* recursion so a self-reference finds the entry that is being built rather than starting a second one.
|
|
2697
|
+
*/
|
|
2698
|
+
private build;
|
|
2699
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicEntityRegistry, never>;
|
|
2700
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
151
2701
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
2702
|
+
/**
|
|
2703
|
+
* Whether the screens of the organization's own entity types — the ones built at run time from definitions — are
|
|
2704
|
+
* read-only in this page. A host sets it while it shows *draft* definitions: there the screens are a preview of
|
|
2705
|
+
* definitions not yet released, over the organization's real objects, and a save through a draft's attributes and
|
|
2706
|
+
* rules would write live data the running application does not yet expect.
|
|
2707
|
+
*
|
|
2708
|
+
* `false` unless a host provides it. The designer's own screens are never affected: they are compiled into the
|
|
2709
|
+
* application, not built from definitions.
|
|
2710
|
+
*/
|
|
2711
|
+
export declare const ENTITY_PREVIEW_READ_ONLY: InjectionToken<boolean>;
|
|
2712
|
+
/** Answers, per entity type, whether its screens may only be looked at; see {@link ENTITY_PREVIEW_READ_ONLY}. */
|
|
2713
|
+
export declare class EntityPreviewMode {
|
|
2714
|
+
private readonly previewReadOnly;
|
|
2715
|
+
private readonly dynamicEntities;
|
|
2716
|
+
/** True for an entity type built from a definition, while the host previews drafts. */
|
|
2717
|
+
isReadOnly(entityName: string | undefined): boolean;
|
|
2718
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityPreviewMode, never>;
|
|
2719
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
156
2720
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
2721
|
+
/**
|
|
2722
|
+
* An embedded child to mount under an entity's details route. The entity's descriptor has to reference it
|
|
2723
|
+
* with `FormControlType.EMBEDDED_COMPONENTS`, and the child's own descriptor has to name the entity as a
|
|
2724
|
+
* `componentParent`.
|
|
2725
|
+
*/
|
|
2726
|
+
interface EmbeddedChildRoute {
|
|
2727
|
+
entityName: string;
|
|
2728
|
+
facade: ProviderToken<BaseEntityFacade<BaseEntity>>;
|
|
2729
|
+
/** Extra providers for the branch — a transloco scope, most often. */
|
|
2730
|
+
providers?: Array<Provider | EnvironmentProviders>;
|
|
2731
|
+
/**
|
|
2732
|
+
* The child's own embedded children. A thunk so a child may name itself: `App Nav Item` nests inside
|
|
2733
|
+
* `App Nav Item`, which no eager value could express.
|
|
2734
|
+
*/
|
|
2735
|
+
children?: () => EmbeddedChildRoute[];
|
|
160
2736
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
2737
|
+
/**
|
|
2738
|
+
* The list and details routes of one entity, plus a branch per embedded child.
|
|
2739
|
+
*
|
|
2740
|
+
* An embedded child is addressed by its position in the containing document, so its screens hang **below**
|
|
2741
|
+
* the owner's details route — `test-entity/1/details/embedded-component/embedded_1_1/details`. That nesting
|
|
2742
|
+
* is not decoration: it is what carries the path, so a deep link and a refresh resolve to the same row, and
|
|
2743
|
+
* what makes the child unreachable except through its parent, since the parent's segments are part of the
|
|
2744
|
+
* URL that matches at all.
|
|
2745
|
+
*
|
|
2746
|
+
* The branch is attached with `loadChildren` rather than `children` because it is expanded one level per
|
|
2747
|
+
* navigation. A child that names itself would otherwise be an infinite structure; lazily, it is finite at
|
|
2748
|
+
* any moment and Angular memoizes each level it has expanded.
|
|
2749
|
+
*/
|
|
2750
|
+
export declare function baseEntityRoutes(embeddedChildren?: EmbeddedChildRoute[], extraTabs?: EntityTabDescriptor[]): Routes;
|
|
2751
|
+
/** The stand-alone entity routes, unchanged for every caller that has no embedded children to mount. */
|
|
2752
|
+
export declare const BASE_ENTITY_ROUTES: Routes;
|
|
2753
|
+
/** Everything needed to mount one entity's List and Details screens somewhere. */
|
|
2754
|
+
interface EntityScreens {
|
|
2755
|
+
descriptor: BaseEntityDescriptor;
|
|
2756
|
+
/** The branches to hand to `baseEntityRoutes`, one per `EMBEDDED_COMPONENTS` attribute, recursively. */
|
|
2757
|
+
embeddedChildren: EmbeddedChildRoute[];
|
|
2758
|
+
/**
|
|
2759
|
+
* The descriptor's own extra tabs plus whatever the registered {@link EntityTabContributor}s offered —
|
|
2760
|
+
* the value to hand `baseEntityRoutes`, so that every tab the tab bar renders a link for has a route
|
|
2761
|
+
* answering to it. Mirrors `descriptor.extraTabs`, which this resolver has already updated.
|
|
2762
|
+
*/
|
|
2763
|
+
extraTabs: EntityTabDescriptor[];
|
|
164
2764
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
2765
|
+
/**
|
|
2766
|
+
* Resolves an entity by name to its descriptor and the embedded branches below it — **whether the entity is
|
|
2767
|
+
* compiled in or exists only as metadata**.
|
|
2768
|
+
*
|
|
2769
|
+
* This is the seam that keeps the run-time shell from having to care about the difference. `base-app`'s
|
|
2770
|
+
* route renderer asks for an entity by the name an `AppDefinition` route gave it and gets the same answer
|
|
2771
|
+
* either way: a descriptor with a store bound, and the `EmbeddedChildRoute[]` that `baseEntityRoutes`
|
|
2772
|
+
* already knows how to mount. A tenant may perfectly well have an application whose screens are half
|
|
2773
|
+
* compiled (`Document`, with its content editor) and half authored, and neither has to know about the other.
|
|
2774
|
+
*
|
|
2775
|
+
* Compile-time facades win. If an entity name is in `BASE_ENTITY_FACADE_REGISTRY`, that registration is the
|
|
2776
|
+
* host application's explicit decision — it may attach extra tabs or a hand-tuned layout a synthesized
|
|
2777
|
+
* descriptor cannot know about — and a definition of the same name does not override it.
|
|
2778
|
+
*/
|
|
2779
|
+
export declare class EntityScreenResolver {
|
|
2780
|
+
private readonly facadeRegistry;
|
|
2781
|
+
private readonly dynamicRegistry;
|
|
2782
|
+
private readonly injector;
|
|
2783
|
+
private readonly tabContributors;
|
|
2784
|
+
private readonly stateControl;
|
|
2785
|
+
/** `undefined` when neither a facade nor a definition answers to `entityName`. */
|
|
2786
|
+
resolve(entityName: string | undefined): Promise<EntityScreens | undefined>;
|
|
2787
|
+
/**
|
|
2788
|
+
* Turns the attribute a state machine governs into a {@link FormControlType.STATE} control, so the form offers
|
|
2789
|
+
* the allowed transitions instead of a free edit of the value. Idempotent, which matters for the same reason as
|
|
2790
|
+
* in {@link extraTabsOf}: a compile-time descriptor is a singleton resolved more than once. A provider that
|
|
2791
|
+
* throws leaves the descriptor as it was — the attribute stays editable, as it was before base-state existed.
|
|
2792
|
+
*/
|
|
2793
|
+
private markStateAttribute;
|
|
2794
|
+
/**
|
|
2795
|
+
* The descriptor's extra tabs after every contributor has been asked — and **written back onto the
|
|
2796
|
+
* descriptor**, because that is what `BaseEntityTabsComponent` renders the links from. The routes are
|
|
2797
|
+
* built from the returned array, so the two cannot disagree.
|
|
2798
|
+
*
|
|
2799
|
+
* Deduplicated by segment, and mutated in place rather than replaced: a compile-time descriptor is a
|
|
2800
|
+
* singleton that may be resolved more than once (two routes mounting the same entity, or base-app
|
|
2801
|
+
* re-rendering after a definition changed), and both a duplicated tab and a descriptor whose array
|
|
2802
|
+
* identity changed under a rendered tab bar are bugs this has already had.
|
|
2803
|
+
*
|
|
2804
|
+
* A contributor that throws is skipped with the others left intact: it is offering a screen, and an
|
|
2805
|
+
* entity's List and Details are not worth failing over one feature that could not make up its mind.
|
|
2806
|
+
*/
|
|
2807
|
+
private extraTabsOf;
|
|
2808
|
+
private tabsFrom;
|
|
2809
|
+
/**
|
|
2810
|
+
* The branches for one descriptor's embedded children — **one level of them**.
|
|
2811
|
+
*
|
|
2812
|
+
* Each branch carries a *thunk* for the level below it rather than an expanded tree, which is what
|
|
2813
|
+
* `EmbeddedChildRoute.children` is for and what makes the depth unbounded: `baseEntityRoutes` calls the
|
|
2814
|
+
* thunk from a `loadChildren`, once per navigation into that level. So a child type that nests inside
|
|
2815
|
+
* itself — base-app's `App Nav Item`, or any definition whose `EMBEDDED_COMPONENTS` attribute names its
|
|
2816
|
+
* own — is finite at any moment and expands as far as the user drills. An eagerly built tree could not
|
|
2817
|
+
* express that structure at all, and would not terminate trying.
|
|
2818
|
+
*
|
|
2819
|
+
* A child with neither a facade nor a resolved definition is **skipped**: its rows are still listed on
|
|
2820
|
+
* the owner's form (they are part of the owner's payload), they just cannot be opened. That is a better
|
|
2821
|
+
* reading of an incomplete aggregate than refusing to mount the owner's screens at all.
|
|
2822
|
+
*/
|
|
2823
|
+
private embeddedChildrenOf;
|
|
2824
|
+
private childRouteOf;
|
|
2825
|
+
/** Only the *compile-time* descriptor: `BaseEntityDescriptorRegistry` would answer for both. */
|
|
2826
|
+
private compileTimeDescriptorOf;
|
|
2827
|
+
private compileTimeFacadeOf;
|
|
2828
|
+
private descriptorOf;
|
|
2829
|
+
private facadeTokenOf;
|
|
2830
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityScreenResolver, never>;
|
|
2831
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
175
2832
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
private readonly injector;
|
|
202
|
-
private _mapper?;
|
|
203
|
-
private _service?;
|
|
204
|
-
private _storeClass?;
|
|
205
|
-
private _storeInstance?;
|
|
206
|
-
private _descriptor?;
|
|
207
|
-
get mapper(): BaseEntityMapper<Entity>;
|
|
208
|
-
get service(): BaseEntityService<Entity>;
|
|
209
|
-
get storeClass(): Type<unknown>;
|
|
210
|
-
get store(): unknown;
|
|
211
|
-
get descriptor(): BaseEntityDescriptor;
|
|
212
|
-
get entityName(): string;
|
|
213
|
-
get attrDescriptors(): AbstractAttrDescriptor[];
|
|
214
|
-
get entityTitle(): string;
|
|
215
|
-
protected createMapper(): BaseEntityMapper<Entity>;
|
|
216
|
-
protected createService(mapper: BaseEntityMapper<Entity>): BaseEntityService<Entity>;
|
|
217
|
-
protected createStoreClass(): Type<unknown>;
|
|
218
|
-
protected abstract createDescriptor(): BaseEntityDescriptor;
|
|
219
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseEntityFacade<any>, never>;
|
|
220
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<BaseEntityFacade<any>>;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
declare const BASE_ENTITY_STORE: InjectionToken<unknown>;
|
|
224
|
-
interface BaseEntityStoreApi<Entity extends BaseEntity> {
|
|
225
|
-
entities: Signal<Entity[]>;
|
|
226
|
-
selectedEntities: Signal<Entity[]>;
|
|
227
|
-
currentEntity: Signal<Entity | undefined>;
|
|
228
|
-
currentId: Signal<string | undefined>;
|
|
229
|
-
isLoading: Signal<boolean>;
|
|
230
|
-
error: Signal<string | undefined>;
|
|
231
|
-
number: Signal<number>;
|
|
232
|
-
size: Signal<number>;
|
|
233
|
-
totalElements: Signal<number>;
|
|
234
|
-
totalPages: Signal<number>;
|
|
235
|
-
filterKey: Signal<string | undefined>;
|
|
236
|
-
activeTabs: Signal<string[]>;
|
|
237
|
-
currentTab: Signal<string | undefined>;
|
|
238
|
-
countOfEntities: Signal<number>;
|
|
239
|
-
matTableDataSource: Signal<MatTableDataSource<Entity>>;
|
|
240
|
-
add(entity: Entity): Promise<PersistedEntity<Entity> | undefined>;
|
|
241
|
-
delete(id: string): Promise<void>;
|
|
242
|
-
deleteAll(input?: void): void;
|
|
243
|
-
deselectAll(): void;
|
|
244
|
-
deselectEntity(id: string): void;
|
|
245
|
-
load(query: BaseEntityQueryCondition): void;
|
|
246
|
-
loadById(id: string): Entity | undefined;
|
|
247
|
-
resetErrorState(): void;
|
|
248
|
-
selectEntity(id: string): void;
|
|
249
|
-
setCurrentEntity(id: string | undefined): void;
|
|
250
|
-
update(entity: PersistedEntity<Entity>): Promise<PersistedEntity<Entity> | undefined>;
|
|
251
|
-
clearCurrentEntity(): void;
|
|
252
|
-
createEntity(): Entity;
|
|
253
|
-
doFilter(filterKey: string): void;
|
|
254
|
-
reset(): void;
|
|
255
|
-
tabIsActive(tabName: string): void;
|
|
256
|
-
tabIsInactive(tabName: string): void;
|
|
257
|
-
}
|
|
258
|
-
declare function BaseEntityStore<Entity extends BaseEntity>(entityType: new () => Entity, getRepository: () => BaseEntityService<Entity>): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
259
|
-
state: {
|
|
260
|
-
entities: Entity[];
|
|
261
|
-
number: number;
|
|
262
|
-
size: number;
|
|
263
|
-
totalElements: number;
|
|
264
|
-
totalPages: number;
|
|
265
|
-
currentId: string | undefined;
|
|
266
|
-
currentEntity: Entity | undefined;
|
|
267
|
-
isLoading: boolean;
|
|
268
|
-
error: string | undefined;
|
|
269
|
-
selectedEntities: Entity[];
|
|
270
|
-
};
|
|
271
|
-
props: {
|
|
272
|
-
countOfEntities: Signal<number>;
|
|
273
|
-
matTableDataSource: Signal<MatTableDataSource<Entity, _angular_material_paginator.MatPaginator>>;
|
|
274
|
-
};
|
|
275
|
-
methods: {
|
|
276
|
-
clearCurrentEntity: () => void;
|
|
277
|
-
createEntity: () => Entity;
|
|
278
|
-
add: (entity: Entity) => Promise<PersistedEntity<Entity> | undefined>;
|
|
279
|
-
delete: (id: string) => Promise<void>;
|
|
280
|
-
deleteAll: _ngrx_signals_rxjs_interop.RxMethod<void>;
|
|
281
|
-
deselectAll: () => void;
|
|
282
|
-
deselectEntity: (id: string) => void;
|
|
283
|
-
load: _ngrx_signals_rxjs_interop.RxMethod<BaseEntityQueryCondition>;
|
|
284
|
-
loadById: (id: string) => Entity | undefined;
|
|
285
|
-
resetErrorState: () => void;
|
|
286
|
-
selectEntity: (id: string) => void;
|
|
287
|
-
setCurrentEntity: (id: string | undefined) => void;
|
|
288
|
-
update: (entity: PersistedEntity<Entity>) => Promise<PersistedEntity<Entity> | undefined>;
|
|
289
|
-
};
|
|
290
|
-
}>;
|
|
291
|
-
|
|
292
|
-
declare class BaseEntityContainerComponent implements OnDestroy, OnInit {
|
|
293
|
-
entityDescriptor: _angular_core.InputSignal<BaseEntityDescriptor | undefined>;
|
|
294
|
-
facade: _angular_core.InputSignal<BaseEntityFacade<BaseEntity> | undefined>;
|
|
295
|
-
private readonly injectedFacade;
|
|
296
|
-
protected snackBar: MatSnackBar;
|
|
297
|
-
store: BaseEntityStoreApi<BaseEntity>;
|
|
298
|
-
protected activeFacade: _angular_core.Signal<BaseEntityFacade<BaseEntity> | undefined>;
|
|
299
|
-
protected resolvedDescriptor: _angular_core.Signal<BaseEntityDescriptor>;
|
|
300
|
-
constructor();
|
|
301
|
-
ngOnDestroy(): void;
|
|
302
|
-
ngOnInit(): void;
|
|
303
|
-
private registerEffects;
|
|
304
|
-
private registerFacadeDescriptorMerge;
|
|
305
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseEntityContainerComponent, never>;
|
|
306
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<BaseEntityContainerComponent, "base-entity-container", never, { "entityDescriptor": { "alias": "entityDescriptor"; "required": false; "isSignal": true; }; "facade": { "alias": "facade"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
declare function BaseEntityContainerStore(): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
310
|
-
state: {
|
|
311
|
-
filterKey: string | undefined;
|
|
312
|
-
};
|
|
313
|
-
props: {};
|
|
314
|
-
methods: {
|
|
315
|
-
doFilter: (filterKey: string) => void;
|
|
316
|
-
};
|
|
317
|
-
}>;
|
|
318
|
-
|
|
319
|
-
declare class BaseEntityRestService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
320
|
-
protected entityMapper: BaseEntityMapper<Entity>;
|
|
321
|
-
protected urlProperty: string;
|
|
322
|
-
protected resourceUrl: string;
|
|
323
|
-
private readonly runtimeConfiguration;
|
|
324
|
-
private readonly baseUrl;
|
|
325
|
-
protected httpClient: HttpClient;
|
|
326
|
-
protected headers: HttpHeaders;
|
|
327
|
-
constructor(entityMapper: BaseEntityMapper<Entity>, urlProperty: string, resourceUrl: string);
|
|
328
|
-
delete(id: string): Observable<unknown>;
|
|
329
|
-
deleteAll(): Observable<unknown>;
|
|
330
|
-
findAll(page?: number): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
|
|
331
|
-
findByQuery(queryCondition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
|
|
332
|
-
private isPagedResponse;
|
|
333
|
-
private isEmptyBody;
|
|
334
|
-
findById(id: string): Observable<void | PersistedEntity<Entity>>;
|
|
335
|
-
add(entity: Entity, id?: number): Observable<PersistedEntity<Entity>>;
|
|
336
|
-
update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
|
|
337
|
-
protected buildFullUrl(resourceUri: string, queryCondition: BaseEntityQueryCondition): string | undefined;
|
|
338
|
-
protected buildRsql(queryCondition: BaseEntityQueryCondition): string | undefined;
|
|
339
|
-
private buildOrder;
|
|
340
|
-
private mapPagedResponse;
|
|
341
|
-
private mapSimpleResponse;
|
|
342
|
-
private mapEntityResponse;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
type Selectable = {
|
|
346
|
-
key: string;
|
|
347
|
-
value: unknown;
|
|
348
|
-
};
|
|
349
|
-
type SelectablesInput = Array<Selectable> | (() => Array<Selectable>);
|
|
350
|
-
declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
|
|
351
|
-
description?: string;
|
|
352
|
-
styleClass?: string | undefined;
|
|
353
|
-
labelClass?: string;
|
|
354
|
-
format?: string;
|
|
355
|
-
isLinkToDetails?: boolean;
|
|
356
|
-
selectables?: SelectablesInput;
|
|
357
|
-
visible: boolean;
|
|
358
|
-
showThumbnail?: boolean;
|
|
359
|
-
hideInTable?: boolean;
|
|
360
|
-
isHeading?: boolean;
|
|
361
|
-
placeholder?: string;
|
|
362
|
-
lines?: number;
|
|
363
|
-
options: {
|
|
364
|
-
inputType: 'text';
|
|
365
|
-
};
|
|
366
|
-
required: boolean;
|
|
367
|
-
referenceIdField?: string;
|
|
368
|
-
private _label?;
|
|
369
|
-
private _linkedEntityType?;
|
|
370
|
-
constructor(attrName: string, formControlType: FormControlType, label?: string, selectables?: SelectablesInput, isLinkToDetails?: boolean, options?: object);
|
|
371
|
-
getSelectables(): Array<Selectable> | undefined;
|
|
372
|
-
get label(): string;
|
|
373
|
-
set label(label: string);
|
|
374
|
-
get linkedEntityType(): string | undefined;
|
|
375
|
-
set linkedEntityType(linkedEntityType: string | undefined);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
declare class BaseFormHostDirective {
|
|
379
|
-
viewContainerRef: ViewContainerRef;
|
|
380
|
-
constructor(viewContainerRef: ViewContainerRef);
|
|
381
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseFormHostDirective, never>;
|
|
382
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BaseFormHostDirective, "[baseFormHost]", never, {}, {}, never, never, true, never>;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
type RuleSeverity = 'ERROR' | 'WARNING' | 'INFO';
|
|
386
|
-
interface EvaluatableRule {
|
|
387
|
-
id: string;
|
|
388
|
-
expression: string;
|
|
389
|
-
severity: RuleSeverity;
|
|
390
|
-
message?: string;
|
|
391
|
-
translocoId?: string;
|
|
392
|
-
enabled?: boolean;
|
|
393
|
-
fields?: string[];
|
|
2833
|
+
/**
|
|
2834
|
+
* Contributes extra tabs to *another* feature's entity — the cross-cutting counterpart of declaring
|
|
2835
|
+
* `extraTabs` on a descriptor.
|
|
2836
|
+
*
|
|
2837
|
+
* The descriptor hook covers the case where the feature owning the entity also owns the extra screen:
|
|
2838
|
+
* `Document` adds its content editor, a `State Machine Definition` adds the modeler. It cannot cover the
|
|
2839
|
+
* opposite case, which is what this is for — base-state has a screen to offer `Order`, and neither
|
|
2840
|
+
* base-entity nor whoever authored the `order` definition can be expected to know that. A contributor is
|
|
2841
|
+
* asked about every entity whose screens are mounted through {@link EntityScreenResolver}, and answers for
|
|
2842
|
+
* the ones it recognizes.
|
|
2843
|
+
*
|
|
2844
|
+
* **Asked once per entity, when its screens are resolved.** {@link tabsFor} may therefore be asynchronous —
|
|
2845
|
+
* a contributor typically has to fetch something to know whether it has anything to offer — and the answer
|
|
2846
|
+
* is fixed for the life of the resolved entity. A tab whose *content* varies is the tab component's
|
|
2847
|
+
* business; a tab whose *existence* varies while the application runs is not expressible here, and should
|
|
2848
|
+
* be a tab that always exists and says it has nothing to show.
|
|
2849
|
+
*
|
|
2850
|
+
* Contributed tabs are appended after the descriptor's own, so a feature's own screens keep the order it
|
|
2851
|
+
* declared them in, and are deduplicated by `segment`: the same contributor answering twice for one
|
|
2852
|
+
* descriptor — which happens whenever a compile-time descriptor, being a singleton, is resolved again —
|
|
2853
|
+
* must not stack the tab up.
|
|
2854
|
+
*/
|
|
2855
|
+
interface EntityTabContributor {
|
|
2856
|
+
/** The tabs this contributor offers `descriptor`, or an empty array — the usual answer. */
|
|
2857
|
+
tabsFor(descriptor: BaseEntityDescriptor): Promise<EntityTabDescriptor[]> | EntityTabDescriptor[];
|
|
394
2858
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
2859
|
+
/**
|
|
2860
|
+
* The registered {@link EntityTabContributor}s. A `multi` token, so every feature adds its own without
|
|
2861
|
+
* any of them knowing about the others; absent entirely when no feature contributes, which is why every
|
|
2862
|
+
* reader injects it optionally.
|
|
2863
|
+
*/
|
|
2864
|
+
export declare const ENTITY_TAB_CONTRIBUTORS: InjectionToken<readonly EntityTabContributor[]>;
|
|
2865
|
+
/**
|
|
2866
|
+
* What renders a {@link FormControlType.STATE} attribute, and which attribute of an entity is one.
|
|
2867
|
+
*
|
|
2868
|
+
* base-entity knows that some attribute *holds* a state; it cannot know the machine behind it — that is
|
|
2869
|
+
* base-state's, and base-entity does not depend on it. So the feature that owns the machines registers this,
|
|
2870
|
+
* the same way it contributes its tab through `ENTITY_TAB_CONTRIBUTORS`, and nothing on either side names the
|
|
2871
|
+
* other. Without a registration a STATE attribute is shown read-only as a label.
|
|
2872
|
+
*/
|
|
2873
|
+
interface EntityStateControl {
|
|
2874
|
+
/** A `BaseFormControlComponent` subclass. Typed loosely: a stricter type would close an import cycle. */
|
|
2875
|
+
component: Type<unknown>;
|
|
2876
|
+
/**
|
|
2877
|
+
* The name of the attribute holding the state of `descriptor`'s objects, or `undefined` when no machine
|
|
2878
|
+
* governs that entity — by far the common answer. {@link EntityScreenResolver} asks this once per resolved
|
|
2879
|
+
* entity and turns that attribute into a STATE control, so a governed entity needs no descriptor change.
|
|
2880
|
+
*/
|
|
2881
|
+
stateAttributeOf(descriptor: BaseEntityDescriptor): Promise<string | undefined> | string | undefined;
|
|
2882
|
+
}
|
|
2883
|
+
export declare const ENTITY_STATE_CONTROL: InjectionToken<EntityStateControl>;
|
|
2884
|
+
interface EntityScreenRouteOptions {
|
|
2885
|
+
/** Entity whose screens to mount, by descriptor name. */
|
|
2886
|
+
entityName: string | undefined;
|
|
2887
|
+
/**
|
|
2888
|
+
* What {@link EntityScreenResolver} answered. Absent — an entity with neither a facade nor a definition —
|
|
2889
|
+
* yields a leaf route whose component renders "no entity type registered" instead of no route at all.
|
|
2890
|
+
*/
|
|
2891
|
+
screens?: EntityScreens;
|
|
2892
|
+
/**
|
|
2893
|
+
* Path this route is mounted at, if any. Only read to decide whether the entity's own segment is already
|
|
2894
|
+
* there; pass the route's own `path`, not the URL prefix above it.
|
|
2895
|
+
*/
|
|
2896
|
+
hostPath?: string;
|
|
2897
|
+
/** Extra route `data` the host wants alongside what this sets. */
|
|
2898
|
+
data?: Record<string, unknown>;
|
|
403
2899
|
}
|
|
404
|
-
interface RuleEngine {
|
|
405
|
-
loadRulesFor(context: string): Observable<EvaluatableRule[]>;
|
|
406
|
-
evaluate(entity: unknown, rule: EvaluatableRule): RuleEvaluationResult;
|
|
407
|
-
}
|
|
408
|
-
declare const RULE_ENGINE: InjectionToken<RuleEngine>;
|
|
409
|
-
|
|
410
|
-
declare class BaseEntityFormComponent<Entity extends BaseEntity> implements OnInit, OnDestroy {
|
|
411
|
-
baseEntityForm: FormGroup;
|
|
412
|
-
entityDescriptor: Signal<BaseEntityDescriptor>;
|
|
413
|
-
entity: Signal<Entity>;
|
|
414
|
-
entityId: InputSignal<string>;
|
|
415
|
-
isAbstract: Signal<boolean>;
|
|
416
|
-
isNewObject: Signal<boolean>;
|
|
417
|
-
store: Signal<BaseEntityStoreApi<Entity>>;
|
|
418
|
-
componentHost: BaseFormHostDirective;
|
|
419
|
-
violations: WritableSignal<RuleEvaluationResult[]>;
|
|
420
|
-
hasErrorViolations: Signal<boolean>;
|
|
421
|
-
saveDisabled: Signal<boolean>;
|
|
422
|
-
private readonly entityFormBuilder;
|
|
423
|
-
private readonly formBuilder;
|
|
424
|
-
protected readonly formNavigator: {
|
|
425
|
-
activeRouteSegment: Signal<_processpuzzle_base_entity.RouteSegments | undefined>;
|
|
426
|
-
entityName: Signal<string>;
|
|
427
|
-
navigationError?: Signal<string | undefined> | undefined;
|
|
428
|
-
navigateTo: Signal<string>;
|
|
429
|
-
responsePayloads: Signal<Map<string, _processpuzzle_base_entity.NavigationPayload>>;
|
|
430
|
-
requestPayloads: Signal<Map<string, _processpuzzle_base_entity.NavigationPayload>>;
|
|
431
|
-
returnTo: Signal<string>;
|
|
432
|
-
formSnapshot: Signal<Record<string, unknown> | undefined>;
|
|
433
|
-
captureFormSnapshot: (snapshot: Record<string, unknown>) => void;
|
|
434
|
-
determineCurrentUrl: () => string;
|
|
435
|
-
determineActiveRouteSegment: () => void;
|
|
436
|
-
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
437
|
-
navigateToDetails: (entityName: string, id: string, returnTo?: string, payload?: _processpuzzle_base_entity.NavigationPayload) => Promise<void>;
|
|
438
|
-
navigateToList: (entityName: string, returnTo?: string, payload?: _processpuzzle_base_entity.NavigationPayload) => Promise<void>;
|
|
439
|
-
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: _processpuzzle_base_entity.NavigationPayload) => Promise<void>;
|
|
440
|
-
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: _processpuzzle_base_entity.NavigationPayload) => Promise<void>;
|
|
441
|
-
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
442
|
-
destroyNavigationTracking: () => void;
|
|
443
|
-
initializeNavigationTracking: () => void;
|
|
444
|
-
popFormSnapshot: () => Record<string, unknown> | undefined;
|
|
445
|
-
popRequestPayload: (attrName?: string) => _processpuzzle_base_entity.NavigationPayload | undefined;
|
|
446
|
-
popResponsePayload: (attrName?: string) => _processpuzzle_base_entity.NavigationPayload | undefined;
|
|
447
|
-
pushResponsePayload: (payload: _processpuzzle_base_entity.NavigationPayload) => void;
|
|
448
|
-
setEntityName: (entityName: string) => void;
|
|
449
|
-
} & _ngrx_signals.StateSource<{
|
|
450
|
-
activeRouteSegment: _processpuzzle_base_entity.RouteSegments | undefined;
|
|
451
|
-
entityName: string;
|
|
452
|
-
navigationError?: string | undefined;
|
|
453
|
-
navigateTo: string;
|
|
454
|
-
responsePayloads: Map<string, _processpuzzle_base_entity.NavigationPayload>;
|
|
455
|
-
requestPayloads: Map<string, _processpuzzle_base_entity.NavigationPayload>;
|
|
456
|
-
returnTo: string;
|
|
457
|
-
formSnapshot: Record<string, unknown> | undefined;
|
|
458
|
-
}>;
|
|
459
|
-
private readonly logger;
|
|
460
|
-
private readonly ruleEngine;
|
|
461
|
-
private readonly violationsStore;
|
|
462
|
-
private rules;
|
|
463
|
-
private readonly fieldsWithRuleErrors;
|
|
464
|
-
private readonly ruleLoad$;
|
|
465
|
-
private ruleSubscription;
|
|
466
|
-
constructor();
|
|
467
|
-
ngOnInit(): void;
|
|
468
|
-
ngOnDestroy(): void;
|
|
469
|
-
onCancel(): Promise<void>;
|
|
470
|
-
onDelete(): Promise<void>;
|
|
471
|
-
onFieldBlur(): void;
|
|
472
|
-
onSubmit(): Promise<void>;
|
|
473
|
-
private evaluateRules;
|
|
474
|
-
private applyFieldRuleErrors;
|
|
475
|
-
private clearFieldRuleErrors;
|
|
476
|
-
private loadRules;
|
|
477
|
-
private registerEffects;
|
|
478
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<BaseEntityFormComponent<any>, never>;
|
|
479
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<BaseEntityFormComponent<any>, "base-form", never, { "entityId": { "alias": "entityId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
2900
|
/**
|
|
483
|
-
*
|
|
2901
|
+
* One entity's screens as a `Route` — component, `data` and the children that make List and Details real
|
|
2902
|
+
* routes.
|
|
484
2903
|
*
|
|
485
|
-
*
|
|
2904
|
+
* The `Route` is returned rather than registered, so it composes: a hand-written application spreads it into
|
|
2905
|
+
* its own route config, and base-app's `AppRouteRenderer` spreads it into what an `AppDefinition` authored.
|
|
2906
|
+
* `path` is deliberately **not** set — that belongs to whoever mounts this.
|
|
486
2907
|
*
|
|
487
|
-
*
|
|
488
|
-
*
|
|
489
|
-
*
|
|
490
|
-
*
|
|
2908
|
+
* Everything about the URL shape lives here rather than in any one host, because the rules are
|
|
2909
|
+
* base-entity's: `BaseFormNavigatorSingletonStore` composes every entity URL as
|
|
2910
|
+
* `<base>/<snakeCaseName(entityName)>/list` or `<base>/<snakeCaseName(entityName)>/<id>/details`, and
|
|
2911
|
+
* derives `<base>` by counting segments back from the current URL. A host that got this wrong would see
|
|
2912
|
+
* every tab click and row link do nothing at all — see {@link entityScreenChildren}.
|
|
2913
|
+
*/
|
|
2914
|
+
export declare function entityScreenRoute({ entityName, screens, hostPath, data }: EntityScreenRouteOptions): Route;
|
|
2915
|
+
/** Route `data` key under which {@link entityScreenRoute} puts the descriptor to render. */
|
|
2916
|
+
export declare const ENTITY_DESCRIPTOR_ROUTE_DATA_KEY = "entityDescriptor";
|
|
2917
|
+
/**
|
|
2918
|
+
* Route `data` key naming the entity the route *asked* for — which is all this component needs, and needs
|
|
2919
|
+
* even when nothing answered to it.
|
|
491
2920
|
*
|
|
492
|
-
*
|
|
2921
|
+
* Not `ENTITY_NAME_ROUTE_DATA_KEY`, deliberately: that key marks the route owning the entity's URL segment,
|
|
2922
|
+
* and everything that reads it — `readEmbeddedBreadcrumb`, `EntityRouteRegistry` — would take this route to
|
|
2923
|
+
* be that one. See the note in {@link entityScreenRoute}.
|
|
493
2924
|
*/
|
|
494
|
-
declare
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
declare
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
2925
|
+
export declare const REQUESTED_ENTITY_ROUTE_DATA_KEY = "requestedEntityName";
|
|
2926
|
+
/**
|
|
2927
|
+
* Hosts one entity's generated screens at a route: List and Details, with the tab bar, toolbar and status
|
|
2928
|
+
* bar `BaseEntityTabsComponent` brings, and the outlet its own child routes render in.
|
|
2929
|
+
*
|
|
2930
|
+
* The descriptor is **read off the route, not resolved here**. Whoever built the route resolved it — see
|
|
2931
|
+
* {@link entityScreenRoute} — so it is on `data` by the time this component exists. That is deliberate:
|
|
2932
|
+
* resolving here would mean an `await` inside the component, hence a frame with no container, and therefore
|
|
2933
|
+
* no `<router-outlet>`, while a child route (`…/order/list`) is already activated.
|
|
2934
|
+
*
|
|
2935
|
+
* Works for an entity of either kind, because a descriptor is a descriptor: one whose facade was compiled in
|
|
2936
|
+
* and one synthesized from a `BaseEntityDefinition` reach here the same way. That is what lets an
|
|
2937
|
+
* application mount metadata-defined entity screens with no knowledge of where the descriptor came from —
|
|
2938
|
+
* and with no dependency on base-app, which merely happens to be one caller.
|
|
2939
|
+
*
|
|
2940
|
+
* Without a descriptor the route stays a leaf and says so. A warning rather than a failure: whatever names
|
|
2941
|
+
* the entity — an `AppDefinition` route, a hand-written route in an application — is allowed to be ahead of
|
|
2942
|
+
* what is deployed, and the link that leads here has to render something.
|
|
2943
|
+
*/
|
|
2944
|
+
export declare class BaseEntityScreensComponent {
|
|
2945
|
+
private readonly route;
|
|
2946
|
+
protected readonly entityName: import("@angular/core").Signal<string | undefined>;
|
|
2947
|
+
protected readonly descriptor: import("@angular/core").Signal<BaseEntityDescriptor | undefined>;
|
|
2948
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityScreensComponent, never>;
|
|
2949
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityScreensComponent, "base-entity-screens", never, {}, {}, never, never, true, never>;
|
|
2950
|
+
}
|
|
2951
|
+
/** One `<entity>/<id>/details` step of the URL: which entity, and which instance of it. */
|
|
2952
|
+
interface EmbeddedRouteLevel {
|
|
2953
|
+
entityName: string;
|
|
2954
|
+
/** `undefined` on a list route, {@link BaseUrlSegments.NewEntity} for a row being created. */
|
|
2955
|
+
entityId: string | undefined;
|
|
2956
|
+
}
|
|
2957
|
+
/** A {@link EmbeddedRouteLevel} with the two URLs the level can be navigated by. */
|
|
2958
|
+
interface EmbeddedBreadcrumbLevel extends EmbeddedRouteLevel {
|
|
2959
|
+
/** This level's own screen — its details form, or its list while no row is named. */
|
|
2960
|
+
url: string;
|
|
2961
|
+
/** The prefix the level's own `<entity>/...` segments hang off, which a sibling URL is built on. */
|
|
2962
|
+
baseUrl: string;
|
|
2963
|
+
}
|
|
2964
|
+
/** Everything the store's service needs to read and write one embedded level's rows. */
|
|
2965
|
+
interface EmbeddedRouteContext {
|
|
2966
|
+
rootEntityName: string;
|
|
2967
|
+
rootId: string;
|
|
2968
|
+
/** Hops from the root down to the **owner** of these rows; `[]` when the owner is the root itself. */
|
|
2969
|
+
path: EmbeddedPath;
|
|
2970
|
+
/** The owner's attribute carrying these rows. */
|
|
2971
|
+
attrName: string;
|
|
2972
|
+
entityName: string;
|
|
2973
|
+
referenceIdField?: string;
|
|
2974
|
+
}
|
|
2975
|
+
/**
|
|
2976
|
+
* The chain of entities the URL walks through, outermost first — `Test Entity/1`, then
|
|
2977
|
+
* `Embedded Component/embedded_1_1`, and so on. It reads the URL only, which is what makes a deep link and a
|
|
2978
|
+
* page refresh resolve to the same row as a drill-down.
|
|
2979
|
+
*
|
|
2980
|
+
* The entity name sits on the container route and the id on its `:entityId/details` child, and the router
|
|
2981
|
+
* hands both **down** to the routes nested below them. Three rules undo that inheritance:
|
|
2982
|
+
*
|
|
2983
|
+
* - a name counts only from the route that *declares* it in its config, not from every descendant that
|
|
2984
|
+
* inherited it — see {@link declaredEntityName};
|
|
2985
|
+
* - a name repeated while the level below it still has no id is that level's own details route echoing its
|
|
2986
|
+
* container, not a new level — whereas a repeat *after* an id is a genuinely self-nesting child
|
|
2987
|
+
* (`app-nav-item/a/details/app-nav-item/b/details`), which `App Nav Item` needs;
|
|
2988
|
+
* - an id counts only from the route that actually declares `:entityId`, so a nested branch does not adopt
|
|
2989
|
+
* the id of the entity it hangs under.
|
|
2990
|
+
*/
|
|
2991
|
+
declare function readEmbeddedRouteChain(snapshot: ActivatedRouteSnapshot | null): EmbeddedRouteLevel[];
|
|
2992
|
+
/**
|
|
2993
|
+
* The same chain, each level carrying the URL of its own screen — which is what turns it into a
|
|
2994
|
+
* breadcrumb the user can walk back up.
|
|
2995
|
+
*
|
|
2996
|
+
* The URL is accumulated from the segments of the routes the walk passes, so a level's `url` ends at the
|
|
2997
|
+
* last route that belongs to *it*: `<owner>/<id>/details` for a level a row is named on. `baseUrl` stops
|
|
2998
|
+
* one step earlier, before the level's own entity segment, and is what a sibling list or details URL is
|
|
2999
|
+
* built on.
|
|
3000
|
+
*/
|
|
3001
|
+
declare function readEmbeddedBreadcrumb(snapshot: ActivatedRouteSnapshot | null): EmbeddedBreadcrumbLevel[];
|
|
3002
|
+
/**
|
|
3003
|
+
* The part of a URL chain that is **one aggregate**: the longest tail in which every level is an embedded
|
|
3004
|
+
* component of the level above it.
|
|
3005
|
+
*
|
|
3006
|
+
* A URL may walk through entities that have nothing to do with each other. The designer's Preview tab is the
|
|
3007
|
+
* case that forced this: a previewed application's screens are mounted *below* `app-definition/<id>`, so an
|
|
3008
|
+
* order line's chain reads `App Definition` -> `Order` -> `Order Line`. Taking the outermost level as the
|
|
3009
|
+
* aggregate root then asks `App Definition` for an embedded `Order` it has never heard of, and nothing
|
|
3010
|
+
* resolves — which showed up as every embedded list in a previewed application coming up empty, and every
|
|
3011
|
+
* link into an embedded row bouncing back to the form it was clicked on.
|
|
3012
|
+
*
|
|
3013
|
+
* Walking back from the deepest level and stopping at the first pair that is not a containment expresses
|
|
3014
|
+
* "one aggregate" without needing to know *why* the outer levels are there. For an ordinary authoring URL,
|
|
3015
|
+
* where the whole chain is one aggregate, it stops at the root and changes nothing.
|
|
3016
|
+
*/
|
|
3017
|
+
declare function aggregateChainOf<Level extends EmbeddedRouteLevel>(levels: readonly Level[], descriptorOf: (entityName: string) => BaseEntityDescriptor | undefined): Level[];
|
|
3018
|
+
/**
|
|
3019
|
+
* Turns the URL chain into a path into the root's payload. Resolving the hops needs the payload itself,
|
|
3020
|
+
* because a row's position is what addresses it — the URL carries the row's *key*, and only the aggregate
|
|
3021
|
+
* knows where that key currently sits.
|
|
3022
|
+
*
|
|
3023
|
+
* Returns `undefined` when the chain names no embedded level, when a descriptor is missing, or when an
|
|
3024
|
+
* intermediate row cannot be found — a stale deep link, which the caller turns into a redirect rather than
|
|
3025
|
+
* into a form bound to the wrong row.
|
|
3026
|
+
*/
|
|
3027
|
+
declare function resolveEmbeddedRouteContext(levels: readonly EmbeddedRouteLevel[], rootPayload: unknown, descriptorOf: (entityName: string) => BaseEntityDescriptor | undefined): EmbeddedRouteContext | undefined;
|
|
3028
|
+
/** An embedded level resolved against the live aggregate: where its rows are, and who owns the document. */
|
|
3029
|
+
interface ResolvedEmbeddedAggregate {
|
|
3030
|
+
context: EmbeddedRouteContext;
|
|
3031
|
+
rootStore: BaseEntityStoreApi<BaseEntity>;
|
|
3032
|
+
rootPayload: unknown;
|
|
3033
|
+
}
|
|
3034
|
+
/**
|
|
3035
|
+
* Resolves an embedded entity's place in the aggregate that is currently open, and is the single point that
|
|
3036
|
+
* knows an embedded write is really a write of the **root** document.
|
|
3037
|
+
*
|
|
3038
|
+
* The lookup is done per call rather than held as state: the stores are root singletons, while the row an
|
|
3039
|
+
* embedded store stands for changes with every navigation.
|
|
3040
|
+
*/
|
|
3041
|
+
export declare class EmbeddedAggregateAccessor {
|
|
3042
|
+
private readonly router;
|
|
3043
|
+
private readonly descriptorRegistry;
|
|
3044
|
+
/** `undefined` when no aggregate holding `entityName` is open — the caller decides whether that is an error. */
|
|
3045
|
+
resolve(entityName: string): ResolvedEmbeddedAggregate | undefined;
|
|
3046
|
+
/**
|
|
3047
|
+
* The store of the document `entityName`'s rows live in, resolved from the route alone.
|
|
3048
|
+
*
|
|
3049
|
+
* Unlike {@link resolve} this answers before the document has loaded, which is what lets a caller depend on
|
|
3050
|
+
* it reactively: an embedded store's rows are a projection of the containing document, so whoever reads
|
|
3051
|
+
* them has to be told when that document arrives or changes.
|
|
3052
|
+
*/
|
|
3053
|
+
rootStoreFor(entityName: string): BaseEntityStoreApi<BaseEntity> | undefined;
|
|
3054
|
+
/**
|
|
3055
|
+
* Stages the aggregate with `rootPayload` replaced — an embedded row has no endpoint of its own, and it is
|
|
3056
|
+
* not persisted on its own either: the root's Save writes the whole document once the user is back on it.
|
|
3057
|
+
* Persisting each child step would put the document's own rules in the way of building it — an order's
|
|
3058
|
+
* total cannot match its lines while a line is being added — and leave half-finished documents behind.
|
|
3059
|
+
*/
|
|
3060
|
+
stageRoot(resolved: ResolvedEmbeddedAggregate, rootPayload: Record<string, unknown>): void;
|
|
3061
|
+
/**
|
|
3062
|
+
* The URL chain, ending at `entityName`.
|
|
3063
|
+
*
|
|
3064
|
+
* The route chain does not always reach the entity being asked about: the rows of a *nested* embedded
|
|
3065
|
+
* attribute are listed on their owner's form, so `Embedded Detail`'s store is read while the deepest
|
|
3066
|
+
* active route is still `Embedded Component`. Appending the level in that case is what lets one form host
|
|
3067
|
+
* the list of the next level down.
|
|
3068
|
+
*/
|
|
3069
|
+
private levelsFor;
|
|
3070
|
+
/** The levels of {@link levelsFor} that form one aggregate. See {@link aggregateChainOf}. */
|
|
3071
|
+
private aggregateOf;
|
|
3072
|
+
private deepestActivatedRoute;
|
|
3073
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedAggregateAccessor, never>;
|
|
3074
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
3075
|
+
}
|
|
3076
|
+
/**
|
|
3077
|
+
* The repository of an **embedded** entity: one that has no endpoint of its own because its payload travels
|
|
3078
|
+
* inside its parent's document.
|
|
3079
|
+
*
|
|
3080
|
+
* It is the only piece of the embedded story the rest of the framework does not already have. Because
|
|
3081
|
+
* `BaseEntityStore` reaches the outside world through exactly this interface, swapping the repository is
|
|
3082
|
+
* enough — the child's `BaseEntityListComponent` and `BaseEntityFormComponent`, and the store between them,
|
|
3083
|
+
* are the stock ones and know nothing about any of this.
|
|
3084
|
+
*
|
|
3085
|
+
* A write is a write of the whole root document, **staged** in the root's store rather than persisted (see
|
|
3086
|
+
* {@link EmbeddedAggregateAccessor.stageRoot}): a child's Save, Add or Delete changes the document the root's
|
|
3087
|
+
* form is editing, and the root's own Save — or Cancel — commits or discards all of it at once.
|
|
3088
|
+
*/
|
|
3089
|
+
export declare class EmbeddedEntityService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
3090
|
+
private readonly entityName;
|
|
3091
|
+
private readonly accessor;
|
|
3092
|
+
constructor(entityName: string, accessor: EmbeddedAggregateAccessor);
|
|
3093
|
+
/**
|
|
3094
|
+
* The row arrives with its key already set — `createEntity()` mints one for an `id`-bearing child, and a
|
|
3095
|
+
* child keyed by something else (`App Region` by `type`) gets it from the form — so there is no
|
|
3096
|
+
* server-assigned identity to wait for.
|
|
3097
|
+
*/
|
|
3098
|
+
add(entity: Entity): Observable<PersistedEntity<Entity>>;
|
|
3099
|
+
update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
|
|
3100
|
+
delete(id: string): Observable<unknown>;
|
|
3101
|
+
deleteAll(): Observable<unknown>;
|
|
3102
|
+
findAll(): Observable<PersistedEntity<Entity>[]>;
|
|
3103
|
+
/**
|
|
3104
|
+
* Ignores the query: an embedded attribute holds the rows of exactly one owner, so there is nothing to
|
|
3105
|
+
* page or filter server-side. Returning a bare array puts the store on its unpaged branch, where
|
|
3106
|
+
* `totalElements` follows the row count.
|
|
3107
|
+
*/
|
|
3108
|
+
findByQuery(): Observable<PersistedEntity<Entity>[]>;
|
|
3109
|
+
findById(id: string): Observable<PersistedEntity<Entity> | void>;
|
|
3110
|
+
/**
|
|
3111
|
+
* Reads without an aggregate are answered with nothing rather than an error: a store's `onInit` load runs
|
|
3112
|
+
* as soon as it is injected, which can be before the route that gives it an owner has activated.
|
|
3113
|
+
*/
|
|
3114
|
+
private rows;
|
|
3115
|
+
private rowsOf;
|
|
3116
|
+
private commit;
|
|
3117
|
+
/** A write without an owner would silently go nowhere, so it names the entity instead. */
|
|
3118
|
+
private require;
|
|
3119
|
+
}
|
|
3120
|
+
/**
|
|
3121
|
+
* Makes an embedded route survive a page refresh.
|
|
3122
|
+
*
|
|
3123
|
+
* Reached by drilling down, the aggregate is already in the root's store; reached by a deep link it is not,
|
|
3124
|
+
* and nothing else would load it — an embedded store reads its rows out of the root's payload, so it would
|
|
3125
|
+
* come up empty and the form would bind to nothing. Guards run before any component is created and
|
|
3126
|
+
* parent-before-child, which is exactly the ordering the nested case needs, and returning a `UrlTree` is how
|
|
3127
|
+
* a link to a row that no longer exists lands somewhere sensible instead of on an empty form.
|
|
3128
|
+
*/
|
|
3129
|
+
export declare const embeddedAggregateGuard: CanActivateFn;
|
|
3130
|
+
/**
|
|
3131
|
+
* The branch route of an embedded level: it hands the level's descriptor to the form below it and adds
|
|
3132
|
+
* nothing else.
|
|
3133
|
+
*
|
|
3134
|
+
* Where a stand-alone entity gets `BaseEntityContainerComponent` — tab bar, toolbar, status bar — an
|
|
3135
|
+
* embedded level deliberately gets none of that. Its rows are already listed on the form of the entity
|
|
3136
|
+
* that contains it, so a list tab would be a second way to the same thing, and a second tab bar and
|
|
3137
|
+
* status bar inside the owner's would say twice what the breadcrumb in
|
|
3138
|
+
* `BaseEntityStatusbarComponent` says once. Drilling down replaces the surface; it does not nest chrome
|
|
3139
|
+
* inside chrome.
|
|
3140
|
+
*/
|
|
3141
|
+
export declare class EmbeddedEntityHostComponent {
|
|
3142
|
+
private readonly facade;
|
|
3143
|
+
private readonly snackBar;
|
|
3144
|
+
protected readonly entityDescriptor: Signal<BaseEntityDescriptor>;
|
|
3145
|
+
constructor();
|
|
3146
|
+
/**
|
|
3147
|
+
* An embedded write is a write of the containing document, and it fails the same way any other write
|
|
3148
|
+
* can — so the level reports it, even though it has no toolbar of its own.
|
|
3149
|
+
*
|
|
3150
|
+
* Unlike `BaseEntityContainerComponent` this host does **not** reset the store when it is destroyed:
|
|
3151
|
+
* an embedded store's rows are a projection of the owner's document, and emptying them on the way back
|
|
3152
|
+
* up would blank the very row list the user returns to.
|
|
3153
|
+
*/
|
|
3154
|
+
private registerEffects;
|
|
3155
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedEntityHostComponent, never>;
|
|
3156
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedEntityHostComponent, "base-embedded-entity-host", never, {}, {}, never, never, true, never>;
|
|
3157
|
+
}
|
|
3158
|
+
export declare enum NavigatorCommand {
|
|
3159
|
+
SELECT_OR_CREATE = "SelectOrCreate",
|
|
3160
|
+
EDIT = "Edit"
|
|
586
3161
|
}
|
|
587
3162
|
interface NavigationPayload {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
3163
|
+
command: NavigatorCommand;
|
|
3164
|
+
attrName?: string;
|
|
3165
|
+
payload?: object;
|
|
3166
|
+
context?: unknown;
|
|
592
3167
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
3168
|
+
export declare enum RouteSegments {
|
|
3169
|
+
LIST_ROUTE = "LIST_ROUTE",
|
|
3170
|
+
DETAILS_ROUTE = "DETAILS_ROUTE",
|
|
3171
|
+
/**
|
|
3172
|
+
* One of an entity's extra tabs (see `EntityTabDescriptor`) — `<entity>/<id>/content` and the like.
|
|
3173
|
+
* Which segments count is registered by {@link BaseEntityTabsComponent}, because the store has no
|
|
3174
|
+
* descriptors of its own: a URL tail is only a tab if some entity on screen declared it as one, and an
|
|
3175
|
+
* unregistered tail stays `undefined` exactly as before.
|
|
3176
|
+
*/
|
|
3177
|
+
ENTITY_TAB_ROUTE = "ENTITY_TAB_ROUTE"
|
|
597
3178
|
}
|
|
598
3179
|
interface NavigationState {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
3180
|
+
activeRouteSegment: RouteSegments | undefined;
|
|
3181
|
+
/**
|
|
3182
|
+
* The extra tab the current URL ends in, when {@link activeRouteSegment} is `ENTITY_TAB_ROUTE`. Which
|
|
3183
|
+
* tab is open cannot be read off the enum, since every extra tab shares that one value.
|
|
3184
|
+
*/
|
|
3185
|
+
activeTabSegment: string | undefined;
|
|
3186
|
+
/** Extra tab segments the entities currently on screen declare. See {@link RouteSegments.ENTITY_TAB_ROUTE}. */
|
|
3187
|
+
tabSegments: string[];
|
|
3188
|
+
/**
|
|
3189
|
+
* The entities the current URL walks through, outermost first — what the status bar renders as a
|
|
3190
|
+
* breadcrumb. Derived from the route, never remembered, so a deep link and a refresh describe the same
|
|
3191
|
+
* hierarchy as a drill-down.
|
|
3192
|
+
*/
|
|
3193
|
+
breadcrumb: EmbeddedBreadcrumbLevel[];
|
|
3194
|
+
entityName: string;
|
|
3195
|
+
navigationError?: string;
|
|
3196
|
+
navigateTo: string;
|
|
3197
|
+
responsePayloads: Map<string, NavigationPayload>;
|
|
3198
|
+
requestPayloads: Map<string, NavigationPayload>;
|
|
3199
|
+
returnTo: string;
|
|
3200
|
+
formSnapshot: Record<string, unknown> | undefined;
|
|
607
3201
|
}
|
|
608
|
-
declare
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
3202
|
+
export declare function snakeCaseName(entityName: string): string;
|
|
3203
|
+
export declare const BaseFormNavigatorSingletonStore: import("@angular/core").Type<{
|
|
3204
|
+
activeRouteSegment: import("@angular/core").Signal<RouteSegments | undefined>;
|
|
3205
|
+
activeTabSegment: import("@angular/core").Signal<string | undefined>;
|
|
3206
|
+
tabSegments: import("@angular/core").Signal<string[]>;
|
|
3207
|
+
breadcrumb: import("@angular/core").Signal<EmbeddedBreadcrumbLevel[]>;
|
|
3208
|
+
entityName: import("@angular/core").Signal<string>;
|
|
3209
|
+
navigationError?: import("@angular/core").Signal<string | undefined> | undefined;
|
|
3210
|
+
navigateTo: import("@angular/core").Signal<string>;
|
|
3211
|
+
responsePayloads: import("@angular/core").Signal<Map<string, NavigationPayload>>;
|
|
3212
|
+
requestPayloads: import("@angular/core").Signal<Map<string, NavigationPayload>>;
|
|
3213
|
+
returnTo: import("@angular/core").Signal<string>;
|
|
3214
|
+
formSnapshot: import("@angular/core").Signal<Record<string, unknown> | undefined>;
|
|
3215
|
+
captureFormSnapshot: (snapshot: Record<string, unknown>) => void;
|
|
3216
|
+
determineCurrentUrl: () => string;
|
|
3217
|
+
determineOwnerUrl: () => string;
|
|
3218
|
+
determineActiveRouteSegment: () => void;
|
|
3219
|
+
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
3220
|
+
navigateToBreadcrumbLevel: (index: number) => Promise<void>;
|
|
3221
|
+
navigateToDetails: (entityName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
3222
|
+
navigateToEmbedded: (embeddedTypeName: string, id: string, payload?: NavigationPayload) => Promise<void>;
|
|
3223
|
+
navigateToList: (entityName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
3224
|
+
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
3225
|
+
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
3226
|
+
navigateToTab: (entityName: string, id: string, segment: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
3227
|
+
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
3228
|
+
registerTabSegments: (segments: string[]) => void;
|
|
3229
|
+
showsScreenOf: (entityName: string) => boolean;
|
|
3230
|
+
destroyNavigationTracking: () => void;
|
|
3231
|
+
initializeNavigationTracking: () => void;
|
|
3232
|
+
popFormSnapshot: () => Record<string, unknown> | undefined;
|
|
3233
|
+
popRequestPayload: (attrName?: string) => NavigationPayload | undefined;
|
|
3234
|
+
popResponsePayload: (attrName?: string) => NavigationPayload | undefined;
|
|
3235
|
+
pushResponsePayload: (payload: NavigationPayload) => void;
|
|
3236
|
+
setEntityName: (entityName: string) => void;
|
|
3237
|
+
} & import("@ngrx/signals").StateSource<{
|
|
3238
|
+
activeRouteSegment: RouteSegments | undefined;
|
|
3239
|
+
activeTabSegment: string | undefined;
|
|
3240
|
+
tabSegments: string[];
|
|
3241
|
+
breadcrumb: EmbeddedBreadcrumbLevel[];
|
|
3242
|
+
entityName: string;
|
|
3243
|
+
navigationError?: string | undefined;
|
|
3244
|
+
navigateTo: string;
|
|
3245
|
+
responsePayloads: Map<string, NavigationPayload>;
|
|
3246
|
+
requestPayloads: Map<string, NavigationPayload>;
|
|
3247
|
+
returnTo: string;
|
|
3248
|
+
formSnapshot: Record<string, unknown> | undefined;
|
|
3249
|
+
}>>;
|
|
3250
|
+
export declare function BaseFormNavigatorStore(entityName: string): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
|
|
3251
|
+
state: {};
|
|
3252
|
+
props: {
|
|
3253
|
+
activeRouteSegment: import("@angular/core").Signal<RouteSegments | undefined>;
|
|
3254
|
+
activeTabSegment: import("@angular/core").Signal<string | undefined>;
|
|
3255
|
+
breadcrumb: import("@angular/core").Signal<EmbeddedBreadcrumbLevel[]>;
|
|
3256
|
+
entityName: import("@angular/core").Signal<string>;
|
|
3257
|
+
navigationError: import("@angular/core").Signal<string | undefined> | undefined;
|
|
3258
|
+
navigateTo: import("@angular/core").Signal<string>;
|
|
3259
|
+
navigatorPayloads: import("@angular/core").Signal<Map<string, NavigationPayload>>;
|
|
3260
|
+
requestPayloads: import("@angular/core").Signal<Map<string, NavigationPayload>>;
|
|
3261
|
+
responsePayloads: import("@angular/core").Signal<Map<string, NavigationPayload>>;
|
|
3262
|
+
returnTo: import("@angular/core").Signal<string>;
|
|
619
3263
|
determineActiveRouteSegment: () => void;
|
|
3264
|
+
determineCurrentUrl: () => string;
|
|
3265
|
+
determineOwnerUrl: () => string;
|
|
620
3266
|
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
621
|
-
|
|
622
|
-
|
|
3267
|
+
navigateToBreadcrumbLevel: (index: number) => Promise<void>;
|
|
3268
|
+
navigateToDetails: (id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
3269
|
+
navigateToEmbedded: (embeddedTypeName: string, id: string, payload?: NavigationPayload) => Promise<void>;
|
|
3270
|
+
navigateToList: (returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
623
3271
|
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
624
3272
|
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
3273
|
+
navigateToTab: (id: string, segment: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
625
3274
|
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
626
|
-
|
|
627
|
-
initializeNavigationTracking: () => void;
|
|
628
|
-
popFormSnapshot: () => Record<string, unknown> | undefined;
|
|
3275
|
+
registerTabSegments: (segments: string[]) => void;
|
|
629
3276
|
popRequestPayload: (attrName?: string) => NavigationPayload | undefined;
|
|
630
3277
|
popResponsePayload: (attrName?: string) => NavigationPayload | undefined;
|
|
631
3278
|
pushResponsePayload: (payload: NavigationPayload) => void;
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
activeRouteSegment: RouteSegments | undefined;
|
|
635
|
-
entityName: string;
|
|
636
|
-
navigationError?: string | undefined;
|
|
637
|
-
navigateTo: string;
|
|
638
|
-
responsePayloads: Map<string, NavigationPayload>;
|
|
639
|
-
requestPayloads: Map<string, NavigationPayload>;
|
|
640
|
-
returnTo: string;
|
|
641
|
-
formSnapshot: Record<string, unknown> | undefined;
|
|
642
|
-
}>>;
|
|
643
|
-
declare function BaseFormNavigatorStore(entityName: string): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
644
|
-
state: {};
|
|
645
|
-
props: {
|
|
646
|
-
activeRouteSegment: _angular_core.Signal<RouteSegments | undefined>;
|
|
647
|
-
entityName: _angular_core.Signal<string>;
|
|
648
|
-
navigationError: _angular_core.Signal<string | undefined> | undefined;
|
|
649
|
-
navigateTo: _angular_core.Signal<string>;
|
|
650
|
-
navigatorPayloads: _angular_core.Signal<Map<string, NavigationPayload>>;
|
|
651
|
-
requestPayloads: _angular_core.Signal<Map<string, NavigationPayload>>;
|
|
652
|
-
responsePayloads: _angular_core.Signal<Map<string, NavigationPayload>>;
|
|
653
|
-
returnTo: _angular_core.Signal<string>;
|
|
654
|
-
determineActiveRouteSegment: () => void;
|
|
655
|
-
determineCurrentUrl: () => string;
|
|
656
|
-
navigateBack: (defaultUrl?: string) => Promise<void>;
|
|
657
|
-
navigateToDetails: (id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
658
|
-
navigateToList: (returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
659
|
-
navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
660
|
-
navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: NavigationPayload) => Promise<void>;
|
|
661
|
-
navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
|
|
662
|
-
popRequestPayload: (attrName?: string) => NavigationPayload | undefined;
|
|
663
|
-
popResponsePayload: (attrName?: string) => NavigationPayload | undefined;
|
|
664
|
-
pushResponsePayload: (payload: NavigationPayload) => void;
|
|
665
|
-
};
|
|
666
|
-
methods: {};
|
|
3279
|
+
};
|
|
3280
|
+
methods: {};
|
|
667
3281
|
}>;
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
declare
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
declare function provideEntityRouteRegistry(): EnvironmentProviders;
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
3282
|
+
export declare const ENTITY_NAME_ROUTE_DATA_KEY = "entityName";
|
|
3283
|
+
/** Marks a route branch as an embedded child, which is addressed relative to its owner rather than absolutely. */
|
|
3284
|
+
export declare const EMBEDDED_ENTITY_ROUTE_DATA_KEY = "embeddedEntity";
|
|
3285
|
+
export declare class EntityRouteRegistry {
|
|
3286
|
+
private readonly router;
|
|
3287
|
+
private readonly basePaths;
|
|
3288
|
+
scan(): void;
|
|
3289
|
+
observeLazyLoads(): void;
|
|
3290
|
+
basePath(entityName: string): string | undefined;
|
|
3291
|
+
listPath(entityName: string): string | undefined;
|
|
3292
|
+
detailsPath(entityName: string, id: string): string | undefined;
|
|
3293
|
+
registeredEntities(): ReadonlyArray<string>;
|
|
3294
|
+
private walk;
|
|
3295
|
+
private append;
|
|
3296
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityRouteRegistry, never>;
|
|
3297
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
3298
|
+
}
|
|
3299
|
+
export declare function provideEntityRouteRegistry(): EnvironmentProviders;
|
|
3300
|
+
/**
|
|
3301
|
+
* Talks to Firestore straight from the browser, bypassing the OpenAPI contract entirely.
|
|
3302
|
+
*
|
|
3303
|
+
* @deprecated Use `BaseEntityRestService` against the contract. This adapter is kept for consumers
|
|
3304
|
+
* who deploy on Firestore; ProcessPuzzle itself no longer does, so it is no longer exercised by any
|
|
3305
|
+
* environment here.
|
|
3306
|
+
*
|
|
3307
|
+
* Why this path is being retired rather than kept as an option:
|
|
3308
|
+
* - **It is a second seam.** With an adapter chosen in the client, every feature has to be built
|
|
3309
|
+
* twice, and only the REST half is covered by a contract test. Drift on this side is undetectable
|
|
3310
|
+
* until it reaches a user.
|
|
3311
|
+
* - **Its paging is a fiction.** `findByQueryAsync` reports `totalPages: 1` and
|
|
3312
|
+
* `totalElements: content.length`, so a paginator tells the truth on REST and guesses here.
|
|
3313
|
+
* - **Firestore cannot answer the query language.** `createQuery` maps a
|
|
3314
|
+
* {@link BaseEntityQueryCondition} onto Firestore constraints, which have no substring or
|
|
3315
|
+
* case-insensitive compare, and silently drop documents that lack the `orderBy` field.
|
|
3316
|
+
* - **Authorization ends up in two dialects** — `firestore.rules` here, server-side policy there —
|
|
3317
|
+
* so tenant isolation has to be got right twice.
|
|
3318
|
+
*
|
|
3319
|
+
* Nothing about it is broken today and no removal date is set, but only one call site is left to
|
|
3320
|
+
* migrate before it can go: `BaseEntityFacade.createService` still returns it when
|
|
3321
|
+
* `BACKEND_SERVICE_PROVIDER` is not `rest`. `ApplicationPropertyService` in `base-widget` no longer
|
|
3322
|
+
* extends it, and the testbed's own Firestore sample is gone — its entities are served through the
|
|
3323
|
+
* contract like every other deployment's.
|
|
3324
|
+
*
|
|
3325
|
+
* Both of its dependencies on `@angular/fire` are injected rather than imported: the instance as
|
|
3326
|
+
* {@link FIRESTORE} rather than the `Firestore` class, and the module functions as {@link FIRESTORE_API}.
|
|
3327
|
+
* Each token's own file says which testability problem it solves.
|
|
3328
|
+
*/
|
|
3329
|
+
export declare class BaseEntityFirestoreService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
|
|
3330
|
+
protected entityMapper: BaseEntityMapper<Entity>;
|
|
3331
|
+
protected collectionName: string;
|
|
3332
|
+
protected collection: import("@firebase/firestore").CollectionReference<DocumentData, DocumentData>;
|
|
3333
|
+
protected readonly firestore: import("@angular/fire/firestore").Firestore;
|
|
3334
|
+
protected readonly firestoreApi: import("@processpuzzle/base-entity").FirestoreApi;
|
|
3335
|
+
constructor(entityMapper: BaseEntityMapper<Entity>, collectionName: string);
|
|
3336
|
+
add(entity: Entity): Observable<PersistedEntity<Entity>>;
|
|
3337
|
+
delete(id: string): Observable<unknown>;
|
|
3338
|
+
deleteAll(): Observable<unknown>;
|
|
3339
|
+
findAll(page?: number, pageSize?: number): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[]>;
|
|
3340
|
+
findById(id: string): Observable<PersistedEntity<Entity> | void>;
|
|
3341
|
+
findByQuery(queryCondition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[]>;
|
|
3342
|
+
update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
|
|
3343
|
+
protected addAsync(entity: Entity): Promise<PersistedEntity<Entity>>;
|
|
3344
|
+
protected createQuery(queryCondition: BaseEntityQueryCondition): import("@firebase/firestore").Query<DocumentData, DocumentData>;
|
|
3345
|
+
protected findByQueryAsync(queryCondition: BaseEntityQueryCondition): Promise<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[]>;
|
|
3346
|
+
protected mapCollection(source: Observable<unknown[]>): PersistedEntity<Entity>[];
|
|
3347
|
+
protected mapDocument(docData: unknown): PersistedEntity<Entity>;
|
|
3348
|
+
private mapEntity;
|
|
3349
|
+
private updateAsync;
|
|
3350
|
+
}
|
|
3351
|
+
/**
|
|
3352
|
+
* The Firestore instance {@link BaseEntityFirestoreService} reads and writes through.
|
|
3353
|
+
*
|
|
3354
|
+
* The service used to inject `@angular/fire`'s `Firestore` class directly. Angular matches providers by
|
|
3355
|
+
* object identity, and a bare specifier does not always resolve to one object: mock the barrel, or let a
|
|
3356
|
+
* build inline it on one side of the graph and import it on the other, and the module the service imports
|
|
3357
|
+
* is a second instance of the same file. The class is then two distinct tokens — one registered, the other
|
|
3358
|
+
* asked for — and DI fails with `NG0201: No provider found for Firestore`.
|
|
3359
|
+
*
|
|
3360
|
+
* An `InjectionToken` declared here is a single object owned by this library. Note the `import type`: it
|
|
3361
|
+
* carries no runtime dependency on `@angular/fire/firestore`, which is what keeps this module out of the
|
|
3362
|
+
* blast radius when a test replaces the barrel, and so keeps the token one object.
|
|
3363
|
+
*
|
|
3364
|
+
* Applications that deploy on Firestore bind it with `provideFirestoreToken()`, next to their existing
|
|
3365
|
+
* `provideFirestore(...)` call.
|
|
3366
|
+
*/
|
|
3367
|
+
export declare const FIRESTORE: InjectionToken<Firestore>;
|
|
3368
|
+
/**
|
|
3369
|
+
* The subset of the Firestore module API that {@link BaseEntityFirestoreService} calls.
|
|
3370
|
+
*/
|
|
3371
|
+
interface FirestoreApi {
|
|
3372
|
+
readonly collection: typeof collection;
|
|
3373
|
+
readonly deleteDoc: typeof deleteDoc;
|
|
3374
|
+
readonly doc: typeof doc;
|
|
3375
|
+
readonly getDoc: typeof getDoc;
|
|
3376
|
+
readonly getDocs: typeof getDocs;
|
|
3377
|
+
readonly limit: typeof limit;
|
|
3378
|
+
readonly orderBy: typeof orderBy;
|
|
3379
|
+
readonly query: typeof query;
|
|
3380
|
+
readonly setDoc: typeof setDoc;
|
|
3381
|
+
readonly updateDoc: typeof updateDoc;
|
|
3382
|
+
readonly where: typeof where;
|
|
3383
|
+
}
|
|
3384
|
+
/**
|
|
3385
|
+
* Firestore's free functions, reached through DI instead of imported at each call site.
|
|
3386
|
+
*
|
|
3387
|
+
* This exists so the adapter can be tested deterministically, and the indirection is the only way to get
|
|
3388
|
+
* that here. The suite used to `vi.mock('@angular/fire/firestore')` and assert on the mocked functions.
|
|
3389
|
+
* That is a bare specifier, which the Angular unit-test system does allow — but whether the replacement
|
|
3390
|
+
* reaches *this library's* modules is not stable: the builder may inline the barrel into the source bundle,
|
|
3391
|
+
* where a mock cannot touch it. The suite consequently passed or failed at roughly even odds on an
|
|
3392
|
+
* unchanged commit — surfacing either as the real `collection()` rejecting a plain object, or, since the
|
|
3393
|
+
* real `Firestore` class then became the token the service asked for, as
|
|
3394
|
+
* `NG0201: No provider found for Firestore`. CI failed on the coin flip.
|
|
3395
|
+
*
|
|
3396
|
+
* Nor can the barrel be hidden behind a relative re-export and that mocked instead: the runner rejects it
|
|
3397
|
+
* outright — *"vi.mock and related methods are not supported for relative imports with the Angular
|
|
3398
|
+
* unit-test system. Please use Angular TestBed for mocking dependencies."* This token is that advice taken.
|
|
3399
|
+
*
|
|
3400
|
+
* The default factory returns the real functions, so an application binds nothing.
|
|
3401
|
+
*/
|
|
3402
|
+
export declare const FIRESTORE_API: InjectionToken<FirestoreApi>;
|
|
3403
|
+
/**
|
|
3404
|
+
* Binds {@link FIRESTORE} to the instance `provideFirestore(...)` registered, for an application that
|
|
3405
|
+
* deploys `BaseEntityFirestoreService` against a real Firestore.
|
|
3406
|
+
*
|
|
3407
|
+
* One line next to the `provideFirestore(...)` call:
|
|
3408
|
+
* ```ts
|
|
3409
|
+
* providers: [provideFirebaseApp(() => initializeApp(config)), provideFirestore(() => getFirestore()), provideFirestoreToken()]
|
|
3410
|
+
* ```
|
|
3411
|
+
*
|
|
3412
|
+
* It lives in its own file on purpose. `firestore.token.ts` must not import `@angular/fire/firestore` at
|
|
3413
|
+
* run-time — see the note there — and this is where the one import that has to exist is confined.
|
|
3414
|
+
*/
|
|
3415
|
+
export declare function provideFirestoreToken(): Provider;
|
|
3416
|
+
export declare enum FlexDirection {
|
|
3417
|
+
CONTAINER = 0,
|
|
3418
|
+
COLUMN = 1,
|
|
3419
|
+
ROW = 2
|
|
3420
|
+
}
|
|
3421
|
+
export declare class FlexboxDescriptor extends AbstractAttrDescriptor {
|
|
3422
|
+
readonly attrDescriptors: AbstractAttrDescriptor[];
|
|
3423
|
+
readonly direction: FlexDirection;
|
|
3424
|
+
constructor(attrDescriptors: AbstractAttrDescriptor[], direction: FlexDirection);
|
|
3425
|
+
}
|
|
720
3426
|
/**
|
|
721
3427
|
* Defines an entity data transformer capable of transforming data to and from the server.
|
|
722
3428
|
*/
|
|
723
3429
|
interface IEntityTransformer {
|
|
724
|
-
|
|
725
|
-
|
|
3430
|
+
fromServer?: (data: unknown, criteria?: unknown) => unknown;
|
|
3431
|
+
toServer?: (entity: unknown, criteria?: unknown) => unknown;
|
|
726
3432
|
}
|
|
727
3433
|
interface EntityOptions {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
3434
|
+
modelName: string;
|
|
3435
|
+
pluralName: string;
|
|
3436
|
+
uriName: string;
|
|
3437
|
+
transform?: IEntityTransformer;
|
|
732
3438
|
}
|
|
733
3439
|
/**
|
|
734
3440
|
* Class decorator for entity classes
|
|
735
3441
|
* @param options Configuration options for the entity
|
|
736
3442
|
* @returns Class decorator function
|
|
737
3443
|
*/
|
|
738
|
-
declare function Entity(options: EntityOptions): ClassDecorator;
|
|
3444
|
+
export declare function Entity(options: EntityOptions): ClassDecorator;
|
|
739
3445
|
/**
|
|
740
3446
|
* Gets entity options from an entity instance
|
|
741
3447
|
* @param instance An instance of a class decorated with @Entity
|
|
742
3448
|
* @returns The entity options or undefined if not found
|
|
743
3449
|
*/
|
|
744
|
-
declare function getEntityOptions(instance: object | null | undefined): EntityOptions | undefined;
|
|
3450
|
+
export declare function getEntityOptions(instance: object | null | undefined): EntityOptions | undefined;
|
|
745
3451
|
/**
|
|
746
3452
|
* Property decorator for marking entity properties as ID fields
|
|
747
3453
|
* @returns PropertyDecorator function
|
|
748
3454
|
*/
|
|
749
|
-
declare function Id(): PropertyDecorator;
|
|
3455
|
+
export declare function Id(): PropertyDecorator;
|
|
750
3456
|
/**
|
|
751
3457
|
* Gets all property names marked with @Id decorator from an entity instance
|
|
752
3458
|
* @param instance An instance of a class with properties decorated with @Id
|
|
753
3459
|
* @returns Array of property names marked as IDs or empty array if none found
|
|
754
3460
|
*/
|
|
755
|
-
declare function getEntityIds(instance: object | null | undefined): string[];
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
3461
|
+
export declare function getEntityIds(instance: object | null | undefined): string[];
|
|
3462
|
+
export declare enum BaseUrlSegments {
|
|
3463
|
+
DetailsForm = "details",
|
|
3464
|
+
EntityID = "entityId",
|
|
3465
|
+
Feed = "feed",
|
|
3466
|
+
ListForm = "list",
|
|
3467
|
+
NewEntity = "new",
|
|
3468
|
+
UnknownEntity = "unknown"
|
|
3469
|
+
}
|
|
3470
|
+
export declare const RuleViolationsSingletonStore: import("@angular/core").Type<{
|
|
3471
|
+
entityName: import("@angular/core").Signal<string | undefined>;
|
|
3472
|
+
violations: import("@angular/core").Signal<RuleEvaluationResult[]>;
|
|
3473
|
+
errorCount: import("@angular/core").Signal<number>;
|
|
3474
|
+
warningCount: import("@angular/core").Signal<number>;
|
|
3475
|
+
infoCount: import("@angular/core").Signal<number>;
|
|
3476
|
+
hasViolations: import("@angular/core").Signal<boolean>;
|
|
3477
|
+
setViolations: (entityName: string, violations: RuleEvaluationResult[]) => void;
|
|
3478
|
+
clearViolations: () => void;
|
|
3479
|
+
} & import("@ngrx/signals").StateSource<{
|
|
3480
|
+
entityName: string | undefined;
|
|
3481
|
+
violations: RuleEvaluationResult[];
|
|
771
3482
|
}>>;
|
|
772
|
-
|
|
773
3483
|
interface LookupTable extends BaseEntity {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
3484
|
+
key: string;
|
|
3485
|
+
value: string | number;
|
|
3486
|
+
description?: string;
|
|
777
3487
|
}
|
|
778
|
-
|
|
779
3488
|
/**
|
|
780
3489
|
* Defines a single column in the exported PDF table.
|
|
781
3490
|
* Maps directly from your entity descriptor's field definitions.
|
|
782
3491
|
*/
|
|
783
3492
|
interface PdfColumnDefinition {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
3493
|
+
/** Field key on the entity object — used to extract the value */
|
|
3494
|
+
field: string;
|
|
3495
|
+
/** Display label used as the column header in the PDF */
|
|
3496
|
+
header: string;
|
|
3497
|
+
/**
|
|
3498
|
+
* Optional value formatter. If omitted, the raw value is coerced to string.
|
|
3499
|
+
* Receives the raw field value and the full entity row.
|
|
3500
|
+
*/
|
|
3501
|
+
formatter?: (value: unknown, row: Record<string, unknown>) => string;
|
|
3502
|
+
/**
|
|
3503
|
+
* Relative column width weight. Columns without a width share the remaining
|
|
3504
|
+
* space equally. Example: set to 2 for a "description" column that should be
|
|
3505
|
+
* twice as wide as a typical "status" column.
|
|
3506
|
+
*/
|
|
3507
|
+
width?: number;
|
|
3508
|
+
/** Text alignment within the column. Defaults to 'left'. */
|
|
3509
|
+
align?: 'left' | 'center' | 'right';
|
|
801
3510
|
}
|
|
802
3511
|
interface PdfExportOptions {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
3512
|
+
/** PDF filename (without extension). Defaults to 'export'. */
|
|
3513
|
+
filename?: string;
|
|
3514
|
+
/** Document title rendered at the top of the first page. */
|
|
3515
|
+
title?: string;
|
|
3516
|
+
/** Optional subtitle line rendered below the title. */
|
|
3517
|
+
subtitle?: string;
|
|
3518
|
+
/**
|
|
3519
|
+
* Page orientation. The service auto-selects 'landscape' when there are
|
|
3520
|
+
* more than 5 columns unless you override this explicitly.
|
|
3521
|
+
*/
|
|
3522
|
+
orientation?: 'portrait' | 'landscape';
|
|
3523
|
+
/** ISO 216 page size. Defaults to 'a4'. */
|
|
3524
|
+
pageSize?: 'a4' | 'a3' | 'letter';
|
|
3525
|
+
/**
|
|
3526
|
+
* Whether to include a page footer with page number and export timestamp.
|
|
3527
|
+
* Defaults to true.
|
|
3528
|
+
*/
|
|
3529
|
+
includeFooter?: boolean;
|
|
3530
|
+
/**
|
|
3531
|
+
* Language dates and numbers are written in — the active Transloco language. Defaults to the browser's,
|
|
3532
|
+
* which is what a user who switched the application's language does not expect.
|
|
3533
|
+
*/
|
|
3534
|
+
locale?: string;
|
|
821
3535
|
}
|
|
822
3536
|
interface PdfExportResult {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
3537
|
+
success: boolean;
|
|
3538
|
+
filename: string;
|
|
3539
|
+
rowCount: number;
|
|
3540
|
+
error?: string;
|
|
827
3541
|
}
|
|
828
|
-
|
|
829
3542
|
/**
|
|
830
3543
|
* Generates and downloads a PDF table from entity store data, client-side.
|
|
831
3544
|
*
|
|
@@ -850,30 +3563,29 @@ interface PdfExportResult {
|
|
|
850
3563
|
* npm install jspdf jspdf-autotable
|
|
851
3564
|
* npm install --save-dev @types/jspdf-autotable
|
|
852
3565
|
*/
|
|
853
|
-
declare class PdfExportService {
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
}
|
|
876
|
-
|
|
3566
|
+
export declare class PdfExportService {
|
|
3567
|
+
/** Tracks whether a PDF generation is currently in progress. */
|
|
3568
|
+
readonly exporting: import("@angular/core").WritableSignal<boolean>;
|
|
3569
|
+
/**
|
|
3570
|
+
* Exports entities to a PDF and triggers a browser download.
|
|
3571
|
+
*
|
|
3572
|
+
* @param entities The raw entity array — typically `store.entities()`.
|
|
3573
|
+
* @param columns Column definitions derived from the entity descriptor.
|
|
3574
|
+
* @param options Title, filename, orientation, page size.
|
|
3575
|
+
*/
|
|
3576
|
+
export(entities: Record<string, unknown>[], columns: PdfColumnDefinition[], options?: PdfExportOptions): Promise<PdfExportResult>;
|
|
3577
|
+
private generate;
|
|
3578
|
+
/**
|
|
3579
|
+
* Formats a raw entity field value as a readable string for the PDF cell.
|
|
3580
|
+
* Handles the common cases; override per-column with a custom `formatter`.
|
|
3581
|
+
*/
|
|
3582
|
+
private formatValue;
|
|
3583
|
+
/** Renders ISO date strings as locale dates, leaving all other strings untouched. */
|
|
3584
|
+
private formatString;
|
|
3585
|
+
private drawFooter;
|
|
3586
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PdfExportService, never>;
|
|
3587
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
3588
|
+
}
|
|
877
3589
|
/**
|
|
878
3590
|
* Converts a BaseEntityDescriptor's attribute descriptors into PdfColumnDefinition[]
|
|
879
3591
|
* for {@link PdfExportService}.
|
|
@@ -885,10 +3597,10 @@ declare class PdfExportService {
|
|
|
885
3597
|
* the PDF.
|
|
886
3598
|
*
|
|
887
3599
|
* Type-appropriate alignment and value formatters are derived from `formControlType` so
|
|
888
|
-
* booleans, dates, tags and artifacts render sensibly without per-field configuration.
|
|
3600
|
+
* booleans, dates, tags and artifacts render sensibly without per-field configuration. A date is written in
|
|
3601
|
+
* its attribute's `dateFormat` and `locale` — the active language, as the list shows it — not the browser's.
|
|
889
3602
|
*/
|
|
890
|
-
declare function entityDescriptorToPdfColumns(descriptors: AbstractAttrDescriptor[]): PdfColumnDefinition[];
|
|
891
|
-
|
|
3603
|
+
export declare function entityDescriptorToPdfColumns(descriptors: AbstractAttrDescriptor[], locale?: string): PdfColumnDefinition[];
|
|
892
3604
|
type PdfExportDialogResult = Pick<PdfExportOptions, 'orientation' | 'pageSize' | 'includeFooter'>;
|
|
893
3605
|
/**
|
|
894
3606
|
* Asks the user for the few PDF layout choices we expose — orientation, page size and
|
|
@@ -896,16 +3608,344 @@ type PdfExportDialogResult = Pick<PdfExportOptions, 'orientation' | 'pageSize' |
|
|
|
896
3608
|
*
|
|
897
3609
|
* Closes with a {@link PdfExportDialogResult} on Export, or `undefined` on Cancel.
|
|
898
3610
|
*/
|
|
899
|
-
declare class PdfExportOptionsDialog {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
3611
|
+
export declare class PdfExportOptionsDialog {
|
|
3612
|
+
private readonly dialogRef;
|
|
3613
|
+
protected readonly orientation: import("@angular/core").WritableSignal<"portrait" | "landscape">;
|
|
3614
|
+
protected readonly pageSize: import("@angular/core").WritableSignal<"a4" | "a3" | "letter">;
|
|
3615
|
+
protected readonly includeFooter: import("@angular/core").WritableSignal<boolean>;
|
|
3616
|
+
protected onExport(): void;
|
|
3617
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PdfExportOptionsDialog, never>;
|
|
3618
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PdfExportOptionsDialog, "base-entity-pdf-export-options-dialog", never, {}, {}, never, never, true, never>;
|
|
3619
|
+
}
|
|
3620
|
+
/**
|
|
3621
|
+
* Transloco scope of this library — the generic screen labels (`base_entity.tabs.*`,
|
|
3622
|
+
* `base_entity.toolbar.*`) every generated list and form renders.
|
|
3623
|
+
*
|
|
3624
|
+
* Declared here as a constant so the scope name has one home; the routes and components that register
|
|
3625
|
+
* it still spell the alias out, because transloco camel-cases a default alias and would turn
|
|
3626
|
+
* `base_entity` into `baseEntity`, missing every key below it.
|
|
3627
|
+
*/
|
|
3628
|
+
export declare const BASE_ENTITY_TRANSLOCO_SCOPE = "base_entity";
|
|
3629
|
+
/**
|
|
3630
|
+
* Key roots of the two entities of the **authoring** branch — the screens with which a tenant declares its
|
|
3631
|
+
* entity types (`base-entity-authoring/`).
|
|
3632
|
+
*
|
|
3633
|
+
* Children of {@link BASE_ENTITY_TRANSLOCO_SCOPE} rather than scopes of their own, and this is the one
|
|
3634
|
+
* feature where that is not merely convenient: the labels of the entity being authored and the framework's
|
|
3635
|
+
* own `base_entity.tabs.*` are owned by the same library, so one scope registration covers the whole branch
|
|
3636
|
+
* and `BASE_ENTITY_AUTHORING_ROUTES` registers exactly one.
|
|
3637
|
+
*
|
|
3638
|
+
* These label the *authoring form*, not the entities it declares. The label of a declared entity comes from
|
|
3639
|
+
* its own definition and is resolved through {@link EntityLabelPipe}'s fallback, which is why no key here
|
|
3640
|
+
* ever names a tenant's entity.
|
|
3641
|
+
*/
|
|
3642
|
+
export declare const ENTITY_DEFINITION_I18N_SCOPE = "base_entity.entity_definition";
|
|
3643
|
+
export declare const ENTITY_ATTRIBUTE_I18N_SCOPE = "base_entity.entity_attribute";
|
|
3644
|
+
/**
|
|
3645
|
+
* Where this library's transloco bundles come from when the application ships without its assets.
|
|
3646
|
+
*
|
|
3647
|
+
* Spread into the application's `TRANSLATION_SOURCE_REGISTRY`, the way its facades are spread into
|
|
3648
|
+
* `BASE_ENTITY_FACADE_REGISTRY`. The scope normally arrives as a static file — the build copies it into
|
|
3649
|
+
* `assets/i18n/base_entity` and the loader tries the asset first — so this is reached only by a host
|
|
3650
|
+
* that skips that copy step. It is declared here rather than in the application because which backend
|
|
3651
|
+
* owns a scope is base-entity's knowledge, not its caller's.
|
|
3652
|
+
*/
|
|
3653
|
+
export declare const BASE_ENTITY_TRANSLATION_SOURCE: TranslationSource;
|
|
3654
|
+
/**
|
|
3655
|
+
* The authoring branch of the knowledge layer: the list and form of an `Entity Definition`, and the
|
|
3656
|
+
* `Entity Attribute` level below it. Mounted by the designer under `/design/entities` — see
|
|
3657
|
+
* `DESIGN_ROUTES`.
|
|
3658
|
+
*
|
|
3659
|
+
* These are the screens with which a tenant *declares* its entity types. Not to be confused with the
|
|
3660
|
+
* screens those declarations produce: those are mounted by `entityScreenRoute` / `EntityScreenResolver`,
|
|
3661
|
+
* which read the very rows this branch writes.
|
|
3662
|
+
*
|
|
3663
|
+
* The path segment has to be `snakeCaseName('Entity Definition')`, because
|
|
3664
|
+
* `BaseFormNavigatorSingletonStore` builds the details URL from the entity name — the same constraint
|
|
3665
|
+
* `BASE_APP_ROUTES`, `BASE_RULE_ROUTES` and `BASE_STATE_ROUTES` carry.
|
|
3666
|
+
*
|
|
3667
|
+
* `entityName` in `data` is not decoration: `readEmbeddedBreadcrumb` pushes a level when it meets the route
|
|
3668
|
+
* that *declares* the name, and takes that level's base URL from the URL accumulated so far. It has to sit
|
|
3669
|
+
* on the route contributing the definition's own segment — here — or every URL built on that level doubles
|
|
3670
|
+
* the segment.
|
|
3671
|
+
*
|
|
3672
|
+
* As for base-app, base-document, base-widget, base-state and base-workflow, the hosting application has to
|
|
3673
|
+
* spread `BASE_ENTITY_AUTHORING_FACADE_PROVIDERS` and `BASE_ENTITY_AUTHORING_ENTITY_FACADES` into its own
|
|
3674
|
+
* providers: both levels resolve their store and descriptor through `BASE_ENTITY_FACADE_REGISTRY`, and a
|
|
3675
|
+
* library cannot contribute to that token without replacing it.
|
|
3676
|
+
*/
|
|
3677
|
+
export declare const BASE_ENTITY_AUTHORING_ROUTES: Routes;
|
|
3678
|
+
/**
|
|
3679
|
+
* The facades of the definition graph, to be spread into the application's `providers`.
|
|
3680
|
+
*
|
|
3681
|
+
* The embedded one is here for the same reason the routable one is: an embedded entity has a facade like any
|
|
3682
|
+
* other — that is what gives it a store — and only its repository differs, reading and writing the
|
|
3683
|
+
* `Entity Definition` document rather than an endpoint of its own.
|
|
3684
|
+
*/
|
|
3685
|
+
export declare const BASE_ENTITY_AUTHORING_FACADE_PROVIDERS: Provider[];
|
|
3686
|
+
/**
|
|
3687
|
+
* The same facades keyed by entity name, to be spread into the application's `BASE_ENTITY_FACADE_REGISTRY`
|
|
3688
|
+
* value.
|
|
3689
|
+
*
|
|
3690
|
+
* Every entity an `EMBEDDED_COMPONENTS` attribute of this branch names has to appear here, or the control
|
|
3691
|
+
* throws on first render rather than showing a list whose rows go nowhere on save — the registry is how it
|
|
3692
|
+
* reaches the child's store and descriptor. Spread rather than provided separately, because the token holds
|
|
3693
|
+
* one value: a second `provide: BASE_ENTITY_FACADE_REGISTRY` would replace the application's own entities
|
|
3694
|
+
* instead of adding to them.
|
|
3695
|
+
*
|
|
3696
|
+
* Note what these two entries do *not* do: they register the screens that author definitions, not the
|
|
3697
|
+
* entities a definition declares. Those stay absent from the registry on purpose — a compile-time facade
|
|
3698
|
+
* wins over a synthesized one, so registering `Order` here would override the metadata path that
|
|
3699
|
+
* `EntityScreenResolver` exists to take.
|
|
3700
|
+
*/
|
|
3701
|
+
export declare const BASE_ENTITY_AUTHORING_ENTITY_FACADES: BaseEntityFacadeRegistry;
|
|
3702
|
+
/**
|
|
3703
|
+
* Entity names of the definition graph, kept in one dependency-free module.
|
|
3704
|
+
*
|
|
3705
|
+
* They live here rather than next to their descriptors because the graph is cyclic: the
|
|
3706
|
+
* `Entity Definition` descriptor aggregates `Entity Attribute`, and that one names the definition back as
|
|
3707
|
+
* its `componentParent`. Each descriptor module re-exports its own name, so importers are unaffected.
|
|
3708
|
+
* Same arrangement as base-state's `state-entity-names.ts` and base-app's `app-entity-names.ts`.
|
|
3709
|
+
*
|
|
3710
|
+
* `BASE_ENTITY_FACADE_REGISTRY` is one flat map for the whole application, so a name has to be specific
|
|
3711
|
+
* enough that no other feature would plausibly claim it. These two also have a second reason to be
|
|
3712
|
+
* distinctive: a *tenant* authors entity names through these very screens, and a definition named
|
|
3713
|
+
* `Entity Definition` would then shadow the screens that created it.
|
|
3714
|
+
*/
|
|
3715
|
+
export declare const ENTITY_DEFINITION_ENTITY_NAME = "Entity Definition";
|
|
3716
|
+
export declare const ENTITY_ATTRIBUTE_ENTITY_NAME = "Entity Attribute";
|
|
3717
|
+
/** @param entityCodes the codes Component Parents may pick from; see {@link EntityDefinitionOptions.codes} */
|
|
3718
|
+
export declare function createEntityDefinitionDescriptor(entityCodes?: () => Selectable[]): BaseEntityDescriptor;
|
|
3719
|
+
/**
|
|
3720
|
+
* An `EntityAttributeDefinition` is identified by `code`, unique within its definition — the contract
|
|
3721
|
+
* gives it a read-only uuid nothing addresses it by. Referencing attributes therefore have to set
|
|
3722
|
+
* `referenceIdField = 'code'`; see the `attributes` attribute of the `Entity Definition` descriptor.
|
|
3723
|
+
*/
|
|
3724
|
+
export declare const ENTITY_ATTRIBUTE_ID_FIELD = "code";
|
|
3725
|
+
/** @param entityCodes the codes the Linked Entity dropdown offers; see {@link EntityDefinitionOptions.codes} */
|
|
3726
|
+
export declare function createEntityAttributeDescriptor(entityCodes?: () => Selectable[]): BaseEntityDescriptor;
|
|
3727
|
+
/** `BaseEntityAttributeInput` of `base-entity-api.yaml`, plus the `id` a response carries. */
|
|
3728
|
+
interface EntityAttributeDto {
|
|
3729
|
+
id?: string;
|
|
3730
|
+
code?: string;
|
|
3731
|
+
name?: string;
|
|
3732
|
+
description?: string;
|
|
3733
|
+
displayOrder?: number;
|
|
3734
|
+
valueKind?: EntityValueKind;
|
|
3735
|
+
formControlType?: string;
|
|
3736
|
+
multiplicity?: Multiplicity;
|
|
3737
|
+
maxOccurs?: number;
|
|
3738
|
+
required?: boolean;
|
|
3739
|
+
indexed?: boolean;
|
|
3740
|
+
defaultValue?: unknown;
|
|
3741
|
+
enumValues?: string[];
|
|
3742
|
+
dateFormat?: DateFormat;
|
|
3743
|
+
linkedEntityType?: string;
|
|
3744
|
+
isLinkToDetails?: boolean;
|
|
3745
|
+
autosizeColumn?: boolean;
|
|
3746
|
+
defaultAvatar?: string;
|
|
3747
|
+
showMap?: boolean;
|
|
3748
|
+
mapProvider?: MapProvider;
|
|
3749
|
+
defaultCountry?: string;
|
|
3750
|
+
}
|
|
3751
|
+
/** `BaseEntityDefinition` on the way in, `BaseEntityDefinitionInput` on the way out. */
|
|
3752
|
+
interface EntityDefinitionDto {
|
|
3753
|
+
id?: string;
|
|
3754
|
+
code?: string;
|
|
3755
|
+
name?: string;
|
|
3756
|
+
description?: string;
|
|
3757
|
+
status?: EntityDefinitionStatus;
|
|
3758
|
+
releaseState?: ReleaseState;
|
|
3759
|
+
componentParents?: string[];
|
|
3760
|
+
isEmbedded?: boolean;
|
|
3761
|
+
attributes?: EntityAttributeDto[];
|
|
3762
|
+
version?: number;
|
|
3763
|
+
createdAt?: string;
|
|
3764
|
+
updatedAt?: string;
|
|
3765
|
+
}
|
|
3766
|
+
/**
|
|
3767
|
+
* Translates between the `BaseEntityDefinition` DTO of `base-entity-api.yaml` and the entity the generated
|
|
3768
|
+
* screens author.
|
|
3769
|
+
*
|
|
3770
|
+
* Three things are worth knowing about it.
|
|
3771
|
+
*
|
|
3772
|
+
* **`id` is a mirror of `code`.** The contract addresses a definition by `code`
|
|
3773
|
+
* (`/entity-definitions/{code}`) while the generic screens address a record by `id` — so the mapper is
|
|
3774
|
+
* where the two meet, rather than every caller. It mirrors on the way *in* only: the request body is
|
|
3775
|
+
* `BaseEntityDefinitionInput`, which has no `id`, so `toDto` emits none and the path segment stays the sole
|
|
3776
|
+
* source of truth. The read-only uuid a response calls `id` is deliberately dropped, and can be, because
|
|
3777
|
+
* nothing sends it back. (base-state's mapper does emit an `id`, for a reason that does not apply here: it
|
|
3778
|
+
* used to be read by json-server, which no longer serves any platform feature.)
|
|
3779
|
+
*
|
|
3780
|
+
* **The nested rows are mapped element by element**, not passed through. An embedded row is edited as the
|
|
3781
|
+
* parsed JSON it arrived as, so a field the wire spelled differently from the model would leave its control
|
|
3782
|
+
* empty and silently drop the value on the next save. Mapping each row keeps that class of bug out of the
|
|
3783
|
+
* attribute descriptor even though nothing is spelled two ways today.
|
|
3784
|
+
*
|
|
3785
|
+
* **`PUT /entity-definitions/{code}` is a full replacement**, so `toDto` emits `attributes` unconditionally
|
|
3786
|
+
* — an absent list is an emptied definition, not an untouched one. The three fields the contract marks
|
|
3787
|
+
* `readOnly` (`version`, `createdAt`, `updatedAt`, and `releaseState`) are for the same reason *not* emitted: the form shows
|
|
3788
|
+
* them disabled, and sending a value back would be claiming to own something the backend assigns.
|
|
3789
|
+
*/
|
|
3790
|
+
export declare class EntityDefinitionMapper implements BaseEntityMapper<EntityDefinition> {
|
|
3791
|
+
fromDto(dto: unknown): EntityDefinition;
|
|
3792
|
+
toDto(entity: EntityDefinition): EntityDefinitionDto;
|
|
3793
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionMapper, never>;
|
|
3794
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
3795
|
+
}
|
|
3796
|
+
/**
|
|
3797
|
+
* CRUD access to `/organizations/{orgKey}/entity-definitions` — the knowledge-layer resource of
|
|
3798
|
+
* `base-entity-api.yaml`, as the designer writes it. As in base-rule, base-app and base-state, the
|
|
3799
|
+
* organization is part of the configured service root, so the tenant is a deployment concern rather than
|
|
3800
|
+
* something every call has to carry.
|
|
3801
|
+
*
|
|
3802
|
+
* A second service over the same resource as {@link EntityDefinitionService}, and deliberately so — the two
|
|
3803
|
+
* answer different questions. That one reads **all** definitions in one call and caches them for the
|
|
3804
|
+
* session, because a run-time shell needs the whole set to resolve a `linkedEntityType` code and swallows a
|
|
3805
|
+
* failure as "no definitions". This one is a `BaseEntityRestService`, which is what gives a definition a
|
|
3806
|
+
* *store*: paged reads, `findById`, POST, PUT, DELETE, and errors that reach the screen instead of being
|
|
3807
|
+
* turned into an empty list. Merging them would mean either a designer that cannot report a failed save or
|
|
3808
|
+
* a shell that breaks a preview over one.
|
|
3809
|
+
*
|
|
3810
|
+
* `ENTITY_SERVICE_ROOT` is optional in `BaseConfiguration`: `serviceRootOf` falls back to
|
|
3811
|
+
* `BACKEND_SERVICE_ROOT`, which is what every deployment of this workspace configures today.
|
|
3812
|
+
*
|
|
3813
|
+
* Nothing is added on top of the generic CRUD. The contract's incremental attribute endpoints
|
|
3814
|
+
* (`POST/PUT/DELETE .../attributes/{attributeCode}`) are not used: the attributes are edited as an embedded
|
|
3815
|
+
* list inside the definition's own form, so the whole definition is what gets PUT — the "PUT the whole
|
|
3816
|
+
* definition for bulk changes" path the contract names on `addAttribute` itself.
|
|
3817
|
+
*/
|
|
3818
|
+
export declare class EntityDefinitionAuthoringService extends BaseEntityRestService<EntityDefinition> {
|
|
3819
|
+
protected entityMapper: EntityDefinitionMapper;
|
|
3820
|
+
constructor(entityMapper: EntityDefinitionMapper);
|
|
3821
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionAuthoringService, never>;
|
|
3822
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
3823
|
+
}
|
|
3824
|
+
/**
|
|
3825
|
+
* The stock CRUD store. Like `StateMachineDefinitionStore` and unlike `AppDefinitionStore` there is no extra
|
|
3826
|
+
* feature to add: a definition's `status` is authored as an ordinary dropdown, not promoted through a
|
|
3827
|
+
* publish endpoint, and its `version` is an optimistic lock rather than a lifecycle.
|
|
3828
|
+
*
|
|
3829
|
+
* `providedIn: 'root'` because the store outlives the route: the designer's list, the attribute levels below
|
|
3830
|
+
* it and `EntityDefinitionContainerComponent` all read the same rows.
|
|
3831
|
+
*/
|
|
3832
|
+
export declare const EntityDefinitionStore: import("@angular/core").Type<{
|
|
3833
|
+
entities: import("@angular/core").Signal<EntityDefinition[]>;
|
|
3834
|
+
number: import("@angular/core").Signal<number>;
|
|
3835
|
+
size: import("@angular/core").Signal<number>;
|
|
3836
|
+
totalElements: import("@angular/core").Signal<number>;
|
|
3837
|
+
totalPages: import("@angular/core").Signal<number>;
|
|
3838
|
+
currentId: import("@angular/core").Signal<string | undefined>;
|
|
3839
|
+
currentEntity: import("@ngrx/signals").DeepSignal<EntityDefinition> | import("@angular/core").Signal<undefined>;
|
|
3840
|
+
isLoading: import("@angular/core").Signal<boolean>;
|
|
3841
|
+
error: import("@angular/core").Signal<string | undefined>;
|
|
3842
|
+
selectedEntities: import("@angular/core").Signal<EntityDefinition[]>;
|
|
3843
|
+
stagedIds: import("@angular/core").Signal<string[]>;
|
|
3844
|
+
activeTabs: import("@angular/core").Signal<string[]>;
|
|
3845
|
+
currentTab: import("@angular/core").Signal<string | undefined>;
|
|
3846
|
+
filterKey: import("@angular/core").Signal<string | undefined>;
|
|
3847
|
+
countOfEntities: import("@angular/core").Signal<number>;
|
|
3848
|
+
matTableDataSource: import("@angular/core").Signal<import("@angular/material/table").MatTableDataSource<EntityDefinition, import("@angular/material/paginator").MatPaginator>>;
|
|
3849
|
+
clearCurrentEntity: () => void;
|
|
3850
|
+
createEntity: () => EntityDefinition;
|
|
3851
|
+
add: (entity: EntityDefinition) => Promise<import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition> | undefined>;
|
|
3852
|
+
delete: (id: string) => Promise<void>;
|
|
3853
|
+
hasStagedChanges: (id: string) => boolean;
|
|
3854
|
+
deleteAll: import("@ngrx/signals/rxjs-interop").RxMethod<void>;
|
|
3855
|
+
deselectAll: () => void;
|
|
3856
|
+
deselectEntity: (id: string) => void;
|
|
3857
|
+
load: import("@ngrx/signals/rxjs-interop").RxMethod<import("@processpuzzle/base-entity").BaseEntityQueryCondition>;
|
|
3858
|
+
loadById: (id: string) => EntityDefinition | undefined;
|
|
3859
|
+
reload: (id: string) => Promise<import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition> | undefined>;
|
|
3860
|
+
resetErrorState: () => void;
|
|
3861
|
+
selectEntity: (id: string) => void;
|
|
3862
|
+
setCurrentEntity: (id: string | undefined) => void;
|
|
3863
|
+
stage: (entity: import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition>) => void;
|
|
3864
|
+
update: (entity: import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition>) => Promise<import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition> | undefined>;
|
|
3865
|
+
reset: () => void;
|
|
3866
|
+
tabIsActive: (tabName: string) => void;
|
|
3867
|
+
tabIsInactive: (tabName: string) => void;
|
|
3868
|
+
doFilter: (filterKey: string) => void;
|
|
3869
|
+
} & import("@ngrx/signals").StateSource<{
|
|
3870
|
+
entities: EntityDefinition[];
|
|
3871
|
+
number: number;
|
|
3872
|
+
size: number;
|
|
3873
|
+
totalElements: number;
|
|
3874
|
+
totalPages: number;
|
|
3875
|
+
currentId: string | undefined;
|
|
3876
|
+
currentEntity: EntityDefinition | undefined;
|
|
3877
|
+
isLoading: boolean;
|
|
3878
|
+
error: string | undefined;
|
|
3879
|
+
selectedEntities: EntityDefinition[];
|
|
3880
|
+
stagedIds: string[];
|
|
3881
|
+
activeTabs: string[];
|
|
3882
|
+
currentTab: string | undefined;
|
|
3883
|
+
filterKey: string | undefined;
|
|
3884
|
+
}>>;
|
|
3885
|
+
/**
|
|
3886
|
+
* The routable `Entity Definition`. Everything the generated screens need comes off this facade, which is
|
|
3887
|
+
* what `ACTIVE_ENTITY_FACADE` hands to the container, the list and the form.
|
|
3888
|
+
*
|
|
3889
|
+
* The mapper and the service are injected rather than constructed, so both stay `providedIn: 'root'`
|
|
3890
|
+
* singletons — the store's repository and this facade's have to be the same object, or a save would not be
|
|
3891
|
+
* visible to the rows the list already holds.
|
|
3892
|
+
*/
|
|
3893
|
+
export declare class EntityDefinitionFacade extends BaseEntityFacade<EntityDefinition> {
|
|
3894
|
+
readonly entityType: typeof EntityDefinition;
|
|
3895
|
+
private readonly mapperRef;
|
|
3896
|
+
private readonly serviceRef;
|
|
3897
|
+
protected createMapper(): EntityDefinitionMapper;
|
|
3898
|
+
protected createService(): EntityDefinitionAuthoringService;
|
|
3899
|
+
protected createStoreClass(): Type<unknown>;
|
|
3900
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
3901
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionFacade, never>;
|
|
3902
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
3903
|
+
}
|
|
3904
|
+
/**
|
|
3905
|
+
* The one embedded level of a definition: its attributes, carried inside the definition document.
|
|
3906
|
+
*
|
|
3907
|
+
* A facade like any other — that is what gives it a store, and so a working list and form — with only its
|
|
3908
|
+
* repository differing: `EmbeddedEntityService` reads and writes the `Entity Definition` being edited
|
|
3909
|
+
* rather than an endpoint of its own. It takes no mapper for the same reason; the rows are mapped by
|
|
3910
|
+
* `EntityDefinitionMapper` as part of the owner's payload.
|
|
3911
|
+
*/
|
|
3912
|
+
export declare class EntityAttributeFacade extends EmbeddedEntityFacade<EntityAttributeDefinition> {
|
|
3913
|
+
readonly entityType: typeof EntityAttributeDefinition;
|
|
3914
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
3915
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityAttributeFacade, never>;
|
|
3916
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
3917
|
+
}
|
|
3918
|
+
/**
|
|
3919
|
+
* Hosts the generic container for `Entity Definition`, and invalidates the two run-time caches when the
|
|
3920
|
+
* author leaves the section.
|
|
3921
|
+
*
|
|
3922
|
+
* The container takes no inputs: `BaseEntityContainerComponent` resolves its descriptor and its store from
|
|
3923
|
+
* `ACTIVE_ENTITY_FACADE`, which `BASE_ENTITY_AUTHORING_ROUTES` binds to `EntityDefinitionFacade` — the same
|
|
3924
|
+
* token every level below it resolves through, so the definition and its attributes are reached the same
|
|
3925
|
+
* way. A component of this library's own is nevertheless what the route mounts, and the cache reset is the
|
|
3926
|
+
* whole reason.
|
|
3927
|
+
*
|
|
3928
|
+
* **Why the reset.** `EntityDefinitionRegistry` memoizes the tenant's definitions for the session, and
|
|
3929
|
+
* `DynamicEntityRegistry` memoizes the descriptors and facades synthesized from them. That is right for a
|
|
3930
|
+
* run-time shell, where metadata does not change under a running application — and wrong in the designer,
|
|
3931
|
+
* where changing it is the point: a definition edited here decides what the Preview tab and every
|
|
3932
|
+
* `EntityScreenResolver`-mounted screen should render next, and nothing else would ever invalidate a
|
|
3933
|
+
* session-long cache. Both registries name this caller in their own `reset()` docs.
|
|
3934
|
+
*
|
|
3935
|
+
* Only `DynamicEntityRegistry` is asked, because its `reset()` cascades to `EntityDefinitionRegistry` —
|
|
3936
|
+
* discarding the descriptors without discarding the definitions they were built from would rebuild the same
|
|
3937
|
+
* descriptors.
|
|
3938
|
+
*
|
|
3939
|
+
* **Why on destroy** rather than after each save: leaving the section is the last moment before a stale
|
|
3940
|
+
* descriptor could be rendered, it happens once, and it cannot be mistaken for a change when the author only
|
|
3941
|
+
* looked. Refetching after a visit that edited nothing costs one request; the alternative — resetting on
|
|
3942
|
+
* every mutation of the store's row set — also fires on a page change and a filter.
|
|
3943
|
+
*/
|
|
3944
|
+
export declare class EntityDefinitionContainerComponent implements OnDestroy {
|
|
3945
|
+
private readonly dynamicEntities;
|
|
3946
|
+
ngOnDestroy(): void;
|
|
3947
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionContainerComponent, never>;
|
|
3948
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EntityDefinitionContainerComponent, "pp-entity-definition-container", never, {}, {}, never, never, true, never>;
|
|
3949
|
+
}
|
|
3950
|
+
export type { AddressFormat, ArtifactAttr, BaseEntity, BaseEntityDescriptorOptions, BaseEntityFacadeRegistry, BaseEntityFormBuilder, BaseEntityLoadResponse, BaseEntityMapper, BaseEntityQueryCondition, DateFormat, DateStyle, DefinitionLookup, DynamicEntity, EmbeddedBreadcrumbLevel, EmbeddedChildRoute, EmbeddedPath, EmbeddedPathStep, EmbeddedRouteContext, EmbeddedRouteLevel, EmbeddedRow, EntityComment, EntityDefinitionStatus, EntityOptions, EntityScreenRouteOptions, EntityScreens, EntityServiceKind, EntityStateControl, EntityTabContributor, EntityTabDescriptor, EntityValueKind, EvaluatableRule, FilterCondition, FirestoreApi, GeoLocation, GeoLocatorError, GeoPoint, LocationSource, LookupTable, MapProvider, Multiplicity, MultiplicityHolder, NavigationPayload, NavigationState, ObjectUriResponse, OrderByCondition, PdfColumnDefinition, PdfExportDialogResult, PdfExportOptions, PdfExportResult, PersistedBaseEntity, PersistedEntity, PostalAddress, ResolvedDynamicEntity, ResolvedEmbeddedAggregate, RichTextContent, RuleEngine, RuleEvaluationResult, RuleSeverity, Selectable, SelectablesInput, TimeStyle };
|
|
3951
|
+
//# sourceMappingURL=processpuzzle-base-entity.d.ts.map
|