@processpuzzle/base-entity 1.3.0 → 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.
@@ -1,36 +1,62 @@
1
- import { Observable } from "rxjs";
2
1
  import * as i0 from "@angular/core";
3
2
  import { AfterViewInit, EnvironmentProviders, InjectionToken, Injector, InputSignal, OnDestroy, OnInit, PipeTransform, Provider, ProviderToken, Signal, TemplateRef, Type, ViewContainerRef, WritableSignal } from "@angular/core";
4
- import { MatSnackBar } from "@angular/material/snack-bar";
3
+ import { FormControl, FormGroup } from "@angular/forms";
4
+ import { NGXLogger } from "ngx-logging-kit";
5
5
  import { ActivatedRouteSnapshot, CanActivateFn, Route, Routes } from "@angular/router";
6
- import { DocumentData, DocumentSnapshot, Firestore, WhereFilterOp, collection, deleteDoc, doc, getDoc, getDocs, limit, orderBy, query, setDoc, updateDoc, where } from "@angular/fire/firestore";
7
6
  import { WritableStateSource } from "@ngrx/signals";
8
7
  import { MatTableDataSource } from "@angular/material/table";
9
- import { HttpClient, HttpHeaders } from "@angular/common/http";
10
- import { FormGroup } from "@angular/forms";
11
- import { NGXLogger } from "ngx-logging-kit";
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";
12
14
  import { TranslocoService } from "@jsverse/transloco";
15
+ import { NativeDateAdapter } from "@angular/material/core";
13
16
  import { MatSort } from "@angular/material/sort";
14
17
  import { MatPaginator } from "@angular/material/paginator";
15
18
  import { SelectionModel } from "@angular/cdk/collections";
19
+ import { ReleaseState, TranslationSource } from "@processpuzzle/util";
16
20
  import "reflect-metadata";
