@mediusinc/mng-commons 0.2.5 → 0.2.6
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/esm2020/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +6 -2
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +1 -2
- package/esm2020/lib/components/layout/main-layout.component.mjs +1 -1
- package/esm2020/lib/components/layout/topbar.component.mjs +1 -1
- package/esm2020/lib/components/tableview/index.mjs +2 -1
- package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +3 -3
- package/esm2020/lib/components/tableview/route/tableview-route.component.mjs +33 -0
- package/esm2020/lib/components/tableview/services/tableview.component.service.mjs +1 -2
- package/esm2020/lib/mng-commons.module.mjs +8 -6
- package/esm2020/lib/models/index.mjs +1 -2
- package/esm2020/lib/router/index.mjs +2 -0
- package/esm2020/lib/router/models/index.mjs +2 -0
- package/esm2020/lib/router/models/router.model.mjs +2 -0
- package/esm2020/lib/router/route-builder.mjs +288 -0
- package/esm2020/lib/services/commons.service.mjs +1 -1
- package/esm2020/lib/utils/route.util.mjs +24 -0
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/mediusinc-mng-commons.mjs +348 -5
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +346 -5
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/components/tableview/index.d.ts +1 -0
- package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +3 -2
- package/lib/components/tableview/route/tableview-route.component.d.ts +15 -0
- package/lib/mng-commons.module.d.ts +45 -44
- package/lib/models/index.d.ts +0 -1
- package/lib/router/index.d.ts +1 -0
- package/lib/router/models/index.d.ts +1 -0
- package/lib/router/models/router.model.d.ts +22 -0
- package/lib/router/route-builder.d.ts +66 -0
- package/lib/utils/route.util.d.ts +4 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/esm2020/lib/models/router.model.mjs +0 -2
- package/lib/models/router.model.d.ts +0 -14
|
@@ -3315,7 +3315,6 @@ class ActionTriggerResult {
|
|
|
3315
3315
|
class TableviewComponentService {
|
|
3316
3316
|
constructor() {
|
|
3317
3317
|
this.actions = [];
|
|
3318
|
-
console.log('TableviewComponentService init.');
|
|
3319
3318
|
}
|
|
3320
3319
|
reloadTable() {
|
|
3321
3320
|
// TODO: add callback functions to implement
|
|
@@ -4880,6 +4879,10 @@ class MngFormlyFieldInputComponent extends FieldType {
|
|
|
4880
4879
|
ngOnInit() {
|
|
4881
4880
|
this.iFormControl = this.formControl;
|
|
4882
4881
|
this.descriptor = this.to['descriptor'];
|
|
4882
|
+
if (this.to.type === 'datepicker' && typeof this.iFormControl.value === 'string') {
|
|
4883
|
+
const dateObject = new Date(this.iFormControl.value);
|
|
4884
|
+
this.iFormControl.setValue(dateObject);
|
|
4885
|
+
}
|
|
4883
4886
|
}
|
|
4884
4887
|
}
|
|
4885
4888
|
MngFormlyFieldInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngFormlyFieldInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -5313,7 +5316,6 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
5313
5316
|
const hasEditAction = this.descriptor.actions.some(a => a === FieldManyEditorDescriptor.ActionEnum.Edit);
|
|
5314
5317
|
const hasDeleteAction = this.descriptor.actions.some(a => a === FieldManyEditorDescriptor.ActionEnum.Delete);
|
|
5315
5318
|
if (hasAddAction) {
|
|
5316
|
-
console.log(this.descriptor.tableviewDescriptor.addEditor);
|
|
5317
5319
|
const addAction = new ActionEditorDescriptor(this.descriptor.tableviewDescriptor.addEditor, 'add', this.descriptor.editor.model.type, this.descriptor.property)
|
|
5318
5320
|
.withTitle(null)
|
|
5319
5321
|
.withIcon('pi pi-plus')
|
|
@@ -5585,7 +5587,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
|
|
|
5585
5587
|
}] } });
|
|
5586
5588
|
|
|
5587
5589
|
class AMngTableviewRouteComponent {
|
|
5588
|
-
|
|
5590
|
+
ngOnInit() {
|
|
5589
5591
|
this.descriptor = this.createTableviewDescriptor();
|
|
5590
5592
|
this.dataProvider = this.createTableviewDataProvider();
|
|
5591
5593
|
this.actions = this.createActionDescriptors();
|
|
@@ -5603,7 +5605,35 @@ AMngTableviewRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.
|
|
|
5603
5605
|
AMngTableviewRouteComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.3", type: AMngTableviewRouteComponent, ngImport: i0 });
|
|
5604
5606
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: AMngTableviewRouteComponent, decorators: [{
|
|
5605
5607
|
type: Directive
|
|
5606
|
-
}]
|
|
5608
|
+
}] });
|
|
5609
|
+
|
|
5610
|
+
class MngTableviewRouteComponent extends AMngTableviewRouteComponent {
|
|
5611
|
+
constructor(route) {
|
|
5612
|
+
super();
|
|
5613
|
+
this.route = route;
|
|
5614
|
+
}
|
|
5615
|
+
createTableviewDescriptor() {
|
|
5616
|
+
if (!this.route.snapshot.data['tableviewData'].descriptor) {
|
|
5617
|
+
throw Error('Tableview requires a descriptor.');
|
|
5618
|
+
}
|
|
5619
|
+
return this.route.snapshot.data['tableviewData'].descriptor;
|
|
5620
|
+
}
|
|
5621
|
+
createTableviewDataProvider() {
|
|
5622
|
+
if (!this.route.snapshot.data['tableviewData'].dataProvider) {
|
|
5623
|
+
throw Error('Tableview requires a data provider.');
|
|
5624
|
+
}
|
|
5625
|
+
return this.route.snapshot.data['tableviewData'].dataProvider;
|
|
5626
|
+
}
|
|
5627
|
+
createActionDescriptors() {
|
|
5628
|
+
return this.route.snapshot.data['tableviewData'].actions ?? super.createActionDescriptors();
|
|
5629
|
+
}
|
|
5630
|
+
}
|
|
5631
|
+
MngTableviewRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngTableviewRouteComponent, deps: [{ token: i1$2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
|
|
5632
|
+
MngTableviewRouteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.3", type: MngTableviewRouteComponent, selector: "mng-tableview-route", usesInheritance: true, ngImport: i0, template: "<div class=\"grid\">\n <div class=\"col-12\">\n <mng-tableview [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview>\n </div>\n</div>\n", components: [{ type: MngTableviewComponent, selector: "mng-tableview", inputs: ["descriptor", "dataProvider", "actions"] }] });
|
|
5633
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngTableviewRouteComponent, decorators: [{
|
|
5634
|
+
type: Component,
|
|
5635
|
+
args: [{ selector: 'mng-tableview-route', template: "<div class=\"grid\">\n <div class=\"col-12\">\n <mng-tableview [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview>\n </div>\n</div>\n" }]
|
|
5636
|
+
}], ctorParameters: function () { return [{ type: i1$2.ActivatedRoute }]; } });
|
|
5607
5637
|
|
|
5608
5638
|
function mngCommonsInitializerProvider(mngCommons) {
|
|
5609
5639
|
return () => mngCommons.initialize();
|
|
@@ -5860,6 +5890,7 @@ const declarations = [
|
|
|
5860
5890
|
MngTableviewComponent,
|
|
5861
5891
|
MngTableColumnValueComponent,
|
|
5862
5892
|
MngTableColumnFilterComponent,
|
|
5893
|
+
MngTableviewRouteComponent,
|
|
5863
5894
|
// editor components
|
|
5864
5895
|
MngFormEditorComponent,
|
|
5865
5896
|
MngActionComponent,
|
|
@@ -5950,6 +5981,7 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
|
|
|
5950
5981
|
MngTableviewComponent,
|
|
5951
5982
|
MngTableColumnValueComponent,
|
|
5952
5983
|
MngTableColumnFilterComponent,
|
|
5984
|
+
MngTableviewRouteComponent,
|
|
5953
5985
|
// editor components
|
|
5954
5986
|
MngFormEditorComponent,
|
|
5955
5987
|
MngActionComponent,
|
|
@@ -6056,6 +6088,7 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
|
|
|
6056
6088
|
MngTableviewComponent,
|
|
6057
6089
|
MngTableColumnValueComponent,
|
|
6058
6090
|
MngTableColumnFilterComponent,
|
|
6091
|
+
MngTableviewRouteComponent,
|
|
6059
6092
|
// editor components
|
|
6060
6093
|
MngFormEditorComponent,
|
|
6061
6094
|
MngActionComponent,
|
|
@@ -6202,6 +6235,314 @@ class AMngCrudApiService {
|
|
|
6202
6235
|
}
|
|
6203
6236
|
}
|
|
6204
6237
|
|
|
6238
|
+
class RouteUtil {
|
|
6239
|
+
static removeEmptyPathSegments(path) {
|
|
6240
|
+
const filteredPath = path.filter(ps => typeof ps === 'string' && ps.length > 0);
|
|
6241
|
+
return filteredPath.length > 0 ? filteredPath : [''];
|
|
6242
|
+
}
|
|
6243
|
+
static appendPathToBasePath(basePath, path) {
|
|
6244
|
+
if (path.length > 0) {
|
|
6245
|
+
if (path[0].startsWith('/')) {
|
|
6246
|
+
return path;
|
|
6247
|
+
}
|
|
6248
|
+
else if (path[0].startsWith('../')) {
|
|
6249
|
+
// TODO: process multi upper folder
|
|
6250
|
+
throw new Error('Not implemented');
|
|
6251
|
+
}
|
|
6252
|
+
else {
|
|
6253
|
+
return RouteUtil.removeEmptyPathSegments([...basePath, ...path]);
|
|
6254
|
+
}
|
|
6255
|
+
}
|
|
6256
|
+
else {
|
|
6257
|
+
return basePath;
|
|
6258
|
+
}
|
|
6259
|
+
}
|
|
6260
|
+
}
|
|
6261
|
+
|
|
6262
|
+
class RoutesBuilder {
|
|
6263
|
+
constructor(layoutRoute) {
|
|
6264
|
+
this.routes = [];
|
|
6265
|
+
this.layoutRoute = layoutRoute?.withRoot(this);
|
|
6266
|
+
}
|
|
6267
|
+
static create() {
|
|
6268
|
+
return new RoutesBuilder();
|
|
6269
|
+
}
|
|
6270
|
+
static createWithLayout(layoutComponent = MngMainLayoutComponent) {
|
|
6271
|
+
const routesBuilder = new RoutesBuilder(RouteBuilder.create('', layoutComponent));
|
|
6272
|
+
return routesBuilder;
|
|
6273
|
+
}
|
|
6274
|
+
addAngularRoute(route) {
|
|
6275
|
+
return this.addRouteBuilder(RouteBuilder.createFromRoute(route));
|
|
6276
|
+
}
|
|
6277
|
+
addRouteRedirect(path, redirectTo, pathMatch = 'prefix') {
|
|
6278
|
+
return this.addRouteBuilder(RouteBuilder.createRedirect(path, redirectTo, pathMatch));
|
|
6279
|
+
}
|
|
6280
|
+
addLazyRoute(path, loadChildren) {
|
|
6281
|
+
return this.addRouteBuilder(RouteBuilder.createFromRoute({ path: path, loadChildren: loadChildren }));
|
|
6282
|
+
}
|
|
6283
|
+
addRoute(path, component) {
|
|
6284
|
+
return this.addRouteBuilder(RouteBuilder.create(path, component));
|
|
6285
|
+
}
|
|
6286
|
+
addTableviewRoutes(path, descriptor, tableviewDataProvider, actions, hasDetails = true, hasEdit = true, hasAdd = true) {
|
|
6287
|
+
return this.addRouteBuilder(RouteBuilder.createTableviewRoutes(path, descriptor, tableviewDataProvider, actions, hasDetails, hasEdit, hasAdd));
|
|
6288
|
+
}
|
|
6289
|
+
addTableviewRoutesFromComponent(path, component, hasDetails = true, hasEdit = true, hasAdd = true) {
|
|
6290
|
+
return this.addRouteBuilder(RouteBuilder.createTableviewRoutesFromComponent(path, component, hasDetails, hasEdit, hasAdd));
|
|
6291
|
+
}
|
|
6292
|
+
addRouteBuilder(routeBuilder) {
|
|
6293
|
+
this.currentRoute = routeBuilder.withRoot(this);
|
|
6294
|
+
this.routes.push(routeBuilder);
|
|
6295
|
+
return this;
|
|
6296
|
+
}
|
|
6297
|
+
toRoute() {
|
|
6298
|
+
if (!this.currentRoute) {
|
|
6299
|
+
throw new Error('No routes were added!');
|
|
6300
|
+
}
|
|
6301
|
+
return this.currentRoute;
|
|
6302
|
+
}
|
|
6303
|
+
buildRoutes() {
|
|
6304
|
+
let angularRoutes = [];
|
|
6305
|
+
for (let route of this.routes) {
|
|
6306
|
+
angularRoutes.push(route.buildRoute());
|
|
6307
|
+
}
|
|
6308
|
+
if (this.layoutRoute) {
|
|
6309
|
+
const layoutAngularRoute = this.layoutRoute.buildRoute();
|
|
6310
|
+
if (angularRoutes.length > 0) {
|
|
6311
|
+
layoutAngularRoute.children = angularRoutes;
|
|
6312
|
+
}
|
|
6313
|
+
angularRoutes = [layoutAngularRoute];
|
|
6314
|
+
}
|
|
6315
|
+
return angularRoutes;
|
|
6316
|
+
}
|
|
6317
|
+
buildMenu() {
|
|
6318
|
+
const menuItems = [];
|
|
6319
|
+
for (const route of this.routes) {
|
|
6320
|
+
menuItems.push(...route.buildMenu());
|
|
6321
|
+
}
|
|
6322
|
+
return menuItems.flat();
|
|
6323
|
+
}
|
|
6324
|
+
}
|
|
6325
|
+
class RouteBuilder {
|
|
6326
|
+
constructor(route) {
|
|
6327
|
+
this.routePath = [];
|
|
6328
|
+
this.children = [];
|
|
6329
|
+
this.menuItemChildren = [];
|
|
6330
|
+
if (!route.data) {
|
|
6331
|
+
route.data = {};
|
|
6332
|
+
}
|
|
6333
|
+
if (!route.data['breadcrumb']) {
|
|
6334
|
+
route.data['breadcrumb'] = null;
|
|
6335
|
+
}
|
|
6336
|
+
this.route = route;
|
|
6337
|
+
if (this.route.path && this.route.path.length > 0) {
|
|
6338
|
+
this.routePath = [this.route.path];
|
|
6339
|
+
}
|
|
6340
|
+
}
|
|
6341
|
+
static create(path, component) {
|
|
6342
|
+
return new RouteBuilder({
|
|
6343
|
+
path: path,
|
|
6344
|
+
component: component
|
|
6345
|
+
});
|
|
6346
|
+
}
|
|
6347
|
+
static createRedirect(path, redirectTo, pathMatch = 'prefix') {
|
|
6348
|
+
return new RouteBuilder({
|
|
6349
|
+
path: path,
|
|
6350
|
+
redirectTo: redirectTo,
|
|
6351
|
+
pathMatch: pathMatch
|
|
6352
|
+
});
|
|
6353
|
+
}
|
|
6354
|
+
static createFromRoute(route) {
|
|
6355
|
+
return new RouteBuilder(route);
|
|
6356
|
+
}
|
|
6357
|
+
static createTableviewRoutes(path, descriptor, tableviewDataProvider, actions, hasDetails = true, hasEdit = true, hasAdd = true) {
|
|
6358
|
+
const tableviewRoute = RouteBuilder.createFromRoute({
|
|
6359
|
+
data: {
|
|
6360
|
+
tableviewData: {
|
|
6361
|
+
descriptor: descriptor,
|
|
6362
|
+
dataProvider: tableviewDataProvider,
|
|
6363
|
+
actions: actions
|
|
6364
|
+
}
|
|
6365
|
+
},
|
|
6366
|
+
path: path,
|
|
6367
|
+
component: MngTableviewRouteComponent
|
|
6368
|
+
});
|
|
6369
|
+
RouteBuilder.addActionsSubroutesToTableviewParent(tableviewRoute, hasDetails, hasEdit, hasAdd);
|
|
6370
|
+
return tableviewRoute;
|
|
6371
|
+
}
|
|
6372
|
+
static createTableviewRoutesFromComponent(path, component, hasDetails = true, hasEdit = true, hasAdd = true) {
|
|
6373
|
+
const actionCrudRoute = RouteBuilder.create(path, component);
|
|
6374
|
+
RouteBuilder.addActionsSubroutesToTableviewParent(actionCrudRoute, hasDetails, hasEdit, hasAdd);
|
|
6375
|
+
return actionCrudRoute;
|
|
6376
|
+
}
|
|
6377
|
+
static addActionsSubroutesToTableviewParent(parentRoute, hasDetails, hasEdit, hasAdd) {
|
|
6378
|
+
parentRoute.addChild('', MngActionRouteComponent);
|
|
6379
|
+
if (hasAdd) {
|
|
6380
|
+
parentRoute.addChild('add', MngActionRouteComponent);
|
|
6381
|
+
}
|
|
6382
|
+
if (hasDetails) {
|
|
6383
|
+
parentRoute.addChild(':itemId', MngActionRouteComponent);
|
|
6384
|
+
}
|
|
6385
|
+
if (hasEdit) {
|
|
6386
|
+
parentRoute.addChild(':itemId/edit', MngActionRouteComponent);
|
|
6387
|
+
}
|
|
6388
|
+
}
|
|
6389
|
+
withRoot(routesBuilder) {
|
|
6390
|
+
this.root = routesBuilder;
|
|
6391
|
+
return this;
|
|
6392
|
+
}
|
|
6393
|
+
withParent(parent) {
|
|
6394
|
+
this.parent = parent;
|
|
6395
|
+
this.routePath = RouteUtil.removeEmptyPathSegments([...this.parent.routePath, this.route.path ?? '']);
|
|
6396
|
+
return this;
|
|
6397
|
+
}
|
|
6398
|
+
withBreadcrumb(breadcrumb) {
|
|
6399
|
+
this.breadcrumb = breadcrumb;
|
|
6400
|
+
this.route.data['breadcrumb'] = breadcrumb;
|
|
6401
|
+
return this;
|
|
6402
|
+
}
|
|
6403
|
+
withPageTitle(pageTitle) {
|
|
6404
|
+
this.pageTitle = pageTitle;
|
|
6405
|
+
this.route.data['pageTitle'] = pageTitle;
|
|
6406
|
+
return this;
|
|
6407
|
+
}
|
|
6408
|
+
withRedirectTo(redirectTo) {
|
|
6409
|
+
this.route.redirectTo = redirectTo;
|
|
6410
|
+
return this;
|
|
6411
|
+
}
|
|
6412
|
+
withPathMatch(pathMatch) {
|
|
6413
|
+
this.route.pathMatch = pathMatch;
|
|
6414
|
+
return this;
|
|
6415
|
+
}
|
|
6416
|
+
withTitle(title) {
|
|
6417
|
+
this.withPageTitle(title);
|
|
6418
|
+
this.withBreadcrumb(title);
|
|
6419
|
+
return this;
|
|
6420
|
+
}
|
|
6421
|
+
withData(data) {
|
|
6422
|
+
this.route.data = data;
|
|
6423
|
+
return this;
|
|
6424
|
+
}
|
|
6425
|
+
withPrimeMenuItem(menuItem) {
|
|
6426
|
+
this.menuItem = menuItem;
|
|
6427
|
+
return this;
|
|
6428
|
+
}
|
|
6429
|
+
withMenuItem(icon, label, routerLink) {
|
|
6430
|
+
this.menuItem = this.createMenuItem(icon, label, routerLink);
|
|
6431
|
+
return this;
|
|
6432
|
+
}
|
|
6433
|
+
withMenuItemChild(label, icon, routerLink) {
|
|
6434
|
+
this.menuItemChildren.push(this.createMenuItem(icon, label, routerLink));
|
|
6435
|
+
return this;
|
|
6436
|
+
}
|
|
6437
|
+
createMenuItem(icon, label, routerLink) {
|
|
6438
|
+
const menuItem = {};
|
|
6439
|
+
if (icon) {
|
|
6440
|
+
menuItem.icon = icon;
|
|
6441
|
+
}
|
|
6442
|
+
if (label) {
|
|
6443
|
+
menuItem.label = label;
|
|
6444
|
+
}
|
|
6445
|
+
if (routerLink) {
|
|
6446
|
+
menuItem.routerLink = RouteUtil.appendPathToBasePath(this.routePath, routerLink);
|
|
6447
|
+
;
|
|
6448
|
+
}
|
|
6449
|
+
else {
|
|
6450
|
+
menuItem.routerLink = this.routePath;
|
|
6451
|
+
}
|
|
6452
|
+
return menuItem;
|
|
6453
|
+
}
|
|
6454
|
+
withMenuItemChildren(routesBuilder) {
|
|
6455
|
+
const menu = routesBuilder.buildMenu();
|
|
6456
|
+
this.adjustMenuRouterLinksFromBuilder(menu);
|
|
6457
|
+
this.menuItemChildren.push(...menu);
|
|
6458
|
+
return this;
|
|
6459
|
+
}
|
|
6460
|
+
adjustMenuRouterLinksFromBuilder(menuItems) {
|
|
6461
|
+
for (const menuItem of menuItems) {
|
|
6462
|
+
if (menuItem.routerLink) {
|
|
6463
|
+
menuItem.routerLink = RouteUtil.appendPathToBasePath(this.routePath, menuItem.routerLink);
|
|
6464
|
+
}
|
|
6465
|
+
if (Array.isArray(menuItem.items)) {
|
|
6466
|
+
this.adjustMenuRouterLinksFromBuilder(menuItem.items);
|
|
6467
|
+
}
|
|
6468
|
+
}
|
|
6469
|
+
}
|
|
6470
|
+
addChild(path, component) {
|
|
6471
|
+
const childRouteBuilder = RouteBuilder.create(path, component);
|
|
6472
|
+
this.addChildBuilder(childRouteBuilder);
|
|
6473
|
+
return childRouteBuilder;
|
|
6474
|
+
}
|
|
6475
|
+
addChildBuilder(routeBuilder) {
|
|
6476
|
+
routeBuilder.withParent(this);
|
|
6477
|
+
if (this.root) {
|
|
6478
|
+
routeBuilder.withRoot(this.root);
|
|
6479
|
+
}
|
|
6480
|
+
this.children.push(routeBuilder);
|
|
6481
|
+
return this;
|
|
6482
|
+
}
|
|
6483
|
+
addTableviewRoutes(path, descriptor, tableviewDataProvider, actions, hasDetails = true, hasEdit = true, hasAdd = true) {
|
|
6484
|
+
const routeBuilder = RouteBuilder.createTableviewRoutes(path, descriptor, tableviewDataProvider, actions, hasDetails, hasEdit, hasAdd);
|
|
6485
|
+
this.addChildBuilder(routeBuilder);
|
|
6486
|
+
return routeBuilder;
|
|
6487
|
+
}
|
|
6488
|
+
addTableviewRoutesFromComponent(path, component, hasDetails = true, hasEdit = true, hasAdd = true) {
|
|
6489
|
+
const routeBuilder = RouteBuilder.createTableviewRoutesFromComponent(path, component, hasDetails, hasEdit, hasAdd);
|
|
6490
|
+
this.addChildBuilder(routeBuilder);
|
|
6491
|
+
return routeBuilder;
|
|
6492
|
+
}
|
|
6493
|
+
toParent() {
|
|
6494
|
+
if (!this.parent) {
|
|
6495
|
+
throw new Error('Parent was not provided.');
|
|
6496
|
+
}
|
|
6497
|
+
return this.parent;
|
|
6498
|
+
}
|
|
6499
|
+
toRoot() {
|
|
6500
|
+
if (!this.root) {
|
|
6501
|
+
throw new Error('Root was not provided.');
|
|
6502
|
+
}
|
|
6503
|
+
return this.root;
|
|
6504
|
+
}
|
|
6505
|
+
finish() {
|
|
6506
|
+
return this.toRoot();
|
|
6507
|
+
}
|
|
6508
|
+
buildRoute() {
|
|
6509
|
+
const angularRoute = {
|
|
6510
|
+
...this.route
|
|
6511
|
+
};
|
|
6512
|
+
if ((this.route.children?.length ?? 0) > 0 || this.children.length > 0) {
|
|
6513
|
+
// route has children
|
|
6514
|
+
angularRoute.children = [];
|
|
6515
|
+
if (this.route.children?.length) {
|
|
6516
|
+
angularRoute.children.push(...this.route.children);
|
|
6517
|
+
}
|
|
6518
|
+
if (this.children.length) {
|
|
6519
|
+
for (let childRoute of this.children) {
|
|
6520
|
+
angularRoute.children.push(childRoute.buildRoute());
|
|
6521
|
+
}
|
|
6522
|
+
}
|
|
6523
|
+
}
|
|
6524
|
+
return angularRoute;
|
|
6525
|
+
}
|
|
6526
|
+
buildMenu() {
|
|
6527
|
+
const menuItem = this.menuItem ? { ...this.menuItem } : null;
|
|
6528
|
+
const routeChildrenMenuItems = this.children.flatMap(child => child.buildMenu());
|
|
6529
|
+
const menuItemChildren = [];
|
|
6530
|
+
if (menuItem?.items) {
|
|
6531
|
+
menuItemChildren.push(...menuItem.items);
|
|
6532
|
+
}
|
|
6533
|
+
menuItemChildren.push(...this.menuItemChildren, ...routeChildrenMenuItems);
|
|
6534
|
+
if (!menuItem) {
|
|
6535
|
+
return menuItemChildren;
|
|
6536
|
+
}
|
|
6537
|
+
menuItem.label = menuItem.label ?? this.pageTitle;
|
|
6538
|
+
menuItem.routerLink = RouteUtil.removeEmptyPathSegments(menuItem.routerLink ?? this.routePath);
|
|
6539
|
+
if (menuItemChildren.length > 0) {
|
|
6540
|
+
menuItem.items = menuItemChildren;
|
|
6541
|
+
}
|
|
6542
|
+
return [menuItem];
|
|
6543
|
+
}
|
|
6544
|
+
}
|
|
6545
|
+
|
|
6205
6546
|
/*
|
|
6206
6547
|
* Public API Surface of mng-commons
|
|
6207
6548
|
*/
|
|
@@ -6210,5 +6551,5 @@ class AMngCrudApiService {
|
|
|
6210
6551
|
* Generated bundle index. Do not edit.
|
|
6211
6552
|
*/
|
|
6212
6553
|
|
|
6213
|
-
export { AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngCrudApiService, AMngTableviewRouteComponent, ActionActivationResult, ActionActivationTriggerEnum, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorEditDescriptor, ActionError, ActionExecContext, ActionLevelEnum, ActionPositionEnum, ActionRunResult, ActionTriggerResult, ActionTypeEnum, ColumnDescriptor, DataProvider, EditorDataProvider, EditorDescriptor, EditorFormlyUtil, FieldGroupDescriptor, FieldInputDescriptor, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldManyEditorDescriptor, FieldManyToManyEditorDescriptor, FieldTabGroupDescriptor, FieldValidator, FilterDescriptor, FilterLookupDescriptor, I18nUtil, LookupDataProvider, MNG_AUTOCOMPLETE_VALUE_ACCESSOR, MNG_DROPDOWN_VALUE_ACCESSOR, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusQueryResultBase, MediusQueryResultWithObject, MediusRestUtil, MngActionComponent, MngActionDialogComponent, MngActionRouteComponent, MngActionService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDropdownComponent, MngFooterComponent, MngFormEditorComponent, MngFormEditorSubmitEvent, MngFormlyFieldAutocompleteComponent, MngFormlyFieldDropdownComponent, MngFormlyFieldFieldsetComponent, MngFormlyFieldInputComponent, MngFormlyFieldTableDialogFormComponent, MngFormlyFieldTableDialogMultiselectComponent, MngFormlyFieldTabsComponent, MngFormlyFieldWrapperComponent, MngFormlyTableWrapperComponent, MngMainLayoutComponent, MngMainLayoutComponentService, MngMenuComponent, MngMenuItemComponent, MngNavigationService, MngPropertyPathPipe, MngTableColumnFilterComponent, MngTableColumnValueComponent, MngTableComponent, MngTableviewComponent, MngTemplateDirective, MngTopbarComponent, ModelDescriptor, ModelUtil, ObjectSerializer, TableDescriptor, TableviewComponentService, TableviewDataProvider, TableviewDescriptor, ToastUtil, TypeName, TypeUtil, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getFormlyValidationMessages, getMaxLengthValidationMessage, getMinLengthValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngCommonsInitializerProvider, mngConfigJsonAppInitializerProvider, mngConfigurationServiceProvider, mngFormlyConfigProvider, primeNgModules, typeMapBase, typeNameDecoratorPropertyName };
|
|
6554
|
+
export { AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngCrudApiService, AMngTableviewRouteComponent, ActionActivationResult, ActionActivationTriggerEnum, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorEditDescriptor, ActionError, ActionExecContext, ActionLevelEnum, ActionPositionEnum, ActionRunResult, ActionTriggerResult, ActionTypeEnum, ColumnDescriptor, DataProvider, EditorDataProvider, EditorDescriptor, EditorFormlyUtil, FieldGroupDescriptor, FieldInputDescriptor, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldManyEditorDescriptor, FieldManyToManyEditorDescriptor, FieldTabGroupDescriptor, FieldValidator, FilterDescriptor, FilterLookupDescriptor, I18nUtil, LookupDataProvider, MNG_AUTOCOMPLETE_VALUE_ACCESSOR, MNG_DROPDOWN_VALUE_ACCESSOR, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusQueryResultBase, MediusQueryResultWithObject, MediusRestUtil, MngActionComponent, MngActionDialogComponent, MngActionRouteComponent, MngActionService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDropdownComponent, MngFooterComponent, MngFormEditorComponent, MngFormEditorSubmitEvent, MngFormlyFieldAutocompleteComponent, MngFormlyFieldDropdownComponent, MngFormlyFieldFieldsetComponent, MngFormlyFieldInputComponent, MngFormlyFieldTableDialogFormComponent, MngFormlyFieldTableDialogMultiselectComponent, MngFormlyFieldTabsComponent, MngFormlyFieldWrapperComponent, MngFormlyTableWrapperComponent, MngMainLayoutComponent, MngMainLayoutComponentService, MngMenuComponent, MngMenuItemComponent, MngNavigationService, MngPropertyPathPipe, MngTableColumnFilterComponent, MngTableColumnValueComponent, MngTableComponent, MngTableviewComponent, MngTableviewRouteComponent, MngTemplateDirective, MngTopbarComponent, ModelDescriptor, ModelUtil, ObjectSerializer, RouteBuilder, RoutesBuilder, TableDescriptor, TableviewComponentService, TableviewDataProvider, TableviewDescriptor, ToastUtil, TypeName, TypeUtil, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getFormlyValidationMessages, getMaxLengthValidationMessage, getMinLengthValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngCommonsInitializerProvider, mngConfigJsonAppInitializerProvider, mngConfigurationServiceProvider, mngFormlyConfigProvider, primeNgModules, typeMapBase, typeNameDecoratorPropertyName };
|
|
6214
6555
|
//# sourceMappingURL=mediusinc-mng-commons.mjs.map
|