@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,2403 @@
|
|
|
1
|
+
import { WIDGET_PLACEMENTS, WidgetPlacement, WIDGET_REGISTRY, WidgetInstance } from '@processpuzzle/widgets';
|
|
2
|
+
export { WIDGET_PLACEMENTS, WidgetInstance } from '@processpuzzle/widgets';
|
|
3
|
+
import { BaseEntityAttrDescriptor, FormControlType, FlexboxDescriptor, FlexDirection, BaseEntityDescriptor, toSelectables, BaseEntityRestService, BaseEntityStore, BaseEntityTabsStore, BaseEntityContainerStore, BaseEntityFacade, EmbeddedEntityFacade, translateLabel, EntityScreenResolver, entityScreenRoute, EntityLabelPipe, BaseUrlSegments, BaseEntityContainerComponent, BaseFormHostDirective, baseEntityRoutes } from '@processpuzzle/base-entity';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { Injectable, inject, input, computed, Component, viewChild, ViewChild } from '@angular/core';
|
|
6
|
+
import { map, firstValueFrom } from 'rxjs';
|
|
7
|
+
import { signalStoreFeature, type, withMethods, patchState, signalStore } from '@ngrx/signals';
|
|
8
|
+
import { withDevtools } from '@angular-architects/ngrx-toolkit';
|
|
9
|
+
import { httpErrorMessage } from '@processpuzzle/util';
|
|
10
|
+
import { provideTranslocoScope, TranslocoService, TranslocoPipe } from '@jsverse/transloco';
|
|
11
|
+
import { ActivatedRoute, RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
|
|
12
|
+
import * as i1 from '@angular/common';
|
|
13
|
+
import { CommonModule, NgTemplateOutlet, NgComponentOutlet } from '@angular/common';
|
|
14
|
+
import { MatButton } from '@angular/material/button';
|
|
15
|
+
import { MatTooltip } from '@angular/material/tooltip';
|
|
16
|
+
import { MatSidenav, MatSidenavContainer, MatSidenavContent } from '@angular/material/sidenav';
|
|
17
|
+
import { MatNavList, MatListItem, MatListItemIcon, MatListItemTitle } from '@angular/material/list';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Frontend model of the `AppDefinition` schema of `base-app-api.yaml`. `theme` and `layout` are
|
|
21
|
+
* flattened onto the entity by {@link AppDefinitionMapper} so that the generated form can offer a
|
|
22
|
+
* typed control per field; the original objects are kept alongside, because a full replacement PUT
|
|
23
|
+
* would otherwise drop the parts no control writes. `regions`, `routes` and `modules` stay nested and
|
|
24
|
+
* are edited through the `EMBEDDED_COMPONENTS` controls of the `App Region` / `App Route` /
|
|
25
|
+
* `App Module Mount` descriptors.
|
|
26
|
+
*
|
|
27
|
+
* A route's `target` is flattened the same way, for the same reason and by the same mapper. The
|
|
28
|
+
* contract already keeps `RouteTarget` flat rather than a `oneOf` because the generic form cannot edit
|
|
29
|
+
* a discriminated union of classes; a nested object it equally cannot reach, since an
|
|
30
|
+
* `EMBEDDED_COMPONENTS` row is edited as the parsed JSON it arrived as and a descriptor addresses one
|
|
31
|
+
* property, not a path. So {@link RouteDefinition} carries `kind` and the per-kind fields directly and
|
|
32
|
+
* {@link AppDefinitionMapper} re-nests them on save.
|
|
33
|
+
*
|
|
34
|
+
* The nested definitions are classes rather than interfaces, because each is an embedded entity of
|
|
35
|
+
* its own: `EmbeddedEntityFacade` mints the blank row an `Add` opens the child's form on, and that
|
|
36
|
+
* needs a constructor. They stay plain data — the rows of a loaded aggregate are the parsed JSON,
|
|
37
|
+
* never instances of these classes, so nothing may rely on `instanceof` or on a method.
|
|
38
|
+
*/
|
|
39
|
+
const MATERIAL_THEMES = ['azure-blue', 'rose-red', 'magenta-violet', 'cyan-orange'];
|
|
40
|
+
const COLOR_SCHEMES = ['light', 'dark', 'auto'];
|
|
41
|
+
const LAYOUT_PRESETS = ['sidenav-left', 'sidenav-right', 'top-nav'];
|
|
42
|
+
const SIDENAV_MODES = ['side', 'over', 'push'];
|
|
43
|
+
/**
|
|
44
|
+
* No `content`: once routes own the content area it *is* the router outlet, so a content region would
|
|
45
|
+
* have no field of its own — `widgets` is header/footer-only and `navItems` sidenav-only. Its sizing
|
|
46
|
+
* lives in {@link LayoutDefinition.contentMaxWidth}.
|
|
47
|
+
*/
|
|
48
|
+
const REGION_TYPES = ['header', 'sidenav', 'footer'];
|
|
49
|
+
/**
|
|
50
|
+
* What a route renders. Uppercase because the contract's enum is — `RegionType` and the theme enums
|
|
51
|
+
* are lowercase, and mixing the two up is a silent miss rather than a type error once a value reaches
|
|
52
|
+
* JSON.
|
|
53
|
+
*/
|
|
54
|
+
const ROUTE_TARGET_KINDS = ['WIDGETS', 'DOCUMENT', 'ENTITY'];
|
|
55
|
+
const ENTITY_MODES = ['LIST', 'DETAILS'];
|
|
56
|
+
var AppDefinitionStatus;
|
|
57
|
+
(function (AppDefinitionStatus) {
|
|
58
|
+
AppDefinitionStatus["DRAFT"] = "DRAFT";
|
|
59
|
+
AppDefinitionStatus["PUBLISHED"] = "PUBLISHED";
|
|
60
|
+
})(AppDefinitionStatus || (AppDefinitionStatus = {}));
|
|
61
|
+
class NavItem {
|
|
62
|
+
id;
|
|
63
|
+
label;
|
|
64
|
+
translocoId;
|
|
65
|
+
icon;
|
|
66
|
+
/**
|
|
67
|
+
* `RouteDefinition.path` of the route this entry navigates to, resolved by string. Absent on a group
|
|
68
|
+
* node, which expands its {@link children} instead of navigating.
|
|
69
|
+
*
|
|
70
|
+
* A path naming no route is a validation *warning* server-side, not an error: it may name a route of
|
|
71
|
+
* a module that has not been authored yet, and modules stay loosely coupled.
|
|
72
|
+
*/
|
|
73
|
+
routePath;
|
|
74
|
+
roles;
|
|
75
|
+
children;
|
|
76
|
+
constructor(init = {}) {
|
|
77
|
+
this.id = init.id ?? '';
|
|
78
|
+
this.label = init.label ?? '';
|
|
79
|
+
this.translocoId = init.translocoId;
|
|
80
|
+
this.icon = init.icon;
|
|
81
|
+
this.routePath = init.routePath;
|
|
82
|
+
this.roles = init.roles;
|
|
83
|
+
this.children = init.children;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
class RegionDefinition {
|
|
87
|
+
/**
|
|
88
|
+
* Required by the contract, but undefined while a region is being created — the dropdown is declared
|
|
89
|
+
* `required`, so the form is what enforces the contract before the row reaches the payload.
|
|
90
|
+
*/
|
|
91
|
+
type;
|
|
92
|
+
/** `sidenav` only; left undefined so a header region's payload carries no empty nav tree. */
|
|
93
|
+
navItems;
|
|
94
|
+
/** `header` / `footer` only. */
|
|
95
|
+
widgets;
|
|
96
|
+
constructor(init = {}) {
|
|
97
|
+
this.type = init.type;
|
|
98
|
+
this.navItems = init.navItems;
|
|
99
|
+
this.widgets = init.widgets;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* One navigable route. **Flat: a route has no children.** `path` may be multi-segment, so `claims`,
|
|
104
|
+
* `claims/open` and `claims/:id` are three sibling entries rather than a tree — Angular's own nesting
|
|
105
|
+
* is derived from those prefixes when the shell builds its `Routes`, because nesting is a rendering
|
|
106
|
+
* concern rather than something worth authoring. Structure is broken up at the module boundary
|
|
107
|
+
* instead, through {@link ModuleMount}.
|
|
108
|
+
*
|
|
109
|
+
* The `target` fields are flattened onto the row and re-nested by {@link AppDefinitionMapper}; which of
|
|
110
|
+
* them are meaningful follows from {@link kind}, and the backend — not the form — is what enforces it.
|
|
111
|
+
*/
|
|
112
|
+
class RouteDefinition {
|
|
113
|
+
/** Relative to the app root, no leading slash. May contain `/` for depth and `:name` for a parameter. */
|
|
114
|
+
path;
|
|
115
|
+
title;
|
|
116
|
+
translocoId;
|
|
117
|
+
icon;
|
|
118
|
+
/** Empty or absent means any authenticated member of the organization, as on {@link NavItem.roles}. */
|
|
119
|
+
roles;
|
|
120
|
+
// region flattened target — re-nested into `target` by AppDefinitionMapper
|
|
121
|
+
/**
|
|
122
|
+
* Required by the contract, but undefined while a route is being created — the dropdown is declared
|
|
123
|
+
* `required`, so the form is what enforces it before the row reaches the payload.
|
|
124
|
+
*/
|
|
125
|
+
kind;
|
|
126
|
+
/** WIDGETS only. Starts as an empty array so the embedded list has something to append to. */
|
|
127
|
+
widgets;
|
|
128
|
+
documentSlug;
|
|
129
|
+
entityName;
|
|
130
|
+
entityMode;
|
|
131
|
+
rsqlFilter;
|
|
132
|
+
// endregion
|
|
133
|
+
/** The object the flattened fields came from, preserved so a save cannot drop a future field. */
|
|
134
|
+
target;
|
|
135
|
+
constructor(init = {}) {
|
|
136
|
+
this.path = init.path ?? '';
|
|
137
|
+
this.title = init.title ?? '';
|
|
138
|
+
this.translocoId = init.translocoId;
|
|
139
|
+
this.icon = init.icon;
|
|
140
|
+
this.roles = init.roles;
|
|
141
|
+
this.kind = init.kind;
|
|
142
|
+
this.widgets = init.widgets ?? [];
|
|
143
|
+
this.documentSlug = init.documentSlug;
|
|
144
|
+
this.entityName = init.entityName;
|
|
145
|
+
this.entityMode = init.entityMode;
|
|
146
|
+
this.rsqlFilter = init.rsqlFilter;
|
|
147
|
+
this.target = init.target;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Mounts a module's routes under {@link basePath}. The one place route structure composes, and it
|
|
152
|
+
* composes exactly one level deep: a module cannot mount modules.
|
|
153
|
+
*/
|
|
154
|
+
class ModuleMount {
|
|
155
|
+
/**
|
|
156
|
+
* Key of a `ModuleDefinition` in this organization. One naming no existing module is a validation
|
|
157
|
+
* warning, not an error — an app may mount a module before it has been authored.
|
|
158
|
+
*/
|
|
159
|
+
moduleKey;
|
|
160
|
+
basePath;
|
|
161
|
+
constructor(init = {}) {
|
|
162
|
+
this.moduleKey = init.moduleKey ?? '';
|
|
163
|
+
this.basePath = init.basePath ?? '';
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
class AppDefinition {
|
|
167
|
+
/** Unique within the organization and used verbatim as the run-time route segment. */
|
|
168
|
+
id;
|
|
169
|
+
name;
|
|
170
|
+
translocoId;
|
|
171
|
+
description;
|
|
172
|
+
// region flattened theme
|
|
173
|
+
materialTheme;
|
|
174
|
+
colorScheme;
|
|
175
|
+
tokenOverrides;
|
|
176
|
+
logoUrl;
|
|
177
|
+
faviconUrl;
|
|
178
|
+
// endregion
|
|
179
|
+
// region flattened layout
|
|
180
|
+
preset;
|
|
181
|
+
sidenavMode;
|
|
182
|
+
sidenavCollapsible;
|
|
183
|
+
sidenavOpenByDefault;
|
|
184
|
+
contentMaxWidth;
|
|
185
|
+
// endregion
|
|
186
|
+
/** The objects the flattened fields came from, preserved so a save cannot drop a future field. */
|
|
187
|
+
theme;
|
|
188
|
+
layout;
|
|
189
|
+
regions;
|
|
190
|
+
routes;
|
|
191
|
+
modules;
|
|
192
|
+
// region server-assigned
|
|
193
|
+
orgKey;
|
|
194
|
+
status;
|
|
195
|
+
version;
|
|
196
|
+
publishedVersion;
|
|
197
|
+
createdAt;
|
|
198
|
+
updatedAt;
|
|
199
|
+
// endregion
|
|
200
|
+
constructor(init = {}) {
|
|
201
|
+
this.id = init.id ?? '';
|
|
202
|
+
this.name = init.name ?? '';
|
|
203
|
+
this.translocoId = init.translocoId;
|
|
204
|
+
this.description = init.description;
|
|
205
|
+
this.materialTheme = init.materialTheme;
|
|
206
|
+
this.colorScheme = init.colorScheme;
|
|
207
|
+
this.tokenOverrides = init.tokenOverrides;
|
|
208
|
+
this.logoUrl = init.logoUrl;
|
|
209
|
+
this.faviconUrl = init.faviconUrl;
|
|
210
|
+
this.preset = init.preset;
|
|
211
|
+
this.sidenavMode = init.sidenavMode;
|
|
212
|
+
this.sidenavCollapsible = init.sidenavCollapsible ?? true;
|
|
213
|
+
this.sidenavOpenByDefault = init.sidenavOpenByDefault ?? true;
|
|
214
|
+
this.contentMaxWidth = init.contentMaxWidth;
|
|
215
|
+
this.theme = init.theme;
|
|
216
|
+
this.layout = init.layout;
|
|
217
|
+
this.regions = init.regions;
|
|
218
|
+
this.routes = init.routes;
|
|
219
|
+
this.modules = init.modules;
|
|
220
|
+
this.orgKey = init.orgKey;
|
|
221
|
+
this.status = init.status;
|
|
222
|
+
this.version = init.version;
|
|
223
|
+
this.publishedVersion = init.publishedVersion;
|
|
224
|
+
this.createdAt = init.createdAt;
|
|
225
|
+
this.updatedAt = init.updatedAt;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Frontend model of the `ModuleDefinition` schema of `base-app-api.yaml`: a lazily-loadable slice of an
|
|
231
|
+
* application, with its own flat route list and its own transloco scope. An {@link ModuleMount} of an
|
|
232
|
+
* `AppDefinition` names one of these by key and mounts its routes under a base path.
|
|
233
|
+
*
|
|
234
|
+
* **What "lazy" honestly means.** A module lazy-loads *metadata* — this definition, its routes, its
|
|
235
|
+
* translations, and the documents and descriptors they name. It does **not** lazy-load widget code:
|
|
236
|
+
* widget components are bundled at compile time and resolved through the frontend registry, so a
|
|
237
|
+
* metadata module cannot split a bundle on its own. The wins are that `AppDefinition` stops being one
|
|
238
|
+
* aggregate that has to be loaded, locked and published atomically, and that a module is the unit of
|
|
239
|
+
* authoring permission and versioning. Nothing here should be justified on bundle size.
|
|
240
|
+
*
|
|
241
|
+
* Unlike the region / route / mount classes this one is a **routable** entity: it has endpoints of its
|
|
242
|
+
* own, so it comes with a service, a store and a facade rather than travelling inside another payload.
|
|
243
|
+
*/
|
|
244
|
+
class ModuleDefinition {
|
|
245
|
+
/**
|
|
246
|
+
* The contract calls this field `key`; base-entity keys every store, URL and reference on `id`, so
|
|
247
|
+
* {@link ModuleDefinitionMapper} renames it on the way in and out rather than teaching the framework a
|
|
248
|
+
* second identity field. One name for one thing on this side of the mapper — a `key` property beside
|
|
249
|
+
* `id` could only ever disagree with it.
|
|
250
|
+
*
|
|
251
|
+
* Immutable by contract: `ModuleMount.moduleKey` resolves against it, and a rename would silently
|
|
252
|
+
* unmount the module from every app that mounts it.
|
|
253
|
+
*/
|
|
254
|
+
id;
|
|
255
|
+
name;
|
|
256
|
+
translocoId;
|
|
257
|
+
description;
|
|
258
|
+
/**
|
|
259
|
+
* Transloco scope the module's translations load under. Absent means {@link id}, which is the default
|
|
260
|
+
* the contract states; {@link moduleTranslocoScope} is the one place that default is applied.
|
|
261
|
+
*/
|
|
262
|
+
translocoScope;
|
|
263
|
+
/**
|
|
264
|
+
* The module's routes, flat and relative to the base path it is mounted at — the same shape and the
|
|
265
|
+
* same derived nesting as `AppDefinition.routes`, and flattened by the same mapper. A module does not
|
|
266
|
+
* mount modules: this is where composition stops.
|
|
267
|
+
*/
|
|
268
|
+
routes;
|
|
269
|
+
// region server-assigned
|
|
270
|
+
orgKey;
|
|
271
|
+
version;
|
|
272
|
+
createdAt;
|
|
273
|
+
updatedAt;
|
|
274
|
+
// endregion
|
|
275
|
+
constructor(init = {}) {
|
|
276
|
+
this.id = init.id ?? '';
|
|
277
|
+
this.name = init.name ?? '';
|
|
278
|
+
this.translocoId = init.translocoId;
|
|
279
|
+
this.description = init.description;
|
|
280
|
+
this.translocoScope = init.translocoScope;
|
|
281
|
+
this.routes = init.routes;
|
|
282
|
+
this.orgKey = init.orgKey;
|
|
283
|
+
this.version = init.version;
|
|
284
|
+
this.createdAt = init.createdAt;
|
|
285
|
+
this.updatedAt = init.updatedAt;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* The scope a module's translations load under, applying the contract's default. Kept as a function
|
|
290
|
+
* rather than resolved in the mapper, so a definition never carries a `translocoScope` the designer did
|
|
291
|
+
* not author — the field stays empty in the form, and the fallback is a rendering decision.
|
|
292
|
+
*/
|
|
293
|
+
function moduleTranslocoScope(definition) {
|
|
294
|
+
return definition.translocoScope?.trim() || definition.id;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Transloco scope of this library. The translations live in
|
|
299
|
+
* `libs/js-shared/base-app-frontend/src/assets/i18n/base_app/*.json` and are published with the
|
|
300
|
+
* package; a consuming application copies them to `assets/i18n/base_app` (see the testbed's
|
|
301
|
+
* `project.json`). The scope is registered on {@link BASE_APP_ROUTES}, so it loads lazily with the
|
|
302
|
+
* route rather than with the application shell.
|
|
303
|
+
*
|
|
304
|
+
* The alias is spelled out on purpose: transloco camel-cases the default alias, which would turn
|
|
305
|
+
* `base_app` into `baseApp` and silently miss every key below.
|
|
306
|
+
*/
|
|
307
|
+
const BASE_APP_TRANSLOCO_SCOPE = 'base_app';
|
|
308
|
+
/**
|
|
309
|
+
* Scope of the generic framework labels (`base_entity.tabs.*`, `base_entity.toolbar.*`), whose files
|
|
310
|
+
* base-entity owns. It has to be registered next to {@link BASE_APP_TRANSLOCO_SCOPE} wherever the
|
|
311
|
+
* generic screens are hosted: `BaseEntityTabsComponent` translates from it through `TranslocoPipe`,
|
|
312
|
+
* which caches the value it resolved for a key on first render. If only `base_app` were loaded, the
|
|
313
|
+
* tabs would keep the raw key even after the toolbar — which registers this scope for itself —
|
|
314
|
+
* triggers the load.
|
|
315
|
+
*/
|
|
316
|
+
const BASE_ENTITY_TRANSLOCO_SCOPE = 'base_entity';
|
|
317
|
+
/** Key root of the `AppDefinition` entity name (`._self`) and of its attribute labels. */
|
|
318
|
+
const APP_DEFINITION_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_definition`;
|
|
319
|
+
/**
|
|
320
|
+
* Label of the Preview tab. Under this library's own scope rather than `base_entity.tabs.*`: the generic
|
|
321
|
+
* tabs are List and Details, and an application preview is this feature's contribution, not the framework's.
|
|
322
|
+
* Resolved with `{ entity }` like the generic tab labels, so a translation may name the entity if it reads
|
|
323
|
+
* better that way.
|
|
324
|
+
*/
|
|
325
|
+
const APP_PREVIEW_I18N_KEY = `${APP_DEFINITION_I18N_SCOPE}.tabs.preview`;
|
|
326
|
+
/**
|
|
327
|
+
* Key root of the `ModuleDefinition` entity name and attribute labels. A child of this library's scope
|
|
328
|
+
* like the one above, and not to be confused with `ModuleDefinition.translocoScope`, which is a scope an
|
|
329
|
+
* *authored* module's own translations load under — see {@link moduleTranslocoScope}. These keys are the
|
|
330
|
+
* framework's labels for the authoring form; that one is the tenant's content.
|
|
331
|
+
*/
|
|
332
|
+
const MODULE_DEFINITION_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.module_definition`;
|
|
333
|
+
/**
|
|
334
|
+
* Key roots of the nested definitions the `AppDefinition` form contains through `EMBEDDED_COMPONENTS`
|
|
335
|
+
* controls. They are children of {@link BASE_APP_TRANSLOCO_SCOPE} rather than scopes of their own,
|
|
336
|
+
* because the whole graph is edited under `BASE_APP_ROUTES` and one scope registration has to cover
|
|
337
|
+
* all of it — the embedded route branches add none.
|
|
338
|
+
*/
|
|
339
|
+
const APP_REGION_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_region`;
|
|
340
|
+
const APP_ROUTE_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_route`;
|
|
341
|
+
const APP_MODULE_MOUNT_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_module_mount`;
|
|
342
|
+
const APP_NAV_ITEM_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_nav_item`;
|
|
343
|
+
const APP_WIDGET_I18N_SCOPE = `${BASE_APP_TRANSLOCO_SCOPE}.app_widget`;
|
|
344
|
+
/** Keys of the `Publish` form action contributed by `AppDefinitionContainerComponent`. */
|
|
345
|
+
const PUBLISH_BUTTON_I18N_KEY = `${BASE_APP_TRANSLOCO_SCOPE}.publish.button`;
|
|
346
|
+
const PUBLISH_TOOLTIP_I18N_KEY = `${BASE_APP_TRANSLOCO_SCOPE}.publish.tooltip`;
|
|
347
|
+
/**
|
|
348
|
+
* Where this library's transloco bundles come from when the application ships without its assets.
|
|
349
|
+
*
|
|
350
|
+
* Spread into the application's `TRANSLATION_SOURCE_REGISTRY`, the way its facades are spread into
|
|
351
|
+
* `BASE_ENTITY_FACADE_REGISTRY`. The scopes below normally arrive as static files — the build copies
|
|
352
|
+
* them into `assets/i18n/<scope>` and the loader tries the asset first — so this is reached only by a
|
|
353
|
+
* host that skips that copy step. It is declared here rather than in the application because which
|
|
354
|
+
* backend owns a scope is base-app's knowledge, not its caller's.
|
|
355
|
+
*/
|
|
356
|
+
const BASE_APP_TRANSLATION_SOURCE = {
|
|
357
|
+
scopes: ['base_app'],
|
|
358
|
+
serviceRootKey: 'APP_SERVICE_ROOT',
|
|
359
|
+
segment: 'app',
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Entity names of the app-definition graph, kept in one dependency-free module.
|
|
364
|
+
*
|
|
365
|
+
* They live here rather than next to their descriptors because the graph is cyclic: `App Definition`
|
|
366
|
+
* aggregates `App Region`, and `App Region` names `App Definition` as its `componentParent`. Each
|
|
367
|
+
* descriptor module re-exports its own name, so importers are unaffected.
|
|
368
|
+
*/
|
|
369
|
+
const APP_DEFINITION_ENTITY_NAME = 'App Definition';
|
|
370
|
+
/**
|
|
371
|
+
* A second aggregate root beside `App Definition`, not a part of it — hence no `App` prefix, which in
|
|
372
|
+
* every other name here marks something the app document carries. `App Module Mount` is the row inside
|
|
373
|
+
* an app that *names* one of these.
|
|
374
|
+
*/
|
|
375
|
+
const MODULE_DEFINITION_ENTITY_NAME = 'Module Definition';
|
|
376
|
+
const APP_MODULE_MOUNT_ENTITY_NAME = 'App Module Mount';
|
|
377
|
+
const APP_NAV_ITEM_ENTITY_NAME = 'App Nav Item';
|
|
378
|
+
const APP_REGION_ENTITY_NAME = 'App Region';
|
|
379
|
+
const APP_ROUTE_ENTITY_NAME = 'App Route';
|
|
380
|
+
const APP_WIDGET_ENTITY_NAME = 'App Widget';
|
|
381
|
+
|
|
382
|
+
/** `ModuleMount` has no `id` — an app mounts a given module once, so `moduleKey` identifies the row. */
|
|
383
|
+
const APP_MODULE_MOUNT_ID_FIELD = 'moduleKey';
|
|
384
|
+
function createModuleMountAttrDescriptors() {
|
|
385
|
+
// A plain text box rather than a FOREIGN_KEY onto the module list: modules stay loosely coupled, so a
|
|
386
|
+
// key naming no existing module is a server-side warning rather than an error, and a dropdown of the
|
|
387
|
+
// modules authored so far would turn that warning into something the form refuses to let happen.
|
|
388
|
+
const moduleKeyAttr = new BaseEntityAttrDescriptor('moduleKey', FormControlType.TEXT_BOX, 'Module Key', undefined, true);
|
|
389
|
+
moduleKeyAttr.required = true;
|
|
390
|
+
moduleKeyAttr.isHeading = true;
|
|
391
|
+
moduleKeyAttr.placeholder = 'Key of a module definition of this organization';
|
|
392
|
+
// Both patterns are the contract's own. Declaring them here makes the form refuse what the backend
|
|
393
|
+
// would refuse anyway, and puts them in the e2e registry, so generated fixtures produce dashed tokens
|
|
394
|
+
// rather than prose the PUT answers with 400.
|
|
395
|
+
moduleKeyAttr.pattern = '^[a-z0-9]+(-[a-z0-9]+)*$';
|
|
396
|
+
const basePathAttr = new BaseEntityAttrDescriptor('basePath', FormControlType.TEXT_BOX, 'Base Path');
|
|
397
|
+
basePathAttr.required = true;
|
|
398
|
+
basePathAttr.placeholder = 'The module routes are mounted under this prefix, e.g. claims';
|
|
399
|
+
basePathAttr.pattern = '^[a-z0-9][a-z0-9\\-/]*$';
|
|
400
|
+
const flexBoxContainer = new FlexboxDescriptor([moduleKeyAttr, basePathAttr], FlexDirection.ROW);
|
|
401
|
+
flexBoxContainer.style = { 'column-gap': '10px', width: 'fit-content' };
|
|
402
|
+
return [flexBoxContainer];
|
|
403
|
+
}
|
|
404
|
+
function createModuleMountDescriptor() {
|
|
405
|
+
return new BaseEntityDescriptor({
|
|
406
|
+
entityName: APP_MODULE_MOUNT_ENTITY_NAME,
|
|
407
|
+
attrDescriptors: createModuleMountAttrDescriptors(),
|
|
408
|
+
i18nScope: APP_MODULE_MOUNT_I18N_SCOPE,
|
|
409
|
+
componentParent: APP_DEFINITION_ENTITY_NAME,
|
|
410
|
+
isEmbedded: true,
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* `RegionDefinition` has no `id` — a region is identified by the shell slot it fills, and an app
|
|
416
|
+
* declares each slot at most once. Referencing attributes therefore have to set
|
|
417
|
+
* `referenceIdField = 'type'`; see the `regions` attribute of the `AppDefinition` descriptor.
|
|
418
|
+
*/
|
|
419
|
+
const APP_REGION_ID_FIELD = 'type';
|
|
420
|
+
function createRegionDefinitionAttrDescriptors() {
|
|
421
|
+
const typeAttr = new BaseEntityAttrDescriptor('type', FormControlType.DROPDOWN, 'Type', toSelectables(REGION_TYPES), true);
|
|
422
|
+
typeAttr.required = true;
|
|
423
|
+
typeAttr.isHeading = true;
|
|
424
|
+
// Per the contract, `navItems` applies to `sidenav` and `widgets` to `header` / `footer`; the
|
|
425
|
+
// schema models them as optional siblings rather than a discriminated union, so both are offered
|
|
426
|
+
// and it is the region's type that decides which one is meaningful. Both are contained: the rows
|
|
427
|
+
// are nested arrays of this region, which is itself nested in the app definition's document.
|
|
428
|
+
const navItemsAttr = new BaseEntityAttrDescriptor('navItems', FormControlType.EMBEDDED_COMPONENTS, 'Nav Items');
|
|
429
|
+
navItemsAttr.linkedEntityType = APP_NAV_ITEM_ENTITY_NAME;
|
|
430
|
+
navItemsAttr.hideInTable = true;
|
|
431
|
+
const widgetsAttr = new BaseEntityAttrDescriptor('widgets', FormControlType.EMBEDDED_COMPONENTS, 'Widgets');
|
|
432
|
+
widgetsAttr.linkedEntityType = APP_WIDGET_ENTITY_NAME;
|
|
433
|
+
widgetsAttr.hideInTable = true;
|
|
434
|
+
const flexBoxContainer = new FlexboxDescriptor([typeAttr, navItemsAttr, widgetsAttr], FlexDirection.COLUMN);
|
|
435
|
+
flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };
|
|
436
|
+
return [flexBoxContainer];
|
|
437
|
+
}
|
|
438
|
+
function createRegionDefinitionDescriptor() {
|
|
439
|
+
return new BaseEntityDescriptor({
|
|
440
|
+
entityName: APP_REGION_ENTITY_NAME,
|
|
441
|
+
attrDescriptors: createRegionDefinitionAttrDescriptors(),
|
|
442
|
+
i18nScope: APP_REGION_I18N_SCOPE,
|
|
443
|
+
componentParent: APP_DEFINITION_ENTITY_NAME,
|
|
444
|
+
isEmbedded: true,
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* `RouteDefinition` has no `id` — `path` identifies a route, and it is what a `NavItem.routePath`
|
|
450
|
+
* resolves against. Referencing attributes therefore have to set `referenceIdField = 'path'`; see the
|
|
451
|
+
* `routePath` attribute of the `App Nav Item` descriptor.
|
|
452
|
+
*
|
|
453
|
+
* Unlike `App Region`'s `type`, this value may contain `/`, so the authoring URL that addresses one row
|
|
454
|
+
* carries it percent-encoded (`app-route/claims%2Fopen/details`). Angular round-trips that, but a
|
|
455
|
+
* reverse proxy that normalizes `%2F` before the SPA sees it would not — worth an e2e case once
|
|
456
|
+
* multi-segment routes are authored in the testbed.
|
|
457
|
+
*/
|
|
458
|
+
const APP_ROUTE_ID_FIELD = 'path';
|
|
459
|
+
function createRouteDefinitionAttrDescriptors() {
|
|
460
|
+
const pathAttr = new BaseEntityAttrDescriptor('path', FormControlType.TEXT_BOX, 'Path', undefined, true);
|
|
461
|
+
pathAttr.required = true;
|
|
462
|
+
pathAttr.placeholder = 'Relative to the app root, e.g. claims/open or claims/:id';
|
|
463
|
+
// The contract's own pattern. Declaring it here is what makes the form reject a value the backend
|
|
464
|
+
// would reject anyway — and it is serialized into the e2e registry, so generated fixtures produce a
|
|
465
|
+
// dashed token instead of a prose value the PUT answers with 400.
|
|
466
|
+
pathAttr.pattern = '^[a-z0-9:][a-z0-9\\-:/]*$';
|
|
467
|
+
const titleAttr = new BaseEntityAttrDescriptor('title', FormControlType.TEXT_BOX, 'Title');
|
|
468
|
+
titleAttr.required = true;
|
|
469
|
+
titleAttr.isHeading = true;
|
|
470
|
+
const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');
|
|
471
|
+
translocoIdAttr.placeholder = 'Translation key of the route title';
|
|
472
|
+
translocoIdAttr.hideInTable = true;
|
|
473
|
+
const iconAttr = new BaseEntityAttrDescriptor('icon', FormControlType.TEXT_BOX, 'Icon');
|
|
474
|
+
iconAttr.placeholder = 'Material or FontAwesome icon name';
|
|
475
|
+
iconAttr.hideInTable = true;
|
|
476
|
+
const rolesAttr = new BaseEntityAttrDescriptor('roles', FormControlType.TAGS, 'Roles');
|
|
477
|
+
rolesAttr.placeholder = 'Empty means any authenticated member of the organization';
|
|
478
|
+
rolesAttr.hideInTable = true;
|
|
479
|
+
// region flattened target — re-nested into `target` by AppDefinitionMapper
|
|
480
|
+
// Which of the fields below is meaningful follows from `kind`; all of them are offered, and the
|
|
481
|
+
// backend validator — not the form — is what rejects a combination that makes no sense. The generic
|
|
482
|
+
// form has no conditional visibility, and a discriminated union is not something a descriptor can
|
|
483
|
+
// express in the first place.
|
|
484
|
+
const kindAttr = new BaseEntityAttrDescriptor('kind', FormControlType.DROPDOWN, 'Renders', toSelectables(ROUTE_TARGET_KINDS));
|
|
485
|
+
kindAttr.required = true;
|
|
486
|
+
const widgetsAttr = new BaseEntityAttrDescriptor('widgets', FormControlType.EMBEDDED_COMPONENTS, 'Widgets');
|
|
487
|
+
widgetsAttr.linkedEntityType = APP_WIDGET_ENTITY_NAME;
|
|
488
|
+
widgetsAttr.hideInTable = true;
|
|
489
|
+
const documentSlugAttr = new BaseEntityAttrDescriptor('documentSlug', FormControlType.TEXT_BOX, 'Document Slug');
|
|
490
|
+
documentSlugAttr.placeholder = 'DOCUMENT only: slug of the document to render';
|
|
491
|
+
documentSlugAttr.hideInTable = true;
|
|
492
|
+
const entityNameAttr = new BaseEntityAttrDescriptor('entityName', FormControlType.TEXT_BOX, 'Entity Name');
|
|
493
|
+
entityNameAttr.placeholder = 'ENTITY only: name of the descriptor to generate the screen from';
|
|
494
|
+
entityNameAttr.hideInTable = true;
|
|
495
|
+
const entityModeAttr = new BaseEntityAttrDescriptor('entityMode', FormControlType.DROPDOWN, 'Entity Mode', toSelectables(ENTITY_MODES));
|
|
496
|
+
entityModeAttr.hideInTable = true;
|
|
497
|
+
const rsqlFilterAttr = new BaseEntityAttrDescriptor('rsqlFilter', FormControlType.TEXT_BOX, 'Rsql Filter');
|
|
498
|
+
rsqlFilterAttr.placeholder = 'ENTITY + LIST only: RSQL the list is pre-filtered with';
|
|
499
|
+
rsqlFilterAttr.hideInTable = true;
|
|
500
|
+
// endregion
|
|
501
|
+
const identityRow = new FlexboxDescriptor([pathAttr, titleAttr, translocoIdAttr], FlexDirection.ROW);
|
|
502
|
+
identityRow.style = { 'column-gap': '10px' };
|
|
503
|
+
const presentationRow = new FlexboxDescriptor([iconAttr, kindAttr], FlexDirection.ROW);
|
|
504
|
+
presentationRow.style = { 'column-gap': '10px' };
|
|
505
|
+
const documentRow = new FlexboxDescriptor([documentSlugAttr], FlexDirection.ROW);
|
|
506
|
+
documentRow.style = { 'column-gap': '10px' };
|
|
507
|
+
const entityRow = new FlexboxDescriptor([entityNameAttr, entityModeAttr, rsqlFilterAttr], FlexDirection.ROW);
|
|
508
|
+
entityRow.style = { 'column-gap': '10px' };
|
|
509
|
+
const flexBoxContainer = new FlexboxDescriptor([identityRow, presentationRow, rolesAttr, documentRow, entityRow, widgetsAttr], FlexDirection.COLUMN);
|
|
510
|
+
flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };
|
|
511
|
+
return [flexBoxContainer];
|
|
512
|
+
}
|
|
513
|
+
function createRouteDefinitionDescriptor() {
|
|
514
|
+
return new BaseEntityDescriptor({
|
|
515
|
+
entityName: APP_ROUTE_ENTITY_NAME,
|
|
516
|
+
attrDescriptors: createRouteDefinitionAttrDescriptors(),
|
|
517
|
+
i18nScope: APP_ROUTE_I18N_SCOPE,
|
|
518
|
+
// Two parents, one descriptor: an app's own routes and a module's routes are the same schema, and a
|
|
519
|
+
// route has to mean the same thing wherever it was authored. The module's paths are simply relative
|
|
520
|
+
// to the base path its mount gives them.
|
|
521
|
+
componentParent: [APP_DEFINITION_ENTITY_NAME, MODULE_DEFINITION_ENTITY_NAME],
|
|
522
|
+
isEmbedded: true,
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const statusSelectables = toSelectables(Object.keys(AppDefinitionStatus));
|
|
527
|
+
function createAppDefinitionAttrDescriptors() {
|
|
528
|
+
const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Id');
|
|
529
|
+
idAttr.required = true;
|
|
530
|
+
idAttr.placeholder = 'Unique within the organization, e.g. claims-app';
|
|
531
|
+
const nameAttr = new BaseEntityAttrDescriptor('name', FormControlType.TEXT_BOX, 'Name', undefined, true);
|
|
532
|
+
nameAttr.required = true;
|
|
533
|
+
nameAttr.isHeading = true;
|
|
534
|
+
const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');
|
|
535
|
+
translocoIdAttr.placeholder = 'Translation key of the application name';
|
|
536
|
+
translocoIdAttr.hideInTable = true;
|
|
537
|
+
const descriptionAttr = new BaseEntityAttrDescriptor('description', FormControlType.TEXTAREA, 'Description');
|
|
538
|
+
descriptionAttr.styleClass = 'full-width';
|
|
539
|
+
descriptionAttr.hideInTable = true;
|
|
540
|
+
// Server-assigned: shown so the designer can see where a definition stands, never edited here.
|
|
541
|
+
// Status changes through `POST .../publish`, the versions through any successful write.
|
|
542
|
+
const statusAttr = new BaseEntityAttrDescriptor('status', FormControlType.DROPDOWN, 'Status', statusSelectables);
|
|
543
|
+
statusAttr.disabled = true;
|
|
544
|
+
const versionAttr = new BaseEntityAttrDescriptor('version', FormControlType.TEXT_BOX, 'Version');
|
|
545
|
+
versionAttr.disabled = true;
|
|
546
|
+
const publishedVersionAttr = new BaseEntityAttrDescriptor('publishedVersion', FormControlType.TEXT_BOX, 'Published Version');
|
|
547
|
+
publishedVersionAttr.disabled = true;
|
|
548
|
+
const updatedAtAttr = new BaseEntityAttrDescriptor('updatedAt', FormControlType.TEXT_BOX, 'Updated At');
|
|
549
|
+
updatedAtAttr.disabled = true;
|
|
550
|
+
// region theme — flattened out of `theme` by AppDefinitionMapper
|
|
551
|
+
const materialThemeAttr = new BaseEntityAttrDescriptor('materialTheme', FormControlType.DROPDOWN, 'Material Theme', toSelectables(MATERIAL_THEMES));
|
|
552
|
+
materialThemeAttr.hideInTable = true;
|
|
553
|
+
const colorSchemeAttr = new BaseEntityAttrDescriptor('colorScheme', FormControlType.DROPDOWN, 'Color Scheme', toSelectables(COLOR_SCHEMES));
|
|
554
|
+
colorSchemeAttr.hideInTable = true;
|
|
555
|
+
const logoUrlAttr = new BaseEntityAttrDescriptor('logoUrl', FormControlType.TEXT_BOX, 'Logo Url');
|
|
556
|
+
logoUrlAttr.placeholder = 'Tenant logo shown in the header region';
|
|
557
|
+
logoUrlAttr.hideInTable = true;
|
|
558
|
+
const faviconUrlAttr = new BaseEntityAttrDescriptor('faviconUrl', FormControlType.TEXT_BOX, 'Favicon Url');
|
|
559
|
+
faviconUrlAttr.hideInTable = true;
|
|
560
|
+
// An open key/value map by contract — keys are `--pp-*` token names, values any CSS color — so a
|
|
561
|
+
// key/value editor is the only shape that can carry it without the form inventing a closed list.
|
|
562
|
+
const tokenOverridesAttr = new BaseEntityAttrDescriptor('tokenOverrides', FormControlType.ADDITIONAL_PROPERTIES, 'Token Overrides');
|
|
563
|
+
tokenOverridesAttr.hideInTable = true;
|
|
564
|
+
// endregion
|
|
565
|
+
// region layout — flattened out of `layout` by AppDefinitionMapper
|
|
566
|
+
const presetAttr = new BaseEntityAttrDescriptor('preset', FormControlType.DROPDOWN, 'Layout Preset', toSelectables(LAYOUT_PRESETS));
|
|
567
|
+
presetAttr.hideInTable = true;
|
|
568
|
+
const sidenavModeAttr = new BaseEntityAttrDescriptor('sidenavMode', FormControlType.DROPDOWN, 'Sidenav Mode', toSelectables(SIDENAV_MODES));
|
|
569
|
+
sidenavModeAttr.hideInTable = true;
|
|
570
|
+
const contentMaxWidthAttr = new BaseEntityAttrDescriptor('contentMaxWidth', FormControlType.TEXT_BOX, 'Content Max Width');
|
|
571
|
+
contentMaxWidthAttr.placeholder = 'CSS length, e.g. 1280px; empty means full width';
|
|
572
|
+
contentMaxWidthAttr.hideInTable = true;
|
|
573
|
+
const sidenavCollapsibleAttr = new BaseEntityAttrDescriptor('sidenavCollapsible', FormControlType.CHECKBOX, 'Sidenav Collapsible');
|
|
574
|
+
sidenavCollapsibleAttr.hideInTable = true;
|
|
575
|
+
const sidenavOpenByDefaultAttr = new BaseEntityAttrDescriptor('sidenavOpenByDefault', FormControlType.CHECKBOX, 'Sidenav Open By Default');
|
|
576
|
+
sidenavOpenByDefaultAttr.hideInTable = true;
|
|
577
|
+
// endregion
|
|
578
|
+
// region nested graph — kept on the entity as-is by AppDefinitionMapper, so the full-replacement PUT preserves it
|
|
579
|
+
// Containment, not association: the contract nests `RegionDefinition`, `RouteDefinition` and
|
|
580
|
+
// `ModuleMount` inside the AppDefinition document, and none has an endpoint of its own, so the rows
|
|
581
|
+
// travel inside this entity's payload and are saved with it. A `ModuleMount` is the exception that
|
|
582
|
+
// proves it — the module it *names* is a separate aggregate with its own endpoints, but the mount
|
|
583
|
+
// itself belongs to this app.
|
|
584
|
+
const regionsAttr = new BaseEntityAttrDescriptor('regions', FormControlType.EMBEDDED_COMPONENTS, 'Regions');
|
|
585
|
+
regionsAttr.linkedEntityType = APP_REGION_ENTITY_NAME;
|
|
586
|
+
// A region has no `id` in the contract; `type` is what identifies it. See APP_REGION_ID_FIELD.
|
|
587
|
+
regionsAttr.referenceIdField = APP_REGION_ID_FIELD;
|
|
588
|
+
regionsAttr.hideInTable = true;
|
|
589
|
+
// Flat by design: a route has no children, and the multi-segment paths of these rows are what the
|
|
590
|
+
// shell derives Angular's nesting from at registration time.
|
|
591
|
+
const routesAttr = new BaseEntityAttrDescriptor('routes', FormControlType.EMBEDDED_COMPONENTS, 'Routes');
|
|
592
|
+
routesAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;
|
|
593
|
+
routesAttr.referenceIdField = APP_ROUTE_ID_FIELD;
|
|
594
|
+
routesAttr.hideInTable = true;
|
|
595
|
+
const modulesAttr = new BaseEntityAttrDescriptor('modules', FormControlType.EMBEDDED_COMPONENTS, 'Modules');
|
|
596
|
+
modulesAttr.linkedEntityType = APP_MODULE_MOUNT_ENTITY_NAME;
|
|
597
|
+
modulesAttr.referenceIdField = APP_MODULE_MOUNT_ID_FIELD;
|
|
598
|
+
modulesAttr.hideInTable = true;
|
|
599
|
+
// endregion
|
|
600
|
+
const identityRow = new FlexboxDescriptor([idAttr, nameAttr, translocoIdAttr], FlexDirection.ROW);
|
|
601
|
+
identityRow.style = { 'column-gap': '10px' };
|
|
602
|
+
const revisionRow = new FlexboxDescriptor([statusAttr, versionAttr, publishedVersionAttr, updatedAtAttr], FlexDirection.ROW);
|
|
603
|
+
revisionRow.style = { 'column-gap': '10px' };
|
|
604
|
+
const themeRow = new FlexboxDescriptor([materialThemeAttr, colorSchemeAttr], FlexDirection.ROW);
|
|
605
|
+
themeRow.style = { 'column-gap': '10px' };
|
|
606
|
+
const brandingRow = new FlexboxDescriptor([logoUrlAttr, faviconUrlAttr], FlexDirection.ROW);
|
|
607
|
+
brandingRow.style = { 'column-gap': '10px' };
|
|
608
|
+
const layoutRow = new FlexboxDescriptor([presetAttr, sidenavModeAttr, contentMaxWidthAttr], FlexDirection.ROW);
|
|
609
|
+
layoutRow.style = { 'column-gap': '10px' };
|
|
610
|
+
const sidenavRow = new FlexboxDescriptor([sidenavCollapsibleAttr, sidenavOpenByDefaultAttr], FlexDirection.ROW);
|
|
611
|
+
sidenavRow.style = { 'column-gap': '10px' };
|
|
612
|
+
const graphRow = new FlexboxDescriptor([regionsAttr, routesAttr, modulesAttr], FlexDirection.ROW);
|
|
613
|
+
graphRow.style = { 'column-gap': '10px' };
|
|
614
|
+
const flexBoxContainer = new FlexboxDescriptor([identityRow, revisionRow, descriptionAttr, themeRow, brandingRow, tokenOverridesAttr, layoutRow, sidenavRow, graphRow], FlexDirection.COLUMN);
|
|
615
|
+
flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };
|
|
616
|
+
return [flexBoxContainer];
|
|
617
|
+
}
|
|
618
|
+
function createAppDefinitionDescriptor() {
|
|
619
|
+
return new BaseEntityDescriptor({ entityName: APP_DEFINITION_ENTITY_NAME, attrDescriptors: createAppDefinitionAttrDescriptors(), i18nScope: APP_DEFINITION_I18N_SCOPE });
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
function createNavItemAttrDescriptors() {
|
|
623
|
+
const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Id');
|
|
624
|
+
idAttr.required = true;
|
|
625
|
+
const labelAttr = new BaseEntityAttrDescriptor('label', FormControlType.TEXT_BOX, 'Label', undefined, true);
|
|
626
|
+
labelAttr.required = true;
|
|
627
|
+
labelAttr.isHeading = true;
|
|
628
|
+
const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');
|
|
629
|
+
translocoIdAttr.placeholder = 'Translation key of the label';
|
|
630
|
+
translocoIdAttr.hideInTable = true;
|
|
631
|
+
const iconAttr = new BaseEntityAttrDescriptor('icon', FormControlType.TEXT_BOX, 'Icon');
|
|
632
|
+
iconAttr.placeholder = 'Material or FontAwesome icon name';
|
|
633
|
+
iconAttr.hideInTable = true;
|
|
634
|
+
// A group node expands its children instead of navigating, so this stays optional. The route is
|
|
635
|
+
// resolved by `path` rather than by an id — see APP_ROUTE_ID_FIELD.
|
|
636
|
+
const routePathAttr = new BaseEntityAttrDescriptor('routePath', FormControlType.FOREIGN_KEY, 'Route');
|
|
637
|
+
routePathAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;
|
|
638
|
+
routePathAttr.referenceIdField = APP_ROUTE_ID_FIELD;
|
|
639
|
+
const rolesAttr = new BaseEntityAttrDescriptor('roles', FormControlType.TAGS, 'Roles');
|
|
640
|
+
rolesAttr.placeholder = 'Empty means any authenticated member of the organization';
|
|
641
|
+
rolesAttr.hideInTable = true;
|
|
642
|
+
// A group node contains its children rather than pointing at them — they are an inline array of this
|
|
643
|
+
// entry, and the entry itself is nested in the app definition's document.
|
|
644
|
+
const childrenAttr = new BaseEntityAttrDescriptor('children', FormControlType.EMBEDDED_COMPONENTS, 'Children');
|
|
645
|
+
childrenAttr.linkedEntityType = APP_NAV_ITEM_ENTITY_NAME;
|
|
646
|
+
childrenAttr.hideInTable = true;
|
|
647
|
+
const identityRow = new FlexboxDescriptor([idAttr, labelAttr, translocoIdAttr], FlexDirection.ROW);
|
|
648
|
+
identityRow.style = { 'column-gap': '10px' };
|
|
649
|
+
const targetRow = new FlexboxDescriptor([iconAttr, routePathAttr], FlexDirection.ROW);
|
|
650
|
+
targetRow.style = { 'column-gap': '10px' };
|
|
651
|
+
const flexBoxContainer = new FlexboxDescriptor([identityRow, targetRow, rolesAttr, childrenAttr], FlexDirection.COLUMN);
|
|
652
|
+
flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };
|
|
653
|
+
return [flexBoxContainer];
|
|
654
|
+
}
|
|
655
|
+
function createNavItemDescriptor() {
|
|
656
|
+
return new BaseEntityDescriptor({
|
|
657
|
+
entityName: APP_NAV_ITEM_ENTITY_NAME,
|
|
658
|
+
attrDescriptors: createNavItemAttrDescriptors(),
|
|
659
|
+
i18nScope: APP_NAV_ITEM_I18N_SCOPE,
|
|
660
|
+
// A nav item hangs off the sidenav region, or off another nav item as a group child.
|
|
661
|
+
componentParent: [APP_REGION_ENTITY_NAME, APP_NAV_ITEM_ENTITY_NAME],
|
|
662
|
+
isEmbedded: true,
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function createWidgetInstanceAttrDescriptors() {
|
|
667
|
+
// `id` rather than `type` identifies the widget: it is unique within its page or region, while a
|
|
668
|
+
// page with two `entity-grid`s would otherwise show the same label twice.
|
|
669
|
+
const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Id', undefined, true);
|
|
670
|
+
idAttr.required = true;
|
|
671
|
+
idAttr.isHeading = true;
|
|
672
|
+
idAttr.placeholder = 'Unique within the page or region, e.g. widget-claims-grid';
|
|
673
|
+
// Deliberately a free-text box and not a dropdown: `WidgetInstance.type` is a key into the frontend
|
|
674
|
+
// widget registry, which the contract keeps open so new widget types need no schema change.
|
|
675
|
+
const typeAttr = new BaseEntityAttrDescriptor('type', FormControlType.TEXT_BOX, 'Type');
|
|
676
|
+
typeAttr.required = true;
|
|
677
|
+
typeAttr.placeholder = 'Widget registry key, e.g. entity-grid';
|
|
678
|
+
// Each widget type owns and validates its own props shape, so the only thing this form can
|
|
679
|
+
// honestly offer is an open key/value editor.
|
|
680
|
+
const propsAttr = new BaseEntityAttrDescriptor('props', FormControlType.ADDITIONAL_PROPERTIES, 'Props');
|
|
681
|
+
propsAttr.hideInTable = true;
|
|
682
|
+
// Widgets do not nest: a container widget type lists the ids of siblings in `props.childIds`, and each
|
|
683
|
+
// of those siblings is marked REFERENCED so it is placed by the container instead of rendering twice.
|
|
684
|
+
// That is the whole of composition here — there is no child collection to edit.
|
|
685
|
+
const placementAttr = new BaseEntityAttrDescriptor('placement', FormControlType.DROPDOWN, 'Placement', toSelectables(WIDGET_PLACEMENTS));
|
|
686
|
+
placementAttr.hideInTable = true;
|
|
687
|
+
const identityRow = new FlexboxDescriptor([idAttr, typeAttr, placementAttr], FlexDirection.ROW);
|
|
688
|
+
identityRow.style = { 'column-gap': '10px' };
|
|
689
|
+
const flexBoxContainer = new FlexboxDescriptor([identityRow, propsAttr], FlexDirection.COLUMN);
|
|
690
|
+
flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };
|
|
691
|
+
return [flexBoxContainer];
|
|
692
|
+
}
|
|
693
|
+
function createWidgetInstanceDescriptor() {
|
|
694
|
+
return new BaseEntityDescriptor({
|
|
695
|
+
entityName: APP_WIDGET_ENTITY_NAME,
|
|
696
|
+
attrDescriptors: createWidgetInstanceAttrDescriptors(),
|
|
697
|
+
i18nScope: APP_WIDGET_I18N_SCOPE,
|
|
698
|
+
// A widget sits in a header/footer region or on a page — and only there, since it cannot be nested
|
|
699
|
+
// in another widget.
|
|
700
|
+
componentParent: [APP_REGION_ENTITY_NAME, APP_ROUTE_ENTITY_NAME],
|
|
701
|
+
isEmbedded: true,
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
function createModuleDefinitionAttrDescriptors() {
|
|
706
|
+
// The contract's `key`, renamed to `id` by ModuleDefinitionMapper because base-entity keys stores and
|
|
707
|
+
// URLs on `id`. Labelled 'Key' so the designer sees the name the contract and `ModuleMount.moduleKey`
|
|
708
|
+
// use. The pattern is the contract's own: the key is a URL segment of the module endpoints and the
|
|
709
|
+
// prefix a mount composes with, so a value needing encoding would break both.
|
|
710
|
+
const idAttr = new BaseEntityAttrDescriptor('id', FormControlType.TEXT_BOX, 'Key');
|
|
711
|
+
idAttr.required = true;
|
|
712
|
+
idAttr.pattern = '^[a-z0-9]+(-[a-z0-9]+)*$';
|
|
713
|
+
idAttr.placeholder = 'Unique within the organization, e.g. claims — immutable once mounted';
|
|
714
|
+
const nameAttr = new BaseEntityAttrDescriptor('name', FormControlType.TEXT_BOX, 'Name', undefined, true);
|
|
715
|
+
nameAttr.required = true;
|
|
716
|
+
nameAttr.isHeading = true;
|
|
717
|
+
const translocoIdAttr = new BaseEntityAttrDescriptor('translocoId', FormControlType.TEXT_BOX, 'Transloco Id');
|
|
718
|
+
translocoIdAttr.placeholder = 'Translation key of the module name';
|
|
719
|
+
translocoIdAttr.hideInTable = true;
|
|
720
|
+
const descriptionAttr = new BaseEntityAttrDescriptor('description', FormControlType.TEXTAREA, 'Description');
|
|
721
|
+
descriptionAttr.styleClass = 'full-width';
|
|
722
|
+
descriptionAttr.hideInTable = true;
|
|
723
|
+
// Left empty means the key, which is the default the contract states — applied by
|
|
724
|
+
// `moduleTranslocoScope` rather than written into the row, so an empty field stays empty.
|
|
725
|
+
const translocoScopeAttr = new BaseEntityAttrDescriptor('translocoScope', FormControlType.TEXT_BOX, 'Transloco Scope');
|
|
726
|
+
translocoScopeAttr.placeholder = "Scope the module's translations load under; empty means the key";
|
|
727
|
+
translocoScopeAttr.hideInTable = true;
|
|
728
|
+
// Server-assigned, shown so the designer can see where a module stands.
|
|
729
|
+
const versionAttr = new BaseEntityAttrDescriptor('version', FormControlType.TEXT_BOX, 'Version');
|
|
730
|
+
versionAttr.disabled = true;
|
|
731
|
+
const updatedAtAttr = new BaseEntityAttrDescriptor('updatedAt', FormControlType.TEXT_BOX, 'Updated At');
|
|
732
|
+
updatedAtAttr.disabled = true;
|
|
733
|
+
// The same rows, the same descriptor and the same derived nesting as `AppDefinition.routes` — only the
|
|
734
|
+
// paths are relative to the base path a mount gives them. `App Route` therefore names this entity as a
|
|
735
|
+
// second `componentParent`.
|
|
736
|
+
const routesAttr = new BaseEntityAttrDescriptor('routes', FormControlType.EMBEDDED_COMPONENTS, 'Routes');
|
|
737
|
+
routesAttr.linkedEntityType = APP_ROUTE_ENTITY_NAME;
|
|
738
|
+
routesAttr.referenceIdField = APP_ROUTE_ID_FIELD;
|
|
739
|
+
routesAttr.hideInTable = true;
|
|
740
|
+
const identityRow = new FlexboxDescriptor([idAttr, nameAttr, translocoIdAttr], FlexDirection.ROW);
|
|
741
|
+
identityRow.style = { 'column-gap': '10px' };
|
|
742
|
+
const revisionRow = new FlexboxDescriptor([translocoScopeAttr, versionAttr, updatedAtAttr], FlexDirection.ROW);
|
|
743
|
+
revisionRow.style = { 'column-gap': '10px' };
|
|
744
|
+
const flexBoxContainer = new FlexboxDescriptor([identityRow, revisionRow, descriptionAttr, routesAttr], FlexDirection.COLUMN);
|
|
745
|
+
flexBoxContainer.style = { 'row-gap': '5px', width: 'fit-content' };
|
|
746
|
+
return [flexBoxContainer];
|
|
747
|
+
}
|
|
748
|
+
function createModuleDefinitionDescriptor() {
|
|
749
|
+
return new BaseEntityDescriptor({
|
|
750
|
+
entityName: MODULE_DEFINITION_ENTITY_NAME,
|
|
751
|
+
attrDescriptors: createModuleDefinitionAttrDescriptors(),
|
|
752
|
+
i18nScope: MODULE_DEFINITION_I18N_SCOPE,
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* The `target` flattening both aggregates that own routes need — `AppDefinition.routes` and
|
|
758
|
+
* `ModuleDefinition.routes` carry the same schema, and a route authored in a module has to behave
|
|
759
|
+
* exactly like one authored in an app.
|
|
760
|
+
*
|
|
761
|
+
* Why flatten at all: `EMBEDDED_COMPONENTS` edits a row as the flat JSON it arrived as, and a descriptor
|
|
762
|
+
* addresses one property rather than a path, so nothing in the generated form could reach
|
|
763
|
+
* `target.documentSlug`. The contract already keeps `RouteTarget` flat rather than a `oneOf` for the
|
|
764
|
+
* related reason that the form cannot edit a discriminated union of classes.
|
|
765
|
+
*/
|
|
766
|
+
function flattenRouteTarget(dto) {
|
|
767
|
+
const target = dto.target;
|
|
768
|
+
return new RouteDefinition({
|
|
769
|
+
path: dto.path,
|
|
770
|
+
title: dto.title,
|
|
771
|
+
translocoId: dto.translocoId,
|
|
772
|
+
icon: dto.icon,
|
|
773
|
+
roles: dto.roles,
|
|
774
|
+
kind: target?.kind,
|
|
775
|
+
widgets: target?.widgets,
|
|
776
|
+
documentSlug: target?.documentSlug,
|
|
777
|
+
entityName: target?.entityName,
|
|
778
|
+
entityMode: target?.entityMode,
|
|
779
|
+
rsqlFilter: target?.rsqlFilter,
|
|
780
|
+
// Kept so nestRouteTarget can merge onto it rather than replace it.
|
|
781
|
+
target,
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* The inverse. `kind` is non-optional in the contract but undefined on a row the designer has not
|
|
786
|
+
* finished — the dropdown is `required`, so the form rejects that before a save; the cast keeps this
|
|
787
|
+
* mapping from having to invent a default the backend would then have to second-guess.
|
|
788
|
+
*
|
|
789
|
+
* `widgets` is omitted when empty rather than sent as `[]`, so a DOCUMENT or ENTITY route does not
|
|
790
|
+
* persist an empty widget list it has no use for. The rest is merged onto the `target` the fields were
|
|
791
|
+
* lifted out of, which preserves any field a later contract version adds before this mapping learns
|
|
792
|
+
* about it — a PUT is a full replacement, so anything dropped here is dropped for good.
|
|
793
|
+
*/
|
|
794
|
+
function nestRouteTarget(route) {
|
|
795
|
+
const widgets = route.widgets;
|
|
796
|
+
return {
|
|
797
|
+
path: route.path,
|
|
798
|
+
title: route.title,
|
|
799
|
+
translocoId: route.translocoId,
|
|
800
|
+
icon: route.icon,
|
|
801
|
+
roles: route.roles,
|
|
802
|
+
target: {
|
|
803
|
+
...route.target,
|
|
804
|
+
kind: route.kind,
|
|
805
|
+
widgets: widgets?.length ? widgets : undefined,
|
|
806
|
+
documentSlug: route.documentSlug,
|
|
807
|
+
entityName: route.entityName,
|
|
808
|
+
entityMode: route.entityMode,
|
|
809
|
+
rsqlFilter: route.rsqlFilter,
|
|
810
|
+
},
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Translates between the `AppDefinition` DTO of `base-app-api.yaml` and the flat entity the
|
|
816
|
+
* generated form works with.
|
|
817
|
+
*
|
|
818
|
+
* Two invariants matter here. The form saves `{ ...entity, ...form.value }`, so every DTO field the
|
|
819
|
+
* form does not show has to survive on the entity — `regions`, `routes` and `modules` are nested
|
|
820
|
+
* rather than flattened for exactly that reason, and the `EMBEDDED_COMPONENTS` controls edit them in
|
|
821
|
+
* place. And `PUT /app-definitions/{appId}` is a full replacement, so {@link toDto} rebuilds `theme`
|
|
822
|
+
* and `layout` from the flattened controls *on top of* the objects they were lifted out of, which
|
|
823
|
+
* keeps any field a later contract version adds before this mapper learns about it.
|
|
824
|
+
*
|
|
825
|
+
* A route's `target` is the third thing flattened, one level deeper: `regions` and `modules` rows
|
|
826
|
+
* travel as the raw DTO they arrived as, but a route row cannot. That flattening lives in
|
|
827
|
+
* `route-definition.mapper.ts` rather than here, because `ModuleDefinition.routes` carries the same
|
|
828
|
+
* schema and a route authored in a module has to behave exactly like one authored in an app.
|
|
829
|
+
*/
|
|
830
|
+
class AppDefinitionMapper {
|
|
831
|
+
fromDto(dto) {
|
|
832
|
+
const source = dto;
|
|
833
|
+
const theme = source.theme;
|
|
834
|
+
const layout = source.layout;
|
|
835
|
+
return new AppDefinition({
|
|
836
|
+
id: source.id,
|
|
837
|
+
name: source.name,
|
|
838
|
+
translocoId: source.translocoId,
|
|
839
|
+
description: source.description,
|
|
840
|
+
materialTheme: theme?.materialTheme,
|
|
841
|
+
colorScheme: theme?.colorScheme,
|
|
842
|
+
tokenOverrides: theme?.tokenOverrides,
|
|
843
|
+
logoUrl: theme?.logoUrl,
|
|
844
|
+
faviconUrl: theme?.faviconUrl,
|
|
845
|
+
preset: layout?.preset,
|
|
846
|
+
sidenavMode: layout?.sidenavMode,
|
|
847
|
+
sidenavCollapsible: layout?.sidenavCollapsible,
|
|
848
|
+
sidenavOpenByDefault: layout?.sidenavOpenByDefault,
|
|
849
|
+
contentMaxWidth: layout?.contentMaxWidth,
|
|
850
|
+
theme,
|
|
851
|
+
layout,
|
|
852
|
+
regions: source.regions,
|
|
853
|
+
routes: source.routes?.map(flattenRouteTarget),
|
|
854
|
+
modules: source.modules,
|
|
855
|
+
orgKey: source.orgKey,
|
|
856
|
+
status: source.status,
|
|
857
|
+
version: source.version,
|
|
858
|
+
publishedVersion: source.publishedVersion,
|
|
859
|
+
createdAt: source.createdAt,
|
|
860
|
+
updatedAt: source.updatedAt,
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
toDto(entity) {
|
|
864
|
+
// Listed field by field rather than spread, so the flattened controls never reach the payload.
|
|
865
|
+
return {
|
|
866
|
+
id: entity.id,
|
|
867
|
+
name: entity.name,
|
|
868
|
+
translocoId: entity.translocoId,
|
|
869
|
+
description: entity.description,
|
|
870
|
+
theme: this.mergeTheme(entity),
|
|
871
|
+
layout: this.mergeLayout(entity),
|
|
872
|
+
regions: entity.regions,
|
|
873
|
+
routes: entity.routes?.map(nestRouteTarget),
|
|
874
|
+
modules: entity.modules,
|
|
875
|
+
orgKey: entity.orgKey,
|
|
876
|
+
status: entity.status,
|
|
877
|
+
version: entity.version,
|
|
878
|
+
publishedVersion: entity.publishedVersion,
|
|
879
|
+
createdAt: entity.createdAt,
|
|
880
|
+
updatedAt: entity.updatedAt,
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
mergeTheme(entity) {
|
|
884
|
+
return {
|
|
885
|
+
...entity.theme,
|
|
886
|
+
materialTheme: entity.materialTheme,
|
|
887
|
+
colorScheme: entity.colorScheme,
|
|
888
|
+
tokenOverrides: entity.tokenOverrides,
|
|
889
|
+
logoUrl: entity.logoUrl,
|
|
890
|
+
faviconUrl: entity.faviconUrl,
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
mergeLayout(entity) {
|
|
894
|
+
return {
|
|
895
|
+
...entity.layout,
|
|
896
|
+
preset: entity.preset,
|
|
897
|
+
sidenavMode: entity.sidenavMode,
|
|
898
|
+
sidenavCollapsible: entity.sidenavCollapsible,
|
|
899
|
+
sidenavOpenByDefault: entity.sidenavOpenByDefault,
|
|
900
|
+
contentMaxWidth: entity.contentMaxWidth,
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionMapper, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
904
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionMapper, providedIn: 'root' });
|
|
905
|
+
}
|
|
906
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionMapper, decorators: [{
|
|
907
|
+
type: Injectable,
|
|
908
|
+
args: [{ providedIn: 'root' }]
|
|
909
|
+
}] });
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* REST access to `/organizations/{orgKey}/app-definitions`. As in base-rule, the organization is
|
|
913
|
+
* part of the configured service root — `APP_SERVICE_ROOT`, the optional per-feature escape hatch,
|
|
914
|
+
* falling back to `BACKEND_SERVICE_ROOT`, which is what every deployment actually sets — so the
|
|
915
|
+
* tenant is a deployment concern rather than something every call has to carry.
|
|
916
|
+
*/
|
|
917
|
+
class AppDefinitionService extends BaseEntityRestService {
|
|
918
|
+
entityMapper;
|
|
919
|
+
constructor(entityMapper) {
|
|
920
|
+
super(entityMapper, 'APP_SERVICE_ROOT', 'app-definitions');
|
|
921
|
+
this.entityMapper = entityMapper;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* `POST /app-definitions/{appId}/publish` — promotes the stored `version` to `publishedVersion` and
|
|
925
|
+
* sets the status to `PUBLISHED`. The backend validates the definition first and answers 400 when it
|
|
926
|
+
* is not publishable, so the caller only has to deal with the happy path and the error.
|
|
927
|
+
*/
|
|
928
|
+
publish(id) {
|
|
929
|
+
const pathParams = new Map([['id', String(id)]]);
|
|
930
|
+
const fullUrl = this.buildFullUrl(this.resourceUrl + '/%{id}/publish', { pathParams });
|
|
931
|
+
if (!fullUrl)
|
|
932
|
+
throw new Error('Could not determine the full url');
|
|
933
|
+
return this.httpClient.post(fullUrl, {}, { headers: this.headers }).pipe(map((response) => this.entityMapper.fromDto(response)));
|
|
934
|
+
}
|
|
935
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionService, deps: [{ token: AppDefinitionMapper }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
936
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionService, providedIn: 'root' });
|
|
937
|
+
}
|
|
938
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionService, decorators: [{
|
|
939
|
+
type: Injectable,
|
|
940
|
+
args: [{ providedIn: 'root' }]
|
|
941
|
+
}], ctorParameters: () => [{ type: AppDefinitionMapper }] });
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* Adds the `publish` use case on top of the generic CRUD store. It keeps the same contract as
|
|
945
|
+
* `addEntity` / `updateEntity`: flip `isLoading`, replace the entity in the list with the server's
|
|
946
|
+
* answer so the form's read-only `status` / `publishedVersion` fields refresh, and surface failures
|
|
947
|
+
* through `error` rather than by throwing.
|
|
948
|
+
*/
|
|
949
|
+
function AppDefinitionPublishStore() {
|
|
950
|
+
return signalStoreFeature({ state: type() }, withMethods((store, service = inject(AppDefinitionService)) => ({
|
|
951
|
+
publish: async (id) => {
|
|
952
|
+
patchState(store, { isLoading: true, error: undefined });
|
|
953
|
+
try {
|
|
954
|
+
const publishedEntity = await firstValueFrom(service.publish(id));
|
|
955
|
+
const entities = [...store.entities()];
|
|
956
|
+
const indexToUpdate = entities.findIndex((entity) => entity.id === id);
|
|
957
|
+
if (indexToUpdate >= 0)
|
|
958
|
+
entities[indexToUpdate] = publishedEntity;
|
|
959
|
+
const currentEntity = store.currentEntity()?.id === id ? publishedEntity : store.currentEntity();
|
|
960
|
+
patchState(store, { entities, currentEntity, isLoading: false });
|
|
961
|
+
return publishedEntity;
|
|
962
|
+
}
|
|
963
|
+
catch (error) {
|
|
964
|
+
patchState(store, { error: httpErrorMessage(error), isLoading: false });
|
|
965
|
+
return undefined;
|
|
966
|
+
}
|
|
967
|
+
},
|
|
968
|
+
})));
|
|
969
|
+
}
|
|
970
|
+
const AppDefinitionStore = signalStore({ providedIn: 'root' }, BaseEntityStore(AppDefinition, () => inject(AppDefinitionService)), BaseEntityTabsStore(), BaseEntityContainerStore(), AppDefinitionPublishStore(), withDevtools('AppDefinition'));
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* Translates between the `ModuleDefinition` DTO of `base-app-api.yaml` and the entity the generated form
|
|
974
|
+
* works with. Two renamings, and nothing else — a module is a much smaller aggregate than an app:
|
|
975
|
+
*
|
|
976
|
+
* - **`key` becomes `id`.** base-entity keys every store, URL and reference on `id`, so the rename
|
|
977
|
+
* happens here rather than in the framework. See {@link ModuleDefinition.id}.
|
|
978
|
+
* - **each route's `target` is flattened** onto the row and re-nested on save, by the same functions
|
|
979
|
+
* `AppDefinitionMapper` uses, so a route authored in a module behaves like one authored in an app.
|
|
980
|
+
*/
|
|
981
|
+
class ModuleDefinitionMapper {
|
|
982
|
+
fromDto(dto) {
|
|
983
|
+
const source = dto;
|
|
984
|
+
return new ModuleDefinition({
|
|
985
|
+
id: source.key,
|
|
986
|
+
name: source.name,
|
|
987
|
+
translocoId: source.translocoId,
|
|
988
|
+
description: source.description,
|
|
989
|
+
translocoScope: source.translocoScope,
|
|
990
|
+
routes: source.routes?.map(flattenRouteTarget),
|
|
991
|
+
orgKey: source.orgKey,
|
|
992
|
+
version: source.version,
|
|
993
|
+
createdAt: source.createdAt,
|
|
994
|
+
updatedAt: source.updatedAt,
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
toDto(entity) {
|
|
998
|
+
// Field by field rather than spread, so `id` does not travel beside the `key` it became.
|
|
999
|
+
return {
|
|
1000
|
+
key: entity.id,
|
|
1001
|
+
name: entity.name,
|
|
1002
|
+
translocoId: entity.translocoId,
|
|
1003
|
+
description: entity.description,
|
|
1004
|
+
translocoScope: entity.translocoScope,
|
|
1005
|
+
routes: entity.routes?.map(nestRouteTarget),
|
|
1006
|
+
orgKey: entity.orgKey,
|
|
1007
|
+
version: entity.version,
|
|
1008
|
+
createdAt: entity.createdAt,
|
|
1009
|
+
updatedAt: entity.updatedAt,
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionMapper, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1013
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionMapper, providedIn: 'root' });
|
|
1014
|
+
}
|
|
1015
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionMapper, decorators: [{
|
|
1016
|
+
type: Injectable,
|
|
1017
|
+
args: [{ providedIn: 'root' }]
|
|
1018
|
+
}] });
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* REST access to `/organizations/{orgKey}/modules`. As for `AppDefinitionService`, the organization is
|
|
1022
|
+
* part of the configured service root (`APP_SERVICE_ROOT`, falling back to `BACKEND_SERVICE_ROOT`), so
|
|
1023
|
+
* the tenant is a deployment concern rather
|
|
1024
|
+
* than something every call has to carry.
|
|
1025
|
+
*
|
|
1026
|
+
* The URL variable is the module key — `ModuleDefinitionMapper` maps it onto `id`, which is what the
|
|
1027
|
+
* inherited `findById` builds `GET .../modules/{moduleKey}` from. That single-module read is also the call
|
|
1028
|
+
* the shell makes when something first navigates under a mount; see `ModuleLoader` in
|
|
1029
|
+
* `app-route-builder.ts`.
|
|
1030
|
+
*/
|
|
1031
|
+
class ModuleDefinitionService extends BaseEntityRestService {
|
|
1032
|
+
entityMapper;
|
|
1033
|
+
constructor(entityMapper) {
|
|
1034
|
+
super(entityMapper, 'APP_SERVICE_ROOT', 'modules');
|
|
1035
|
+
this.entityMapper = entityMapper;
|
|
1036
|
+
}
|
|
1037
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionService, deps: [{ token: ModuleDefinitionMapper }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1038
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionService, providedIn: 'root' });
|
|
1039
|
+
}
|
|
1040
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionService, decorators: [{
|
|
1041
|
+
type: Injectable,
|
|
1042
|
+
args: [{ providedIn: 'root' }]
|
|
1043
|
+
}], ctorParameters: () => [{ type: ModuleDefinitionMapper }] });
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* Plain generic CRUD — a module has no `publish` of its own. Publishing is an `AppDefinition` operation:
|
|
1047
|
+
* an app is what a user navigates to, and its status is what decides whether a mount is live. Giving a
|
|
1048
|
+
* module a second, independent lifecycle would make "which version of what is live" a question with two
|
|
1049
|
+
* answers.
|
|
1050
|
+
*/
|
|
1051
|
+
const ModuleDefinitionStore = signalStore({ providedIn: 'root' }, BaseEntityStore(ModuleDefinition, () => inject(ModuleDefinitionService)), BaseEntityTabsStore(), BaseEntityContainerStore(), withDevtools('ModuleDefinition'));
|
|
1052
|
+
|
|
1053
|
+
class AppDefinitionFacade extends BaseEntityFacade {
|
|
1054
|
+
entityType = AppDefinition;
|
|
1055
|
+
mapperRef = inject(AppDefinitionMapper);
|
|
1056
|
+
serviceRef = inject(AppDefinitionService);
|
|
1057
|
+
createMapper() {
|
|
1058
|
+
return this.mapperRef;
|
|
1059
|
+
}
|
|
1060
|
+
createService() {
|
|
1061
|
+
return this.serviceRef;
|
|
1062
|
+
}
|
|
1063
|
+
createStoreClass() {
|
|
1064
|
+
return AppDefinitionStore;
|
|
1065
|
+
}
|
|
1066
|
+
createDescriptor() {
|
|
1067
|
+
return createAppDefinitionDescriptor();
|
|
1068
|
+
}
|
|
1069
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1070
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionFacade });
|
|
1071
|
+
}
|
|
1072
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionFacade, decorators: [{
|
|
1073
|
+
type: Injectable
|
|
1074
|
+
}] });
|
|
1075
|
+
|
|
1076
|
+
class ModuleDefinitionFacade extends BaseEntityFacade {
|
|
1077
|
+
entityType = ModuleDefinition;
|
|
1078
|
+
mapperRef = inject(ModuleDefinitionMapper);
|
|
1079
|
+
serviceRef = inject(ModuleDefinitionService);
|
|
1080
|
+
createMapper() {
|
|
1081
|
+
return this.mapperRef;
|
|
1082
|
+
}
|
|
1083
|
+
createService() {
|
|
1084
|
+
return this.serviceRef;
|
|
1085
|
+
}
|
|
1086
|
+
createStoreClass() {
|
|
1087
|
+
return ModuleDefinitionStore;
|
|
1088
|
+
}
|
|
1089
|
+
createDescriptor() {
|
|
1090
|
+
return createModuleDefinitionDescriptor();
|
|
1091
|
+
}
|
|
1092
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1093
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionFacade });
|
|
1094
|
+
}
|
|
1095
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionFacade, decorators: [{
|
|
1096
|
+
type: Injectable
|
|
1097
|
+
}] });
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* A mount is a row of the `App Definition` document, so it is edited through that document — unlike the
|
|
1101
|
+
* `ModuleDefinition` it names, which is an aggregate of its own with its own endpoints.
|
|
1102
|
+
*/
|
|
1103
|
+
class AppModuleMountFacade extends EmbeddedEntityFacade {
|
|
1104
|
+
entityType = ModuleMount;
|
|
1105
|
+
createDescriptor() {
|
|
1106
|
+
return createModuleMountDescriptor();
|
|
1107
|
+
}
|
|
1108
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppModuleMountFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1109
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppModuleMountFacade });
|
|
1110
|
+
}
|
|
1111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppModuleMountFacade, decorators: [{
|
|
1112
|
+
type: Injectable
|
|
1113
|
+
}] });
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* One facade covers every level of the nav tree, however deep: the store is a root singleton and the row
|
|
1117
|
+
* it stands for comes from the route, so `app-nav-item/a/details/app-nav-item/b/details` resolves through
|
|
1118
|
+
* the same facade as the top level.
|
|
1119
|
+
*/
|
|
1120
|
+
class AppNavItemFacade extends EmbeddedEntityFacade {
|
|
1121
|
+
entityType = NavItem;
|
|
1122
|
+
createDescriptor() {
|
|
1123
|
+
return createNavItemDescriptor();
|
|
1124
|
+
}
|
|
1125
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppNavItemFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1126
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppNavItemFacade });
|
|
1127
|
+
}
|
|
1128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppNavItemFacade, decorators: [{
|
|
1129
|
+
type: Injectable
|
|
1130
|
+
}] });
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* Derives Angular's nested `Routes` from the flat route list of an `AppDefinition`.
|
|
1134
|
+
*
|
|
1135
|
+
* Nesting is computed here rather than authored, which is the whole point of keeping
|
|
1136
|
+
* {@link RouteDefinition} flat: `claims`, `claims/open` and `claims/:id` are three sibling rows a
|
|
1137
|
+
* designer can reorder, rename and reason about one at a time, and it is only at registration that
|
|
1138
|
+
* they become a parent with two children. Two rules produce that shape:
|
|
1139
|
+
*
|
|
1140
|
+
* - **An authored route that is a prefix of others becomes their parent.** So `claims` stays mounted
|
|
1141
|
+
* while `claims/open` renders in its `<router-outlet>` — which is the one thing a flat registration
|
|
1142
|
+
* could not express, and the reason this function exists at all. A component rendering a route that
|
|
1143
|
+
* has children therefore has to host an outlet.
|
|
1144
|
+
* - **A prefix nothing authored stays part of the path.** With only `claims/open` and `claims/closed`
|
|
1145
|
+
* declared, no synthetic `claims` parent is invented: the two are emitted with their full paths, since
|
|
1146
|
+
* a component-less grouping node would change nothing about what matches or what renders.
|
|
1147
|
+
*
|
|
1148
|
+
* Modules mount as a parent of their own at {@link ModuleMount.basePath}, component-less because a mount
|
|
1149
|
+
* is a prefix rather than a screen. That is the single composition point, and it composes one level: the
|
|
1150
|
+
* routes of a mounted module are built by the same two rules, and a module mounts no modules. A module the
|
|
1151
|
+
* shell already has is emitted now; one it has not is emitted as `loadChildren` — see {@link lazyMount}.
|
|
1152
|
+
*
|
|
1153
|
+
* Siblings are ordered static-prefix-first, so `claims/new` is matched before `claims/:id` rather than
|
|
1154
|
+
* swallowed by it. Beyond that the authored order is kept, and a duplicate path — which the backend
|
|
1155
|
+
* rejects as an error, so it should never arrive — keeps its first occurrence.
|
|
1156
|
+
*/
|
|
1157
|
+
async function buildAppRoutes(source, renderRoute) {
|
|
1158
|
+
const appRoutes = await emitLevel(trieOf(source.routes), [], renderRoute);
|
|
1159
|
+
return [...appRoutes, ...(await moduleRoutesOf(source, renderRoute))];
|
|
1160
|
+
}
|
|
1161
|
+
async function moduleRoutesOf(source, renderRoute) {
|
|
1162
|
+
const mounted = [];
|
|
1163
|
+
for (const mount of source.modules ?? []) {
|
|
1164
|
+
if (!mount.basePath)
|
|
1165
|
+
continue;
|
|
1166
|
+
const routes = source.moduleRoutes?.[mount.moduleKey];
|
|
1167
|
+
if (routes) {
|
|
1168
|
+
if (routes.length)
|
|
1169
|
+
mounted.push({ path: mount.basePath, children: await emitLevel(trieOf(routes), [], renderRoute) });
|
|
1170
|
+
}
|
|
1171
|
+
else if (source.loadModule) {
|
|
1172
|
+
mounted.push(lazyMount(mount.moduleKey, mount.basePath, source.loadModule, renderRoute));
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
return mounted;
|
|
1176
|
+
}
|
|
1177
|
+
/**
|
|
1178
|
+
* A mount whose module the shell has not got yet: the same component-less parent at the base path, with
|
|
1179
|
+
* its children resolved on first navigation into it instead of now.
|
|
1180
|
+
*
|
|
1181
|
+
* What is deferred is the *metadata* — one `GET /modules/{key}` per module the user actually visits, so an
|
|
1182
|
+
* app that mounts twenty modules does not fetch twenty definitions to show its first screen. It is not a
|
|
1183
|
+
* deferred *bundle*: the widgets a module's routes render come from the widget registry and are part of
|
|
1184
|
+
* the application's own build either way.
|
|
1185
|
+
*
|
|
1186
|
+
* The module's transloco scope is registered here, on a component-less wrapper inside the loaded children,
|
|
1187
|
+
* because that is the first moment its name is known — the default is the module key, but a module may
|
|
1188
|
+
* name its own. The alias is spelled out, as everywhere in this workspace: transloco would otherwise
|
|
1189
|
+
* camel-case it and miss every key below it.
|
|
1190
|
+
*
|
|
1191
|
+
* The framework scopes are re-registered alongside it, for the reason `BASE_APP_ROUTES.authoringScopes()`
|
|
1192
|
+
* gives: a route that declares TRANSLOCO_SCOPE *replaces* the collection it inherits rather than adding to
|
|
1193
|
+
* it, because Angular does not merge `multi` providers across injectors. A module's routes render the same
|
|
1194
|
+
* generic screens as everything else — an ENTITY route reaches `BaseEntityTabsComponent`, which translates
|
|
1195
|
+
* `base_entity.tabs.*` — so naming only the module's scope here would leave every framework label below the
|
|
1196
|
+
* mount unresolved.
|
|
1197
|
+
*/
|
|
1198
|
+
function lazyMount(moduleKey, basePath, loadModule, renderRoute) {
|
|
1199
|
+
return {
|
|
1200
|
+
path: basePath,
|
|
1201
|
+
loadChildren: async () => {
|
|
1202
|
+
const definition = await loadModule(moduleKey);
|
|
1203
|
+
const children = await emitLevel(trieOf(definition?.routes), [], renderRoute);
|
|
1204
|
+
if (!definition || !children.length)
|
|
1205
|
+
return [];
|
|
1206
|
+
const scope = moduleTranslocoScope(definition);
|
|
1207
|
+
const providers = [
|
|
1208
|
+
provideTranslocoScope({ scope, alias: scope }, { scope: BASE_ENTITY_TRANSLOCO_SCOPE, alias: BASE_ENTITY_TRANSLOCO_SCOPE }, { scope: BASE_APP_TRANSLOCO_SCOPE, alias: BASE_APP_TRANSLOCO_SCOPE }),
|
|
1209
|
+
];
|
|
1210
|
+
return [{ path: '', providers, children }];
|
|
1211
|
+
},
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
/** The authored paths as a trie, so a route that is a prefix of another can be recognized as its parent. */
|
|
1215
|
+
function trieOf(routes) {
|
|
1216
|
+
const roots = [];
|
|
1217
|
+
for (const definition of routes ?? []) {
|
|
1218
|
+
const segments = segmentsOf(definition.path);
|
|
1219
|
+
if (!segments.length)
|
|
1220
|
+
continue;
|
|
1221
|
+
let level = roots;
|
|
1222
|
+
let node = { segment: '', children: roots };
|
|
1223
|
+
for (const segment of segments) {
|
|
1224
|
+
const existing = level.find((candidate) => candidate.segment === segment);
|
|
1225
|
+
node = existing ?? { segment, children: [] };
|
|
1226
|
+
if (!existing)
|
|
1227
|
+
level.push(node);
|
|
1228
|
+
level = node.children;
|
|
1229
|
+
}
|
|
1230
|
+
// First occurrence wins: a duplicate path is a validation error server-side, so the only way to see
|
|
1231
|
+
// one here is a definition that bypassed validation, and dropping the later row is the harmless read.
|
|
1232
|
+
node.definition ??= definition;
|
|
1233
|
+
}
|
|
1234
|
+
return roots;
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* The routes of one level. An authored node becomes a `Route` whose children are emitted below it; an
|
|
1238
|
+
* unauthored one contributes its segment to the paths of its descendants instead of a route of its own.
|
|
1239
|
+
*/
|
|
1240
|
+
async function emitLevel(nodes, prefix, renderRoute) {
|
|
1241
|
+
const routes = (await Promise.all(nodes.map((node) => emitNode(node, prefix, renderRoute)))).flat();
|
|
1242
|
+
return routes.sort((left, right) => staticDepthOf(right.path) - staticDepthOf(left.path));
|
|
1243
|
+
}
|
|
1244
|
+
async function emitNode(node, prefix, renderRoute) {
|
|
1245
|
+
const path = [...prefix, node.segment];
|
|
1246
|
+
if (!node.definition)
|
|
1247
|
+
return (await Promise.all(node.children.map((child) => emitNode(child, path, renderRoute)))).flat();
|
|
1248
|
+
const authoredChildren = await emitLevel(node.children, [], renderRoute);
|
|
1249
|
+
const rendered = await renderRoute(node.definition);
|
|
1250
|
+
const route = { ...rendered, path: path.join('/') };
|
|
1251
|
+
// The renderer's own children come first and the authored ones after, rather than the authored ones
|
|
1252
|
+
// replacing them. An `ENTITY` route contributes the List and Details routes of its entity *and* may be
|
|
1253
|
+
// the path prefix of other authored routes; overwriting would silently drop whichever of the two the
|
|
1254
|
+
// builder happened not to know about. The renderer's include an empty-path redirect, which `pathMatch:
|
|
1255
|
+
// 'full'` confines to the prefix's own URL, so it cannot shadow an authored sibling.
|
|
1256
|
+
const children = [...(rendered.children ?? []), ...authoredChildren];
|
|
1257
|
+
if (children.length)
|
|
1258
|
+
route.children = children;
|
|
1259
|
+
return [route];
|
|
1260
|
+
}
|
|
1261
|
+
function segmentsOf(path) {
|
|
1262
|
+
return (path ?? '').split('/').filter((segment) => segment.length > 0);
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* How many leading segments of a path are static. Sorting by it descending is what keeps a parameterized
|
|
1266
|
+
* route from shadowing its static siblings: `claims/new` scores 2, `claims/:id` scores 1, and Angular
|
|
1267
|
+
* matches in the order given.
|
|
1268
|
+
*/
|
|
1269
|
+
function staticDepthOf(path) {
|
|
1270
|
+
const segments = segmentsOf(path);
|
|
1271
|
+
const firstParameter = segments.findIndex((segment) => segment.startsWith(':') || segment === '**');
|
|
1272
|
+
return firstParameter === -1 ? segments.length : firstParameter;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/** Maps widget instances onto rows, dropping the ones a container places by id rather than in sequence. */
|
|
1276
|
+
function toWidgetRows(widgets, registry) {
|
|
1277
|
+
return (widgets ?? [])
|
|
1278
|
+
.filter((widget) => widget.placement !== WidgetPlacement.REFERENCED)
|
|
1279
|
+
.map((widget) => {
|
|
1280
|
+
const component = registry.get(widget.type);
|
|
1281
|
+
return { id: widget.id, type: widget.type, props: widget.props, ...(component ? { component } : {}) };
|
|
1282
|
+
});
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Renders the top-level widgets shared by routed content and static shell regions.
|
|
1286
|
+
*
|
|
1287
|
+
* A `WidgetInstance.type` is an open string on the contract and the server checks it for blankness alone —
|
|
1288
|
+
* it cannot know which components the hosting application registered. So an unregistered type is a state
|
|
1289
|
+
* this component has to render, not one it can rule out: it shows a placeholder naming the type, where
|
|
1290
|
+
* throwing would take the whole shell down over one mistyped widget in one region and leave the designer
|
|
1291
|
+
* with a blank page instead of a pointer to the row at fault.
|
|
1292
|
+
*/
|
|
1293
|
+
class WidgetListComponent {
|
|
1294
|
+
widgets = input([], /* @ts-ignore */
|
|
1295
|
+
...(ngDevMode ? [{ debugName: "widgets" }] : /* istanbul ignore next */ []));
|
|
1296
|
+
/** Optional: an application that registers no widget at all renders every instance as a placeholder. */
|
|
1297
|
+
registry = inject(WIDGET_REGISTRY, { optional: true }) ?? new Map();
|
|
1298
|
+
rows = computed(() => toWidgetRows(this.widgets(), this.registry), /* @ts-ignore */
|
|
1299
|
+
...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
1300
|
+
explain(type) {
|
|
1301
|
+
return `No component is registered for widget type '${type}' — check the provideWidget() calls of this application.`;
|
|
1302
|
+
}
|
|
1303
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: WidgetListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1304
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: WidgetListComponent, isStandalone: true, selector: "pp-widget-list", inputs: { widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
1305
|
+
@for (row of rows(); track row.id) {
|
|
1306
|
+
@if (row.component; as component) {
|
|
1307
|
+
<ng-container *ngComponentOutlet="component; inputs: row.props"></ng-container>
|
|
1308
|
+
} @else {
|
|
1309
|
+
<span class="pp-widget-list__unregistered" [attr.data-testid]="'unregistered-' + row.id" [title]="explain(row.type)">{{ row.type }}</span>
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
`, isInline: true, styles: [".pp-widget-list__unregistered{font-style:italic;opacity:.6}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }] });
|
|
1313
|
+
}
|
|
1314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: WidgetListComponent, decorators: [{
|
|
1315
|
+
type: Component,
|
|
1316
|
+
args: [{ selector: 'pp-widget-list', standalone: true, imports: [CommonModule], template: `
|
|
1317
|
+
@for (row of rows(); track row.id) {
|
|
1318
|
+
@if (row.component; as component) {
|
|
1319
|
+
<ng-container *ngComponentOutlet="component; inputs: row.props"></ng-container>
|
|
1320
|
+
} @else {
|
|
1321
|
+
<span class="pp-widget-list__unregistered" [attr.data-testid]="'unregistered-' + row.id" [title]="explain(row.type)">{{ row.type }}</span>
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
`, styles: [".pp-widget-list__unregistered{font-style:italic;opacity:.6}\n"] }]
|
|
1325
|
+
}], propDecorators: { widgets: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgets", required: false }] }] } });
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* Renders a route whose kind is WIDGETS: every STANDALONE instance in order, via NgComponentOutlet
|
|
1329
|
+
* resolved against WIDGET_REGISTRY. REFERENCED instances are skipped here for the same reason
|
|
1330
|
+
* DocumentEditorComponent skips them at its top level — they're placed by whichever STANDALONE
|
|
1331
|
+
* container widget names them in props.childIds, not by this component.
|
|
1332
|
+
*
|
|
1333
|
+
* Delegates the common widget rendering rule to WidgetListComponent, which is also used by the
|
|
1334
|
+
* header and footer regions in the application preview.
|
|
1335
|
+
*/
|
|
1336
|
+
class RouteWidgetsComponent {
|
|
1337
|
+
route = inject(ActivatedRoute);
|
|
1338
|
+
widgets = this.route.snapshot.data['widgets'] ?? [];
|
|
1339
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RouteWidgetsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1340
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: RouteWidgetsComponent, isStandalone: true, selector: "pp-route-widgets", ngImport: i0, template: `<pp-widget-list [widgets]="widgets" />`, isInline: true, dependencies: [{ kind: "component", type: WidgetListComponent, selector: "pp-widget-list", inputs: ["widgets"] }] });
|
|
1341
|
+
}
|
|
1342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RouteWidgetsComponent, decorators: [{
|
|
1343
|
+
type: Component,
|
|
1344
|
+
args: [{
|
|
1345
|
+
selector: 'pp-route-widgets',
|
|
1346
|
+
standalone: true,
|
|
1347
|
+
imports: [WidgetListComponent],
|
|
1348
|
+
template: `<pp-widget-list [widgets]="widgets" />`,
|
|
1349
|
+
}]
|
|
1350
|
+
}] });
|
|
1351
|
+
|
|
1352
|
+
/**
|
|
1353
|
+
* Fallback rendered by {@link AppRouteRenderer} for a route kind it doesn't yet know how to build a
|
|
1354
|
+
* real component for (today: DOCUMENT, and any kind value the frontend doesn't recognize). Exists so
|
|
1355
|
+
* an unfinished part of the shell fails visibly and specifically at the one route that hits it,
|
|
1356
|
+
* rather than throwing during route registration and taking the whole app down, or — worse — silently
|
|
1357
|
+
* rendering nothing and leaving a designer to wonder why their route is blank.
|
|
1358
|
+
*
|
|
1359
|
+
* Not an error state: an app definition is allowed to reference a route kind the frontend hasn't
|
|
1360
|
+
* caught up to yet, same spirit as a NavItem naming a route that hasn't been authored being a warning
|
|
1361
|
+
* rather than a validation failure elsewhere in this library.
|
|
1362
|
+
*/
|
|
1363
|
+
class RouteUnsupportedComponent {
|
|
1364
|
+
route = inject(ActivatedRoute);
|
|
1365
|
+
reason = computed(() => this.route.snapshot.data['reason'] ?? 'This route is not yet supported.', /* @ts-ignore */
|
|
1366
|
+
...(ngDevMode ? [{ debugName: "reason" }] : /* istanbul ignore next */ []));
|
|
1367
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RouteUnsupportedComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1368
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: RouteUnsupportedComponent, isStandalone: true, selector: "pp-route-unsupported", ngImport: i0, template: `<p class="pp-route-unsupported">{{ reason() }}</p>`, isInline: true });
|
|
1369
|
+
}
|
|
1370
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RouteUnsupportedComponent, decorators: [{
|
|
1371
|
+
type: Component,
|
|
1372
|
+
args: [{
|
|
1373
|
+
selector: 'pp-route-unsupported',
|
|
1374
|
+
standalone: true,
|
|
1375
|
+
template: `<p class="pp-route-unsupported">{{ reason() }}</p>`,
|
|
1376
|
+
}]
|
|
1377
|
+
}] });
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
* The route's `title`, preferring `translocoId` over the authored literal where the key resolves.
|
|
1381
|
+
*
|
|
1382
|
+
* A `ResolveFn` rather than a plain string because a title is resolved per navigation, which is late
|
|
1383
|
+
* enough for a lazily-loaded module scope to have arrived — the string form is captured when the route is
|
|
1384
|
+
* built, before the scope that owns the key is registered. `translateLabel` falls back to the literal, so
|
|
1385
|
+
* a route whose scope is absent or whose key is missing keeps the authored title.
|
|
1386
|
+
*/
|
|
1387
|
+
function titleOf(definition) {
|
|
1388
|
+
return () => translateLabel(inject(TranslocoService), definition.translocoId, definition.title);
|
|
1389
|
+
}
|
|
1390
|
+
/**
|
|
1391
|
+
* The `RouteRenderer` {@link buildAppRoutes} needs — turns one authored `RouteDefinition` into the
|
|
1392
|
+
* `Route` that actually renders it. Owns `component`, `data` and any `children` the kind calls for; `path`
|
|
1393
|
+
* is `buildAppRoutes`' to set, and the routes authored *below* this one are appended to whatever children
|
|
1394
|
+
* this contributes.
|
|
1395
|
+
*
|
|
1396
|
+
* A separate injectable rather than a free function because it is the one piece Preview and the eventual
|
|
1397
|
+
* production shell must call identically — same reasoning as `buildAppRoutes` itself being free of any
|
|
1398
|
+
* component.
|
|
1399
|
+
*
|
|
1400
|
+
* `roles` -> `canMatch` is deliberately not set here yet — see the note on this design's own deferral of
|
|
1401
|
+
* that question. `kind: DOCUMENT` is deliberately unhandled too: `BaseDocumentContainerComponent` is an
|
|
1402
|
+
* authoring component wired to one document via an injected store, not something parameterizable by a
|
|
1403
|
+
* route's `documentSlug` at runtime. Rendering a document read-only inside a live app is its own small
|
|
1404
|
+
* design question and this falls through to {@link RouteUnsupportedComponent} rather than guessing.
|
|
1405
|
+
*/
|
|
1406
|
+
class AppRouteRenderer {
|
|
1407
|
+
entityScreens = inject(EntityScreenResolver);
|
|
1408
|
+
render = async (definition) => {
|
|
1409
|
+
switch (definition.kind) {
|
|
1410
|
+
case 'WIDGETS':
|
|
1411
|
+
return { component: RouteWidgetsComponent, title: titleOf(definition), data: { widgets: definition.widgets } };
|
|
1412
|
+
case 'ENTITY':
|
|
1413
|
+
return this.entityRoute(definition);
|
|
1414
|
+
case 'DOCUMENT':
|
|
1415
|
+
return {
|
|
1416
|
+
component: RouteUnsupportedComponent,
|
|
1417
|
+
title: titleOf(definition),
|
|
1418
|
+
data: { reason: `DOCUMENT routes are not yet supported (route '${definition.path}')` },
|
|
1419
|
+
};
|
|
1420
|
+
default:
|
|
1421
|
+
return {
|
|
1422
|
+
component: RouteUnsupportedComponent,
|
|
1423
|
+
title: titleOf(definition),
|
|
1424
|
+
data: { reason: `Unknown route kind '${String(definition.kind)}' (route '${definition.path}')` },
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
/**
|
|
1429
|
+
* An `ENTITY` route: base-entity's generated screens, mounted at the authored path.
|
|
1430
|
+
*
|
|
1431
|
+
* Both halves belong to base-entity and are called rather than reimplemented here: `EntityScreenResolver`
|
|
1432
|
+
* answers for an entity with a compile-time facade and for one that exists only as a `BaseEntityDefinition`
|
|
1433
|
+
* alike, and `entityScreenRoute` owns the URL shape those screens need. What is left is exactly the
|
|
1434
|
+
* *application definition* concern — when the routes are built, the authored title, and the authored
|
|
1435
|
+
* `entityMode` / `rsqlFilter`.
|
|
1436
|
+
*
|
|
1437
|
+
* The descriptor is resolved **before** the route exists, which is what makes the route either complete or
|
|
1438
|
+
* a leaf. An entity nothing answers to keeps the leaf, whose component says so at the URL the nav item
|
|
1439
|
+
* links to; a legitimate state, since an `AppDefinition` may name an entity that has been renamed or one
|
|
1440
|
+
* whose definitions this deployment's backend does not serve.
|
|
1441
|
+
*
|
|
1442
|
+
* `entityMode` is passed along but not applied. A `DETAILS` route lands on the list, from which the row is
|
|
1443
|
+
* one click away: making it open a form directly means carrying the authored route's own `:id` into the
|
|
1444
|
+
* child URL, and the `RedirectFunction` that would do it receives a *partial* route snapshot whose
|
|
1445
|
+
* parameter inheritance at recognition time is not something to bet a navigation on. Deferred with `roles`
|
|
1446
|
+
* and `rsqlFilter` rather than guessed at.
|
|
1447
|
+
*/
|
|
1448
|
+
async entityRoute(definition) {
|
|
1449
|
+
const screens = await this.entityScreens.resolve(definition.entityName);
|
|
1450
|
+
const route = entityScreenRoute({
|
|
1451
|
+
entityName: definition.entityName,
|
|
1452
|
+
screens,
|
|
1453
|
+
hostPath: definition.path,
|
|
1454
|
+
data: { entityMode: definition.entityMode, rsqlFilter: definition.rsqlFilter },
|
|
1455
|
+
});
|
|
1456
|
+
return { ...route, title: titleOf(definition) };
|
|
1457
|
+
}
|
|
1458
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRouteRenderer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1459
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRouteRenderer, providedIn: 'root' });
|
|
1460
|
+
}
|
|
1461
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRouteRenderer, decorators: [{
|
|
1462
|
+
type: Injectable,
|
|
1463
|
+
args: [{ providedIn: 'root' }]
|
|
1464
|
+
}] });
|
|
1465
|
+
|
|
1466
|
+
/**
|
|
1467
|
+
* A region has a facade like any other entity — that is what gives it a store, and so a working list and
|
|
1468
|
+
* form. Its repository reads and writes the `App Definition` document instead of an endpoint of its own,
|
|
1469
|
+
* because the contract nests `regions` inside that document.
|
|
1470
|
+
*/
|
|
1471
|
+
class AppRegionFacade extends EmbeddedEntityFacade {
|
|
1472
|
+
entityType = RegionDefinition;
|
|
1473
|
+
createDescriptor() {
|
|
1474
|
+
return createRegionDefinitionDescriptor();
|
|
1475
|
+
}
|
|
1476
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRegionFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1477
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRegionFacade });
|
|
1478
|
+
}
|
|
1479
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRegionFacade, decorators: [{
|
|
1480
|
+
type: Injectable
|
|
1481
|
+
}] });
|
|
1482
|
+
|
|
1483
|
+
/**
|
|
1484
|
+
* `GET .../app-definitions/{appId}/layout` is a read-only projection for the run-time shell, not a write
|
|
1485
|
+
* endpoint — a route is authored inside the `App Definition` document, so its store goes through that
|
|
1486
|
+
* document like every other embedded child of the graph.
|
|
1487
|
+
*/
|
|
1488
|
+
class AppRouteFacade extends EmbeddedEntityFacade {
|
|
1489
|
+
entityType = RouteDefinition;
|
|
1490
|
+
createDescriptor() {
|
|
1491
|
+
return createRouteDefinitionDescriptor();
|
|
1492
|
+
}
|
|
1493
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRouteFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1494
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRouteFacade });
|
|
1495
|
+
}
|
|
1496
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRouteFacade, decorators: [{
|
|
1497
|
+
type: Injectable
|
|
1498
|
+
}] });
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* A widget sits under a region, a page or another widget, and one facade serves all three: which owner's
|
|
1502
|
+
* rows its store reads is decided by the route that is open, not by the facade.
|
|
1503
|
+
*/
|
|
1504
|
+
class AppWidgetFacade extends EmbeddedEntityFacade {
|
|
1505
|
+
entityType = WidgetInstance;
|
|
1506
|
+
createDescriptor() {
|
|
1507
|
+
return createWidgetInstanceDescriptor();
|
|
1508
|
+
}
|
|
1509
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppWidgetFacade, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1510
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppWidgetFacade });
|
|
1511
|
+
}
|
|
1512
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppWidgetFacade, decorators: [{
|
|
1513
|
+
type: Injectable
|
|
1514
|
+
}] });
|
|
1515
|
+
|
|
1516
|
+
/**
|
|
1517
|
+
* `sidenav-left` because a definition that declares no preset is the common case — a freshly created
|
|
1518
|
+
* app — and the framework's own screens are left-sidenav. The same value the contract documents as
|
|
1519
|
+
* its default.
|
|
1520
|
+
*/
|
|
1521
|
+
const DEFAULT_PRESET = 'sidenav-left';
|
|
1522
|
+
/** Matches the contract's default and Material's own, so an unset value behaves as `mat-sidenav` does. */
|
|
1523
|
+
const DEFAULT_SIDENAV_MODE = 'side';
|
|
1524
|
+
/**
|
|
1525
|
+
* Resolves the layout of one definition.
|
|
1526
|
+
*
|
|
1527
|
+
* Each field is read from the flattened property first and from `layout` second. For an entity that
|
|
1528
|
+
* came through {@link AppDefinitionMapper} the two always agree — `fromDto` copies `layout.preset`
|
|
1529
|
+
* onto `preset`, and `toDto` merges the flattened value back — so the fallback is there for the
|
|
1530
|
+
* definitions nothing mapped: `new AppDefinition({ layout: { preset: 'top-nav' } })` is a legal
|
|
1531
|
+
* construction that leaves `preset` undefined, and a shell that ignored `layout` would silently
|
|
1532
|
+
* render the default instead.
|
|
1533
|
+
*
|
|
1534
|
+
* `sidenavCollapsible` and `sidenavOpenByDefault` need no such fallback: they are non-optional on the
|
|
1535
|
+
* entity and the constructor defaults them, so there is always a value to read.
|
|
1536
|
+
*/
|
|
1537
|
+
function layoutOf(definition) {
|
|
1538
|
+
const preset = definition?.preset ?? definition?.layout?.preset ?? DEFAULT_PRESET;
|
|
1539
|
+
return {
|
|
1540
|
+
preset,
|
|
1541
|
+
sidenavMode: definition?.sidenavMode ?? definition?.layout?.sidenavMode ?? DEFAULT_SIDENAV_MODE,
|
|
1542
|
+
sidenavPosition: preset === 'sidenav-right' ? 'end' : 'start',
|
|
1543
|
+
hasSidenav: preset !== 'top-nav',
|
|
1544
|
+
sidenavOpened: definition?.sidenavOpenByDefault ?? true,
|
|
1545
|
+
sidenavCollapsible: definition?.sidenavCollapsible ?? true,
|
|
1546
|
+
contentMaxWidth: definition?.contentMaxWidth ?? definition?.layout?.contentMaxWidth,
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* The `--pp-*` overrides of one definition, as a style object to bind on the shell's host element.
|
|
1551
|
+
*
|
|
1552
|
+
* Custom properties cascade, so setting them on one element re-tints every framework surface below it
|
|
1553
|
+
* — which is what makes a themed preview possible at all without an iframe. `materialTheme` and
|
|
1554
|
+
* `colorScheme` are deliberately **not** handled: those want `:root` and a Material theme class, and
|
|
1555
|
+
* neither scopes to a subtree. They belong to the standalone runtime host, where the shell owns the
|
|
1556
|
+
* document.
|
|
1557
|
+
*
|
|
1558
|
+
* Keys are passed through untouched, including their leading `--`: Angular's `[style]` binding treats
|
|
1559
|
+
* a custom property as a custom property, and the contract calls these overrides of the tokens in
|
|
1560
|
+
* `pp-colors.css`, so anything else would be this function inventing a naming rule.
|
|
1561
|
+
*/
|
|
1562
|
+
function themeVarsOf(definition) {
|
|
1563
|
+
// The nested object first, so an override the form actually edited wins over the one the server sent.
|
|
1564
|
+
return { ...definition?.theme?.tokenOverrides, ...definition?.tokenOverrides };
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* The route paths this definition accounts for: its own routes' paths, plus the base path of every module
|
|
1568
|
+
* it mounts.
|
|
1569
|
+
*
|
|
1570
|
+
* A module's *own* routes are deliberately absent. They live in the module's definition, which the router
|
|
1571
|
+
* fetches only when something navigates into the mount, so they cannot be known here — which is why the
|
|
1572
|
+
* consumer of this list treats a path *below* a known one as accounted for. See `toNavRows`.
|
|
1573
|
+
*/
|
|
1574
|
+
function knownRoutePathsOf(definition) {
|
|
1575
|
+
const declared = (definition?.routes ?? []).map((route) => route.path);
|
|
1576
|
+
const mounted = (definition?.modules ?? []).map((mount) => mount.basePath);
|
|
1577
|
+
return [...declared, ...mounted].filter((path) => !!path);
|
|
1578
|
+
}
|
|
1579
|
+
/** The scheme a definition that names none is rendered in, matching the contract's own default. */
|
|
1580
|
+
const DEFAULT_COLOR_SCHEME = 'light';
|
|
1581
|
+
/**
|
|
1582
|
+
* Which of the scoped Material themes in `app-shell.component.scss` the shell should wear, as the class
|
|
1583
|
+
* names that select it — `pp-theme-<materialTheme> pp-scheme-<colorScheme>`.
|
|
1584
|
+
*
|
|
1585
|
+
* **Empty unless a `materialTheme` is named.** A `colorScheme` on its own would be half a theme: it
|
|
1586
|
+
* decides which side of the stylesheet's `light-dark()` values is used, and with no theme block applied
|
|
1587
|
+
* there are none — so it would flip native controls to dark while every Material component kept the
|
|
1588
|
+
* surrounding application's colours. Inheriting the host's theme untouched is the honest reading of a
|
|
1589
|
+
* definition that has not chosen one, and matches the shell's rule of never inventing what was not
|
|
1590
|
+
* authored.
|
|
1591
|
+
*/
|
|
1592
|
+
function themeClassOf(definition) {
|
|
1593
|
+
const materialTheme = definition?.materialTheme ?? definition?.theme?.materialTheme;
|
|
1594
|
+
if (!materialTheme)
|
|
1595
|
+
return '';
|
|
1596
|
+
const colorScheme = definition?.colorScheme ?? definition?.theme?.colorScheme ?? DEFAULT_COLOR_SCHEME;
|
|
1597
|
+
return `pp-theme-${materialTheme} pp-scheme-${colorScheme}`;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
/**
|
|
1601
|
+
* The `footer` region: the widgets it declares, and nothing else. The contract gives a footer no field
|
|
1602
|
+
* beyond `widgets`, so this stays a thin styled host over {@link WidgetListComponent} — separate from
|
|
1603
|
+
* the header only because the two are different slots with different styling, not because they share
|
|
1604
|
+
* no logic.
|
|
1605
|
+
*/
|
|
1606
|
+
class RegionFooterComponent {
|
|
1607
|
+
widgets = input([], /* @ts-ignore */
|
|
1608
|
+
...(ngDevMode ? [{ debugName: "widgets" }] : /* istanbul ignore next */ []));
|
|
1609
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RegionFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1610
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.1", type: RegionFooterComponent, isStandalone: true, selector: "pp-region-footer", inputs: { widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `<pp-widget-list [widgets]="widgets()" />`, isInline: true, styles: [":host{align-items:center;background-color:var(--pp-surface-header);display:flex;gap:16px;justify-content:space-between;padding:8px 16px}pp-widget-list{align-items:center;display:flex;gap:8px}\n"], dependencies: [{ kind: "component", type: WidgetListComponent, selector: "pp-widget-list", inputs: ["widgets"] }] });
|
|
1611
|
+
}
|
|
1612
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RegionFooterComponent, decorators: [{
|
|
1613
|
+
type: Component,
|
|
1614
|
+
args: [{ selector: 'pp-region-footer', standalone: true, imports: [WidgetListComponent], template: `<pp-widget-list [widgets]="widgets()" />`, styles: [":host{align-items:center;background-color:var(--pp-surface-header);display:flex;gap:16px;justify-content:space-between;padding:8px 16px}pp-widget-list{align-items:center;display:flex;gap:8px}\n"] }]
|
|
1615
|
+
}], propDecorators: { widgets: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgets", required: false }] }] } });
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* The `header` region: the application's brand block and the widgets the region declares.
|
|
1619
|
+
*
|
|
1620
|
+
* The brand is the shell's contribution rather than the region's — `logoUrl` and the title come from
|
|
1621
|
+
* the definition's theme and name, not from anything authored on the region — which is why they are
|
|
1622
|
+
* inputs the renderer fills instead of something this component reaches into a store for. That keeps
|
|
1623
|
+
* it renderable from a spec with three inputs and no providers.
|
|
1624
|
+
*
|
|
1625
|
+
* Nav items are *not* handled here. Under the `top-nav` preset the shell places the `sidenav` region's
|
|
1626
|
+
* nav beside this component in the same row, so that a `top-nav` app with no header region is still
|
|
1627
|
+
* navigable — see {@link AppShellComponent}.
|
|
1628
|
+
*/
|
|
1629
|
+
class RegionHeaderComponent {
|
|
1630
|
+
title = input('', /* @ts-ignore */
|
|
1631
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
1632
|
+
logoUrl = input(undefined, /* @ts-ignore */
|
|
1633
|
+
...(ngDevMode ? [{ debugName: "logoUrl" }] : /* istanbul ignore next */ []));
|
|
1634
|
+
widgets = input([], /* @ts-ignore */
|
|
1635
|
+
...(ngDevMode ? [{ debugName: "widgets" }] : /* istanbul ignore next */ []));
|
|
1636
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RegionHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1637
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: RegionHeaderComponent, isStandalone: true, selector: "pp-region-header", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, logoUrl: { classPropertyName: "logoUrl", publicName: "logoUrl", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
1638
|
+
<div class="pp-region-header__brand">
|
|
1639
|
+
@if (logoUrl(); as logo) {
|
|
1640
|
+
<img class="pp-region-header__logo" [src]="logo" [alt]="title()" />
|
|
1641
|
+
}
|
|
1642
|
+
<h2 class="pp-region-header__title">{{ title() }}</h2>
|
|
1643
|
+
</div>
|
|
1644
|
+
<pp-widget-list [widgets]="widgets()" />
|
|
1645
|
+
`, isInline: true, styles: [":host{align-items:center;background-color:var(--pp-surface-header);display:flex;flex:1;gap:16px;justify-content:space-between;padding:8px 16px}.pp-region-header__brand{align-items:center;display:flex;gap:12px;min-width:0}.pp-region-header__logo{display:block;max-height:48px;max-width:160px;object-fit:contain}.pp-region-header__title{margin:0}pp-widget-list{align-items:center;display:flex;gap:8px}\n"], dependencies: [{ kind: "component", type: WidgetListComponent, selector: "pp-widget-list", inputs: ["widgets"] }] });
|
|
1646
|
+
}
|
|
1647
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RegionHeaderComponent, decorators: [{
|
|
1648
|
+
type: Component,
|
|
1649
|
+
args: [{ selector: 'pp-region-header', standalone: true, imports: [WidgetListComponent], template: `
|
|
1650
|
+
<div class="pp-region-header__brand">
|
|
1651
|
+
@if (logoUrl(); as logo) {
|
|
1652
|
+
<img class="pp-region-header__logo" [src]="logo" [alt]="title()" />
|
|
1653
|
+
}
|
|
1654
|
+
<h2 class="pp-region-header__title">{{ title() }}</h2>
|
|
1655
|
+
</div>
|
|
1656
|
+
<pp-widget-list [widgets]="widgets()" />
|
|
1657
|
+
`, styles: [":host{align-items:center;background-color:var(--pp-surface-header);display:flex;flex:1;gap:16px;justify-content:space-between;padding:8px 16px}.pp-region-header__brand{align-items:center;display:flex;gap:12px;min-width:0}.pp-region-header__logo{display:block;max-height:48px;max-width:160px;object-fit:contain}.pp-region-header__title{margin:0}pp-widget-list{align-items:center;display:flex;gap:8px}\n"] }]
|
|
1658
|
+
}], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], logoUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "logoUrl", required: false }] }], widgets: [{ type: i0.Input, args: [{ isSignal: true, alias: "widgets", required: false }] }] } });
|
|
1659
|
+
|
|
1660
|
+
/**
|
|
1661
|
+
* Maps the authored nav tree onto rows, resolving each `routePath` against the paths the definition
|
|
1662
|
+
* accounts for.
|
|
1663
|
+
*
|
|
1664
|
+
* A path counts as resolved if it equals a declared route's path *or* sits below one — below a declared
|
|
1665
|
+
* route, or below a mounted module's base path. The prefix rule is what keeps this from crying wolf: the
|
|
1666
|
+
* routes inside a module live in the module's own definition, which is fetched lazily and is not knowable
|
|
1667
|
+
* here, so `back-office/lines` has to be trusted on the strength of the `back-office` mount alone.
|
|
1668
|
+
*
|
|
1669
|
+
* A group node — no `routePath`, children instead — is not unresolved. It expands rather than navigates.
|
|
1670
|
+
*/
|
|
1671
|
+
function toNavRows(items, knownPaths) {
|
|
1672
|
+
return (items ?? []).map((item) => {
|
|
1673
|
+
const routePath = normalize(item.routePath);
|
|
1674
|
+
const resolved = routePath !== undefined && knownPaths.some((known) => routePath === known || routePath.startsWith(`${known}/`));
|
|
1675
|
+
return {
|
|
1676
|
+
id: item.id,
|
|
1677
|
+
label: item.label,
|
|
1678
|
+
translocoId: item.translocoId,
|
|
1679
|
+
icon: item.icon,
|
|
1680
|
+
...(resolved ? { routePath } : {}),
|
|
1681
|
+
unresolved: routePath !== undefined && !resolved,
|
|
1682
|
+
children: toNavRows(item.children, knownPaths),
|
|
1683
|
+
};
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* A route path as it is compared and linked: no surrounding slashes, since `RouteDefinition.path` is
|
|
1688
|
+
* relative with no leading slash by contract and a nav item may still have been authored with one.
|
|
1689
|
+
* Whitespace-only counts as absent — an item mid-authoring is a group node, not a broken link.
|
|
1690
|
+
*/
|
|
1691
|
+
function normalize(routePath) {
|
|
1692
|
+
const trimmed = routePath?.trim().replace(/^\/+|\/+$/g, '').trim();
|
|
1693
|
+
return trimmed ? trimmed : undefined;
|
|
1694
|
+
}
|
|
1695
|
+
/**
|
|
1696
|
+
* Renders the nav tree of the `sidenav` region — in the sidenav for the two sidenav presets, and
|
|
1697
|
+
* horizontally in the header row for `top-nav`. One component for both, because the tree and its
|
|
1698
|
+
* grouping rules are the same either way and only the axis differs.
|
|
1699
|
+
*
|
|
1700
|
+
* Links are relative, which is what makes the same component work in the designer's Preview tab and in a
|
|
1701
|
+
* standalone deployment: `routerLink="orders"` resolves against whichever route hosts the shell, so it
|
|
1702
|
+
* becomes `…/app-definition/demo/preview/orders` under the designer and `/orders` under a runtime host,
|
|
1703
|
+
* with nothing here needing to know which.
|
|
1704
|
+
*
|
|
1705
|
+
* An item whose target nothing accounts for is rendered as an inert row with a title, not as a link that
|
|
1706
|
+
* would navigate into a 404. A dangling `routePath` is a *warning* server-side by design — it may name a
|
|
1707
|
+
* route of a module authored later — so the shell has to render it as something rather than reject it.
|
|
1708
|
+
*
|
|
1709
|
+
* `translocoId` is preferred over `label` where it resolves, through the impure `ppLabel` pipe — so a row
|
|
1710
|
+
* shows the authored literal until the scope that owns its key has loaded, then re-renders. A nav label is
|
|
1711
|
+
* *tenant* content living under a module's own scope, which for an authored module is served by the
|
|
1712
|
+
* backend rather than shipped as an asset; `ppLabel` falling back is the normal case, not a defect.
|
|
1713
|
+
*/
|
|
1714
|
+
class RegionNavComponent {
|
|
1715
|
+
navItems = input([], /* @ts-ignore */
|
|
1716
|
+
...(ngDevMode ? [{ debugName: "navItems" }] : /* istanbul ignore next */ []));
|
|
1717
|
+
orientation = input('vertical', /* @ts-ignore */
|
|
1718
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
1719
|
+
/** Route paths the definition accounts for, supplied by `AppRegionRenderer`. See {@link toNavRows}. */
|
|
1720
|
+
knownPaths = input([], /* @ts-ignore */
|
|
1721
|
+
...(ngDevMode ? [{ debugName: "knownPaths" }] : /* istanbul ignore next */ []));
|
|
1722
|
+
rows = computed(() => toNavRows(this.navItems(), this.knownPaths()), /* @ts-ignore */
|
|
1723
|
+
...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
1724
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RegionNavComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1725
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: RegionNavComponent, isStandalone: true, selector: "pp-region-nav", inputs: { navItems: { classPropertyName: "navItems", publicName: "navItems", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, knownPaths: { classPropertyName: "knownPaths", publicName: "knownPaths", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
1726
|
+
<mat-nav-list [class.pp-region-nav--horizontal]="orientation() === 'horizontal'">
|
|
1727
|
+
<ng-container *ngTemplateOutlet="rowList; context: { $implicit: rows(), depth: 0 }"></ng-container>
|
|
1728
|
+
</mat-nav-list>
|
|
1729
|
+
|
|
1730
|
+
<!--
|
|
1731
|
+
Recursive through ngTemplateOutlet: a NavItem nests in itself, so the depth is not knowable here.
|
|
1732
|
+
|
|
1733
|
+
The icon and the title are spelled out in both branches rather than shared through one more template.
|
|
1734
|
+
A list item sorts its content with an ng-content selector on [matListItemIcon], and a projection
|
|
1735
|
+
selector is matched at compile time against the element's own children — so anything arriving through
|
|
1736
|
+
ngTemplateOutlet is one opaque node to it, and lands in the unprojected slot beside the title. That is
|
|
1737
|
+
what put the icon on a line of its own above every label.
|
|
1738
|
+
-->
|
|
1739
|
+
<ng-template #rowList let-rows let-depth="depth">
|
|
1740
|
+
@for (row of rows; track row.id) {
|
|
1741
|
+
@if (row.routePath; as routePath) {
|
|
1742
|
+
<!-- An anchor, not a bare list item: RouterLink only writes href onto one, and without it the row
|
|
1743
|
+
is not a real link — no middle-click, no open-in-new-tab, no keyboard activation. -->
|
|
1744
|
+
<a
|
|
1745
|
+
mat-list-item
|
|
1746
|
+
class="pp-region-nav__item"
|
|
1747
|
+
[routerLink]="routePath"
|
|
1748
|
+
routerLinkActive="pp-region-nav__item--active"
|
|
1749
|
+
[style.padding-inline-start.px]="depth * 12"
|
|
1750
|
+
[attr.data-testid]="'nav-' + row.id"
|
|
1751
|
+
>
|
|
1752
|
+
@if (row.icon) {
|
|
1753
|
+
<span matListItemIcon class="material-symbols-outlined">{{ row.icon }}</span>
|
|
1754
|
+
}
|
|
1755
|
+
<div matListItemTitle>{{ row.translocoId | ppLabel: row.label }}</div>
|
|
1756
|
+
</a>
|
|
1757
|
+
} @else {
|
|
1758
|
+
<mat-list-item
|
|
1759
|
+
class="pp-region-nav__item"
|
|
1760
|
+
[class.pp-region-nav__item--unresolved]="row.unresolved"
|
|
1761
|
+
[title]="row.unresolved ? 'No route of this application matches this navigation entry yet.' : ''"
|
|
1762
|
+
[style.padding-inline-start.px]="depth * 12"
|
|
1763
|
+
[attr.data-testid]="'nav-' + row.id"
|
|
1764
|
+
>
|
|
1765
|
+
@if (row.icon) {
|
|
1766
|
+
<span matListItemIcon class="material-symbols-outlined">{{ row.icon }}</span>
|
|
1767
|
+
}
|
|
1768
|
+
<div matListItemTitle>{{ row.translocoId | ppLabel: row.label }}</div>
|
|
1769
|
+
</mat-list-item>
|
|
1770
|
+
}
|
|
1771
|
+
@if (row.children.length) {
|
|
1772
|
+
<ng-container *ngTemplateOutlet="rowList; context: { $implicit: row.children, depth: depth + 1 }"></ng-container>
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
</ng-template>
|
|
1776
|
+
`, isInline: true, styles: [":host{display:block}.pp-region-nav--horizontal{display:flex;padding-top:0}.pp-region-nav--horizontal .pp-region-nav__item{width:auto}.pp-region-nav__item--unresolved{font-style:italic;opacity:.6}\n"], dependencies: [{ kind: "component", type: MatNavList, selector: "mat-nav-list", exportAs: ["matNavList"] }, { kind: "component", type: MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "directive", type: MatListItemIcon, selector: "[matListItemIcon]" }, { kind: "directive", type: MatListItemTitle, selector: "[matListItemTitle]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "directive", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "pipe", type: EntityLabelPipe, name: "ppLabel" }] });
|
|
1777
|
+
}
|
|
1778
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RegionNavComponent, decorators: [{
|
|
1779
|
+
type: Component,
|
|
1780
|
+
args: [{ selector: 'pp-region-nav', standalone: true, imports: [MatNavList, MatListItem, MatListItemIcon, MatListItemTitle, NgTemplateOutlet, RouterLink, RouterLinkActive, EntityLabelPipe], template: `
|
|
1781
|
+
<mat-nav-list [class.pp-region-nav--horizontal]="orientation() === 'horizontal'">
|
|
1782
|
+
<ng-container *ngTemplateOutlet="rowList; context: { $implicit: rows(), depth: 0 }"></ng-container>
|
|
1783
|
+
</mat-nav-list>
|
|
1784
|
+
|
|
1785
|
+
<!--
|
|
1786
|
+
Recursive through ngTemplateOutlet: a NavItem nests in itself, so the depth is not knowable here.
|
|
1787
|
+
|
|
1788
|
+
The icon and the title are spelled out in both branches rather than shared through one more template.
|
|
1789
|
+
A list item sorts its content with an ng-content selector on [matListItemIcon], and a projection
|
|
1790
|
+
selector is matched at compile time against the element's own children — so anything arriving through
|
|
1791
|
+
ngTemplateOutlet is one opaque node to it, and lands in the unprojected slot beside the title. That is
|
|
1792
|
+
what put the icon on a line of its own above every label.
|
|
1793
|
+
-->
|
|
1794
|
+
<ng-template #rowList let-rows let-depth="depth">
|
|
1795
|
+
@for (row of rows; track row.id) {
|
|
1796
|
+
@if (row.routePath; as routePath) {
|
|
1797
|
+
<!-- An anchor, not a bare list item: RouterLink only writes href onto one, and without it the row
|
|
1798
|
+
is not a real link — no middle-click, no open-in-new-tab, no keyboard activation. -->
|
|
1799
|
+
<a
|
|
1800
|
+
mat-list-item
|
|
1801
|
+
class="pp-region-nav__item"
|
|
1802
|
+
[routerLink]="routePath"
|
|
1803
|
+
routerLinkActive="pp-region-nav__item--active"
|
|
1804
|
+
[style.padding-inline-start.px]="depth * 12"
|
|
1805
|
+
[attr.data-testid]="'nav-' + row.id"
|
|
1806
|
+
>
|
|
1807
|
+
@if (row.icon) {
|
|
1808
|
+
<span matListItemIcon class="material-symbols-outlined">{{ row.icon }}</span>
|
|
1809
|
+
}
|
|
1810
|
+
<div matListItemTitle>{{ row.translocoId | ppLabel: row.label }}</div>
|
|
1811
|
+
</a>
|
|
1812
|
+
} @else {
|
|
1813
|
+
<mat-list-item
|
|
1814
|
+
class="pp-region-nav__item"
|
|
1815
|
+
[class.pp-region-nav__item--unresolved]="row.unresolved"
|
|
1816
|
+
[title]="row.unresolved ? 'No route of this application matches this navigation entry yet.' : ''"
|
|
1817
|
+
[style.padding-inline-start.px]="depth * 12"
|
|
1818
|
+
[attr.data-testid]="'nav-' + row.id"
|
|
1819
|
+
>
|
|
1820
|
+
@if (row.icon) {
|
|
1821
|
+
<span matListItemIcon class="material-symbols-outlined">{{ row.icon }}</span>
|
|
1822
|
+
}
|
|
1823
|
+
<div matListItemTitle>{{ row.translocoId | ppLabel: row.label }}</div>
|
|
1824
|
+
</mat-list-item>
|
|
1825
|
+
}
|
|
1826
|
+
@if (row.children.length) {
|
|
1827
|
+
<ng-container *ngTemplateOutlet="rowList; context: { $implicit: row.children, depth: depth + 1 }"></ng-container>
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
</ng-template>
|
|
1831
|
+
`, styles: [":host{display:block}.pp-region-nav--horizontal{display:flex;padding-top:0}.pp-region-nav--horizontal .pp-region-nav__item{width:auto}.pp-region-nav__item--unresolved{font-style:italic;opacity:.6}\n"] }]
|
|
1832
|
+
}], propDecorators: { navItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "navItems", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], knownPaths: [{ type: i0.Input, args: [{ isSignal: true, alias: "knownPaths", required: false }] }] } });
|
|
1833
|
+
|
|
1834
|
+
/**
|
|
1835
|
+
* Turns one authored `RegionDefinition` into the {@link RegionView} that renders it.
|
|
1836
|
+
*
|
|
1837
|
+
* An injectable rather than a free function, though stateless today, for the reason `AppRouteRenderer`
|
|
1838
|
+
* is one: the Preview tab and the eventual standalone runtime host must resolve regions *identically*,
|
|
1839
|
+
* so there has to be exactly one of these, and a constructor parameter is a cheaper way to grow it than
|
|
1840
|
+
* a rewrite.
|
|
1841
|
+
*/
|
|
1842
|
+
class AppRegionRenderer {
|
|
1843
|
+
render = (region, definition) => {
|
|
1844
|
+
switch (region.type) {
|
|
1845
|
+
case 'header':
|
|
1846
|
+
return {
|
|
1847
|
+
slot: 'header',
|
|
1848
|
+
component: RegionHeaderComponent,
|
|
1849
|
+
// Brand from the definition, widgets from the region: the two halves of a header row come
|
|
1850
|
+
// from different levels of the document, and only this function knows both.
|
|
1851
|
+
inputs: { title: definition?.name ?? '', logoUrl: definition?.logoUrl ?? definition?.theme?.logoUrl, widgets: region.widgets ?? [] },
|
|
1852
|
+
};
|
|
1853
|
+
case 'footer':
|
|
1854
|
+
return { slot: 'footer', component: RegionFooterComponent, inputs: { widgets: region.widgets ?? [] } };
|
|
1855
|
+
case 'sidenav':
|
|
1856
|
+
// `orientation` is left at the component's own default; the shell overrides it for `top-nav`,
|
|
1857
|
+
// because the axis follows the layout preset rather than anything authored on the region.
|
|
1858
|
+
// `knownPaths` comes from the definition rather than the region: whether a nav entry resolves is a
|
|
1859
|
+
// question about the *application's* routes, which only this function can see from here.
|
|
1860
|
+
return { slot: 'sidenav', component: RegionNavComponent, inputs: { navItems: region.navItems ?? [], knownPaths: knownRoutePathsOf(definition) } };
|
|
1861
|
+
default:
|
|
1862
|
+
// A region whose `type` the designer has not chosen yet. `RegionDefinition.type` is
|
|
1863
|
+
// `RegionType | undefined` precisely because a row exists before its dropdown is touched, and
|
|
1864
|
+
// the preview renders it *while* that is happening — so this is the normal path, not an error
|
|
1865
|
+
// one. Omitting it is quieter than a placeholder, and the form already shows the empty row.
|
|
1866
|
+
return undefined;
|
|
1867
|
+
}
|
|
1868
|
+
};
|
|
1869
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRegionRenderer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1870
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRegionRenderer, providedIn: 'root' });
|
|
1871
|
+
}
|
|
1872
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppRegionRenderer, decorators: [{
|
|
1873
|
+
type: Injectable,
|
|
1874
|
+
args: [{ providedIn: 'root' }]
|
|
1875
|
+
}] });
|
|
1876
|
+
|
|
1877
|
+
/**
|
|
1878
|
+
* The run-time shell of a metadata-defined application: the chrome an `AppDefinition` describes, with a
|
|
1879
|
+
* `<router-outlet>` where its routes render.
|
|
1880
|
+
*
|
|
1881
|
+
* **This is the application, not a picture of one.** `AppPreviewComponent` hosts it so that the Preview
|
|
1882
|
+
* tab shows the real thing, and the standalone runtime host will mount the same component — which is
|
|
1883
|
+
* the whole point of it being a component with one input rather than something assembled inside the
|
|
1884
|
+
* preview. A shell built for the preview would drift from the one built for production, and a preview
|
|
1885
|
+
* that drifts is worse than none.
|
|
1886
|
+
*
|
|
1887
|
+
* Everything is bound declaratively. Regions are resolved to {@link RegionView}s and rendered through
|
|
1888
|
+
* `NgComponentOutlet`, never created imperatively, so that a definition edited in the neighbouring
|
|
1889
|
+
* details form re-renders through ordinary signal propagation instead of a clear-and-rebuild that would
|
|
1890
|
+
* drop scroll position and focus on every keystroke.
|
|
1891
|
+
*
|
|
1892
|
+
* The whole theme is applied here, not only the brand colours: `--pp-*` overrides as a style binding and
|
|
1893
|
+
* the definition's `materialTheme` / `colorScheme` as a class selecting one of the scoped Material themes
|
|
1894
|
+
* in `src/theme/pp-material-themes.scss`. Both work because a Material theme is a set of custom
|
|
1895
|
+
* properties and nothing else. That file is a **global stylesheet the application registers**; if it is
|
|
1896
|
+
* not registered the classes below still land and the shell simply inherits the host's theme. See it for
|
|
1897
|
+
* the one thing this cannot reach — CDK overlays, which render outside the shell's subtree.
|
|
1898
|
+
*
|
|
1899
|
+
* Not yet handled, deliberately: **no routes are registered** under the outlet. That is the nested router
|
|
1900
|
+
* context, which needs `EntityTabDescriptor` to be able to carry child routes.
|
|
1901
|
+
*/
|
|
1902
|
+
class AppShellComponent {
|
|
1903
|
+
/**
|
|
1904
|
+
* The definition to render. Optional rather than required because the shell is mounted before the
|
|
1905
|
+
* definition resolves — the preview's store selects the entity in its own `ngOnInit`, and a deep link
|
|
1906
|
+
* arrives with nothing loaded — so an empty shell is a state to render, not an error.
|
|
1907
|
+
*/
|
|
1908
|
+
definition = input(undefined, /* @ts-ignore */
|
|
1909
|
+
...(ngDevMode ? [{ debugName: "definition" }] : /* istanbul ignore next */ []));
|
|
1910
|
+
regionRenderer = inject(AppRegionRenderer);
|
|
1911
|
+
layout = computed(() => layoutOf(this.definition()), /* @ts-ignore */
|
|
1912
|
+
...(ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []));
|
|
1913
|
+
themeVars = computed(() => themeVarsOf(this.definition()), /* @ts-ignore */
|
|
1914
|
+
...(ngDevMode ? [{ debugName: "themeVars" }] : /* istanbul ignore next */ []));
|
|
1915
|
+
themeClass = computed(() => themeClassOf(this.definition()), /* @ts-ignore */
|
|
1916
|
+
...(ngDevMode ? [{ debugName: "themeClass" }] : /* istanbul ignore next */ []));
|
|
1917
|
+
regionViews = computed(() => (this.definition()?.regions ?? []).map((region) => this.regionRenderer.render(region, this.definition())).filter((view) => view !== undefined), /* @ts-ignore */
|
|
1918
|
+
...(ngDevMode ? [{ debugName: "regionViews" }] : /* istanbul ignore next */ []));
|
|
1919
|
+
headerView = computed(() => this.viewOf('header'), /* @ts-ignore */
|
|
1920
|
+
...(ngDevMode ? [{ debugName: "headerView" }] : /* istanbul ignore next */ []));
|
|
1921
|
+
footerView = computed(() => this.viewOf('footer'), /* @ts-ignore */
|
|
1922
|
+
...(ngDevMode ? [{ debugName: "footerView" }] : /* istanbul ignore next */ []));
|
|
1923
|
+
/**
|
|
1924
|
+
* The nav in the sidenav, for the two sidenav presets. Split from {@link topNavView} rather than
|
|
1925
|
+
* decided in the template, so each slot is one unambiguous `@if` and the mutual exclusion is stated
|
|
1926
|
+
* once, here.
|
|
1927
|
+
*/
|
|
1928
|
+
sidenavView = computed(() => (this.layout().hasSidenav ? this.viewOf('sidenav') : undefined), /* @ts-ignore */
|
|
1929
|
+
...(ngDevMode ? [{ debugName: "sidenavView" }] : /* istanbul ignore next */ []));
|
|
1930
|
+
/**
|
|
1931
|
+
* The same nav relocated into the header row under `top-nav`. It is placed beside the header region
|
|
1932
|
+
* rather than inside it, so that a `top-nav` app which declares no header region is still navigable —
|
|
1933
|
+
* and so that the shell still never invents a region that was not authored.
|
|
1934
|
+
*/
|
|
1935
|
+
topNavView = computed(() => (this.layout().hasSidenav ? undefined : this.viewOf('sidenav')), /* @ts-ignore */
|
|
1936
|
+
...(ngDevMode ? [{ debugName: "topNavView" }] : /* istanbul ignore next */ []));
|
|
1937
|
+
/**
|
|
1938
|
+
* The nav view's own inputs with the axis the layout dictates laid over them.
|
|
1939
|
+
*
|
|
1940
|
+
* Computeds rather than a method called from the template: a method would hand `NgComponentOutlet` a
|
|
1941
|
+
* freshly built object on every change-detection pass, so it would re-diff and re-apply the nav's
|
|
1942
|
+
* inputs continuously. Memoized, the identity only changes when the definition or the preset does.
|
|
1943
|
+
*/
|
|
1944
|
+
sidenavInputs = computed(() => this.navInputsOf(this.sidenavView(), 'vertical'), /* @ts-ignore */
|
|
1945
|
+
...(ngDevMode ? [{ debugName: "sidenavInputs" }] : /* istanbul ignore next */ []));
|
|
1946
|
+
topNavInputs = computed(() => this.navInputsOf(this.topNavView(), 'horizontal'), /* @ts-ignore */
|
|
1947
|
+
...(ngDevMode ? [{ debugName: "topNavInputs" }] : /* istanbul ignore next */ []));
|
|
1948
|
+
navInputsOf(view, orientation) {
|
|
1949
|
+
return { ...view?.inputs, orientation };
|
|
1950
|
+
}
|
|
1951
|
+
viewOf(slot) {
|
|
1952
|
+
// First occurrence wins. An app declares each slot at most once — `type` is the region's identity,
|
|
1953
|
+
// see APP_REGION_ID_FIELD — so a second one is a definition that bypassed validation, and ignoring
|
|
1954
|
+
// it is the harmless read. The same rule `buildAppRoutes` applies to a duplicate path.
|
|
1955
|
+
return this.regionViews().find((view) => view.slot === slot);
|
|
1956
|
+
}
|
|
1957
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppShellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1958
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: AppShellComponent, isStandalone: true, selector: "pp-app-shell", inputs: { definition: { classPropertyName: "definition", publicName: "definition", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "themeClass()", "style": "themeVars()" } }, ngImport: i0, template: `
|
|
1959
|
+
@if (headerView() || topNavView()) {
|
|
1960
|
+
<div class="pp-app-shell__top">
|
|
1961
|
+
@if (headerView(); as view) {
|
|
1962
|
+
<ng-container *ngComponentOutlet="view.component; inputs: view.inputs"></ng-container>
|
|
1963
|
+
}
|
|
1964
|
+
@if (topNavView(); as view) {
|
|
1965
|
+
<ng-container *ngComponentOutlet="view.component; inputs: topNavInputs()"></ng-container>
|
|
1966
|
+
}
|
|
1967
|
+
</div>
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
<mat-sidenav-container class="pp-app-shell__body">
|
|
1971
|
+
@if (sidenavView(); as view) {
|
|
1972
|
+
<mat-sidenav class="pp-app-shell__sidenav" [mode]="layout().sidenavMode" [opened]="layout().sidenavOpened" [position]="layout().sidenavPosition">
|
|
1973
|
+
<ng-container *ngComponentOutlet="view.component; inputs: sidenavInputs()"></ng-container>
|
|
1974
|
+
</mat-sidenav>
|
|
1975
|
+
}
|
|
1976
|
+
<mat-sidenav-content>
|
|
1977
|
+
<main class="pp-app-shell__content" [style.max-width]="layout().contentMaxWidth">
|
|
1978
|
+
<router-outlet />
|
|
1979
|
+
</main>
|
|
1980
|
+
</mat-sidenav-content>
|
|
1981
|
+
</mat-sidenav-container>
|
|
1982
|
+
|
|
1983
|
+
@if (footerView(); as view) {
|
|
1984
|
+
<ng-container *ngComponentOutlet="view.component; inputs: view.inputs"></ng-container>
|
|
1985
|
+
}
|
|
1986
|
+
`, isInline: true, styles: ["@charset \"UTF-8\";:host{display:grid;grid-template-rows:auto 1fr auto;height:100%}.pp-app-shell__top{align-items:stretch;display:flex;background-color:var(--pp-surface-header)}.pp-app-shell__body{height:100%;min-height:0}.pp-app-shell__sidenav{background-color:var(--pp-surface-sidenav);color:var(--pp-on-sidenav);min-width:200px}.pp-app-shell__content{padding:16px 20px 24px}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { kind: "component", type: MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { kind: "component", type: MatSidenavContent, selector: "mat-sidenav-content" }, { kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
|
|
1987
|
+
}
|
|
1988
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppShellComponent, decorators: [{
|
|
1989
|
+
type: Component,
|
|
1990
|
+
args: [{ selector: 'pp-app-shell', standalone: true, imports: [NgComponentOutlet, MatSidenav, MatSidenavContainer, MatSidenavContent, RouterOutlet], host: { '[class]': 'themeClass()', '[style]': 'themeVars()' }, template: `
|
|
1991
|
+
@if (headerView() || topNavView()) {
|
|
1992
|
+
<div class="pp-app-shell__top">
|
|
1993
|
+
@if (headerView(); as view) {
|
|
1994
|
+
<ng-container *ngComponentOutlet="view.component; inputs: view.inputs"></ng-container>
|
|
1995
|
+
}
|
|
1996
|
+
@if (topNavView(); as view) {
|
|
1997
|
+
<ng-container *ngComponentOutlet="view.component; inputs: topNavInputs()"></ng-container>
|
|
1998
|
+
}
|
|
1999
|
+
</div>
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
<mat-sidenav-container class="pp-app-shell__body">
|
|
2003
|
+
@if (sidenavView(); as view) {
|
|
2004
|
+
<mat-sidenav class="pp-app-shell__sidenav" [mode]="layout().sidenavMode" [opened]="layout().sidenavOpened" [position]="layout().sidenavPosition">
|
|
2005
|
+
<ng-container *ngComponentOutlet="view.component; inputs: sidenavInputs()"></ng-container>
|
|
2006
|
+
</mat-sidenav>
|
|
2007
|
+
}
|
|
2008
|
+
<mat-sidenav-content>
|
|
2009
|
+
<main class="pp-app-shell__content" [style.max-width]="layout().contentMaxWidth">
|
|
2010
|
+
<router-outlet />
|
|
2011
|
+
</main>
|
|
2012
|
+
</mat-sidenav-content>
|
|
2013
|
+
</mat-sidenav-container>
|
|
2014
|
+
|
|
2015
|
+
@if (footerView(); as view) {
|
|
2016
|
+
<ng-container *ngComponentOutlet="view.component; inputs: view.inputs"></ng-container>
|
|
2017
|
+
}
|
|
2018
|
+
`, styles: ["@charset \"UTF-8\";:host{display:grid;grid-template-rows:auto 1fr auto;height:100%}.pp-app-shell__top{align-items:stretch;display:flex;background-color:var(--pp-surface-header)}.pp-app-shell__body{height:100%;min-height:0}.pp-app-shell__sidenav{background-color:var(--pp-surface-sidenav);color:var(--pp-on-sidenav);min-width:200px}.pp-app-shell__content{padding:16px 20px 24px}\n"] }]
|
|
2019
|
+
}], propDecorators: { definition: [{ type: i0.Input, args: [{ isSignal: true, alias: "definition", required: false }] }] } });
|
|
2020
|
+
|
|
2021
|
+
/**
|
|
2022
|
+
* The Preview tab's screen, mounted at `app-definition/<id>/preview` by `BASE_APP_ROUTES` — a sibling of
|
|
2023
|
+
* the generic Details form rather than something stacked under it, which is what the `extraTabs` hook on
|
|
2024
|
+
* `BaseEntityDescriptor` exists for.
|
|
2025
|
+
*
|
|
2026
|
+
* A **container and nothing more**: it resolves which definition is being previewed and frames the
|
|
2027
|
+
* result. Everything about *how* an application renders belongs to {@link AppShellComponent}, which the
|
|
2028
|
+
* standalone runtime host will mount just as this does — so the preview cannot grow behaviour the real
|
|
2029
|
+
* shell lacks, which is the only way a preview stays honest.
|
|
2030
|
+
*
|
|
2031
|
+
* The frame below — rounded, white, and tall enough to look like an application — is the preview's own,
|
|
2032
|
+
* not the shell's. In production the shell fills the viewport and none of it applies.
|
|
2033
|
+
*/
|
|
2034
|
+
class AppPreviewComponent {
|
|
2035
|
+
/**
|
|
2036
|
+
* Bound from the route's `:entityId` param by `withComponentInputBinding()`, the same way
|
|
2037
|
+
* `BaseEntityFormComponent` receives it — so a deep link and a reload resolve the same app definition as a
|
|
2038
|
+
* click through the tab does.
|
|
2039
|
+
*/
|
|
2040
|
+
entityId = input.required(/* @ts-ignore */
|
|
2041
|
+
...(ngDevMode ? [{ debugName: "entityId" }] : /* istanbul ignore next */ []));
|
|
2042
|
+
store = inject(AppDefinitionStore);
|
|
2043
|
+
app = computed(() => this.store.currentEntity(), /* @ts-ignore */
|
|
2044
|
+
...(ngDevMode ? [{ debugName: "app" }] : /* istanbul ignore next */ []));
|
|
2045
|
+
ngOnInit() {
|
|
2046
|
+
// Also sets the current entity, so the tab bar's Details link stays enabled and the status bar keeps
|
|
2047
|
+
// naming the record — arriving here directly, nothing else has selected it.
|
|
2048
|
+
this.store.setCurrentEntity(this.entityId());
|
|
2049
|
+
}
|
|
2050
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppPreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2051
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.1", type: AppPreviewComponent, isStandalone: true, selector: "pp-app-preview-tab", inputs: { entityId: { classPropertyName: "entityId", publicName: "entityId", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
2052
|
+
<div class="pp-app-preview">
|
|
2053
|
+
<pp-app-shell [definition]="app()" />
|
|
2054
|
+
</div>
|
|
2055
|
+
`, isInline: true, styles: [".pp-app-preview{background-color:var(--pp-surface-base, #ffffff);border-radius:6px;overflow:hidden}.pp-app-preview>pp-app-shell{min-height:65vh}\n"], dependencies: [{ kind: "component", type: AppShellComponent, selector: "pp-app-shell", inputs: ["definition"] }] });
|
|
2056
|
+
}
|
|
2057
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppPreviewComponent, decorators: [{
|
|
2058
|
+
type: Component,
|
|
2059
|
+
args: [{ selector: 'pp-app-preview-tab', standalone: true, imports: [AppShellComponent], template: `
|
|
2060
|
+
<div class="pp-app-preview">
|
|
2061
|
+
<pp-app-shell [definition]="app()" />
|
|
2062
|
+
</div>
|
|
2063
|
+
`, styles: [".pp-app-preview{background-color:var(--pp-surface-base, #ffffff);border-radius:6px;overflow:hidden}.pp-app-preview>pp-app-shell{min-height:65vh}\n"] }]
|
|
2064
|
+
}], propDecorators: { entityId: [{ type: i0.Input, args: [{ isSignal: true, alias: "entityId", required: true }] }] } });
|
|
2065
|
+
|
|
2066
|
+
/**
|
|
2067
|
+
* Turns one `AppDefinition` into the `Routes` that render its screens — the missing consumer of
|
|
2068
|
+
* {@link buildAppRoutes}, which until now produced routes nothing registered.
|
|
2069
|
+
*
|
|
2070
|
+
* Separate from the guard below so the interesting part is testable without a router: this class answers
|
|
2071
|
+
* "what routes does app X have", and the guard is only the two lines that hand them to Angular.
|
|
2072
|
+
*/
|
|
2073
|
+
class AppShellRoutesFactory {
|
|
2074
|
+
appStore = inject(AppDefinitionStore);
|
|
2075
|
+
appService = inject(AppDefinitionService);
|
|
2076
|
+
moduleStore = inject(ModuleDefinitionStore);
|
|
2077
|
+
moduleService = inject(ModuleDefinitionService);
|
|
2078
|
+
renderRoute = inject(AppRouteRenderer).render;
|
|
2079
|
+
async childrenOf(appId) {
|
|
2080
|
+
const definition = await this.definitionOf(appId);
|
|
2081
|
+
if (!definition)
|
|
2082
|
+
return [];
|
|
2083
|
+
const built = await buildAppRoutes({ routes: definition.routes, modules: definition.modules, loadModule: this.loadModule }, this.renderRoute);
|
|
2084
|
+
return built.length ? [indexRoute(definition, built), ...built] : built;
|
|
2085
|
+
}
|
|
2086
|
+
/**
|
|
2087
|
+
* Store first, endpoint second.
|
|
2088
|
+
*
|
|
2089
|
+
* The store holds the newest definition immediately after a Save, so the next navigation inside the
|
|
2090
|
+
* preview picks up a route the designer just added — without a second GET, and without this having to
|
|
2091
|
+
* know that a save happened. The fetch is for the case the store cannot serve: a deep link or a reload,
|
|
2092
|
+
* where nothing has been loaded yet.
|
|
2093
|
+
*
|
|
2094
|
+
* A failure resolves to `undefined` rather than propagating. A guard that rejects fails the whole
|
|
2095
|
+
* navigation, and an app whose definition cannot be read should render an empty shell, not a dead URL.
|
|
2096
|
+
*/
|
|
2097
|
+
async definitionOf(appId) {
|
|
2098
|
+
const known = this.appStore.loadById(appId);
|
|
2099
|
+
if (known)
|
|
2100
|
+
return known;
|
|
2101
|
+
return (await this.fetch(() => firstValueFrom(this.appService.findById(appId))));
|
|
2102
|
+
}
|
|
2103
|
+
/**
|
|
2104
|
+
* The {@link ModuleLoader} `buildAppRoutes` calls for a mount whose module it has not got. Resolving to
|
|
2105
|
+
* `undefined` is deliberate and is what the contract asks for: a `ModuleMount` naming a module nobody has
|
|
2106
|
+
* authored yet is a validation *warning*, so it must contribute no routes rather than break navigation.
|
|
2107
|
+
*/
|
|
2108
|
+
loadModule = async (moduleKey) => {
|
|
2109
|
+
const known = this.moduleStore.loadById(moduleKey);
|
|
2110
|
+
if (known)
|
|
2111
|
+
return known;
|
|
2112
|
+
return (await this.fetch(() => firstValueFrom(this.moduleService.findById(moduleKey))));
|
|
2113
|
+
};
|
|
2114
|
+
/** `findById` resolves to `void` for a missing record and rejects on a transport error; both mean "no". */
|
|
2115
|
+
async fetch(read) {
|
|
2116
|
+
try {
|
|
2117
|
+
return (await read()) || undefined;
|
|
2118
|
+
}
|
|
2119
|
+
catch {
|
|
2120
|
+
return undefined;
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppShellRoutesFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2124
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppShellRoutesFactory, providedIn: 'root' });
|
|
2125
|
+
}
|
|
2126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppShellRoutesFactory, decorators: [{
|
|
2127
|
+
type: Injectable,
|
|
2128
|
+
args: [{ providedIn: 'root' }]
|
|
2129
|
+
}] });
|
|
2130
|
+
/**
|
|
2131
|
+
* Where the application root goes. Without it the app's own URL — `…/preview` with nothing after it —
|
|
2132
|
+
* matches none of the children and the *whole* route fails to match, which would take the preview screen
|
|
2133
|
+
* down rather than merely leave its content area empty.
|
|
2134
|
+
*
|
|
2135
|
+
* The authored order decides, falling back to the first route as built. The fallback is not decoration: an
|
|
2136
|
+
* app may declare no routes of its own and mount all of its screens from a module, in which case the
|
|
2137
|
+
* definition offers no path to land on but the built routes do.
|
|
2138
|
+
*/
|
|
2139
|
+
function indexRoute(definition, built) {
|
|
2140
|
+
const target = definition.routes?.find((route) => route.path)?.path ?? built[0].path;
|
|
2141
|
+
// `pathMatch: 'full'`, or an empty path would prefix-match every URL below it and swallow the app.
|
|
2142
|
+
return { path: '', pathMatch: 'full', redirectTo: target };
|
|
2143
|
+
}
|
|
2144
|
+
/**
|
|
2145
|
+
* Registers an application's own routes as the children of the Preview tab's route, so that navigating
|
|
2146
|
+
* inside a previewed application is *real* navigation: real URLs, real back button, real outlet.
|
|
2147
|
+
*
|
|
2148
|
+
* Why a `canMatch` guard rather than `loadChildren`, which is the obvious hook for lazily-known children:
|
|
2149
|
+
* the router caches a `loadChildren` result on the `Route` object as `_loadedRoutes`, and one Route object
|
|
2150
|
+
* serves every `:entityId`. The first app previewed would therefore have its routes replayed for the
|
|
2151
|
+
* second. `children`, by contrast, is read fresh on every recognition and never cached — and `canMatch`
|
|
2152
|
+
* runs, and is awaited, *before* the router reads it. So this is the one hook that can answer "children of
|
|
2153
|
+
* *this* app" and still work on a deep link.
|
|
2154
|
+
*
|
|
2155
|
+
* Always returns `true`. It is not deciding whether the tab may be entered — it is filling in the tab's
|
|
2156
|
+
* children on the way past.
|
|
2157
|
+
*/
|
|
2158
|
+
const appShellRoutesGuard = (route, _segments, snapshot) => {
|
|
2159
|
+
const appId = snapshot.paramMap.get(BaseUrlSegments.EntityID);
|
|
2160
|
+
if (!appId)
|
|
2161
|
+
return true;
|
|
2162
|
+
// `inject` before the first await: an async function loses the injection context at its first suspension.
|
|
2163
|
+
const factory = inject(AppShellRoutesFactory);
|
|
2164
|
+
return factory.childrenOf(appId).then((children) => {
|
|
2165
|
+
route.children = children;
|
|
2166
|
+
return true;
|
|
2167
|
+
});
|
|
2168
|
+
};
|
|
2169
|
+
|
|
2170
|
+
/**
|
|
2171
|
+
* The Preview tab, declared once and consumed twice: `BASE_APP_ROUTES` mounts it as
|
|
2172
|
+
* `app-definition/<id>/preview`, and `AppDefinitionContainerComponent` puts it on the descriptor so the tab bar
|
|
2173
|
+
* renders the link. One constant rather than two literals because the segment is what ties the link to the
|
|
2174
|
+
* route — a mismatch would render a tab that navigates to a URL nothing matches.
|
|
2175
|
+
*
|
|
2176
|
+
* The tab is a *container*: `children` starts empty and {@link appShellRoutesGuard} fills it with the
|
|
2177
|
+
* previewed application's own routes on every navigation, so the shell's `<router-outlet>` renders real
|
|
2178
|
+
* screens at real URLs — `app-definition/demo/preview/orders`. The empty array is load-bearing; a route with
|
|
2179
|
+
* no `children` at all takes the `loadChildren` path instead, which is cached per Route object and so cannot
|
|
2180
|
+
* vary by `:entityId`.
|
|
2181
|
+
*/
|
|
2182
|
+
const APP_PREVIEW_TAB = {
|
|
2183
|
+
segment: 'preview',
|
|
2184
|
+
i18nKey: APP_PREVIEW_I18N_KEY,
|
|
2185
|
+
component: AppPreviewComponent,
|
|
2186
|
+
testIdSuffix: 'show-preview',
|
|
2187
|
+
children: [],
|
|
2188
|
+
canMatch: [appShellRoutesGuard],
|
|
2189
|
+
};
|
|
2190
|
+
|
|
2191
|
+
class AppDefinitionContainerComponent {
|
|
2192
|
+
containerComponentRef;
|
|
2193
|
+
baseEntityHost;
|
|
2194
|
+
publishActionsTpl = viewChild('publishActionsTpl', /* @ts-ignore */
|
|
2195
|
+
...(ngDevMode ? [{ debugName: "publishActionsTpl" }] : /* istanbul ignore next */ []));
|
|
2196
|
+
store = inject(AppDefinitionStore);
|
|
2197
|
+
entityDescriptor;
|
|
2198
|
+
publishButtonKey = PUBLISH_BUTTON_I18N_KEY;
|
|
2199
|
+
publishTooltipKey = PUBLISH_TOOLTIP_I18N_KEY;
|
|
2200
|
+
/** Only a definition the backend already knows can be promoted, so a not-yet-saved form cannot publish. */
|
|
2201
|
+
canPublish = computed(() => !this.store.isLoading() && !!this.store.currentEntity()?.id, /* @ts-ignore */
|
|
2202
|
+
...(ngDevMode ? [{ debugName: "canPublish" }] : /* istanbul ignore next */ []));
|
|
2203
|
+
constructor() {
|
|
2204
|
+
this.entityDescriptor = createAppDefinitionDescriptor();
|
|
2205
|
+
this.entityDescriptor.store = this.store;
|
|
2206
|
+
this.entityDescriptor.extraFormActionsTemplate = () => this.publishActionsTpl();
|
|
2207
|
+
this.entityDescriptor.extraTabs = [APP_PREVIEW_TAB];
|
|
2208
|
+
}
|
|
2209
|
+
ngOnDestroy() {
|
|
2210
|
+
if (this.containerComponentRef) {
|
|
2211
|
+
this.containerComponentRef.destroy();
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
async onPublish() {
|
|
2215
|
+
const id = this.store.currentEntity()?.id;
|
|
2216
|
+
if (!id)
|
|
2217
|
+
return;
|
|
2218
|
+
await this.store.publish(id);
|
|
2219
|
+
}
|
|
2220
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2221
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.1", type: AppDefinitionContainerComponent, isStandalone: true, selector: "pp-app-definition-container", viewQueries: [{ propertyName: "publishActionsTpl", first: true, predicate: ["publishActionsTpl"], descendants: true, isSignal: true }, { propertyName: "baseEntityHost", first: true, predicate: BaseFormHostDirective, descendants: true, read: BaseFormHostDirective, static: true }], ngImport: i0, template: `
|
|
2222
|
+
<base-entity-container [entityDescriptor]="entityDescriptor"></base-entity-container>
|
|
2223
|
+
<ng-template #publishActionsTpl>
|
|
2224
|
+
<button id="publish" type="button" mat-raised-button color="accent" [disabled]="!canPublish()" [matTooltip]="publishTooltipKey | transloco" (click)="onPublish()">
|
|
2225
|
+
{{ publishButtonKey | transloco }}
|
|
2226
|
+
</button>
|
|
2227
|
+
</ng-template>
|
|
2228
|
+
`, isInline: true, dependencies: [{ kind: "component", type: BaseEntityContainerComponent, selector: "base-entity-container", inputs: ["entityDescriptor", "facade"] }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
|
|
2229
|
+
}
|
|
2230
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: AppDefinitionContainerComponent, decorators: [{
|
|
2231
|
+
type: Component,
|
|
2232
|
+
args: [{
|
|
2233
|
+
selector: 'pp-app-definition-container',
|
|
2234
|
+
standalone: true,
|
|
2235
|
+
imports: [BaseEntityContainerComponent, MatButton, MatTooltip, TranslocoPipe],
|
|
2236
|
+
template: `
|
|
2237
|
+
<base-entity-container [entityDescriptor]="entityDescriptor"></base-entity-container>
|
|
2238
|
+
<ng-template #publishActionsTpl>
|
|
2239
|
+
<button id="publish" type="button" mat-raised-button color="accent" [disabled]="!canPublish()" [matTooltip]="publishTooltipKey | transloco" (click)="onPublish()">
|
|
2240
|
+
{{ publishButtonKey | transloco }}
|
|
2241
|
+
</button>
|
|
2242
|
+
</ng-template>
|
|
2243
|
+
`,
|
|
2244
|
+
}]
|
|
2245
|
+
}], ctorParameters: () => [], propDecorators: { baseEntityHost: [{
|
|
2246
|
+
type: ViewChild,
|
|
2247
|
+
args: [BaseFormHostDirective, { static: true, read: BaseFormHostDirective }]
|
|
2248
|
+
}], publishActionsTpl: [{ type: i0.ViewChild, args: ['publishActionsTpl', { isSignal: true }] }] } });
|
|
2249
|
+
|
|
2250
|
+
/**
|
|
2251
|
+
* Hosts the generic container for `Module Definition`, whose only job is to bind the descriptor to the
|
|
2252
|
+
* store the routable screens read from.
|
|
2253
|
+
*
|
|
2254
|
+
* Deliberately without the `Publish` action `AppDefinitionContainerComponent` contributes: publishing is
|
|
2255
|
+
* an application operation. An app is what a user navigates to and its status is what decides whether a
|
|
2256
|
+
* mount is live, so a module with a lifecycle of its own would make "which version of what is live" a
|
|
2257
|
+
* question with two answers.
|
|
2258
|
+
*/
|
|
2259
|
+
class ModuleDefinitionContainerComponent {
|
|
2260
|
+
store = inject(ModuleDefinitionStore);
|
|
2261
|
+
entityDescriptor;
|
|
2262
|
+
constructor() {
|
|
2263
|
+
this.entityDescriptor = createModuleDefinitionDescriptor();
|
|
2264
|
+
this.entityDescriptor.store = this.store;
|
|
2265
|
+
}
|
|
2266
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2267
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: ModuleDefinitionContainerComponent, isStandalone: true, selector: "pp-module-definition-container", ngImport: i0, template: `<base-entity-container [entityDescriptor]="entityDescriptor"></base-entity-container>`, isInline: true, dependencies: [{ kind: "component", type: BaseEntityContainerComponent, selector: "base-entity-container", inputs: ["entityDescriptor", "facade"] }] });
|
|
2268
|
+
}
|
|
2269
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: ModuleDefinitionContainerComponent, decorators: [{
|
|
2270
|
+
type: Component,
|
|
2271
|
+
args: [{
|
|
2272
|
+
selector: 'pp-module-definition-container',
|
|
2273
|
+
standalone: true,
|
|
2274
|
+
imports: [BaseEntityContainerComponent],
|
|
2275
|
+
template: `<base-entity-container [entityDescriptor]="entityDescriptor"></base-entity-container>`,
|
|
2276
|
+
}]
|
|
2277
|
+
}], ctorParameters: () => [] });
|
|
2278
|
+
|
|
2279
|
+
/**
|
|
2280
|
+
* The facades of the whole definition graph, to be spread into the application's `providers`.
|
|
2281
|
+
*
|
|
2282
|
+
* The embedded ones are here for the same reason the routable one is: an embedded entity has a facade
|
|
2283
|
+
* like any other — that is what gives it a store — and only its repository differs, reading and writing
|
|
2284
|
+
* the `App Definition` document rather than an endpoint of its own.
|
|
2285
|
+
*/
|
|
2286
|
+
const BASE_APP_FACADE_PROVIDERS = [AppDefinitionFacade, ModuleDefinitionFacade, AppRegionFacade, AppRouteFacade, AppModuleMountFacade, AppNavItemFacade, AppWidgetFacade];
|
|
2287
|
+
/**
|
|
2288
|
+
* The same facades keyed by entity name, to be spread into the application's
|
|
2289
|
+
* `BASE_ENTITY_FACADE_REGISTRY` value.
|
|
2290
|
+
*
|
|
2291
|
+
* Every entity an `EMBEDDED_COMPONENTS` attribute of this library names has to appear here, or the
|
|
2292
|
+
* control throws on first render rather than showing a list whose rows go nowhere on save — the
|
|
2293
|
+
* registry is how it reaches the child's store and descriptor. Spread rather than provided separately,
|
|
2294
|
+
* because the token holds one value: a second `provide: BASE_ENTITY_FACADE_REGISTRY` would replace the
|
|
2295
|
+
* application's own entities instead of adding to them.
|
|
2296
|
+
*/
|
|
2297
|
+
const BASE_APP_ENTITY_FACADES = {
|
|
2298
|
+
[APP_DEFINITION_ENTITY_NAME]: AppDefinitionFacade,
|
|
2299
|
+
[MODULE_DEFINITION_ENTITY_NAME]: ModuleDefinitionFacade,
|
|
2300
|
+
[APP_REGION_ENTITY_NAME]: AppRegionFacade,
|
|
2301
|
+
[APP_ROUTE_ENTITY_NAME]: AppRouteFacade,
|
|
2302
|
+
[APP_MODULE_MOUNT_ENTITY_NAME]: AppModuleMountFacade,
|
|
2303
|
+
[APP_NAV_ITEM_ENTITY_NAME]: AppNavItemFacade,
|
|
2304
|
+
[APP_WIDGET_ENTITY_NAME]: AppWidgetFacade,
|
|
2305
|
+
};
|
|
2306
|
+
|
|
2307
|
+
/**
|
|
2308
|
+
* The path segment has to be `snakeCaseName('App Definition')`, because
|
|
2309
|
+
* `BaseFormNavigatorSingletonStore` builds the details URL from the entity name — see the same
|
|
2310
|
+
* constraint on `BASE_RULE_ROUTES`.
|
|
2311
|
+
*/
|
|
2312
|
+
const BASE_APP_ROUTES = [
|
|
2313
|
+
{
|
|
2314
|
+
path: 'app-definition',
|
|
2315
|
+
title: 'ProcessPuzzle Design - Applications',
|
|
2316
|
+
data: { icon: 'web', menuTitle: 'design.applications', entityName: APP_DEFINITION_ENTITY_NAME },
|
|
2317
|
+
component: AppDefinitionContainerComponent,
|
|
2318
|
+
providers: [authoringScopes()],
|
|
2319
|
+
children: baseEntityRoutes(embeddedDefinitionRoutes(), [APP_PREVIEW_TAB]),
|
|
2320
|
+
},
|
|
2321
|
+
// A sibling rather than a child of the branch above: a module is an aggregate of its own, with its own
|
|
2322
|
+
// endpoints and its own list screen. What ties the two together is data — a `ModuleMount` naming a key —
|
|
2323
|
+
// and the run-time shell that resolves it, not the authoring URL.
|
|
2324
|
+
{
|
|
2325
|
+
path: 'module-definition',
|
|
2326
|
+
title: 'ProcessPuzzle Design - Modules',
|
|
2327
|
+
data: { icon: 'extension', menuTitle: 'design.modules', entityName: MODULE_DEFINITION_ENTITY_NAME },
|
|
2328
|
+
component: ModuleDefinitionContainerComponent,
|
|
2329
|
+
providers: [authoringScopes()],
|
|
2330
|
+
children: baseEntityRoutes([routeRoute()]),
|
|
2331
|
+
},
|
|
2332
|
+
];
|
|
2333
|
+
/**
|
|
2334
|
+
* The transloco scopes every authoring branch of this library needs. Both are required: a route that
|
|
2335
|
+
* declares TRANSLOCO_SCOPE replaces the collection it inherits rather than adding to it, and the generic
|
|
2336
|
+
* tabs translate the framework's own `base_entity.*` keys (see BASE_ENTITY_TRANSLOCO_SCOPE).
|
|
2337
|
+
*
|
|
2338
|
+
* Registered on the top-level routes rather than on the containers, so the base-entity tabs, list and form
|
|
2339
|
+
* rendered in the child routes resolve entity and attribute labels from the same scopes. The embedded
|
|
2340
|
+
* branches below need none of their own: `base_app.app_region.*` and its siblings are keys of the scope
|
|
2341
|
+
* already registered here.
|
|
2342
|
+
*
|
|
2343
|
+
* Both aliases are spelled out, as everywhere in this workspace: transloco camel-cases the default alias,
|
|
2344
|
+
* so `base_app` would silently become `baseApp` and miss every key below it.
|
|
2345
|
+
*/
|
|
2346
|
+
function authoringScopes() {
|
|
2347
|
+
return provideTranslocoScope({ scope: BASE_ENTITY_TRANSLOCO_SCOPE, alias: BASE_ENTITY_TRANSLOCO_SCOPE }, { scope: BASE_APP_TRANSLOCO_SCOPE, alias: BASE_APP_TRANSLOCO_SCOPE });
|
|
2348
|
+
}
|
|
2349
|
+
/**
|
|
2350
|
+
* The definition graph as route branches: a region, a route and a module mount hang below the
|
|
2351
|
+
* definition's details route, a nav item and a widget below the region's, a widget below the route's,
|
|
2352
|
+
* and a nav item below itself.
|
|
2353
|
+
*
|
|
2354
|
+
* The nesting mirrors the containment of `base-app-api.yaml` exactly, and it has to: an embedded row has
|
|
2355
|
+
* no id of its own to be looked up by, so the URL — `app-definition/claims-app/details/app-region/sidenav/
|
|
2356
|
+
* details/app-nav-item/nav-claims/details` — is what addresses it, and each segment resolves against the
|
|
2357
|
+
* rows of the level above it.
|
|
2358
|
+
*
|
|
2359
|
+
* These are the *authoring* routes and have nothing to do with the routes an `AppDefinition` declares:
|
|
2360
|
+
* `App Route` rows are data here, and it is the run-time shell that turns them into `Routes` of their
|
|
2361
|
+
* own. A module mount is a leaf — the module it names is a separate aggregate with its own endpoints,
|
|
2362
|
+
* so its routes are authored there rather than through this branch.
|
|
2363
|
+
*/
|
|
2364
|
+
function embeddedDefinitionRoutes() {
|
|
2365
|
+
return [
|
|
2366
|
+
{ entityName: APP_REGION_ENTITY_NAME, facade: AppRegionFacade, children: () => [navItemRoute(), widgetRoute()] },
|
|
2367
|
+
routeRoute(),
|
|
2368
|
+
{ entityName: APP_MODULE_MOUNT_ENTITY_NAME, facade: AppModuleMountFacade },
|
|
2369
|
+
];
|
|
2370
|
+
}
|
|
2371
|
+
/**
|
|
2372
|
+
* The `App Route` branch, shared by both aggregates that own routes: an app's `routes` and a module's are
|
|
2373
|
+
* the same rows edited by the same descriptor, so the branch below them has to be the same too. Only the
|
|
2374
|
+
* URL prefix differs — `app-definition/demo/details/app-route/...` against
|
|
2375
|
+
* `module-definition/claims/details/app-route/...`.
|
|
2376
|
+
*/
|
|
2377
|
+
function routeRoute() {
|
|
2378
|
+
return { entityName: APP_ROUTE_ENTITY_NAME, facade: AppRouteFacade, children: () => [widgetRoute()] };
|
|
2379
|
+
}
|
|
2380
|
+
/** A nav item nests in itself — a group node's children are nav items. Hence the thunk: the structure is
|
|
2381
|
+
* infinite, and `loadChildren` expands one level per navigation. */
|
|
2382
|
+
function navItemRoute() {
|
|
2383
|
+
return { entityName: APP_NAV_ITEM_ENTITY_NAME, facade: AppNavItemFacade, children: () => [navItemRoute()] };
|
|
2384
|
+
}
|
|
2385
|
+
/**
|
|
2386
|
+
* A widget, unlike a nav item, is a leaf branch: widgets do not nest, so there is no deeper level to
|
|
2387
|
+
* expand. A container widget places its siblings by id through `props.childIds`, and those siblings are
|
|
2388
|
+
* rows of this same list — reachable at this level, not below it.
|
|
2389
|
+
*/
|
|
2390
|
+
function widgetRoute() {
|
|
2391
|
+
return { entityName: APP_WIDGET_ENTITY_NAME, facade: AppWidgetFacade };
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
/*
|
|
2395
|
+
* Public API Surface of @processpuzzle/base-app
|
|
2396
|
+
*/
|
|
2397
|
+
|
|
2398
|
+
/**
|
|
2399
|
+
* Generated bundle index. Do not edit.
|
|
2400
|
+
*/
|
|
2401
|
+
|
|
2402
|
+
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 };
|
|
2403
|
+
//# sourceMappingURL=processpuzzle-base-app.mjs.map
|