@processpuzzle/base-app 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/assets/i18n/base_app/de.json +86 -0
- package/assets/i18n/base_app/en.json +86 -0
- package/assets/i18n/base_app/es.json +86 -0
- package/assets/i18n/base_app/fr.json +86 -0
- package/assets/i18n/base_app/hu.json +86 -0
- package/fesm2022/processpuzzle-base-app.mjs +2403 -0
- package/fesm2022/processpuzzle-base-app.mjs.map +1 -0
- package/package.json +47 -0
- package/theme/pp-material-themes.scss +81 -0
- package/types/processpuzzle-base-app.d.ts +1244 -0
- package/types/processpuzzle-base-app.d.ts.map +1 -0
|
@@ -0,0 +1,1244 @@
|
|
|
1
|
+
import * as _processpuzzle_base_entity from '@processpuzzle/base-entity';
|
|
2
|
+
import { BaseEntity, BaseEntityDescriptor, BaseEntityMapper, BaseEntityRestService, PersistedEntity, BaseEntityFacade, EmbeddedEntityFacade, BaseFormHostDirective, EntityTabDescriptor, BaseEntityFacadeRegistry } from '@processpuzzle/base-entity';
|
|
3
|
+
import { WidgetInstance } from '@processpuzzle/widgets';
|
|
4
|
+
export { WIDGET_PLACEMENTS, WidgetInstance, WidgetPlacement } from '@processpuzzle/widgets';
|
|
5
|
+
import { TranslationSource } from '@processpuzzle/util';
|
|
6
|
+
import * as _angular_core from '@angular/core';
|
|
7
|
+
import { Type, OnDestroy, TemplateRef, OnInit, Provider } from '@angular/core';
|
|
8
|
+
import { Observable } from 'rxjs';
|
|
9
|
+
import * as _ngrx_signals_rxjs_interop from '@ngrx/signals/rxjs-interop';
|
|
10
|
+
import * as _angular_material_table from '@angular/material/table';
|
|
11
|
+
import * as _angular_material_paginator from '@angular/material/paginator';
|
|
12
|
+
import * as _ngrx_signals from '@ngrx/signals';
|
|
13
|
+
import { Route, Routes, CanMatchFn } from '@angular/router';
|
|
14
|
+
import * as _processpuzzle_base_app from '@processpuzzle/base-app';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Frontend model of the `AppDefinition` schema of `base-app-api.yaml`. `theme` and `layout` are
|
|
18
|
+
* flattened onto the entity by {@link AppDefinitionMapper} so that the generated form can offer a
|
|
19
|
+
* typed control per field; the original objects are kept alongside, because a full replacement PUT
|
|
20
|
+
* would otherwise drop the parts no control writes. `regions`, `routes` and `modules` stay nested and
|
|
21
|
+
* are edited through the `EMBEDDED_COMPONENTS` controls of the `App Region` / `App Route` /
|
|
22
|
+
* `App Module Mount` descriptors.
|
|
23
|
+
*
|
|
24
|
+
* A route's `target` is flattened the same way, for the same reason and by the same mapper. The
|
|
25
|
+
* contract already keeps `RouteTarget` flat rather than a `oneOf` because the generic form cannot edit
|
|
26
|
+
* a discriminated union of classes; a nested object it equally cannot reach, since an
|
|
27
|
+
* `EMBEDDED_COMPONENTS` row is edited as the parsed JSON it arrived as and a descriptor addresses one
|
|
28
|
+
* property, not a path. So {@link RouteDefinition} carries `kind` and the per-kind fields directly and
|
|
29
|
+
* {@link AppDefinitionMapper} re-nests them on save.
|
|
30
|
+
*
|
|
31
|
+
* The nested definitions are classes rather than interfaces, because each is an embedded entity of
|
|
32
|
+
* its own: `EmbeddedEntityFacade` mints the blank row an `Add` opens the child's form on, and that
|
|
33
|
+
* needs a constructor. They stay plain data — the rows of a loaded aggregate are the parsed JSON,
|
|
34
|
+
* never instances of these classes, so nothing may rely on `instanceof` or on a method.
|
|
35
|
+
*/
|
|
36
|
+
declare const MATERIAL_THEMES: readonly ["azure-blue", "rose-red", "magenta-violet", "cyan-orange"];
|
|
37
|
+
type MaterialTheme = (typeof MATERIAL_THEMES)[number];
|
|
38
|
+
declare const COLOR_SCHEMES: readonly ["light", "dark", "auto"];
|
|
39
|
+
type ColorScheme = (typeof COLOR_SCHEMES)[number];
|
|
40
|
+
declare const LAYOUT_PRESETS: readonly ["sidenav-left", "sidenav-right", "top-nav"];
|
|
41
|
+
type LayoutPreset = (typeof LAYOUT_PRESETS)[number];
|
|
42
|
+
declare const SIDENAV_MODES: readonly ["side", "over", "push"];
|
|
43
|
+
type SidenavMode = (typeof SIDENAV_MODES)[number];
|
|
44
|
+
/**
|
|
45
|
+
* No `content`: once routes own the content area it *is* the router outlet, so a content region would
|
|
46
|
+
* have no field of its own — `widgets` is header/footer-only and `navItems` sidenav-only. Its sizing
|
|
47
|
+
* lives in {@link LayoutDefinition.contentMaxWidth}.
|
|
48
|
+
*/
|
|
49
|
+
declare const REGION_TYPES: readonly ["header", "sidenav", "footer"];
|
|
50
|
+
type RegionType = (typeof REGION_TYPES)[number];
|
|
51
|
+
/**
|
|
52
|
+
* What a route renders. Uppercase because the contract's enum is — `RegionType` and the theme enums
|
|
53
|
+
* are lowercase, and mixing the two up is a silent miss rather than a type error once a value reaches
|
|
54
|
+
* JSON.
|
|
55
|
+
*/
|
|
56
|
+
declare const ROUTE_TARGET_KINDS: readonly ["WIDGETS", "DOCUMENT", "ENTITY"];
|
|
57
|
+
type RouteTargetKind = (typeof ROUTE_TARGET_KINDS)[number];
|
|
58
|
+
declare const ENTITY_MODES: readonly ["LIST", "DETAILS"];
|
|
59
|
+
type EntityMode = (typeof ENTITY_MODES)[number];
|
|
60
|
+
declare enum AppDefinitionStatus {
|
|
61
|
+
DRAFT = "DRAFT",
|
|
62
|
+
PUBLISHED = "PUBLISHED"
|
|
63
|
+
}
|
|
64
|
+
interface ThemeDefinition {
|
|
65
|
+
materialTheme?: MaterialTheme;
|
|
66
|
+
colorScheme?: ColorScheme;
|
|
67
|
+
/** Overrides for the `--pp-*` custom properties of `widgets/src/theme/pp-colors.css`. */
|
|
68
|
+
tokenOverrides?: Record<string, string>;
|
|
69
|
+
logoUrl?: string;
|
|
70
|
+
faviconUrl?: string;
|
|
71
|
+
}
|
|
72
|
+
interface LayoutDefinition {
|
|
73
|
+
preset?: LayoutPreset;
|
|
74
|
+
sidenavMode?: SidenavMode;
|
|
75
|
+
sidenavCollapsible?: boolean;
|
|
76
|
+
sidenavOpenByDefault?: boolean;
|
|
77
|
+
contentMaxWidth?: string;
|
|
78
|
+
}
|
|
79
|
+
declare class NavItem implements BaseEntity {
|
|
80
|
+
id: string;
|
|
81
|
+
label: string;
|
|
82
|
+
translocoId?: string;
|
|
83
|
+
icon?: string;
|
|
84
|
+
/**
|
|
85
|
+
* `RouteDefinition.path` of the route this entry navigates to, resolved by string. Absent on a group
|
|
86
|
+
* node, which expands its {@link children} instead of navigating.
|
|
87
|
+
*
|
|
88
|
+
* A path naming no route is a validation *warning* server-side, not an error: it may name a route of
|
|
89
|
+
* a module that has not been authored yet, and modules stay loosely coupled.
|
|
90
|
+
*/
|
|
91
|
+
routePath?: string;
|
|
92
|
+
roles?: string[];
|
|
93
|
+
children?: NavItem[];
|
|
94
|
+
constructor(init?: Partial<NavItem>);
|
|
95
|
+
}
|
|
96
|
+
declare class RegionDefinition implements BaseEntity {
|
|
97
|
+
/**
|
|
98
|
+
* Declared, never assigned. The contract gives a region no `id` — `type` identifies it, see
|
|
99
|
+
* `APP_REGION_ID_FIELD` — but `BaseEntity`'s only property is an optional `id`, and TypeScript's
|
|
100
|
+
* weak-type rule rejects a type that shares no property with it. `declare` emits nothing, so the
|
|
101
|
+
* payload stays exactly the shape the schema describes.
|
|
102
|
+
*/
|
|
103
|
+
readonly id?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Required by the contract, but undefined while a region is being created — the dropdown is declared
|
|
106
|
+
* `required`, so the form is what enforces the contract before the row reaches the payload.
|
|
107
|
+
*/
|
|
108
|
+
type: RegionType | undefined;
|
|
109
|
+
/** `sidenav` only; left undefined so a header region's payload carries no empty nav tree. */
|
|
110
|
+
navItems?: NavItem[];
|
|
111
|
+
/** `header` / `footer` only. */
|
|
112
|
+
widgets?: WidgetInstance[];
|
|
113
|
+
constructor(init?: Partial<RegionDefinition>);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The nested `target` object of the DTO. Only {@link AppDefinitionMapper} handles it — the form works
|
|
117
|
+
* on the fields {@link RouteDefinition} carries flattened — so it is an interface rather than a class.
|
|
118
|
+
*/
|
|
119
|
+
interface RouteTarget {
|
|
120
|
+
kind: RouteTargetKind;
|
|
121
|
+
/** WIDGETS only. */
|
|
122
|
+
widgets?: WidgetInstance[];
|
|
123
|
+
/** DOCUMENT only. */
|
|
124
|
+
documentSlug?: string;
|
|
125
|
+
/** ENTITY only. */
|
|
126
|
+
entityName?: string;
|
|
127
|
+
/** ENTITY only. */
|
|
128
|
+
entityMode?: EntityMode;
|
|
129
|
+
/** ENTITY + LIST only. */
|
|
130
|
+
rsqlFilter?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* One navigable route. **Flat: a route has no children.** `path` may be multi-segment, so `claims`,
|
|
134
|
+
* `claims/open` and `claims/:id` are three sibling entries rather than a tree — Angular's own nesting
|
|
135
|
+
* is derived from those prefixes when the shell builds its `Routes`, because nesting is a rendering
|
|
136
|
+
* concern rather than something worth authoring. Structure is broken up at the module boundary
|
|
137
|
+
* instead, through {@link ModuleMount}.
|
|
138
|
+
*
|
|
139
|
+
* The `target` fields are flattened onto the row and re-nested by {@link AppDefinitionMapper}; which of
|
|
140
|
+
* them are meaningful follows from {@link kind}, and the backend — not the form — is what enforces it.
|
|
141
|
+
*/
|
|
142
|
+
declare class RouteDefinition implements BaseEntity {
|
|
143
|
+
/**
|
|
144
|
+
* Declared, never assigned. The contract gives a route no `id`: `path` identifies it, which is what
|
|
145
|
+
* a `NavItem.routePath` resolves against. Same reason as {@link RegionDefinition.id}.
|
|
146
|
+
*/
|
|
147
|
+
readonly id?: string;
|
|
148
|
+
/** Relative to the app root, no leading slash. May contain `/` for depth and `:name` for a parameter. */
|
|
149
|
+
path: string;
|
|
150
|
+
title: string;
|
|
151
|
+
translocoId?: string;
|
|
152
|
+
icon?: string;
|
|
153
|
+
/** Empty or absent means any authenticated member of the organization, as on {@link NavItem.roles}. */
|
|
154
|
+
roles?: string[];
|
|
155
|
+
/**
|
|
156
|
+
* Required by the contract, but undefined while a route is being created — the dropdown is declared
|
|
157
|
+
* `required`, so the form is what enforces it before the row reaches the payload.
|
|
158
|
+
*/
|
|
159
|
+
kind: RouteTargetKind | undefined;
|
|
160
|
+
/** WIDGETS only. Starts as an empty array so the embedded list has something to append to. */
|
|
161
|
+
widgets: WidgetInstance[];
|
|
162
|
+
documentSlug?: string;
|
|
163
|
+
entityName?: string;
|
|
164
|
+
entityMode?: EntityMode;
|
|
165
|
+
rsqlFilter?: string;
|
|
166
|
+
/** The object the flattened fields came from, preserved so a save cannot drop a future field. */
|
|
167
|
+
target?: RouteTarget;
|
|
168
|
+
constructor(init?: Partial<RouteDefinition>);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Mounts a module's routes under {@link basePath}. The one place route structure composes, and it
|
|
172
|
+
* composes exactly one level deep: a module cannot mount modules.
|
|
173
|
+
*/
|
|
174
|
+
declare class ModuleMount implements BaseEntity {
|
|
175
|
+
/** `moduleKey` identifies the mount; the contract gives it no `id`. */
|
|
176
|
+
readonly id?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Key of a `ModuleDefinition` in this organization. One naming no existing module is a validation
|
|
179
|
+
* warning, not an error — an app may mount a module before it has been authored.
|
|
180
|
+
*/
|
|
181
|
+
moduleKey: string;
|
|
182
|
+
basePath: string;
|
|
183
|
+
constructor(init?: Partial<ModuleMount>);
|
|
184
|
+
}
|
|
185
|
+
declare class AppDefinition implements BaseEntity {
|
|
186
|
+
/** Unique within the organization and used verbatim as the run-time route segment. */
|
|
187
|
+
id: string;
|
|
188
|
+
name: string;
|
|
189
|
+
translocoId: string | undefined;
|
|
190
|
+
description: string | undefined;
|
|
191
|
+
materialTheme: MaterialTheme | undefined;
|
|
192
|
+
colorScheme: ColorScheme | undefined;
|
|
193
|
+
tokenOverrides: Record<string, string> | undefined;
|
|
194
|
+
logoUrl: string | undefined;
|
|
195
|
+
faviconUrl: string | undefined;
|
|
196
|
+
preset: LayoutPreset | undefined;
|
|
197
|
+
sidenavMode: SidenavMode | undefined;
|
|
198
|
+
sidenavCollapsible: boolean;
|
|
199
|
+
sidenavOpenByDefault: boolean;
|
|
200
|
+
contentMaxWidth: string | undefined;
|
|
201
|
+
/** The objects the flattened fields came from, preserved so a save cannot drop a future field. */
|
|
202
|
+
theme: ThemeDefinition | undefined;
|
|
203
|
+
layout: LayoutDefinition | undefined;
|
|
204
|
+
regions: RegionDefinition[] | undefined;
|
|
205
|
+
routes: RouteDefinition[] | undefined;
|
|
206
|
+
modules: ModuleMount[] | undefined;
|
|
207
|
+
orgKey: string | undefined;
|
|
208
|
+
status: AppDefinitionStatus | undefined;
|
|
209
|
+
version: number | undefined;
|
|
210
|
+
publishedVersion: number | undefined;
|
|
211
|
+
createdAt: string | undefined;
|
|
212
|
+
updatedAt: string | undefined;
|
|
213
|
+
constructor(init?: Partial<AppDefinition>);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Frontend model of the `ModuleDefinition` schema of `base-app-api.yaml`: a lazily-loadable slice of an
|
|
218
|
+
* application, with its own flat route list and its own transloco scope. An {@link ModuleMount} of an
|
|
219
|
+
* `AppDefinition` names one of these by key and mounts its routes under a base path.
|
|
220
|
+
*
|
|
221
|
+
* **What "lazy" honestly means.** A module lazy-loads *metadata* — this definition, its routes, its
|
|
222
|
+
* translations, and the documents and descriptors they name. It does **not** lazy-load widget code:
|
|
223
|
+
* widget components are bundled at compile time and resolved through the frontend registry, so a
|
|
224
|
+
* metadata module cannot split a bundle on its own. The wins are that `AppDefinition` stops being one
|
|
225
|
+
* aggregate that has to be loaded, locked and published atomically, and that a module is the unit of
|
|
226
|
+
* authoring permission and versioning. Nothing here should be justified on bundle size.
|
|
227
|
+
*
|
|
228
|
+
* Unlike the region / route / mount classes this one is a **routable** entity: it has endpoints of its
|
|
229
|
+
* own, so it comes with a service, a store and a facade rather than travelling inside another payload.
|
|
230
|
+
*/
|
|
231
|
+
declare class ModuleDefinition implements BaseEntity {
|
|
232
|
+
/**
|
|
233
|
+
* The contract calls this field `key`; base-entity keys every store, URL and reference on `id`, so
|
|
234
|
+
* {@link ModuleDefinitionMapper} renames it on the way in and out rather than teaching the framework a
|
|
235
|
+
* second identity field. One name for one thing on this side of the mapper — a `key` property beside
|
|
236
|
+
* `id` could only ever disagree with it.
|
|
237
|
+
*
|
|
238
|
+
* Immutable by contract: `ModuleMount.moduleKey` resolves against it, and a rename would silently
|
|
239
|
+
* unmount the module from every app that mounts it.
|
|
240
|
+
*/
|
|
241
|
+
id: string;
|
|
242
|
+
name: string;
|
|
243
|
+
translocoId: string | undefined;
|
|
244
|
+
description: string | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Transloco scope the module's translations load under. Absent means {@link id}, which is the default
|
|
247
|
+
* the contract states; {@link moduleTranslocoScope} is the one place that default is applied.
|
|
248
|
+
*/
|
|
249
|
+
translocoScope: string | undefined;
|
|
250
|
+
/**
|
|
251
|
+
* The module's routes, flat and relative to the base path it is mounted at — the same shape and the
|
|
252
|
+
* same derived nesting as `AppDefinition.routes`, and flattened by the same mapper. A module does not
|
|
253
|
+
* mount modules: this is where composition stops.
|
|
254
|
+
*/
|
|
255
|
+
routes: RouteDefinition[] | undefined;
|
|
256
|
+
orgKey: string | undefined;
|
|
257
|
+
version: number | undefined;
|
|
258
|
+
createdAt: string | undefined;
|
|
259
|
+
updatedAt: string | undefined;
|
|
260
|
+
constructor(init?: Partial<ModuleDefinition>);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The scope a module's translations load under, applying the contract's default. Kept as a function
|
|
264
|
+
* rather than resolved in the mapper, so a definition never carries a `translocoScope` the designer did
|
|
265
|
+
* not author — the field stays empty in the form, and the fallback is a rendering decision.
|
|
266
|
+
*/
|
|
267
|
+
declare function moduleTranslocoScope(definition: ModuleDefinition): string;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Transloco scope of this library. The translations live in
|
|
271
|
+
* `libs/js-shared/base-app-frontend/src/assets/i18n/base_app/*.json` and are published with the
|
|
272
|
+
* package; a consuming application copies them to `assets/i18n/base_app` (see the testbed's
|
|
273
|
+
* `project.json`). The scope is registered on {@link BASE_APP_ROUTES}, so it loads lazily with the
|
|
274
|
+
* route rather than with the application shell.
|
|
275
|
+
*
|
|
276
|
+
* The alias is spelled out on purpose: transloco camel-cases the default alias, which would turn
|
|
277
|
+
* `base_app` into `baseApp` and silently miss every key below.
|
|
278
|
+
*/
|
|
279
|
+
declare const BASE_APP_TRANSLOCO_SCOPE = "base_app";
|
|
280
|
+
/** Key root of the `AppDefinition` entity name (`._self`) and of its attribute labels. */
|
|
281
|
+
declare const APP_DEFINITION_I18N_SCOPE = "base_app.app_definition";
|
|
282
|
+
/**
|
|
283
|
+
* Label of the Preview tab. Under this library's own scope rather than `base_entity.tabs.*`: the generic
|
|
284
|
+
* tabs are List and Details, and an application preview is this feature's contribution, not the framework's.
|
|
285
|
+
* Resolved with `{ entity }` like the generic tab labels, so a translation may name the entity if it reads
|
|
286
|
+
* better that way.
|
|
287
|
+
*/
|
|
288
|
+
declare const APP_PREVIEW_I18N_KEY = "base_app.app_definition.tabs.preview";
|
|
289
|
+
/**
|
|
290
|
+
* Key root of the `ModuleDefinition` entity name and attribute labels. A child of this library's scope
|
|
291
|
+
* like the one above, and not to be confused with `ModuleDefinition.translocoScope`, which is a scope an
|
|
292
|
+
* *authored* module's own translations load under — see {@link moduleTranslocoScope}. These keys are the
|
|
293
|
+
* framework's labels for the authoring form; that one is the tenant's content.
|
|
294
|
+
*/
|
|
295
|
+
declare const MODULE_DEFINITION_I18N_SCOPE = "base_app.module_definition";
|
|
296
|
+
/**
|
|
297
|
+
* Key roots of the nested definitions the `AppDefinition` form contains through `EMBEDDED_COMPONENTS`
|
|
298
|
+
* controls. They are children of {@link BASE_APP_TRANSLOCO_SCOPE} rather than scopes of their own,
|
|
299
|
+
* because the whole graph is edited under `BASE_APP_ROUTES` and one scope registration has to cover
|
|
300
|
+
* all of it — the embedded route branches add none.
|
|
301
|
+
*/
|
|
302
|
+
declare const APP_REGION_I18N_SCOPE = "base_app.app_region";
|
|
303
|
+
declare const APP_ROUTE_I18N_SCOPE = "base_app.app_route";
|
|
304
|
+
declare const APP_MODULE_MOUNT_I18N_SCOPE = "base_app.app_module_mount";
|
|
305
|
+
declare const APP_NAV_ITEM_I18N_SCOPE = "base_app.app_nav_item";
|
|
306
|
+
declare const APP_WIDGET_I18N_SCOPE = "base_app.app_widget";
|
|
307
|
+
/**
|
|
308
|
+
* Where this library's transloco bundles come from when the application ships without its assets.
|
|
309
|
+
*
|
|
310
|
+
* Spread into the application's `TRANSLATION_SOURCE_REGISTRY`, the way its facades are spread into
|
|
311
|
+
* `BASE_ENTITY_FACADE_REGISTRY`. The scopes below normally arrive as static files — the build copies
|
|
312
|
+
* them into `assets/i18n/<scope>` and the loader tries the asset first — so this is reached only by a
|
|
313
|
+
* host that skips that copy step. It is declared here rather than in the application because which
|
|
314
|
+
* backend owns a scope is base-app's knowledge, not its caller's.
|
|
315
|
+
*/
|
|
316
|
+
declare const BASE_APP_TRANSLATION_SOURCE: TranslationSource;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Entity names of the app-definition graph, kept in one dependency-free module.
|
|
320
|
+
*
|
|
321
|
+
* They live here rather than next to their descriptors because the graph is cyclic: `App Definition`
|
|
322
|
+
* aggregates `App Region`, and `App Region` names `App Definition` as its `componentParent`. Each
|
|
323
|
+
* descriptor module re-exports its own name, so importers are unaffected.
|
|
324
|
+
*/
|
|
325
|
+
declare const APP_DEFINITION_ENTITY_NAME = "App Definition";
|
|
326
|
+
/**
|
|
327
|
+
* A second aggregate root beside `App Definition`, not a part of it — hence no `App` prefix, which in
|
|
328
|
+
* every other name here marks something the app document carries. `App Module Mount` is the row inside
|
|
329
|
+
* an app that *names* one of these.
|
|
330
|
+
*/
|
|
331
|
+
declare const MODULE_DEFINITION_ENTITY_NAME = "Module Definition";
|
|
332
|
+
declare const APP_MODULE_MOUNT_ENTITY_NAME = "App Module Mount";
|
|
333
|
+
declare const APP_NAV_ITEM_ENTITY_NAME = "App Nav Item";
|
|
334
|
+
declare const APP_REGION_ENTITY_NAME = "App Region";
|
|
335
|
+
declare const APP_ROUTE_ENTITY_NAME = "App Route";
|
|
336
|
+
declare const APP_WIDGET_ENTITY_NAME = "App Widget";
|
|
337
|
+
|
|
338
|
+
declare function createAppDefinitionDescriptor(): BaseEntityDescriptor;
|
|
339
|
+
|
|
340
|
+
/** `ModuleMount` has no `id` — an app mounts a given module once, so `moduleKey` identifies the row. */
|
|
341
|
+
declare const APP_MODULE_MOUNT_ID_FIELD = "moduleKey";
|
|
342
|
+
declare function createModuleMountDescriptor(): BaseEntityDescriptor;
|
|
343
|
+
|
|
344
|
+
declare function createNavItemDescriptor(): BaseEntityDescriptor;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* `RegionDefinition` has no `id` — a region is identified by the shell slot it fills, and an app
|
|
348
|
+
* declares each slot at most once. Referencing attributes therefore have to set
|
|
349
|
+
* `referenceIdField = 'type'`; see the `regions` attribute of the `AppDefinition` descriptor.
|
|
350
|
+
*/
|
|
351
|
+
declare const APP_REGION_ID_FIELD = "type";
|
|
352
|
+
declare function createRegionDefinitionDescriptor(): BaseEntityDescriptor;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* `RouteDefinition` has no `id` — `path` identifies a route, and it is what a `NavItem.routePath`
|
|
356
|
+
* resolves against. Referencing attributes therefore have to set `referenceIdField = 'path'`; see the
|
|
357
|
+
* `routePath` attribute of the `App Nav Item` descriptor.
|
|
358
|
+
*
|
|
359
|
+
* Unlike `App Region`'s `type`, this value may contain `/`, so the authoring URL that addresses one row
|
|
360
|
+
* carries it percent-encoded (`app-route/claims%2Fopen/details`). Angular round-trips that, but a
|
|
361
|
+
* reverse proxy that normalizes `%2F` before the SPA sees it would not — worth an e2e case once
|
|
362
|
+
* multi-segment routes are authored in the testbed.
|
|
363
|
+
*/
|
|
364
|
+
declare const APP_ROUTE_ID_FIELD = "path";
|
|
365
|
+
declare function createRouteDefinitionDescriptor(): BaseEntityDescriptor;
|
|
366
|
+
|
|
367
|
+
declare function createWidgetInstanceDescriptor(): BaseEntityDescriptor;
|
|
368
|
+
|
|
369
|
+
declare function createModuleDefinitionDescriptor(): BaseEntityDescriptor;
|
|
370
|
+
|
|
371
|
+
/** The `RouteDefinition` schema as it travels: `target` nested, exactly as the contract declares it. */
|
|
372
|
+
interface RouteDefinitionDto {
|
|
373
|
+
path?: string;
|
|
374
|
+
title?: string;
|
|
375
|
+
translocoId?: string;
|
|
376
|
+
icon?: string;
|
|
377
|
+
roles?: string[];
|
|
378
|
+
target?: RouteTarget;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
interface AppDefinitionDto {
|
|
382
|
+
id?: string;
|
|
383
|
+
name?: string;
|
|
384
|
+
translocoId?: string;
|
|
385
|
+
description?: string;
|
|
386
|
+
theme?: ThemeDefinition;
|
|
387
|
+
layout?: LayoutDefinition;
|
|
388
|
+
regions?: AppDefinition['regions'];
|
|
389
|
+
routes?: RouteDefinitionDto[];
|
|
390
|
+
modules?: AppDefinition['modules'];
|
|
391
|
+
orgKey?: string;
|
|
392
|
+
status?: AppDefinitionStatus;
|
|
393
|
+
version?: number;
|
|
394
|
+
publishedVersion?: number;
|
|
395
|
+
createdAt?: string;
|
|
396
|
+
updatedAt?: string;
|
|
397
|
+
}
|
|
398
|
+
/** What `PUT /app-definitions/{appId}` receives: the DTO with `theme` and `layout` always rebuilt. */
|
|
399
|
+
type AppDefinitionPayload = AppDefinitionDto & {
|
|
400
|
+
theme: ThemeDefinition;
|
|
401
|
+
layout: LayoutDefinition;
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Translates between the `AppDefinition` DTO of `base-app-api.yaml` and the flat entity the
|
|
405
|
+
* generated form works with.
|
|
406
|
+
*
|
|
407
|
+
* Two invariants matter here. The form saves `{ ...entity, ...form.value }`, so every DTO field the
|
|
408
|
+
* form does not show has to survive on the entity — `regions`, `routes` and `modules` are nested
|
|
409
|
+
* rather than flattened for exactly that reason, and the `EMBEDDED_COMPONENTS` controls edit them in
|
|
410
|
+
* place. And `PUT /app-definitions/{appId}` is a full replacement, so {@link toDto} rebuilds `theme`
|
|
411
|
+
* and `layout` from the flattened controls *on top of* the objects they were lifted out of, which
|
|
412
|
+
* keeps any field a later contract version adds before this mapper learns about it.
|
|
413
|
+
*
|
|
414
|
+
* A route's `target` is the third thing flattened, one level deeper: `regions` and `modules` rows
|
|
415
|
+
* travel as the raw DTO they arrived as, but a route row cannot. That flattening lives in
|
|
416
|
+
* `route-definition.mapper.ts` rather than here, because `ModuleDefinition.routes` carries the same
|
|
417
|
+
* schema and a route authored in a module has to behave exactly like one authored in an app.
|
|
418
|
+
*/
|
|
419
|
+
declare class AppDefinitionMapper implements BaseEntityMapper<AppDefinition> {
|
|
420
|
+
fromDto(dto: unknown): AppDefinition;
|
|
421
|
+
toDto(entity: AppDefinition): AppDefinitionPayload;
|
|
422
|
+
private mergeTheme;
|
|
423
|
+
private mergeLayout;
|
|
424
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppDefinitionMapper, never>;
|
|
425
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AppDefinitionMapper>;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* REST access to `/organizations/{orgKey}/app-definitions`. As in base-rule, the organization is
|
|
430
|
+
* part of the configured service root — `APP_SERVICE_ROOT`, the optional per-feature escape hatch,
|
|
431
|
+
* falling back to `BACKEND_SERVICE_ROOT`, which is what every deployment actually sets — so the
|
|
432
|
+
* tenant is a deployment concern rather than something every call has to carry.
|
|
433
|
+
*/
|
|
434
|
+
declare class AppDefinitionService extends BaseEntityRestService<AppDefinition> {
|
|
435
|
+
protected entityMapper: AppDefinitionMapper;
|
|
436
|
+
constructor(entityMapper: AppDefinitionMapper);
|
|
437
|
+
/**
|
|
438
|
+
* `POST /app-definitions/{appId}/publish` — promotes the stored `version` to `publishedVersion` and
|
|
439
|
+
* sets the status to `PUBLISHED`. The backend validates the definition first and answers 400 when it
|
|
440
|
+
* is not publishable, so the caller only has to deal with the happy path and the error.
|
|
441
|
+
*/
|
|
442
|
+
publish(id: string): Observable<PersistedEntity<AppDefinition>>;
|
|
443
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppDefinitionService, never>;
|
|
444
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AppDefinitionService>;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
declare const AppDefinitionStore: _angular_core.Type<{
|
|
448
|
+
entities: _angular_core.Signal<AppDefinition[]>;
|
|
449
|
+
number: _angular_core.Signal<number>;
|
|
450
|
+
size: _angular_core.Signal<number>;
|
|
451
|
+
totalElements: _angular_core.Signal<number>;
|
|
452
|
+
totalPages: _angular_core.Signal<number>;
|
|
453
|
+
currentId: _angular_core.Signal<string | undefined>;
|
|
454
|
+
currentEntity: _angular_core.Signal<AppDefinition | undefined>;
|
|
455
|
+
isLoading: _angular_core.Signal<boolean>;
|
|
456
|
+
error: _angular_core.Signal<string | undefined>;
|
|
457
|
+
selectedEntities: _angular_core.Signal<AppDefinition[]>;
|
|
458
|
+
activeTabs: _angular_core.Signal<string[]>;
|
|
459
|
+
currentTab: _angular_core.Signal<string | undefined>;
|
|
460
|
+
filterKey: _angular_core.Signal<string | undefined>;
|
|
461
|
+
countOfEntities: _angular_core.Signal<number>;
|
|
462
|
+
matTableDataSource: _angular_core.Signal<_angular_material_table.MatTableDataSource<AppDefinition, _angular_material_paginator.MatPaginator>>;
|
|
463
|
+
clearCurrentEntity: () => void;
|
|
464
|
+
createEntity: () => AppDefinition;
|
|
465
|
+
add: (entity: AppDefinition) => Promise<PersistedEntity<AppDefinition> | undefined>;
|
|
466
|
+
delete: (id: string) => Promise<void>;
|
|
467
|
+
deleteAll: _ngrx_signals_rxjs_interop.RxMethod<void>;
|
|
468
|
+
deselectAll: () => void;
|
|
469
|
+
deselectEntity: (id: string) => void;
|
|
470
|
+
load: _ngrx_signals_rxjs_interop.RxMethod<_processpuzzle_base_entity.BaseEntityQueryCondition>;
|
|
471
|
+
loadById: (id: string) => AppDefinition | undefined;
|
|
472
|
+
resetErrorState: () => void;
|
|
473
|
+
selectEntity: (id: string) => void;
|
|
474
|
+
setCurrentEntity: (id: string | undefined) => void;
|
|
475
|
+
update: (entity: PersistedEntity<AppDefinition>) => Promise<PersistedEntity<AppDefinition> | undefined>;
|
|
476
|
+
reset: () => void;
|
|
477
|
+
tabIsActive: (tabName: string) => void;
|
|
478
|
+
tabIsInactive: (tabName: string) => void;
|
|
479
|
+
doFilter: (filterKey: string) => void;
|
|
480
|
+
publish: (id: string) => Promise<PersistedEntity<AppDefinition> | undefined>;
|
|
481
|
+
} & _ngrx_signals.StateSource<{
|
|
482
|
+
entities: AppDefinition[];
|
|
483
|
+
number: number;
|
|
484
|
+
size: number;
|
|
485
|
+
totalElements: number;
|
|
486
|
+
totalPages: number;
|
|
487
|
+
currentId: string | undefined;
|
|
488
|
+
currentEntity: AppDefinition | undefined;
|
|
489
|
+
isLoading: boolean;
|
|
490
|
+
error: string | undefined;
|
|
491
|
+
selectedEntities: AppDefinition[];
|
|
492
|
+
activeTabs: string[];
|
|
493
|
+
currentTab: string | undefined;
|
|
494
|
+
filterKey: string | undefined;
|
|
495
|
+
}>>;
|
|
496
|
+
|
|
497
|
+
interface ModuleDefinitionDto {
|
|
498
|
+
key?: string;
|
|
499
|
+
name?: string;
|
|
500
|
+
translocoId?: string;
|
|
501
|
+
description?: string;
|
|
502
|
+
translocoScope?: string;
|
|
503
|
+
routes?: RouteDefinitionDto[];
|
|
504
|
+
orgKey?: string;
|
|
505
|
+
version?: number;
|
|
506
|
+
createdAt?: string;
|
|
507
|
+
updatedAt?: string;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Translates between the `ModuleDefinition` DTO of `base-app-api.yaml` and the entity the generated form
|
|
511
|
+
* works with. Two renamings, and nothing else — a module is a much smaller aggregate than an app:
|
|
512
|
+
*
|
|
513
|
+
* - **`key` becomes `id`.** base-entity keys every store, URL and reference on `id`, so the rename
|
|
514
|
+
* happens here rather than in the framework. See {@link ModuleDefinition.id}.
|
|
515
|
+
* - **each route's `target` is flattened** onto the row and re-nested on save, by the same functions
|
|
516
|
+
* `AppDefinitionMapper` uses, so a route authored in a module behaves like one authored in an app.
|
|
517
|
+
*/
|
|
518
|
+
declare class ModuleDefinitionMapper implements BaseEntityMapper<ModuleDefinition> {
|
|
519
|
+
fromDto(dto: unknown): ModuleDefinition;
|
|
520
|
+
toDto(entity: ModuleDefinition): ModuleDefinitionDto;
|
|
521
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ModuleDefinitionMapper, never>;
|
|
522
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ModuleDefinitionMapper>;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* REST access to `/organizations/{orgKey}/modules`. As for `AppDefinitionService`, the organization is
|
|
527
|
+
* part of the configured service root (`APP_SERVICE_ROOT`, falling back to `BACKEND_SERVICE_ROOT`), so
|
|
528
|
+
* the tenant is a deployment concern rather
|
|
529
|
+
* than something every call has to carry.
|
|
530
|
+
*
|
|
531
|
+
* The URL variable is the module key — `ModuleDefinitionMapper` maps it onto `id`, which is what the
|
|
532
|
+
* inherited `findById` builds `GET .../modules/{moduleKey}` from. That single-module read is also the call
|
|
533
|
+
* the shell makes when something first navigates under a mount; see `ModuleLoader` in
|
|
534
|
+
* `app-route-builder.ts`.
|
|
535
|
+
*/
|
|
536
|
+
declare class ModuleDefinitionService extends BaseEntityRestService<ModuleDefinition> {
|
|
537
|
+
protected entityMapper: ModuleDefinitionMapper;
|
|
538
|
+
constructor(entityMapper: ModuleDefinitionMapper);
|
|
539
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ModuleDefinitionService, never>;
|
|
540
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ModuleDefinitionService>;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Plain generic CRUD — a module has no `publish` of its own. Publishing is an `AppDefinition` operation:
|
|
545
|
+
* an app is what a user navigates to, and its status is what decides whether a mount is live. Giving a
|
|
546
|
+
* module a second, independent lifecycle would make "which version of what is live" a question with two
|
|
547
|
+
* answers.
|
|
548
|
+
*/
|
|
549
|
+
declare const ModuleDefinitionStore: _angular_core.Type<{
|
|
550
|
+
entities: _angular_core.Signal<ModuleDefinition[]>;
|
|
551
|
+
number: _angular_core.Signal<number>;
|
|
552
|
+
size: _angular_core.Signal<number>;
|
|
553
|
+
totalElements: _angular_core.Signal<number>;
|
|
554
|
+
totalPages: _angular_core.Signal<number>;
|
|
555
|
+
currentId: _angular_core.Signal<string | undefined>;
|
|
556
|
+
currentEntity: _angular_core.Signal<ModuleDefinition | undefined>;
|
|
557
|
+
isLoading: _angular_core.Signal<boolean>;
|
|
558
|
+
error: _angular_core.Signal<string | undefined>;
|
|
559
|
+
selectedEntities: _angular_core.Signal<ModuleDefinition[]>;
|
|
560
|
+
activeTabs: _angular_core.Signal<string[]>;
|
|
561
|
+
currentTab: _angular_core.Signal<string | undefined>;
|
|
562
|
+
filterKey: _angular_core.Signal<string | undefined>;
|
|
563
|
+
countOfEntities: _angular_core.Signal<number>;
|
|
564
|
+
matTableDataSource: _angular_core.Signal<_angular_material_table.MatTableDataSource<ModuleDefinition, _angular_material_paginator.MatPaginator>>;
|
|
565
|
+
clearCurrentEntity: () => void;
|
|
566
|
+
createEntity: () => ModuleDefinition;
|
|
567
|
+
add: (entity: ModuleDefinition) => Promise<_processpuzzle_base_entity.PersistedEntity<ModuleDefinition> | undefined>;
|
|
568
|
+
delete: (id: string) => Promise<void>;
|
|
569
|
+
deleteAll: _ngrx_signals_rxjs_interop.RxMethod<void>;
|
|
570
|
+
deselectAll: () => void;
|
|
571
|
+
deselectEntity: (id: string) => void;
|
|
572
|
+
load: _ngrx_signals_rxjs_interop.RxMethod<_processpuzzle_base_entity.BaseEntityQueryCondition>;
|
|
573
|
+
loadById: (id: string) => ModuleDefinition | undefined;
|
|
574
|
+
resetErrorState: () => void;
|
|
575
|
+
selectEntity: (id: string) => void;
|
|
576
|
+
setCurrentEntity: (id: string | undefined) => void;
|
|
577
|
+
update: (entity: _processpuzzle_base_entity.PersistedEntity<ModuleDefinition>) => Promise<_processpuzzle_base_entity.PersistedEntity<ModuleDefinition> | undefined>;
|
|
578
|
+
reset: () => void;
|
|
579
|
+
tabIsActive: (tabName: string) => void;
|
|
580
|
+
tabIsInactive: (tabName: string) => void;
|
|
581
|
+
doFilter: (filterKey: string) => void;
|
|
582
|
+
} & _ngrx_signals.StateSource<{
|
|
583
|
+
entities: ModuleDefinition[];
|
|
584
|
+
number: number;
|
|
585
|
+
size: number;
|
|
586
|
+
totalElements: number;
|
|
587
|
+
totalPages: number;
|
|
588
|
+
currentId: string | undefined;
|
|
589
|
+
currentEntity: ModuleDefinition | undefined;
|
|
590
|
+
isLoading: boolean;
|
|
591
|
+
error: string | undefined;
|
|
592
|
+
selectedEntities: ModuleDefinition[];
|
|
593
|
+
activeTabs: string[];
|
|
594
|
+
currentTab: string | undefined;
|
|
595
|
+
filterKey: string | undefined;
|
|
596
|
+
}>>;
|
|
597
|
+
|
|
598
|
+
declare class AppDefinitionFacade extends BaseEntityFacade<AppDefinition> {
|
|
599
|
+
readonly entityType: typeof AppDefinition;
|
|
600
|
+
private readonly mapperRef;
|
|
601
|
+
private readonly serviceRef;
|
|
602
|
+
protected createMapper(): AppDefinitionMapper;
|
|
603
|
+
protected createService(): AppDefinitionService;
|
|
604
|
+
protected createStoreClass(): Type<unknown>;
|
|
605
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
606
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppDefinitionFacade, never>;
|
|
607
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AppDefinitionFacade>;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
declare class ModuleDefinitionFacade extends BaseEntityFacade<ModuleDefinition> {
|
|
611
|
+
readonly entityType: typeof ModuleDefinition;
|
|
612
|
+
private readonly mapperRef;
|
|
613
|
+
private readonly serviceRef;
|
|
614
|
+
protected createMapper(): ModuleDefinitionMapper;
|
|
615
|
+
protected createService(): ModuleDefinitionService;
|
|
616
|
+
protected createStoreClass(): Type<unknown>;
|
|
617
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
618
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ModuleDefinitionFacade, never>;
|
|
619
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ModuleDefinitionFacade>;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* A mount is a row of the `App Definition` document, so it is edited through that document — unlike the
|
|
624
|
+
* `ModuleDefinition` it names, which is an aggregate of its own with its own endpoints.
|
|
625
|
+
*/
|
|
626
|
+
declare class AppModuleMountFacade extends EmbeddedEntityFacade<ModuleMount> {
|
|
627
|
+
readonly entityType: typeof ModuleMount;
|
|
628
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
629
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppModuleMountFacade, never>;
|
|
630
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AppModuleMountFacade>;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* One facade covers every level of the nav tree, however deep: the store is a root singleton and the row
|
|
635
|
+
* it stands for comes from the route, so `app-nav-item/a/details/app-nav-item/b/details` resolves through
|
|
636
|
+
* the same facade as the top level.
|
|
637
|
+
*/
|
|
638
|
+
declare class AppNavItemFacade extends EmbeddedEntityFacade<NavItem> {
|
|
639
|
+
readonly entityType: typeof NavItem;
|
|
640
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
641
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppNavItemFacade, never>;
|
|
642
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AppNavItemFacade>;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* What the run-time shell registers routes from. `routes` and `modules` are the app definition's own
|
|
647
|
+
* fields; the other two are how the routes of a mounted module get in.
|
|
648
|
+
*
|
|
649
|
+
* `moduleRoutes` holds the modules the shell already has, keyed by module key. `loadModule` is for the
|
|
650
|
+
* ones it does not: a mount whose key is absent from `moduleRoutes` becomes a `loadChildren` that calls
|
|
651
|
+
* it on first navigation into the mount. With neither, such a mount contributes nothing — a mount naming
|
|
652
|
+
* a module that has not been authored is a warning rather than an error.
|
|
653
|
+
*
|
|
654
|
+
* A key present in `moduleRoutes` is never loaded again, so an empty array there says "this module has no
|
|
655
|
+
* routes" and is honoured as such.
|
|
656
|
+
*/
|
|
657
|
+
interface AppRouteSource {
|
|
658
|
+
routes?: RouteDefinition[];
|
|
659
|
+
modules?: ModuleMount[];
|
|
660
|
+
moduleRoutes?: Record<string, RouteDefinition[] | undefined>;
|
|
661
|
+
loadModule?: ModuleLoader;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Fetches one module by key, or resolves to `undefined` if the organization has no such module. Rejecting
|
|
665
|
+
* is a navigation error; resolving to `undefined` is the loose coupling the contract asks for.
|
|
666
|
+
*/
|
|
667
|
+
type ModuleLoader = (moduleKey: string) => Promise<ModuleDefinition | undefined>;
|
|
668
|
+
/**
|
|
669
|
+
* Turns one authored route into the `Route` that renders it — component or `loadComponent`, `title`,
|
|
670
|
+
* `data`, and any `canMatch` guard the definition's `roles` call for. `path` is {@link buildAppRoutes}'
|
|
671
|
+
* to set; `children` it may contribute, and the authored ones are appended to them.
|
|
672
|
+
*
|
|
673
|
+
* May be asynchronous. An `ENTITY` route's screens are built from a `BaseEntityDescriptor` that has to be
|
|
674
|
+
* *fetched* when the entity exists only as metadata, and the routes below it depend on what that
|
|
675
|
+
* descriptor turns out to contain — which embedded children it carries. Making the renderer async is what
|
|
676
|
+
* lets a route be emitted complete or not at all; the alternative, a guard that fills `children` in on the
|
|
677
|
+
* way past, has no way to signal failure other than leaving the route matching nothing.
|
|
678
|
+
*/
|
|
679
|
+
type RouteRenderer = (definition: RouteDefinition) => Route | Promise<Route>;
|
|
680
|
+
/**
|
|
681
|
+
* Derives Angular's nested `Routes` from the flat route list of an `AppDefinition`.
|
|
682
|
+
*
|
|
683
|
+
* Nesting is computed here rather than authored, which is the whole point of keeping
|
|
684
|
+
* {@link RouteDefinition} flat: `claims`, `claims/open` and `claims/:id` are three sibling rows a
|
|
685
|
+
* designer can reorder, rename and reason about one at a time, and it is only at registration that
|
|
686
|
+
* they become a parent with two children. Two rules produce that shape:
|
|
687
|
+
*
|
|
688
|
+
* - **An authored route that is a prefix of others becomes their parent.** So `claims` stays mounted
|
|
689
|
+
* while `claims/open` renders in its `<router-outlet>` — which is the one thing a flat registration
|
|
690
|
+
* could not express, and the reason this function exists at all. A component rendering a route that
|
|
691
|
+
* has children therefore has to host an outlet.
|
|
692
|
+
* - **A prefix nothing authored stays part of the path.** With only `claims/open` and `claims/closed`
|
|
693
|
+
* declared, no synthetic `claims` parent is invented: the two are emitted with their full paths, since
|
|
694
|
+
* a component-less grouping node would change nothing about what matches or what renders.
|
|
695
|
+
*
|
|
696
|
+
* Modules mount as a parent of their own at {@link ModuleMount.basePath}, component-less because a mount
|
|
697
|
+
* is a prefix rather than a screen. That is the single composition point, and it composes one level: the
|
|
698
|
+
* routes of a mounted module are built by the same two rules, and a module mounts no modules. A module the
|
|
699
|
+
* shell already has is emitted now; one it has not is emitted as `loadChildren` — see {@link lazyMount}.
|
|
700
|
+
*
|
|
701
|
+
* Siblings are ordered static-prefix-first, so `claims/new` is matched before `claims/:id` rather than
|
|
702
|
+
* swallowed by it. Beyond that the authored order is kept, and a duplicate path — which the backend
|
|
703
|
+
* rejects as an error, so it should never arrive — keeps its first occurrence.
|
|
704
|
+
*/
|
|
705
|
+
declare function buildAppRoutes(source: AppRouteSource, renderRoute: RouteRenderer): Promise<Routes>;
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* The `RouteRenderer` {@link buildAppRoutes} needs — turns one authored `RouteDefinition` into the
|
|
709
|
+
* `Route` that actually renders it. Owns `component`, `data` and any `children` the kind calls for; `path`
|
|
710
|
+
* is `buildAppRoutes`' to set, and the routes authored *below* this one are appended to whatever children
|
|
711
|
+
* this contributes.
|
|
712
|
+
*
|
|
713
|
+
* A separate injectable rather than a free function because it is the one piece Preview and the eventual
|
|
714
|
+
* production shell must call identically — same reasoning as `buildAppRoutes` itself being free of any
|
|
715
|
+
* component.
|
|
716
|
+
*
|
|
717
|
+
* `roles` -> `canMatch` is deliberately not set here yet — see the note on this design's own deferral of
|
|
718
|
+
* that question. `kind: DOCUMENT` is deliberately unhandled too: `BaseDocumentContainerComponent` is an
|
|
719
|
+
* authoring component wired to one document via an injected store, not something parameterizable by a
|
|
720
|
+
* route's `documentSlug` at runtime. Rendering a document read-only inside a live app is its own small
|
|
721
|
+
* design question and this falls through to {@link RouteUnsupportedComponent} rather than guessing.
|
|
722
|
+
*/
|
|
723
|
+
declare class AppRouteRenderer {
|
|
724
|
+
private readonly entityScreens;
|
|
725
|
+
render: (definition: RouteDefinition) => Promise<Route>;
|
|
726
|
+
/**
|
|
727
|
+
* An `ENTITY` route: base-entity's generated screens, mounted at the authored path.
|
|
728
|
+
*
|
|
729
|
+
* Both halves belong to base-entity and are called rather than reimplemented here: `EntityScreenResolver`
|
|
730
|
+
* answers for an entity with a compile-time facade and for one that exists only as a `BaseEntityDefinition`
|
|
731
|
+
* alike, and `entityScreenRoute` owns the URL shape those screens need. What is left is exactly the
|
|
732
|
+
* *application definition* concern — when the routes are built, the authored title, and the authored
|
|
733
|
+
* `entityMode` / `rsqlFilter`.
|
|
734
|
+
*
|
|
735
|
+
* The descriptor is resolved **before** the route exists, which is what makes the route either complete or
|
|
736
|
+
* a leaf. An entity nothing answers to keeps the leaf, whose component says so at the URL the nav item
|
|
737
|
+
* links to; a legitimate state, since an `AppDefinition` may name an entity that has been renamed or one
|
|
738
|
+
* whose definitions this deployment's backend does not serve.
|
|
739
|
+
*
|
|
740
|
+
* `entityMode` is passed along but not applied. A `DETAILS` route lands on the list, from which the row is
|
|
741
|
+
* one click away: making it open a form directly means carrying the authored route's own `:id` into the
|
|
742
|
+
* child URL, and the `RedirectFunction` that would do it receives a *partial* route snapshot whose
|
|
743
|
+
* parameter inheritance at recognition time is not something to bet a navigation on. Deferred with `roles`
|
|
744
|
+
* and `rsqlFilter` rather than guessed at.
|
|
745
|
+
*/
|
|
746
|
+
private entityRoute;
|
|
747
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppRouteRenderer, never>;
|
|
748
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AppRouteRenderer>;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Renders a route whose kind is WIDGETS: every STANDALONE instance in order, via NgComponentOutlet
|
|
753
|
+
* resolved against WIDGET_REGISTRY. REFERENCED instances are skipped here for the same reason
|
|
754
|
+
* DocumentEditorComponent skips them at its top level — they're placed by whichever STANDALONE
|
|
755
|
+
* container widget names them in props.childIds, not by this component.
|
|
756
|
+
*
|
|
757
|
+
* Delegates the common widget rendering rule to WidgetListComponent, which is also used by the
|
|
758
|
+
* header and footer regions in the application preview.
|
|
759
|
+
*/
|
|
760
|
+
declare class RouteWidgetsComponent {
|
|
761
|
+
private readonly route;
|
|
762
|
+
protected readonly widgets: WidgetInstance[];
|
|
763
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RouteWidgetsComponent, never>;
|
|
764
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RouteWidgetsComponent, "pp-route-widgets", never, {}, {}, never, never, true, never>;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* One widget as it is rendered: the component the registry answered with, or none.
|
|
769
|
+
*
|
|
770
|
+
* Resolved once per definition into a computed rather than by a template method, so the lookup does not
|
|
771
|
+
* re-run on every change detection pass and `ngComponentOutlet` is not handed a fresh value each time.
|
|
772
|
+
*/
|
|
773
|
+
interface WidgetRow {
|
|
774
|
+
id: string;
|
|
775
|
+
type: string;
|
|
776
|
+
props?: Record<string, unknown>;
|
|
777
|
+
/** Absent when no `provideWidget()` in the hosting application answers `type`. */
|
|
778
|
+
component?: Type<unknown>;
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Renders the top-level widgets shared by routed content and static shell regions.
|
|
782
|
+
*
|
|
783
|
+
* A `WidgetInstance.type` is an open string on the contract and the server checks it for blankness alone —
|
|
784
|
+
* it cannot know which components the hosting application registered. So an unregistered type is a state
|
|
785
|
+
* this component has to render, not one it can rule out: it shows a placeholder naming the type, where
|
|
786
|
+
* throwing would take the whole shell down over one mistyped widget in one region and leave the designer
|
|
787
|
+
* with a blank page instead of a pointer to the row at fault.
|
|
788
|
+
*/
|
|
789
|
+
declare class WidgetListComponent {
|
|
790
|
+
readonly widgets: _angular_core.InputSignal<WidgetInstance[]>;
|
|
791
|
+
/** Optional: an application that registers no widget at all renders every instance as a placeholder. */
|
|
792
|
+
private readonly registry;
|
|
793
|
+
protected readonly rows: _angular_core.Signal<WidgetRow[]>;
|
|
794
|
+
protected explain(type: string): string;
|
|
795
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WidgetListComponent, never>;
|
|
796
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WidgetListComponent, "pp-widget-list", never, { "widgets": { "alias": "widgets"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Fallback rendered by {@link AppRouteRenderer} for a route kind it doesn't yet know how to build a
|
|
801
|
+
* real component for (today: DOCUMENT, and any kind value the frontend doesn't recognize). Exists so
|
|
802
|
+
* an unfinished part of the shell fails visibly and specifically at the one route that hits it,
|
|
803
|
+
* rather than throwing during route registration and taking the whole app down, or — worse — silently
|
|
804
|
+
* rendering nothing and leaving a designer to wonder why their route is blank.
|
|
805
|
+
*
|
|
806
|
+
* Not an error state: an app definition is allowed to reference a route kind the frontend hasn't
|
|
807
|
+
* caught up to yet, same spirit as a NavItem naming a route that hasn't been authored being a warning
|
|
808
|
+
* rather than a validation failure elsewhere in this library.
|
|
809
|
+
*/
|
|
810
|
+
declare class RouteUnsupportedComponent {
|
|
811
|
+
private readonly route;
|
|
812
|
+
protected readonly reason: _angular_core.Signal<string>;
|
|
813
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RouteUnsupportedComponent, never>;
|
|
814
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RouteUnsupportedComponent, "pp-route-unsupported", never, {}, {}, never, never, true, never>;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* A region has a facade like any other entity — that is what gives it a store, and so a working list and
|
|
819
|
+
* form. Its repository reads and writes the `App Definition` document instead of an endpoint of its own,
|
|
820
|
+
* because the contract nests `regions` inside that document.
|
|
821
|
+
*/
|
|
822
|
+
declare class AppRegionFacade extends EmbeddedEntityFacade<RegionDefinition> {
|
|
823
|
+
readonly entityType: typeof RegionDefinition;
|
|
824
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
825
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppRegionFacade, never>;
|
|
826
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AppRegionFacade>;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* `GET .../app-definitions/{appId}/layout` is a read-only projection for the run-time shell, not a write
|
|
831
|
+
* endpoint — a route is authored inside the `App Definition` document, so its store goes through that
|
|
832
|
+
* document like every other embedded child of the graph.
|
|
833
|
+
*/
|
|
834
|
+
declare class AppRouteFacade extends EmbeddedEntityFacade<RouteDefinition> {
|
|
835
|
+
readonly entityType: typeof RouteDefinition;
|
|
836
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
837
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppRouteFacade, never>;
|
|
838
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AppRouteFacade>;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* A widget sits under a region, a page or another widget, and one facade serves all three: which owner's
|
|
843
|
+
* rows its store reads is decided by the route that is open, not by the facade.
|
|
844
|
+
*/
|
|
845
|
+
declare class AppWidgetFacade extends EmbeddedEntityFacade<WidgetInstance> {
|
|
846
|
+
readonly entityType: typeof WidgetInstance;
|
|
847
|
+
protected createDescriptor(): BaseEntityDescriptor;
|
|
848
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppWidgetFacade, never>;
|
|
849
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AppWidgetFacade>;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
declare class AppDefinitionContainerComponent implements OnDestroy {
|
|
853
|
+
private readonly containerComponentRef;
|
|
854
|
+
baseEntityHost: BaseFormHostDirective;
|
|
855
|
+
readonly publishActionsTpl: _angular_core.Signal<TemplateRef<unknown> | undefined>;
|
|
856
|
+
private readonly store;
|
|
857
|
+
readonly entityDescriptor: BaseEntityDescriptor;
|
|
858
|
+
readonly publishButtonKey = "base_app.publish.button";
|
|
859
|
+
readonly publishTooltipKey = "base_app.publish.tooltip";
|
|
860
|
+
/** Only a definition the backend already knows can be promoted, so a not-yet-saved form cannot publish. */
|
|
861
|
+
readonly canPublish: _angular_core.Signal<boolean>;
|
|
862
|
+
constructor();
|
|
863
|
+
ngOnDestroy(): void;
|
|
864
|
+
onPublish(): Promise<void>;
|
|
865
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppDefinitionContainerComponent, never>;
|
|
866
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AppDefinitionContainerComponent, "pp-app-definition-container", never, {}, {}, never, never, true, never>;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* The Preview tab's screen, mounted at `app-definition/<id>/preview` by `BASE_APP_ROUTES` — a sibling of
|
|
871
|
+
* the generic Details form rather than something stacked under it, which is what the `extraTabs` hook on
|
|
872
|
+
* `BaseEntityDescriptor` exists for.
|
|
873
|
+
*
|
|
874
|
+
* A **container and nothing more**: it resolves which definition is being previewed and frames the
|
|
875
|
+
* result. Everything about *how* an application renders belongs to {@link AppShellComponent}, which the
|
|
876
|
+
* standalone runtime host will mount just as this does — so the preview cannot grow behaviour the real
|
|
877
|
+
* shell lacks, which is the only way a preview stays honest.
|
|
878
|
+
*
|
|
879
|
+
* The frame below — rounded, white, and tall enough to look like an application — is the preview's own,
|
|
880
|
+
* not the shell's. In production the shell fills the viewport and none of it applies.
|
|
881
|
+
*/
|
|
882
|
+
declare class AppPreviewComponent implements OnInit {
|
|
883
|
+
/**
|
|
884
|
+
* Bound from the route's `:entityId` param by `withComponentInputBinding()`, the same way
|
|
885
|
+
* `BaseEntityFormComponent` receives it — so a deep link and a reload resolve the same app definition as a
|
|
886
|
+
* click through the tab does.
|
|
887
|
+
*/
|
|
888
|
+
readonly entityId: _angular_core.InputSignal<string>;
|
|
889
|
+
private readonly store;
|
|
890
|
+
protected readonly app: _angular_core.Signal<AppDefinition | undefined>;
|
|
891
|
+
ngOnInit(): void;
|
|
892
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppPreviewComponent, never>;
|
|
893
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AppPreviewComponent, "pp-app-preview-tab", never, { "entityId": { "alias": "entityId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* One region resolved to something renderable: which slot it fills, the component that fills it and
|
|
898
|
+
* the inputs to bind. **Data, not a view** — deliberately the same shape of answer
|
|
899
|
+
* {@link AppRouteRenderer} gives for a route, and for the same reasons: it is assertable from a spec
|
|
900
|
+
* without a `TestBed`, and the shell can bind it declaratively so that editing the definition in the
|
|
901
|
+
* neighbouring form re-renders through ordinary signal propagation.
|
|
902
|
+
*
|
|
903
|
+
* `slot` is where the region *asks* to go. The shell may place it elsewhere — the `top-nav` preset puts
|
|
904
|
+
* the `sidenav` slot's view in the header row — and may override {@link inputs} when it does, which is
|
|
905
|
+
* the second reason this carries inputs rather than a constructed component.
|
|
906
|
+
*/
|
|
907
|
+
interface RegionView {
|
|
908
|
+
slot: RegionType;
|
|
909
|
+
component: Type<unknown>;
|
|
910
|
+
inputs: Record<string, unknown>;
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* Turns one authored `RegionDefinition` into the {@link RegionView} that renders it.
|
|
914
|
+
*
|
|
915
|
+
* An injectable rather than a free function, though stateless today, for the reason `AppRouteRenderer`
|
|
916
|
+
* is one: the Preview tab and the eventual standalone runtime host must resolve regions *identically*,
|
|
917
|
+
* so there has to be exactly one of these, and a constructor parameter is a cheaper way to grow it than
|
|
918
|
+
* a rewrite.
|
|
919
|
+
*/
|
|
920
|
+
declare class AppRegionRenderer {
|
|
921
|
+
render: (region: RegionDefinition, definition: AppDefinition | undefined) => RegionView | undefined;
|
|
922
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppRegionRenderer, never>;
|
|
923
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AppRegionRenderer>;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* The run-time shell of a metadata-defined application: the chrome an `AppDefinition` describes, with a
|
|
928
|
+
* `<router-outlet>` where its routes render.
|
|
929
|
+
*
|
|
930
|
+
* **This is the application, not a picture of one.** `AppPreviewComponent` hosts it so that the Preview
|
|
931
|
+
* tab shows the real thing, and the standalone runtime host will mount the same component — which is
|
|
932
|
+
* the whole point of it being a component with one input rather than something assembled inside the
|
|
933
|
+
* preview. A shell built for the preview would drift from the one built for production, and a preview
|
|
934
|
+
* that drifts is worse than none.
|
|
935
|
+
*
|
|
936
|
+
* Everything is bound declaratively. Regions are resolved to {@link RegionView}s and rendered through
|
|
937
|
+
* `NgComponentOutlet`, never created imperatively, so that a definition edited in the neighbouring
|
|
938
|
+
* details form re-renders through ordinary signal propagation instead of a clear-and-rebuild that would
|
|
939
|
+
* drop scroll position and focus on every keystroke.
|
|
940
|
+
*
|
|
941
|
+
* The whole theme is applied here, not only the brand colours: `--pp-*` overrides as a style binding and
|
|
942
|
+
* the definition's `materialTheme` / `colorScheme` as a class selecting one of the scoped Material themes
|
|
943
|
+
* in `src/theme/pp-material-themes.scss`. Both work because a Material theme is a set of custom
|
|
944
|
+
* properties and nothing else. That file is a **global stylesheet the application registers**; if it is
|
|
945
|
+
* not registered the classes below still land and the shell simply inherits the host's theme. See it for
|
|
946
|
+
* the one thing this cannot reach — CDK overlays, which render outside the shell's subtree.
|
|
947
|
+
*
|
|
948
|
+
* Not yet handled, deliberately: **no routes are registered** under the outlet. That is the nested router
|
|
949
|
+
* context, which needs `EntityTabDescriptor` to be able to carry child routes.
|
|
950
|
+
*/
|
|
951
|
+
declare class AppShellComponent {
|
|
952
|
+
/**
|
|
953
|
+
* The definition to render. Optional rather than required because the shell is mounted before the
|
|
954
|
+
* definition resolves — the preview's store selects the entity in its own `ngOnInit`, and a deep link
|
|
955
|
+
* arrives with nothing loaded — so an empty shell is a state to render, not an error.
|
|
956
|
+
*/
|
|
957
|
+
readonly definition: _angular_core.InputSignal<AppDefinition | undefined>;
|
|
958
|
+
private readonly regionRenderer;
|
|
959
|
+
protected readonly layout: _angular_core.Signal<_processpuzzle_base_app.ResolvedLayout>;
|
|
960
|
+
protected readonly themeVars: _angular_core.Signal<Record<string, string>>;
|
|
961
|
+
protected readonly themeClass: _angular_core.Signal<string>;
|
|
962
|
+
private readonly regionViews;
|
|
963
|
+
protected readonly headerView: _angular_core.Signal<RegionView | undefined>;
|
|
964
|
+
protected readonly footerView: _angular_core.Signal<RegionView | undefined>;
|
|
965
|
+
/**
|
|
966
|
+
* The nav in the sidenav, for the two sidenav presets. Split from {@link topNavView} rather than
|
|
967
|
+
* decided in the template, so each slot is one unambiguous `@if` and the mutual exclusion is stated
|
|
968
|
+
* once, here.
|
|
969
|
+
*/
|
|
970
|
+
protected readonly sidenavView: _angular_core.Signal<RegionView | undefined>;
|
|
971
|
+
/**
|
|
972
|
+
* The same nav relocated into the header row under `top-nav`. It is placed beside the header region
|
|
973
|
+
* rather than inside it, so that a `top-nav` app which declares no header region is still navigable —
|
|
974
|
+
* and so that the shell still never invents a region that was not authored.
|
|
975
|
+
*/
|
|
976
|
+
protected readonly topNavView: _angular_core.Signal<RegionView | undefined>;
|
|
977
|
+
/**
|
|
978
|
+
* The nav view's own inputs with the axis the layout dictates laid over them.
|
|
979
|
+
*
|
|
980
|
+
* Computeds rather than a method called from the template: a method would hand `NgComponentOutlet` a
|
|
981
|
+
* freshly built object on every change-detection pass, so it would re-diff and re-apply the nav's
|
|
982
|
+
* inputs continuously. Memoized, the identity only changes when the definition or the preset does.
|
|
983
|
+
*/
|
|
984
|
+
protected readonly sidenavInputs: _angular_core.Signal<Record<string, unknown>>;
|
|
985
|
+
protected readonly topNavInputs: _angular_core.Signal<Record<string, unknown>>;
|
|
986
|
+
private navInputsOf;
|
|
987
|
+
private viewOf;
|
|
988
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppShellComponent, never>;
|
|
989
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<AppShellComponent, "pp-app-shell", never, { "definition": { "alias": "definition"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Turns one `AppDefinition` into the `Routes` that render its screens — the missing consumer of
|
|
994
|
+
* {@link buildAppRoutes}, which until now produced routes nothing registered.
|
|
995
|
+
*
|
|
996
|
+
* Separate from the guard below so the interesting part is testable without a router: this class answers
|
|
997
|
+
* "what routes does app X have", and the guard is only the two lines that hand them to Angular.
|
|
998
|
+
*/
|
|
999
|
+
declare class AppShellRoutesFactory {
|
|
1000
|
+
private readonly appStore;
|
|
1001
|
+
private readonly appService;
|
|
1002
|
+
private readonly moduleStore;
|
|
1003
|
+
private readonly moduleService;
|
|
1004
|
+
private readonly renderRoute;
|
|
1005
|
+
childrenOf(appId: string): Promise<Routes>;
|
|
1006
|
+
/**
|
|
1007
|
+
* Store first, endpoint second.
|
|
1008
|
+
*
|
|
1009
|
+
* The store holds the newest definition immediately after a Save, so the next navigation inside the
|
|
1010
|
+
* preview picks up a route the designer just added — without a second GET, and without this having to
|
|
1011
|
+
* know that a save happened. The fetch is for the case the store cannot serve: a deep link or a reload,
|
|
1012
|
+
* where nothing has been loaded yet.
|
|
1013
|
+
*
|
|
1014
|
+
* A failure resolves to `undefined` rather than propagating. A guard that rejects fails the whole
|
|
1015
|
+
* navigation, and an app whose definition cannot be read should render an empty shell, not a dead URL.
|
|
1016
|
+
*/
|
|
1017
|
+
private definitionOf;
|
|
1018
|
+
/**
|
|
1019
|
+
* The {@link ModuleLoader} `buildAppRoutes` calls for a mount whose module it has not got. Resolving to
|
|
1020
|
+
* `undefined` is deliberate and is what the contract asks for: a `ModuleMount` naming a module nobody has
|
|
1021
|
+
* authored yet is a validation *warning*, so it must contribute no routes rather than break navigation.
|
|
1022
|
+
*/
|
|
1023
|
+
private loadModule;
|
|
1024
|
+
/** `findById` resolves to `void` for a missing record and rejects on a transport error; both mean "no". */
|
|
1025
|
+
private fetch;
|
|
1026
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppShellRoutesFactory, never>;
|
|
1027
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AppShellRoutesFactory>;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Registers an application's own routes as the children of the Preview tab's route, so that navigating
|
|
1031
|
+
* inside a previewed application is *real* navigation: real URLs, real back button, real outlet.
|
|
1032
|
+
*
|
|
1033
|
+
* Why a `canMatch` guard rather than `loadChildren`, which is the obvious hook for lazily-known children:
|
|
1034
|
+
* the router caches a `loadChildren` result on the `Route` object as `_loadedRoutes`, and one Route object
|
|
1035
|
+
* serves every `:entityId`. The first app previewed would therefore have its routes replayed for the
|
|
1036
|
+
* second. `children`, by contrast, is read fresh on every recognition and never cached — and `canMatch`
|
|
1037
|
+
* runs, and is awaited, *before* the router reads it. So this is the one hook that can answer "children of
|
|
1038
|
+
* *this* app" and still work on a deep link.
|
|
1039
|
+
*
|
|
1040
|
+
* Always returns `true`. It is not deciding whether the tab may be entered — it is filling in the tab's
|
|
1041
|
+
* children on the way past.
|
|
1042
|
+
*/
|
|
1043
|
+
declare const appShellRoutesGuard: CanMatchFn;
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* The layout decisions {@link AppShellComponent} renders from, resolved out of an `AppDefinition`'s
|
|
1047
|
+
* `layout` fields with every default already applied — so the template reads values rather than
|
|
1048
|
+
* spelling out fallbacks, and every default is asserted in one spec instead of being implied by a
|
|
1049
|
+
* `??` in markup.
|
|
1050
|
+
*
|
|
1051
|
+
* A plain function rather than a service for the same reason `buildAppRoutes` is one: nothing here
|
|
1052
|
+
* needs injection, and a pure derivation is testable without a `TestBed`.
|
|
1053
|
+
*/
|
|
1054
|
+
interface ResolvedLayout {
|
|
1055
|
+
preset: LayoutPreset;
|
|
1056
|
+
/**
|
|
1057
|
+
* Always resolved, even for `top-nav` where it is meaningless — {@link hasSidenav} is what says
|
|
1058
|
+
* whether a sidenav is rendered at all. Leaving it undefined there would only push a `?? 'side'`
|
|
1059
|
+
* into the template that no definition can ever reach, since `hasSidenav` already implies a mode.
|
|
1060
|
+
*/
|
|
1061
|
+
sidenavMode: SidenavMode;
|
|
1062
|
+
/** `end` for `sidenav-right`, `start` otherwise — the values `matSidenav`'s `position` takes. */
|
|
1063
|
+
sidenavPosition: 'start' | 'end';
|
|
1064
|
+
/** Whether the shell renders a sidenav at all. False for `top-nav`. */
|
|
1065
|
+
hasSidenav: boolean;
|
|
1066
|
+
sidenavOpened: boolean;
|
|
1067
|
+
sidenavCollapsible: boolean;
|
|
1068
|
+
/** Undefined means unconstrained, which is what an absent `contentMaxWidth` asks for. */
|
|
1069
|
+
contentMaxWidth?: string;
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Resolves the layout of one definition.
|
|
1073
|
+
*
|
|
1074
|
+
* Each field is read from the flattened property first and from `layout` second. For an entity that
|
|
1075
|
+
* came through {@link AppDefinitionMapper} the two always agree — `fromDto` copies `layout.preset`
|
|
1076
|
+
* onto `preset`, and `toDto` merges the flattened value back — so the fallback is there for the
|
|
1077
|
+
* definitions nothing mapped: `new AppDefinition({ layout: { preset: 'top-nav' } })` is a legal
|
|
1078
|
+
* construction that leaves `preset` undefined, and a shell that ignored `layout` would silently
|
|
1079
|
+
* render the default instead.
|
|
1080
|
+
*
|
|
1081
|
+
* `sidenavCollapsible` and `sidenavOpenByDefault` need no such fallback: they are non-optional on the
|
|
1082
|
+
* entity and the constructor defaults them, so there is always a value to read.
|
|
1083
|
+
*/
|
|
1084
|
+
declare function layoutOf(definition: AppDefinition | undefined): ResolvedLayout;
|
|
1085
|
+
/**
|
|
1086
|
+
* The `--pp-*` overrides of one definition, as a style object to bind on the shell's host element.
|
|
1087
|
+
*
|
|
1088
|
+
* Custom properties cascade, so setting them on one element re-tints every framework surface below it
|
|
1089
|
+
* — which is what makes a themed preview possible at all without an iframe. `materialTheme` and
|
|
1090
|
+
* `colorScheme` are deliberately **not** handled: those want `:root` and a Material theme class, and
|
|
1091
|
+
* neither scopes to a subtree. They belong to the standalone runtime host, where the shell owns the
|
|
1092
|
+
* document.
|
|
1093
|
+
*
|
|
1094
|
+
* Keys are passed through untouched, including their leading `--`: Angular's `[style]` binding treats
|
|
1095
|
+
* a custom property as a custom property, and the contract calls these overrides of the tokens in
|
|
1096
|
+
* `pp-colors.css`, so anything else would be this function inventing a naming rule.
|
|
1097
|
+
*/
|
|
1098
|
+
declare function themeVarsOf(definition: AppDefinition | undefined): Record<string, string>;
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* The `footer` region: the widgets it declares, and nothing else. The contract gives a footer no field
|
|
1102
|
+
* beyond `widgets`, so this stays a thin styled host over {@link WidgetListComponent} — separate from
|
|
1103
|
+
* the header only because the two are different slots with different styling, not because they share
|
|
1104
|
+
* no logic.
|
|
1105
|
+
*/
|
|
1106
|
+
declare class RegionFooterComponent {
|
|
1107
|
+
readonly widgets: _angular_core.InputSignal<WidgetInstance[]>;
|
|
1108
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RegionFooterComponent, never>;
|
|
1109
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RegionFooterComponent, "pp-region-footer", never, { "widgets": { "alias": "widgets"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* The `header` region: the application's brand block and the widgets the region declares.
|
|
1114
|
+
*
|
|
1115
|
+
* The brand is the shell's contribution rather than the region's — `logoUrl` and the title come from
|
|
1116
|
+
* the definition's theme and name, not from anything authored on the region — which is why they are
|
|
1117
|
+
* inputs the renderer fills instead of something this component reaches into a store for. That keeps
|
|
1118
|
+
* it renderable from a spec with three inputs and no providers.
|
|
1119
|
+
*
|
|
1120
|
+
* Nav items are *not* handled here. Under the `top-nav` preset the shell places the `sidenav` region's
|
|
1121
|
+
* nav beside this component in the same row, so that a `top-nav` app with no header region is still
|
|
1122
|
+
* navigable — see {@link AppShellComponent}.
|
|
1123
|
+
*/
|
|
1124
|
+
declare class RegionHeaderComponent {
|
|
1125
|
+
readonly title: _angular_core.InputSignal<string>;
|
|
1126
|
+
readonly logoUrl: _angular_core.InputSignal<string | undefined>;
|
|
1127
|
+
readonly widgets: _angular_core.InputSignal<WidgetInstance[]>;
|
|
1128
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RegionHeaderComponent, never>;
|
|
1129
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RegionHeaderComponent, "pp-region-header", never, { "title": { "alias": "title"; "required": false; "isSignal": true; }; "logoUrl": { "alias": "logoUrl"; "required": false; "isSignal": true; }; "widgets": { "alias": "widgets"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
/** Which way the list runs. The shell decides it from `layout.preset`, not the region definition. */
|
|
1133
|
+
type NavOrientation = 'vertical' | 'horizontal';
|
|
1134
|
+
/**
|
|
1135
|
+
* One rendered row. A view model rather than the `NavItem` itself, so that "does this item navigate, and
|
|
1136
|
+
* does its target exist" is decided once per definition in a pure function instead of by methods the
|
|
1137
|
+
* template would re-run on every change detection pass.
|
|
1138
|
+
*/
|
|
1139
|
+
interface NavRow {
|
|
1140
|
+
id: string;
|
|
1141
|
+
label: string;
|
|
1142
|
+
/**
|
|
1143
|
+
* Transloco key for {@link label}, preferred over it when the key resolves. Carried onto the row rather
|
|
1144
|
+
* than translated here: `toNavRows` is a pure function and translation depends on the active language
|
|
1145
|
+
* and on which scopes have finished loading, both of which are the template's concern.
|
|
1146
|
+
*/
|
|
1147
|
+
translocoId?: string;
|
|
1148
|
+
icon?: string;
|
|
1149
|
+
/** Present only when the item names a route that something accounts for — see {@link toNavRows}. */
|
|
1150
|
+
routePath?: string;
|
|
1151
|
+
/** The item names a route path, but nothing in the definition accounts for it. */
|
|
1152
|
+
unresolved: boolean;
|
|
1153
|
+
children: NavRow[];
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* Renders the nav tree of the `sidenav` region — in the sidenav for the two sidenav presets, and
|
|
1157
|
+
* horizontally in the header row for `top-nav`. One component for both, because the tree and its
|
|
1158
|
+
* grouping rules are the same either way and only the axis differs.
|
|
1159
|
+
*
|
|
1160
|
+
* Links are relative, which is what makes the same component work in the designer's Preview tab and in a
|
|
1161
|
+
* standalone deployment: `routerLink="orders"` resolves against whichever route hosts the shell, so it
|
|
1162
|
+
* becomes `…/app-definition/demo/preview/orders` under the designer and `/orders` under a runtime host,
|
|
1163
|
+
* with nothing here needing to know which.
|
|
1164
|
+
*
|
|
1165
|
+
* An item whose target nothing accounts for is rendered as an inert row with a title, not as a link that
|
|
1166
|
+
* would navigate into a 404. A dangling `routePath` is a *warning* server-side by design — it may name a
|
|
1167
|
+
* route of a module authored later — so the shell has to render it as something rather than reject it.
|
|
1168
|
+
*
|
|
1169
|
+
* `translocoId` is preferred over `label` where it resolves, through the impure `ppLabel` pipe — so a row
|
|
1170
|
+
* shows the authored literal until the scope that owns its key has loaded, then re-renders. A nav label is
|
|
1171
|
+
* *tenant* content living under a module's own scope, which for an authored module is served by the
|
|
1172
|
+
* backend rather than shipped as an asset; `ppLabel` falling back is the normal case, not a defect.
|
|
1173
|
+
*/
|
|
1174
|
+
declare class RegionNavComponent {
|
|
1175
|
+
readonly navItems: _angular_core.InputSignal<NavItem[]>;
|
|
1176
|
+
readonly orientation: _angular_core.InputSignal<NavOrientation>;
|
|
1177
|
+
/** Route paths the definition accounts for, supplied by `AppRegionRenderer`. See {@link toNavRows}. */
|
|
1178
|
+
readonly knownPaths: _angular_core.InputSignal<string[]>;
|
|
1179
|
+
protected readonly rows: _angular_core.Signal<NavRow[]>;
|
|
1180
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RegionNavComponent, never>;
|
|
1181
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RegionNavComponent, "pp-region-nav", never, { "navItems": { "alias": "navItems"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "knownPaths": { "alias": "knownPaths"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* The Preview tab, declared once and consumed twice: `BASE_APP_ROUTES` mounts it as
|
|
1186
|
+
* `app-definition/<id>/preview`, and `AppDefinitionContainerComponent` puts it on the descriptor so the tab bar
|
|
1187
|
+
* renders the link. One constant rather than two literals because the segment is what ties the link to the
|
|
1188
|
+
* route — a mismatch would render a tab that navigates to a URL nothing matches.
|
|
1189
|
+
*
|
|
1190
|
+
* The tab is a *container*: `children` starts empty and {@link appShellRoutesGuard} fills it with the
|
|
1191
|
+
* previewed application's own routes on every navigation, so the shell's `<router-outlet>` renders real
|
|
1192
|
+
* screens at real URLs — `app-definition/demo/preview/orders`. The empty array is load-bearing; a route with
|
|
1193
|
+
* no `children` at all takes the `loadChildren` path instead, which is cached per Route object and so cannot
|
|
1194
|
+
* vary by `:entityId`.
|
|
1195
|
+
*/
|
|
1196
|
+
declare const APP_PREVIEW_TAB: EntityTabDescriptor;
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* Hosts the generic container for `Module Definition`, whose only job is to bind the descriptor to the
|
|
1200
|
+
* store the routable screens read from.
|
|
1201
|
+
*
|
|
1202
|
+
* Deliberately without the `Publish` action `AppDefinitionContainerComponent` contributes: publishing is
|
|
1203
|
+
* an application operation. An app is what a user navigates to and its status is what decides whether a
|
|
1204
|
+
* mount is live, so a module with a lifecycle of its own would make "which version of what is live" a
|
|
1205
|
+
* question with two answers.
|
|
1206
|
+
*/
|
|
1207
|
+
declare class ModuleDefinitionContainerComponent {
|
|
1208
|
+
private readonly store;
|
|
1209
|
+
readonly entityDescriptor: BaseEntityDescriptor;
|
|
1210
|
+
constructor();
|
|
1211
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ModuleDefinitionContainerComponent, never>;
|
|
1212
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ModuleDefinitionContainerComponent, "pp-module-definition-container", never, {}, {}, never, never, true, never>;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* The facades of the whole definition graph, to be spread into the application's `providers`.
|
|
1217
|
+
*
|
|
1218
|
+
* The embedded ones are here for the same reason the routable one is: an embedded entity has a facade
|
|
1219
|
+
* like any other — that is what gives it a store — and only its repository differs, reading and writing
|
|
1220
|
+
* the `App Definition` document rather than an endpoint of its own.
|
|
1221
|
+
*/
|
|
1222
|
+
declare const BASE_APP_FACADE_PROVIDERS: Provider[];
|
|
1223
|
+
/**
|
|
1224
|
+
* The same facades keyed by entity name, to be spread into the application's
|
|
1225
|
+
* `BASE_ENTITY_FACADE_REGISTRY` value.
|
|
1226
|
+
*
|
|
1227
|
+
* Every entity an `EMBEDDED_COMPONENTS` attribute of this library names has to appear here, or the
|
|
1228
|
+
* control throws on first render rather than showing a list whose rows go nowhere on save — the
|
|
1229
|
+
* registry is how it reaches the child's store and descriptor. Spread rather than provided separately,
|
|
1230
|
+
* because the token holds one value: a second `provide: BASE_ENTITY_FACADE_REGISTRY` would replace the
|
|
1231
|
+
* application's own entities instead of adding to them.
|
|
1232
|
+
*/
|
|
1233
|
+
declare const BASE_APP_ENTITY_FACADES: BaseEntityFacadeRegistry;
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* The path segment has to be `snakeCaseName('App Definition')`, because
|
|
1237
|
+
* `BaseFormNavigatorSingletonStore` builds the details URL from the entity name — see the same
|
|
1238
|
+
* constraint on `BASE_RULE_ROUTES`.
|
|
1239
|
+
*/
|
|
1240
|
+
declare const BASE_APP_ROUTES: Routes;
|
|
1241
|
+
|
|
1242
|
+
export { APP_DEFINITION_ENTITY_NAME, APP_DEFINITION_I18N_SCOPE, APP_MODULE_MOUNT_ENTITY_NAME, APP_MODULE_MOUNT_I18N_SCOPE, APP_MODULE_MOUNT_ID_FIELD, APP_NAV_ITEM_ENTITY_NAME, APP_NAV_ITEM_I18N_SCOPE, APP_PREVIEW_I18N_KEY, APP_PREVIEW_TAB, APP_REGION_ENTITY_NAME, APP_REGION_I18N_SCOPE, APP_REGION_ID_FIELD, APP_ROUTE_ENTITY_NAME, APP_ROUTE_I18N_SCOPE, APP_ROUTE_ID_FIELD, APP_WIDGET_ENTITY_NAME, APP_WIDGET_I18N_SCOPE, AppDefinition, AppDefinitionContainerComponent, AppDefinitionFacade, AppDefinitionMapper, AppDefinitionService, AppDefinitionStatus, AppDefinitionStore, AppModuleMountFacade, AppNavItemFacade, AppPreviewComponent, AppRegionFacade, AppRegionRenderer, AppRouteFacade, AppRouteRenderer, AppShellComponent, AppShellRoutesFactory, AppWidgetFacade, BASE_APP_ENTITY_FACADES, BASE_APP_FACADE_PROVIDERS, BASE_APP_ROUTES, BASE_APP_TRANSLATION_SOURCE, BASE_APP_TRANSLOCO_SCOPE, COLOR_SCHEMES, ENTITY_MODES, LAYOUT_PRESETS, MATERIAL_THEMES, MODULE_DEFINITION_ENTITY_NAME, MODULE_DEFINITION_I18N_SCOPE, ModuleDefinition, ModuleDefinitionContainerComponent, ModuleDefinitionFacade, ModuleDefinitionMapper, ModuleDefinitionService, ModuleDefinitionStore, ModuleMount, NavItem, REGION_TYPES, ROUTE_TARGET_KINDS, RegionDefinition, RegionFooterComponent, RegionHeaderComponent, RegionNavComponent, RouteDefinition, RouteUnsupportedComponent, RouteWidgetsComponent, SIDENAV_MODES, WidgetListComponent, appShellRoutesGuard, buildAppRoutes, createAppDefinitionDescriptor, createModuleDefinitionDescriptor, createModuleMountDescriptor, createNavItemDescriptor, createRegionDefinitionDescriptor, createRouteDefinitionDescriptor, createWidgetInstanceDescriptor, layoutOf, moduleTranslocoScope, themeVarsOf };
|
|
1243
|
+
export type { AppRouteSource, ColorScheme, EntityMode, LayoutDefinition, LayoutPreset, MaterialTheme, ModuleLoader, NavOrientation, RegionType, RegionView, ResolvedLayout, RouteRenderer, RouteTarget, RouteTargetKind, SidenavMode, ThemeDefinition };
|
|
1244
|
+
//# sourceMappingURL=processpuzzle-base-app.d.ts.map
|