17
- import { TranslationSource } from "@processpuzzle/util";
18
21
  export declare enum FormControlType {
19
22
  ADDITIONAL_PROPERTIES = "ADDITIONAL_PROPERTIES",
23
+ /**
24
+ * A postal address — the value is one `PostalAddress` object. The fields and their order follow the selected
25
+ * country; with `showMap` the address is also shown on a map, with coordinates derived from it.
26
+ */
27
+ ADDRESS = "ADDRESS",
20
28
  ARTIFACT = "ARTIFACT",
29
+ AVATAR = "AVATAR",
21
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",
22
36
  COMPONENTS = "COMPONENTS",
23
37
  /** Rendered by the descriptor's own `component` — the extension point for controls base-entity cannot know. */
24
38
  CUSTOM = "CUSTOM",
25
39
  DATE = "DATE",
26
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",
27
46
  EMBEDDED_COMPONENTS = "EMBEDDED_COMPONENTS",
47
+ EMBEDDED_LIST = "EMBEDDED_LIST",
48
+ EMBEDDED_OBJECT = "EMBEDDED_OBJECT",
28
49
  FLEX_BOX = "FLEX_BOX",
29
50
  FOREIGN_KEY = "FOREIGN_KEY",
30
51
  LABEL = "LABEL",
31
52
  LOOKUP = "LOOKUP",
32
53
  RADIO = "RADIO",
33
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",
34
60
  TAGS = "TAGS",
35
61
  TITLE = "TITLE",
36
62
  TEXT_BOX = "TEXT_BOX",
@@ -59,41 +85,122 @@ export declare abstract class AbstractAttrDescriptor {
59
85
  * collide with an unrelated translation in the consuming app.
60
86
  */
61
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;
62
95
  }
63
- interface ArtifactAttr {
64
- readonly bucket: string;
65
- readonly objectId: string;
66
- readonly name: string;
67
- readonly mimeType: string;
68
- }
69
- interface UploadObjectResponse {
70
- objectID: string;
71
- fileName: string;
72
- mimeType: string;
73
- bucketName?: string;
74
- }
75
- interface ObjectDownloadResponse {
76
- data: Blob;
77
- fileName?: string;
78
- bucketName?: string;
79
- }
80
- interface ObjectUriResponse {
81
- uri: string;
96
+ interface BaseEntity {
97
+ readonly id?: string;
82
98
  }
83
- export declare class ObjectStoreService {
84
- private readonly runtimeConfiguration;
85
- private readonly httpClient;
86
- private readonly baseUrl;
87
- uploadObject(file: Blob, name: string, mimeType: string): Observable<UploadObjectResponse>;
88
- getObjectByID(bucketName: string, objectID: string): Observable<ObjectDownloadResponse>;
89
- deleteObjectByID(bucketName: string, objectID: string): Observable<void>;
90
- getObjectUriByID(bucketName: string, objectID: string): Observable<ObjectUriResponse>;
91
- getThumbnailUriByID(bucketName: string, objectID: string): Observable<ObjectUriResponse | null>;
92
- private buildFullUrl;
93
- private resolveBaseUrl;
94
- static ɵfac: i0.ɵɵFactoryDeclaration<ObjectStoreService, never>;
95
- static ɵprov: i0.ɵɵInjectableDeclaration<any>;
99
+ interface PersistedBaseEntity extends BaseEntity {
100
+ readonly id: string;
96
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;
97
204
  type Selectable = {
98
205
  key: string;
99
206
  value: unknown;
@@ -104,11 +211,40 @@ export declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
104
211
  styleClass?: string | undefined;
105
212
  labelClass?: string;
106
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;
107
220
  isLinkToDetails?: boolean;
108
221
  selectables?: SelectablesInput;
109
222
  visible: boolean;
110
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;
111
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;
112
248
  isHeading?: boolean;
113
249
  placeholder?: string;
114
250
  lines?: number;
@@ -116,6 +252,10 @@ export declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
116
252
  inputType: 'text';
117
253
  };
118
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;
119
259
  /**
120
260
  * Regular-expression source the value has to match, applied as `Validators.pattern` and anchored by
121
261
  * Angular at both ends.
@@ -127,6 +267,20 @@ export declare class BaseEntityAttrDescriptor extends AbstractAttrDescriptor {
127
267
  */
128
268
  pattern?: string;
129
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;
130
284
  /**
131
285
  * The control of a {@link FormControlType.CUSTOM} attribute: a `BaseFormControlComponent` subclass the form
132
286
  * builder creates like any built-in control. Typed loosely because the base class is generic over the entity
@@ -201,6 +355,12 @@ interface BaseEntityDescriptorOptions {
201
355
  */
202
356
  titleKey?: string;
203
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;
204
364
  /** Name of the entity this one inherits from. Unrelated to {@link componentParent}. */
205
365
  parentEntity?: string;
206
366
  route?: string;
@@ -232,11 +392,12 @@ export declare class BaseEntityDescriptor {
232
392
  titleKey?: string;
233
393
  parentEntity: string | undefined;
234
394
  readonly isAbstract: boolean;
395
+ readonly isReadOnly: boolean;
235
396
  route: string | undefined;
236
397
  /** Normalized {@link BaseEntityDescriptorOptions.componentParent}; empty when this is not a component. */
237
398
  readonly componentParents: readonly string[];
238
399
  readonly isEmbedded: boolean;
239
- constructor({ store, attrDescriptors, entityName, entityTitle, extraFormActionsTemplate, extraTabs, i18nScope, titleKey, isAbstract, parentEntity, route, componentParent, isEmbedded }: BaseEntityDescriptorOptions);
400
+ constructor({ store, attrDescriptors, entityName, entityTitle, extraFormActionsTemplate, extraTabs, i18nScope, titleKey, isAbstract, isReadOnly, parentEntity, route, componentParent, isEmbedded }: BaseEntityDescriptorOptions);
240
401
  createTestId(suffix: string): string;
241
402
  /** Transloco key root for this entity, derived from {@link entityName} unless {@link i18nScope} overrides it. */
242
403
  scopeRoot(): string;
@@ -268,31 +429,39 @@ export declare class BaseEntityDescriptor {
268
429
  titleAttrName(): string;
269
430
  overwriteLinkedEntityAttr(attrName: string, linkedEntityName: string): void;
270
431
  }
271
- interface BaseEntity {
272
- readonly id?: string;
273
- }
274
- interface PersistedBaseEntity extends BaseEntity {
275
- readonly id: string;
276
- }
277
- type PersistedEntity<Entity extends BaseEntity> = Entity & PersistedBaseEntity;
278
- declare function assertPersistedEntity<Entity extends BaseEntity>(entity: Entity): asserts entity is PersistedEntity<Entity>;
279
- declare const BASE_ENTITY_MAPPER: InjectionToken<BaseEntityMapper<BaseEntity>>;
280
- interface BaseEntityMapper<Entity extends BaseEntity> {
281
- fromDto(dto: unknown, index?: number): Entity;
282
- toDto(entity: Entity): unknown;
283
- }
284
- export declare class SimpleEntityMapper<Entity extends BaseEntity> implements BaseEntityMapper<Entity> {
285
- private readonly entityType;
286
- constructor(entityType: new (...args: unknown[]) => Entity);
287
- fromDto(dto: unknown): Entity;
288
- toDto(entity: Entity): unknown;
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>;
289
464
  }
290
- export declare function getEnumKeyByValue<E>(myEnum: {
291
- [key: number]: string;
292
- }, enumValue: number): E | undefined;
293
- export declare function getEnumValueByKey<E>(myEnum: {
294
- [key: string]: E | string;
295
- }, enumKey: string): E | undefined;
296
465
  interface WhereCondition<Entity extends BaseEntity> {
297
466
  field: keyof Entity;
298
467
  operator: WhereFilterOp;
@@ -358,41 +527,6 @@ interface BaseEntityService<Entity extends BaseEntity> {
358
527
  findByQuery(condition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
359
528
  update(entity: PersistedEntity<Entity>): Observable<PersistedEntity<Entity>>;
360
529
  }
361
- type EntityServiceKind = 'rest' | 'firestore';
362
- export declare abstract class BaseEntityFacade<Entity extends BaseEntity> {
363
- abstract readonly entityType: Type<Entity>;
364
- protected readonly serviceKind: EntityServiceKind;
365
- protected readonly endpoint?: string;
366
- protected readonly backendRoot?: string;
367
- protected readonly injector: Injector;
368
- private _mapper?;
369
- private _service?;
370
- private _storeClass?;
371
- private _storeInstance?;
372
- private _descriptor?;
373
- get mapper(): BaseEntityMapper<Entity>;
374
- get service(): BaseEntityService<Entity>;
375
- get storeClass(): Type<unknown>;
376
- get store(): unknown;
377
- get descriptor(): BaseEntityDescriptor;
378
- /**
379
- * Deliberately does not go through {@link descriptor}: the store is created with a repository, and a
380
- * repository may need to know which entity it serves — as an embedded one does. Binding the store into the
381
- * descriptor only when the descriptor itself is asked for keeps that from re-entering the store getter and
382
- * building a second store.
383
- */
384
- get entityName(): string;
385
- get attrDescriptors(): AbstractAttrDescriptor[];
386
- get entityTitle(): string;
387
- protected createMapper(): BaseEntityMapper<Entity>;
388
- protected createService(mapper: BaseEntityMapper<Entity>): BaseEntityService<Entity>;
389
- /** The descriptor as declared, before the store is bound into it. See {@link entityName}. */
390
- private declaredDescriptor;
391
- protected createStoreClass(): Type<unknown>;
392
- protected abstract createDescriptor(): BaseEntityDescriptor;
393
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFacade<any>, never>;
394
- static ɵprov: i0.ɵɵInjectableDeclaration<any>;
395
- }
396
530
  export declare const BASE_ENTITY_STORE: InjectionToken<unknown>;
397
531
  interface EntityStoreState<Entity extends BaseEntity> {
398
532
  entities: Entity[];
@@ -405,14 +539,18 @@ interface EntityStoreState<Entity extends BaseEntity> {
405
539
  isLoading: boolean;
406
540
  error: string | undefined;
407
541
  selectedEntities: Array<Entity>;
542
+ /** Keys of rows changed in this store but not yet persisted — see {@link BaseEntityStoreApi.stage}. */
543
+ stagedIds: string[];
408
544
  }
409
545
  type EntityStoreHandle<Entity extends BaseEntity> = WritableStateSource<EntityStoreState<Entity>> & {
410
546
  entities: Signal<Entity[]>;
411
547
  selectedEntities: Signal<Entity[]>;
548
+ stagedIds: Signal<string[]>;
412
549
  };
413
550
  interface BaseEntityStoreApi<Entity extends BaseEntity> {
414
551
  entities: Signal<Entity[]>;
415
552
  selectedEntities: Signal<Entity[]>;
553
+ stagedIds: Signal<string[]>;
416
554
  currentEntity: Signal<Entity | undefined>;
417
555
  currentId: Signal<string | undefined>;
418
556
  isLoading: Signal<boolean>;
@@ -433,9 +571,22 @@ interface BaseEntityStoreApi<Entity extends BaseEntity> {
433
571
  deselectEntity(id: string): void;
434
572
  load(query: BaseEntityQueryCondition): void;
435
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>;
436
579
  resetErrorState(): void;
437
580
  selectEntity(id: string): void;
438
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;
439
590
  update(entity: PersistedEntity<Entity>): Promise<PersistedEntity<Entity> | undefined>;
440
591
  clearCurrentEntity(): void;
441
592
  createEntity(): Entity;
@@ -466,6 +617,7 @@ export declare function BaseEntityStore<Entity extends BaseEntity>(entityType: n
466
617
  isLoading: boolean;
467
618
  error: string | undefined;
468
619
  selectedEntities: Entity[];
620
+ stagedIds: string[];
469
621
  };
470
622
  props: {
471
623
  countOfEntities: Signal<number>;
@@ -476,88 +628,356 @@ export declare function BaseEntityStore<Entity extends BaseEntity>(entityType: n
476
628
  createEntity: () => Entity;
477
629
  add: (entity: Entity) => Promise<PersistedEntity<Entity> | undefined>;
478
630
  delete: (id: string) => Promise<void>;
631
+ hasStagedChanges: (id: string) => boolean;
479
632
  deleteAll: import("@ngrx/signals/rxjs-interop").RxMethod<void>;
480
633
  deselectAll: () => void;
481
634
  deselectEntity: (id: string) => void;
482
635
  load: import("@ngrx/signals/rxjs-interop").RxMethod<BaseEntityQueryCondition>;
483
636
  loadById: (id: string) => Entity | undefined;
637
+ reload: (id: string) => Promise<PersistedEntity<Entity> | undefined>;
484
638
  resetErrorState: () => void;
485
639
  selectEntity: (id: string) => void;
486
640
  setCurrentEntity: (id: string | undefined) => void;
641
+ stage: (entity: PersistedEntity<Entity>) => void;
487
642
  update: (entity: PersistedEntity<Entity>) => Promise<PersistedEntity<Entity> | undefined>;
488
643
  };
489
644
  }>;
490
- export declare class BaseEntityContainerComponent implements OnDestroy, OnInit {
491
- entityDescriptor: import("@angular/core").InputSignal<BaseEntityDescriptor | undefined>;
492
- facade: import("@angular/core").InputSignal<BaseEntityFacade<BaseEntity> | undefined>;
493
- private readonly injectedFacade;
494
- protected snackBar: MatSnackBar;
495
- store: BaseEntityStoreApi<BaseEntity>;
496
- protected activeFacade: import("@angular/core").Signal<BaseEntityFacade<BaseEntity> | undefined>;
497
- protected resolvedDescriptor: import("@angular/core").Signal<BaseEntityDescriptor>;
498
- constructor();
499
- ngOnDestroy(): void;
500
- ngOnInit(): void;
501
- private registerEffects;
502
- private registerFacadeDescriptorMerge;
503
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityContainerComponent, never>;
504
- static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityContainerComponent, "base-entity-container", never, {
505
- "entityDescriptor": {
506
- "alias": "entityDescriptor";
507
- "required": false;
508
- "isSignal": true;
509
- };
510
- "facade": {
511
- "alias": "facade";
512
- "required": false;
513
- "isSignal": true;
514
- };
515
- }, {}, never, ["*"], true, never>;
516
- }
517
- interface EntityContainerState {
518
- filterKey: string | undefined;
519
- }
520
- export declare function BaseEntityContainerStore(): import("@ngrx/signals").SignalStoreFeature<import("@ngrx/signals").EmptyFeatureResult, {
521
- state: {
522
- filterKey: string | undefined;
523
- };
524
- props: {};
525
- methods: {
526
- doFilter: (filterKey: string) => void;
527
- };
528
- }>;
529
- export declare class BaseEntityRestService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
530
- protected entityMapper: BaseEntityMapper<Entity>;
531
- protected urlProperty: string;
532
- protected resourceUrl: string;
533
- private readonly runtimeConfiguration;
534
- private readonly baseUrl;
535
- protected httpClient: HttpClient;
536
- protected headers: HttpHeaders;
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;
537
650
  /**
538
- * Names of the two query parameters a filtered, sorted collection read is built from. Overridable
539
- * because the workspace's contracts do not agree on them: `shared-api.yaml` and every feature that
540
- * refers to it say `where` / `order`, while base-entity's *instances* resource says `rsql` / `sort`
541
- * (`base-entity-api.yaml`, `listEntities`). The RSQL and the sort expression themselves are identical,
542
- * so a subclass renames rather than reimplements — see `DynamicEntityService`.
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.
543
659
  */
544
- protected readonly filterParamName: string;
545
- protected readonly sortParamName: string;
546
- constructor(entityMapper: BaseEntityMapper<Entity>, urlProperty: string, resourceUrl: string);
547
- delete(id: string): Observable<unknown>;
548
- deleteAll(): Observable<unknown>;
549
- findAll(page?: number): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
550
- findByQuery(queryCondition: BaseEntityQueryCondition): Observable<BaseEntityLoadResponse<PersistedEntity<Entity>> | PersistedEntity<Entity>[] | PersistedEntity<Entity>>;
551
- private isPagedResponse;
552
- private isEmptyBody;
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>;
553
673
  /**
554
- * Reads one entity by id. The `/%{id}` suffix is what makes this a single-entity read: without it the
555
- * URL is the collection's, and the response mapper then sees a list where it expects one record — the
556
- * Firestore and embedded implementations of this interface address one document, and so does this one.
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.
557
677
  */
558
- findById(id: string): Observable<void | PersistedEntity<Entity>>;
559
- add(entity: Entity, id?: number): Observable<PersistedEntity<Entity>>;
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
+ }
760
+ interface ArtifactAttr {
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>>;
560
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;
561
981
  protected buildFullUrl(resourceUri: string, queryCondition: BaseEntityQueryCondition): string | undefined;
562
982
  protected buildRsql(queryCondition: BaseEntityQueryCondition): string | undefined;
563
983
  private buildOrder;
@@ -608,6 +1028,8 @@ export declare class BaseEntityFormComponent<Entity extends BaseEntity> implemen
608
1028
  entity: Signal<Entity>;
609
1029
  entityId: InputSignal<string>;
610
1030
  isAbstract: Signal<boolean>;
1031
+ /** A preview of draft definitions over live objects: shown, never saved or deleted — see EntityPreviewMode. */
1032
+ isReadOnly: Signal<boolean>;
611
1033
  isNewObject: Signal<boolean>;
612
1034
  store: Signal<BaseEntityStoreApi<Entity>>;
613
1035
  componentHost: BaseFormHostDirective;
@@ -663,174 +1085,50 @@ export declare class BaseEntityFormComponent<Entity extends BaseEntity> implemen
663
1085
  entityName: string;
664
1086
  navigationError?: string | undefined;
665
1087
  navigateTo: string;
666
- responsePayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
667
- requestPayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
668
- returnTo: string;
669
- formSnapshot: Record<string, unknown> | undefined;
670
- }>;
671
- private readonly logger;
672
- private readonly ruleEngine;
673
- private readonly violationsStore;
674
- private rules;
675
- private readonly fieldsWithRuleErrors;
676
- private readonly ruleLoad$;
677
- private ruleSubscription;
678
- constructor();
679
- ngOnInit(): void;
680
- ngOnDestroy(): void;
681
- onCancel(): Promise<void>;
682
- onDelete(): Promise<void>;
683
- onFieldBlur(): void;
684
- onSubmit(): Promise<void>;
685
- /**
686
- * Leaving an embedded child goes to the form of the entity that contains it. Only a fallback: a drill-down
687
- * already records where it came from. It is a page opened straight on its URL — a deep link, a reload —
688
- * that has nothing recorded, and would otherwise land on the child's own list.
689
- */
690
- private navigateBack;
691
- private evaluateRules;
692
- private applyFieldRuleErrors;
693
- private clearFieldRuleErrors;
694
- private loadRules;
695
- private registerEffects;
696
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormComponent<any>, never>;
697
- static ɵcmp: i0.ɵɵComponentDeclaration<BaseEntityFormComponent<any>, "base-form", never, {
698
- "entityId": {
699
- "alias": "entityId";
700
- "required": true;
701
- "isSignal": true;
702
- };
703
- }, {}, never, never, true, never>;
704
- }
705
- /**
706
- * Resolves an entity's descriptor and store **by name**, whichever world the entity comes from: a
707
- * compile-time `BaseEntityFacade` registered in `BASE_ENTITY_FACADE_REGISTRY`, or a `BaseEntityDefinition`
708
- * synthesized at run-time by `DynamicEntityRegistry` and published into {@link ResolvedEntityCache}.
709
- *
710
- * Being the single lookup surface is what makes the metadata-defined case cost the rest of the library
711
- * nothing. `EmbeddedAggregateAccessor` asks here for the root store of an aggregate and for the descriptor
712
- * of every level below it; `resolveEmbeddedRouteContext` walks the containment graph through the
713
- * descriptors it gets back; the embedded form controls read their child's label the same way. None of them
714
- * changed, and none of them can tell the difference.
715
- *
716
- * Compile-time first. A host application that registered a facade did so on purpose — it may carry extra
717
- * tabs, a hand-tuned layout or a Firestore repository — and a definition of the same name does not
718
- * override that decision. The dynamic side is a fallback, in both senses.
719
- *
720
- * The synthesized side is read out of a cache rather than from the registry that builds it, so that this
721
- * class — injected by half the library — does not depend on the facades, and through them on every
722
- * repository implementation there is. See {@link ResolvedEntityCache}.
723
- */
724
- export declare class BaseEntityDescriptorRegistry {
725
- private readonly registry;
726
- private readonly resolvedEntities;
727
- private readonly injector;
728
- getDescriptor(entityName: string | undefined): BaseEntityDescriptor | undefined;
729
- /**
730
- * An embedded entity has a store too — see `EmbeddedEntityFacade`. It reads and writes the containing
731
- * entity's document rather than an endpoint of its own, which is invisible from here.
732
- */
733
- getStore<Store = unknown>(entityName: string | undefined): Store | undefined;
734
- private resolveFacade;
735
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityDescriptorRegistry, never>;
736
- static ɵprov: i0.ɵɵInjectableDeclaration<any>;
737
- }
738
- declare class BaseEntityFormBuilder<Entity extends BaseEntity> {
739
- private readonly logger;
740
- buildForm(viewContainerRef: ViewContainerRef, baseEntityForm: FormGroup, store: BaseEntityStoreApi<Entity>, attrDescriptors: AbstractAttrDescriptor[], entity: Signal<Entity>, entityName: string, initialValues?: Record<string, unknown>): void;
741
- private createFormControlFor;
742
- private createFormControl;
743
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseEntityFormBuilder<any>, never>;
744
- static ɵprov: i0.ɵɵInjectableDeclaration<any>;
745
- }
746
- export declare abstract class BaseFormControlComponent<Entity extends BaseEntity> {
747
- config: InputSignal<BaseEntityAttrDescriptor>;
748
- entity: InputSignal<Entity>;
749
- entityName: InputSignal<string>;
750
- formGroup: FormGroup;
751
- store: BaseEntityStoreApi<Entity>;
752
- /**
753
- * Set by {@link BaseEntityFormBuilder} on every control it creates, for the controls that build sub-forms of
754
- * their own. Handed over rather than injected because the builder maps control types to these very component
755
- * classes — injecting it here would close a runtime import cycle (NG0919). The import above is type-only.
756
- */
757
- formBuilder: BaseEntityFormBuilder<Entity>;
758
- style: import("@angular/core").Signal<{
759
- [p: string]: unknown;
760
- } | null | undefined>;
761
- linkedEntityName: import("@angular/core").Signal<string>;
762
- linkedEntityDescriptor: import("@angular/core").Signal<BaseEntityDescriptor | undefined>;
763
- value: InputSignal<unknown>;
764
- get testId(): string | null;
765
- get hostStyle(): string | null;
766
- protected readonly logger: NGXLogger;
767
- protected readonly formNavigator: {
768
- activeRouteSegment: import("@angular/core").Signal<import("@processpuzzle/base-entity").RouteSegments | undefined>;
769
- activeTabSegment: import("@angular/core").Signal<string | undefined>;
770
- tabSegments: import("@angular/core").Signal<string[]>;
771
- breadcrumb: import("@angular/core").Signal<import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[]>;
772
- entityName: import("@angular/core").Signal<string>;
773
- navigationError?: import("@angular/core").Signal<string | undefined> | undefined;
774
- navigateTo: import("@angular/core").Signal<string>;
775
- responsePayloads: import("@angular/core").Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
776
- requestPayloads: import("@angular/core").Signal<Map<string, import("@processpuzzle/base-entity").NavigationPayload>>;
777
- returnTo: import("@angular/core").Signal<string>;
778
- formSnapshot: import("@angular/core").Signal<Record<string, unknown> | undefined>;
779
- captureFormSnapshot: (snapshot: Record<string, unknown>) => void;
780
- determineCurrentUrl: () => string;
781
- determineOwnerUrl: () => string;
782
- determineActiveRouteSegment: () => void;
783
- navigateBack: (defaultUrl?: string) => Promise<void>;
784
- navigateToBreadcrumbLevel: (index: number) => Promise<void>;
785
- navigateToDetails: (entityName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
786
- navigateToEmbedded: (embeddedTypeName: string, id: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
787
- navigateToList: (entityName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
788
- navigateToRelated: (relatedTypeName: string, id: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
789
- navigateToRelatedList: (relatedTypeName: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
790
- navigateToTab: (entityName: string, id: string, segment: string, returnTo?: string, payload?: import("@processpuzzle/base-entity").NavigationPayload) => Promise<void>;
791
- navigateToUrl: (url: string, returnTo?: string) => Promise<void>;
792
- registerTabSegments: (segments: string[]) => void;
793
- showsScreenOf: (entityName: string) => boolean;
794
- destroyNavigationTracking: () => void;
795
- initializeNavigationTracking: () => void;
796
- popFormSnapshot: () => Record<string, unknown> | undefined;
797
- popRequestPayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
798
- popResponsePayload: (attrName?: string) => import("@processpuzzle/base-entity").NavigationPayload | undefined;
799
- pushResponsePayload: (payload: import("@processpuzzle/base-entity").NavigationPayload) => void;
800
- setEntityName: (entityName: string) => void;
801
- } & import("@ngrx/signals").StateSource<{
802
- activeRouteSegment: import("@processpuzzle/base-entity").RouteSegments | undefined;
803
- activeTabSegment: string | undefined;
804
- tabSegments: string[];
805
- breadcrumb: import("@processpuzzle/base-entity").EmbeddedBreadcrumbLevel[];
806
- entityName: string;
807
- navigationError?: string | undefined;
808
- navigateTo: string;
809
- responsePayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
810
- requestPayloads: Map<string, import("@processpuzzle/base-entity").NavigationPayload>;
811
- returnTo: string;
812
- formSnapshot: Record<string, unknown> | undefined;
813
- }>;
814
- protected readonly descriptorRegistry: BaseEntityDescriptorRegistry;
815
- static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormControlComponent<any>, never>;
816
- static ɵcmp: i0.ɵɵComponentDeclaration<BaseFormControlComponent<any>, "ng-component", never, {
817
- "config": {
818
- "alias": "config";
819
- "required": true;
820
- "isSignal": true;
821
- };
822
- "entity": {
823
- "alias": "entity";
824
- "required": true;
825
- "isSignal": true;
826
- };
827
- "entityName": {
828
- "alias": "entityName";
829
- "required": true;
830
- "isSignal": true;
831
- };
832
- "value": {
833
- "alias": "value";
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";
834
1132
  "required": true;
835
1133
  "isSignal": true;
836
1134
  };
@@ -930,6 +1228,13 @@ declare function appendRow(rows: readonly EmbeddedRow[], row: EmbeddedRow): Embe
930
1228
  /** Replaces the row identified by `id`; appends when it is not there yet, so an add and a re-save agree. */
931
1229
  declare function replaceRow(rows: readonly EmbeddedRow[], id: string, row: EmbeddedRow, referenceIdField?: string): EmbeddedRow[];
932
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[];
933
1238
  /** Widens a row to the shape the store's API is written in; embedded rows always carry their key field. */
934
1239
  declare function asPersisted<Entity extends BaseEntity>(row: EmbeddedRow): PersistedEntity<Entity>;
935
1240
  /**
@@ -943,7 +1248,7 @@ declare function asPersisted<Entity extends BaseEntity>(row: EmbeddedRow): Persi
943
1248
  * The rows come from the child's own store, which reads them out of this entity's payload
944
1249
  * (`EmbeddedEntityService`), so adding, editing and deleting a child all go through the same
945
1250
  * List → Store → Service path as any other entity. What differs is only where that service writes: the
946
- * containing document, saved as a whole. For a part that is persisted through an endpoint of its own, see
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
947
1252
  * `COMPONENTS`; for one that merely points at an independent entity, `RELATED_ENTITIES`.
948
1253
  */
949
1254
  export declare class EmbeddedComponentsListComponent<Entity extends BaseEntity> extends BaseFormControlComponent<Entity> implements OnInit {
@@ -955,7 +1260,19 @@ export declare class EmbeddedComponentsListComponent<Entity extends BaseEntity>
955
1260
  * The child's store holds exactly this attribute's rows: it resolves them from the containing document
956
1261
  * through the route, so it is already scoped to the entity this form is editing.
957
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. */
958
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>;
959
1276
  constructor();
960
1277
  ngOnInit(): void;
961
1278
  rowKey(row: EmbeddedRow): string;
@@ -978,6 +1295,13 @@ export declare class EmbeddedComponentsListComponent<Entity extends BaseEntity>
978
1295
  addComponent(): void;
979
1296
  /** Destroys the child — an embedded component has no existence outside this payload — after confirmation. */
980
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;
981
1305
  /**
982
1306
  * Both declarations — this attribute's control type and the child's own descriptor — are written by hand
983
1307
  * and have to agree; checking at first render names both sides instead of silently rendering a list whose
@@ -994,23 +1318,38 @@ export declare class EmbeddedComponentsListComponent<Entity extends BaseEntity>
994
1318
  */
995
1319
  private registerRowReload;
996
1320
  /**
997
- * Mirrors the rows into this attribute's control. A child's save writes the containing document itself, so
998
- * the control would otherwise still hold the array as it looked when the form was built — and the owner's
999
- * own save, which merges `form.value` over the entity, would write that stale array back.
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.
1000
1328
  */
1001
1329
  private registerFormControlSync;
1330
+ /** Whether the document these rows live in holds child changes its Save has not persisted yet. */
1331
+ private documentHasStagedChanges;
1002
1332
  static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedComponentsListComponent<any>, never>;
1003
1333
  static ɵcmp: i0.ɵɵComponentDeclaration<EmbeddedComponentsListComponent<any>, "app-embedded-components-list", never, {}, {}, never, never, true, never>;
1004
1334
  }
1005
1335
  /**
1006
- * One row of {@link EmbeddedComponentsListComponent}. Presentation only: opening and deleting both belong to
1007
- * the list, which is the side that knows where the row sits in the containing document.
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.
1008
1341
  */
1009
1342
  export declare class EmbeddedComponentRefComponent {
1010
1343
  displayName: InputSignal<string>;
1011
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>;
1012
1349
  readonly openRequested: import("@angular/core").OutputEmitterRef<void>;
1013
1350
  readonly deleteRequested: import("@angular/core").OutputEmitterRef<void>;
1351
+ readonly moveUpRequested: import("@angular/core").OutputEmitterRef<void>;
1352
+ readonly moveDownRequested: import("@angular/core").OutputEmitterRef<void>;
1014
1353
  requestOpen(event: Event): void;
1015
1354
  requestDelete(): void;
1016
1355
  static ɵfac: i0.ɵɵFactoryDeclaration<EmbeddedComponentRefComponent, never>;
@@ -1025,11 +1364,172 @@ export declare class EmbeddedComponentRefComponent {
1025
1364
  "required": false;
1026
1365
  "isSignal": true;
1027
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
+ };
1028
1382
  }, {
1029
1383
  "openRequested": "openRequested";
1030
1384
  "deleteRequested": "deleteRequested";
1385
+ "moveUpRequested": "moveUpRequested";
1386
+ "moveDownRequested": "moveDownRequested";
1031
1387
  }, never, never, true, never>;
1032
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
+ }
1033
1533
  interface RelatedEntityNameAttr {
1034
1534
  attrName: string;
1035
1535
  name: string;
@@ -1107,6 +1607,421 @@ export declare class RelatedEntitiesListComponent<Entity extends BaseEntity> ext
1107
1607
  static ɵfac: i0.ɵɵFactoryDeclaration<RelatedEntitiesListComponent<any>, never>;
1108
1608
  static ɵcmp: i0.ɵɵComponentDeclaration<RelatedEntitiesListComponent<any>, "app-related-entities-list", never, {}, {}, never, never, true, never>;
1109
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
+ }
1110
2025
  /**
1111
2026
  * Resolves `key` through Transloco, returning `fallback` when the key is absent or unresolved. Shared
1112
2027
  * by {@link EntityLabelPipe} and the components that need the resolved label as a translation
@@ -1140,6 +2055,46 @@ export declare class EntityLabelPipe implements PipeTransform, OnDestroy {
1140
2055
  static ɵfac: i0.ɵɵFactoryDeclaration<EntityLabelPipe, never>;
1141
2056
  static ɵpipe: i0.ɵɵPipeDeclaration<EntityLabelPipe, "ppLabel", true>;
1142
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;
1143
2098
  export declare const BASE_LIST_DESCRIPTORS: InjectionToken<string[]>;
1144
2099
  export declare class BaseEntityListComponent<Entity extends BaseEntity> implements AfterViewInit, OnInit {
1145
2100
  dataSource: MatTableDataSource<PersistedEntity<Entity>>;
@@ -1148,6 +2103,7 @@ export declare class BaseEntityListComponent<Entity extends BaseEntity> implemen
1148
2103
  private readonly logger;
1149
2104
  private readonly formNavigator;
1150
2105
  private readonly objectStoreService;
2106
+ private readonly foreignKeyLabels;
1151
2107
  columnDescriptors: Signal<BaseEntityAttrDescriptor[]>;
1152
2108
  displayedColumns: Signal<string[]>;
1153
2109
  sort: MatSort;
@@ -1162,6 +2118,12 @@ export declare class BaseEntityListComponent<Entity extends BaseEntity> implemen
1162
2118
  onNavigateToDetails(entity: PersistedEntity<Entity>): void;
1163
2119
  onNavigateToRelated(config: BaseEntityAttrDescriptor, entity: PersistedEntity<Entity>): void;
1164
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;
1165
2127
  onDownloadObject(artifact: ArtifactAttr, event?: MouseEvent): void;
1166
2128
  onToggleAllRows(): void;
1167
2129
  onCancelSelectOrCreate(): Promise<void>;
@@ -1227,7 +2189,11 @@ export declare class EntityRegistryComponent {
1227
2189
  * `formControlType` enum is a superset of `FormControlType`, its `code`s are what the descriptor calls
1228
2190
  * entity *names* — the translation is the descriptor factory's job and is documented there.
1229
2191
  */
1230
- /** `EntityDefinitionStatus` of the contract. Only `ACTIVE` definitions are rendered. */
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
+ */
1231
2197
  type EntityDefinitionStatus = 'DRAFT' | 'ACTIVE' | 'DEPRECATED';
1232
2198
  /** `ValueKind` of the contract: what the attribute's value *is*, as opposed to how it is edited. */
1233
2199
  type EntityValueKind = 'TEXT' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'DATE_TIME' | 'ENUM' | 'REFERENCE';
@@ -1275,12 +2241,23 @@ export declare class EntityAttributeDefinition implements BaseEntity {
1275
2241
  displayOrder?: number;
1276
2242
  valueKind?: EntityValueKind;
1277
2243
  formControlType: string;
1278
- isMultiValued?: boolean;
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;
1279
2248
  required?: boolean;
1280
2249
  indexed?: boolean;
1281
2250
  defaultValue?: unknown;
1282
2251
  /** Only meaningful for `valueKind: ENUM`; becomes the dropdown's options. */
1283
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;
1284
2261
  /**
1285
2262
  * **Code** of the definition this attribute points at — a child carried inline
1286
2263
  * (`EMBEDDED_COMPONENTS`) or a parent referenced by key (`FOREIGN_KEY`). The descriptor's
@@ -1289,6 +2266,16 @@ export declare class EntityAttributeDefinition implements BaseEntity {
1289
2266
  linkedEntityType?: string;
1290
2267
  /** Marks the attribute that titles an instance — the descriptor's `isLinkToDetails`. */
1291
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;
1292
2279
  constructor(init?: Partial<EntityAttributeDefinition>);
1293
2280
  }
1294
2281
  /**
@@ -1310,6 +2297,8 @@ export declare class EntityDefinition implements BaseEntity {
1310
2297
  name: string;
1311
2298
  description?: string;
1312
2299
  status?: EntityDefinitionStatus;
2300
+ /** Where this draft stands against the release; reported by the backend, never sent back. */
2301
+ releaseState?: ReleaseState;
1313
2302
  /** **Codes** of the definitions that may aggregate this one; empty for a stand-alone entity. */
1314
2303
  componentParents?: string[];
1315
2304
  /** True when this definition's payload travels inside its parent's and it has no rows of its own. */
@@ -1341,7 +2330,10 @@ interface DynamicEntity {
1341
2330
  interface EntityDefinitionPage {
1342
2331
  content?: EntityDefinition[];
1343
2332
  }
1344
- /** Only an `ACTIVE` definition is rendered; a draft is being authored and a deprecated one is on its way out. */
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
+ */
1345
2337
  declare function isRenderable(definition: EntityDefinition): boolean;
1346
2338
  /** `BaseConfiguration` key naming the org-scoped root of the base-entity endpoints. */
1347
2339
  export declare const ENTITY_SERVICE_ROOT_KEY = "ENTITY_SERVICE_ROOT";
@@ -1707,6 +2699,25 @@ export declare class DynamicEntityRegistry {
1707
2699
  static ɵfac: i0.ɵɵFactoryDeclaration<DynamicEntityRegistry, never>;
1708
2700
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1709
2701
  }
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>;
2720
+ }
1710
2721
  /**
1711
2722
  * An embedded child to mount under an entity's details route. The entity's descriptor has to reference it
1712
2723
  * with `FormControlType.EMBEDDED_COMPONENTS`, and the child's own descriptor has to name the entity as a
@@ -1770,8 +2781,16 @@ export declare class EntityScreenResolver {
1770
2781
  private readonly dynamicRegistry;
1771
2782
  private readonly injector;
1772
2783
  private readonly tabContributors;
2784
+ private readonly stateControl;
1773
2785
  /** `undefined` when neither a facade nor a definition answers to `entityName`. */
1774
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;
1775
2794
  /**
1776
2795
  * The descriptor's extra tabs after every contributor has been asked — and **written back onto the
1777
2796
  * descriptor**, because that is what `BaseEntityTabsComponent` renders the links from. The routes are
@@ -1843,6 +2862,25 @@ interface EntityTabContributor {
1843
2862
  * reader injects it optionally.
1844
2863
  */
1845
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>;
1846
2884
  interface EntityScreenRouteOptions {
1847
2885
  /** Entity whose screens to mount, by descriptor name. */
1848
2886
  entityName: string | undefined;
@@ -2013,8 +3051,13 @@ export declare class EmbeddedAggregateAccessor {
2013
3051
  * them has to be told when that document arrives or changes.
2014
3052
  */
2015
3053
  rootStoreFor(entityName: string): BaseEntityStoreApi<BaseEntity> | undefined;
2016
- /** Persists the aggregate with `rootPayload` replaced — an embedded row has no endpoint of its own. */
2017
- writeRoot(resolved: ResolvedEmbeddedAggregate, rootPayload: Record<string, unknown>): Promise<void>;
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;
2018
3061
  /**
2019
3062
  * The URL chain, ending at `entityName`.
2020
3063
  *
@@ -2039,8 +3082,9 @@ export declare class EmbeddedAggregateAccessor {
2039
3082
  * enough — the child's `BaseEntityListComponent` and `BaseEntityFormComponent`, and the store between them,
2040
3083
  * are the stock ones and know nothing about any of this.
2041
3084
  *
2042
- * A write is a write of the whole root document (see {@link EmbeddedAggregateAccessor.writeRoot}), which is
2043
- * what makes a child's Save persist immediately rather than waiting for the root's form.
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.
2044
3088
  */
2045
3089
  export declare class EmbeddedEntityService<Entity extends BaseEntity> implements BaseEntityService<Entity> {
2046
3090
  private readonly entityName;
@@ -2483,6 +3527,11 @@ interface PdfExportOptions {
2483
3527
  * Defaults to true.
2484
3528
  */
2485
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;
2486
3535
  }
2487
3536
  interface PdfExportResult {
2488
3537
  success: boolean;
@@ -2548,9 +3597,10 @@ export declare class PdfExportService {
2548
3597
  * the PDF.
2549
3598
  *
2550
3599
  * Type-appropriate alignment and value formatters are derived from `formControlType` so
2551
- * 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.
2552
3602
  */
2553
- export declare function entityDescriptorToPdfColumns(descriptors: AbstractAttrDescriptor[]): PdfColumnDefinition[];
3603
+ export declare function entityDescriptorToPdfColumns(descriptors: AbstractAttrDescriptor[], locale?: string): PdfColumnDefinition[];
2554
3604
  type PdfExportDialogResult = Pick<PdfExportOptions, 'orientation' | 'pageSize' | 'includeFooter'>;
2555
3605
  /**
2556
3606
  * Asks the user for the few PDF layout choices we expose — orientation, page size and
@@ -2664,14 +3714,16 @@ export declare const BASE_ENTITY_AUTHORING_ENTITY_FACADES: BaseEntityFacadeRegis
2664
3714
  */
2665
3715
  export declare const ENTITY_DEFINITION_ENTITY_NAME = "Entity Definition";
2666
3716
  export declare const ENTITY_ATTRIBUTE_ENTITY_NAME = "Entity Attribute";
2667
- export declare function createEntityDefinitionDescriptor(): BaseEntityDescriptor;
3717
+ /** @param entityCodes the codes Component Parents may pick from; see {@link EntityDefinitionOptions.codes} */
3718
+ export declare function createEntityDefinitionDescriptor(entityCodes?: () => Selectable[]): BaseEntityDescriptor;
2668
3719
  /**
2669
3720
  * An `EntityAttributeDefinition` is identified by `code`, unique within its definition — the contract
2670
3721
  * gives it a read-only uuid nothing addresses it by. Referencing attributes therefore have to set
2671
3722
  * `referenceIdField = 'code'`; see the `attributes` attribute of the `Entity Definition` descriptor.
2672
3723
  */
2673
3724
  export declare const ENTITY_ATTRIBUTE_ID_FIELD = "code";
2674
- export declare function createEntityAttributeDescriptor(): BaseEntityDescriptor;
3725
+ /** @param entityCodes the codes the Linked Entity dropdown offers; see {@link EntityDefinitionOptions.codes} */
3726
+ export declare function createEntityAttributeDescriptor(entityCodes?: () => Selectable[]): BaseEntityDescriptor;
2675
3727
  /** `BaseEntityAttributeInput` of `base-entity-api.yaml`, plus the `id` a response carries. */
2676
3728
  interface EntityAttributeDto {
2677
3729
  id?: string;
@@ -2681,13 +3733,20 @@ interface EntityAttributeDto {
2681
3733
  displayOrder?: number;
2682
3734
  valueKind?: EntityValueKind;
2683
3735
  formControlType?: string;
2684
- isMultiValued?: boolean;
3736
+ multiplicity?: Multiplicity;
3737
+ maxOccurs?: number;
2685
3738
  required?: boolean;
2686
3739
  indexed?: boolean;
2687
3740
  defaultValue?: unknown;
2688
3741
  enumValues?: string[];
3742
+ dateFormat?: DateFormat;
2689
3743
  linkedEntityType?: string;
2690
3744
  isLinkToDetails?: boolean;
3745
+ autosizeColumn?: boolean;
3746
+ defaultAvatar?: string;
3747
+ showMap?: boolean;
3748
+ mapProvider?: MapProvider;
3749
+ defaultCountry?: string;
2691
3750
  }
2692
3751
  /** `BaseEntityDefinition` on the way in, `BaseEntityDefinitionInput` on the way out. */
2693
3752
  interface EntityDefinitionDto {
@@ -2696,6 +3755,7 @@ interface EntityDefinitionDto {
2696
3755
  name?: string;
2697
3756
  description?: string;
2698
3757
  status?: EntityDefinitionStatus;
3758
+ releaseState?: ReleaseState;
2699
3759
  componentParents?: string[];
2700
3760
  isEmbedded?: boolean;
2701
3761
  attributes?: EntityAttributeDto[];
@@ -2724,7 +3784,7 @@ interface EntityDefinitionDto {
2724
3784
  *
2725
3785
  * **`PUT /entity-definitions/{code}` is a full replacement**, so `toDto` emits `attributes` unconditionally
2726
3786
  * — an absent list is an emptied definition, not an untouched one. The three fields the contract marks
2727
- * `readOnly` (`version`, `createdAt`, `updatedAt`) are for the same reason *not* emitted: the form shows
3787
+ * `readOnly` (`version`, `createdAt`, `updatedAt`, and `releaseState`) are for the same reason *not* emitted: the form shows
2728
3788
  * them disabled, and sending a value back would be claiming to own something the backend assigns.
2729
3789
  */
2730
3790
  export declare class EntityDefinitionMapper implements BaseEntityMapper<EntityDefinition> {
@@ -2780,6 +3840,7 @@ export declare const EntityDefinitionStore: import("@angular/core").Type<{
2780
3840
  isLoading: import("@angular/core").Signal<boolean>;
2781
3841
  error: import("@angular/core").Signal<string | undefined>;
2782
3842
  selectedEntities: import("@angular/core").Signal<EntityDefinition[]>;
3843
+ stagedIds: import("@angular/core").Signal<string[]>;
2783
3844
  activeTabs: import("@angular/core").Signal<string[]>;
2784
3845
  currentTab: import("@angular/core").Signal<string | undefined>;
2785
3846
  filterKey: import("@angular/core").Signal<string | undefined>;
@@ -2789,14 +3850,17 @@ export declare const EntityDefinitionStore: import("@angular/core").Type<{
2789
3850
  createEntity: () => EntityDefinition;
2790
3851
  add: (entity: EntityDefinition) => Promise<import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition> | undefined>;
2791
3852
  delete: (id: string) => Promise<void>;
3853
+ hasStagedChanges: (id: string) => boolean;
2792
3854
  deleteAll: import("@ngrx/signals/rxjs-interop").RxMethod<void>;
2793
3855
  deselectAll: () => void;
2794
3856
  deselectEntity: (id: string) => void;
2795
3857
  load: import("@ngrx/signals/rxjs-interop").RxMethod<import("@processpuzzle/base-entity").BaseEntityQueryCondition>;
2796
3858
  loadById: (id: string) => EntityDefinition | undefined;
3859
+ reload: (id: string) => Promise<import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition> | undefined>;
2797
3860
  resetErrorState: () => void;
2798
3861
  selectEntity: (id: string) => void;
2799
3862
  setCurrentEntity: (id: string | undefined) => void;
3863
+ stage: (entity: import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition>) => void;
2800
3864
  update: (entity: import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition>) => Promise<import("@processpuzzle/base-entity").PersistedEntity<EntityDefinition> | undefined>;
2801
3865
  reset: () => void;
2802
3866
  tabIsActive: (tabName: string) => void;
@@ -2813,6 +3877,7 @@ export declare const EntityDefinitionStore: import("@angular/core").Type<{
2813
3877
  isLoading: boolean;
2814
3878
  error: string | undefined;
2815
3879
  selectedEntities: EntityDefinition[];
3880
+ stagedIds: string[];
2816
3881
  activeTabs: string[];
2817
3882
  currentTab: string | undefined;
2818
3883
  filterKey: string | undefined;
@@ -2882,5 +3947,5 @@ export declare class EntityDefinitionContainerComponent implements OnDestroy {
2882
3947
  static ɵfac: i0.ɵɵFactoryDeclaration<EntityDefinitionContainerComponent, never>;
2883
3948
  static ɵcmp: i0.ɵɵComponentDeclaration<EntityDefinitionContainerComponent, "pp-entity-definition-container", never, {}, {}, never, never, true, never>;
2884
3949
  }
2885
- export type { ArtifactAttr, BaseEntity, BaseEntityDescriptorOptions, BaseEntityFacadeRegistry, BaseEntityFormBuilder, BaseEntityLoadResponse, BaseEntityMapper, BaseEntityQueryCondition, DefinitionLookup, DynamicEntity, EmbeddedBreadcrumbLevel, EmbeddedChildRoute, EmbeddedPath, EmbeddedPathStep, EmbeddedRouteContext, EmbeddedRouteLevel, EmbeddedRow, EntityDefinitionStatus, EntityOptions, EntityScreenRouteOptions, EntityScreens, EntityServiceKind, EntityTabContributor, EntityTabDescriptor, EntityValueKind, EvaluatableRule, FilterCondition, FirestoreApi, LookupTable, NavigationPayload, NavigationState, ObjectUriResponse, OrderByCondition, PdfColumnDefinition, PdfExportDialogResult, PdfExportOptions, PdfExportResult, PersistedBaseEntity, PersistedEntity, ResolvedDynamicEntity, ResolvedEmbeddedAggregate, RuleEngine, RuleEvaluationResult, RuleSeverity, Selectable, SelectablesInput };
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 };
2886
3951
  //# sourceMappingURL=processpuzzle-base-entity.d.ts.map