@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
|
@@ -3347,7 +3347,6 @@ class ActionTriggerResult {
|
|
|
3347
3347
|
class TableviewComponentService {
|
|
3348
3348
|
constructor() {
|
|
3349
3349
|
this.actions = [];
|
|
3350
|
-
console.log('TableviewComponentService init.');
|
|
3351
3350
|
}
|
|
3352
3351
|
reloadTable() {
|
|
3353
3352
|
// TODO: add callback functions to implement
|
|
@@ -4937,6 +4936,10 @@ class MngFormlyFieldInputComponent extends FieldType {
|
|
|
4937
4936
|
ngOnInit() {
|
|
4938
4937
|
this.iFormControl = this.formControl;
|
|
4939
4938
|
this.descriptor = this.to['descriptor'];
|
|
4939
|
+
if (this.to.type === 'datepicker' && typeof this.iFormControl.value === 'string') {
|
|
4940
|
+
const dateObject = new Date(this.iFormControl.value);
|
|
4941
|
+
this.iFormControl.setValue(dateObject);
|
|
4942
|
+
}
|
|
4940
4943
|
}
|
|
4941
4944
|
}
|
|
4942
4945
|
MngFormlyFieldInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngFormlyFieldInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -5376,7 +5379,6 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
5376
5379
|
const hasEditAction = this.descriptor.actions.some(a => a === FieldManyEditorDescriptor.ActionEnum.Edit);
|
|
5377
5380
|
const hasDeleteAction = this.descriptor.actions.some(a => a === FieldManyEditorDescriptor.ActionEnum.Delete);
|
|
5378
5381
|
if (hasAddAction) {
|
|
5379
|
-
console.log(this.descriptor.tableviewDescriptor.addEditor);
|
|
5380
5382
|
const addAction = new ActionEditorDescriptor(this.descriptor.tableviewDescriptor.addEditor, 'add', this.descriptor.editor.model.type, this.descriptor.property)
|
|
5381
5383
|
.withTitle(null)
|
|
5382
5384
|
.withIcon('pi pi-plus')
|
|
@@ -5652,7 +5654,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
|
|
|
5652
5654
|
}] } });
|
|
5653
5655
|
|
|
5654
5656
|
class AMngTableviewRouteComponent {
|
|
5655
|
-
|
|
5657
|
+
ngOnInit() {
|
|
5656
5658
|
this.descriptor = this.createTableviewDescriptor();
|
|
5657
5659
|
this.dataProvider = this.createTableviewDataProvider();
|
|
5658
5660
|
this.actions = this.createActionDescriptors();
|
|
@@ -5670,7 +5672,36 @@ AMngTableviewRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.
|
|
|
5670
5672
|
AMngTableviewRouteComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.3", type: AMngTableviewRouteComponent, ngImport: i0 });
|
|
5671
5673
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: AMngTableviewRouteComponent, decorators: [{
|
|
5672
5674
|
type: Directive
|
|
5673
|
-
}]
|
|
5675
|
+
}] });
|
|
5676
|
+
|
|
5677
|
+
class MngTableviewRouteComponent extends AMngTableviewRouteComponent {
|
|
5678
|
+
constructor(route) {
|
|
5679
|
+
super();
|
|
5680
|
+
this.route = route;
|
|
5681
|
+
}
|
|
5682
|
+
createTableviewDescriptor() {
|
|
5683
|
+
if (!this.route.snapshot.data['tableviewData'].descriptor) {
|
|
5684
|
+
throw Error('Tableview requires a descriptor.');
|
|
5685
|
+
}
|
|
5686
|
+
return this.route.snapshot.data['tableviewData'].descriptor;
|
|
5687
|
+
}
|
|
5688
|
+
createTableviewDataProvider() {
|
|
5689
|
+
if (!this.route.snapshot.data['tableviewData'].dataProvider) {
|
|
5690
|
+
throw Error('Tableview requires a data provider.');
|
|
5691
|
+
}
|
|
5692
|
+
return this.route.snapshot.data['tableviewData'].dataProvider;
|
|
5693
|
+
}
|
|
5694
|
+
createActionDescriptors() {
|
|
5695
|
+
var _a;
|
|
5696
|
+
return (_a = this.route.snapshot.data['tableviewData'].actions) !== null && _a !== void 0 ? _a : super.createActionDescriptors();
|
|
5697
|
+
}
|
|
5698
|
+
}
|
|
5699
|
+
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 });
|
|
5700
|
+
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"] }] });
|
|
5701
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MngTableviewRouteComponent, decorators: [{
|
|
5702
|
+
type: Component,
|
|
5703
|
+
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" }]
|
|
5704
|
+
}], ctorParameters: function () { return [{ type: i1$2.ActivatedRoute }]; } });
|
|
5674
5705
|
|
|
5675
5706
|
function mngCommonsInitializerProvider(mngCommons) {
|
|
5676
5707
|
return () => mngCommons.initialize();
|
|
@@ -5934,6 +5965,7 @@ const declarations = [
|
|
|
5934
5965
|
MngTableviewComponent,
|
|
5935
5966
|
MngTableColumnValueComponent,
|
|
5936
5967
|
MngTableColumnFilterComponent,
|
|
5968
|
+
MngTableviewRouteComponent,
|
|
5937
5969
|
// editor components
|
|
5938
5970
|
MngFormEditorComponent,
|
|
5939
5971
|
MngActionComponent,
|
|
@@ -6024,6 +6056,7 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
|
|
|
6024
6056
|
MngTableviewComponent,
|
|
6025
6057
|
MngTableColumnValueComponent,
|
|
6026
6058
|
MngTableColumnFilterComponent,
|
|
6059
|
+
MngTableviewRouteComponent,
|
|
6027
6060
|
// editor components
|
|
6028
6061
|
MngFormEditorComponent,
|
|
6029
6062
|
MngActionComponent,
|
|
@@ -6132,6 +6165,7 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
|
|
|
6132
6165
|
MngTableviewComponent,
|
|
6133
6166
|
MngTableColumnValueComponent,
|
|
6134
6167
|
MngTableColumnFilterComponent,
|
|
6168
|
+
MngTableviewRouteComponent,
|
|
6135
6169
|
// editor components
|
|
6136
6170
|
MngFormEditorComponent,
|
|
6137
6171
|
MngActionComponent,
|
|
@@ -6278,6 +6312,315 @@ class AMngCrudApiService {
|
|
|
6278
6312
|
}
|
|
6279
6313
|
}
|
|
6280
6314
|
|
|
6315
|
+
class RouteUtil {
|
|
6316
|
+
static removeEmptyPathSegments(path) {
|
|
6317
|
+
const filteredPath = path.filter(ps => typeof ps === 'string' && ps.length > 0);
|
|
6318
|
+
return filteredPath.length > 0 ? filteredPath : [''];
|
|
6319
|
+
}
|
|
6320
|
+
static appendPathToBasePath(basePath, path) {
|
|
6321
|
+
if (path.length > 0) {
|
|
6322
|
+
if (path[0].startsWith('/')) {
|
|
6323
|
+
return path;
|
|
6324
|
+
}
|
|
6325
|
+
else if (path[0].startsWith('../')) {
|
|
6326
|
+
// TODO: process multi upper folder
|
|
6327
|
+
throw new Error('Not implemented');
|
|
6328
|
+
}
|
|
6329
|
+
else {
|
|
6330
|
+
return RouteUtil.removeEmptyPathSegments([...basePath, ...path]);
|
|
6331
|
+
}
|
|
6332
|
+
}
|
|
6333
|
+
else {
|
|
6334
|
+
return basePath;
|
|
6335
|
+
}
|
|
6336
|
+
}
|
|
6337
|
+
}
|
|
6338
|
+
|
|
6339
|
+
class RoutesBuilder {
|
|
6340
|
+
constructor(layoutRoute) {
|
|
6341
|
+
this.routes = [];
|
|
6342
|
+
this.layoutRoute = layoutRoute === null || layoutRoute === void 0 ? void 0 : layoutRoute.withRoot(this);
|
|
6343
|
+
}
|
|
6344
|
+
static create() {
|
|
6345
|
+
return new RoutesBuilder();
|
|
6346
|
+
}
|
|
6347
|
+
static createWithLayout(layoutComponent = MngMainLayoutComponent) {
|
|
6348
|
+
const routesBuilder = new RoutesBuilder(RouteBuilder.create('', layoutComponent));
|
|
6349
|
+
return routesBuilder;
|
|
6350
|
+
}
|
|
6351
|
+
addAngularRoute(route) {
|
|
6352
|
+
return this.addRouteBuilder(RouteBuilder.createFromRoute(route));
|
|
6353
|
+
}
|
|
6354
|
+
addRouteRedirect(path, redirectTo, pathMatch = 'prefix') {
|
|
6355
|
+
return this.addRouteBuilder(RouteBuilder.createRedirect(path, redirectTo, pathMatch));
|
|
6356
|
+
}
|
|
6357
|
+
addLazyRoute(path, loadChildren) {
|
|
6358
|
+
return this.addRouteBuilder(RouteBuilder.createFromRoute({ path: path, loadChildren: loadChildren }));
|
|
6359
|
+
}
|
|
6360
|
+
addRoute(path, component) {
|
|
6361
|
+
return this.addRouteBuilder(RouteBuilder.create(path, component));
|
|
6362
|
+
}
|
|
6363
|
+
addTableviewRoutes(path, descriptor, tableviewDataProvider, actions, hasDetails = true, hasEdit = true, hasAdd = true) {
|
|
6364
|
+
return this.addRouteBuilder(RouteBuilder.createTableviewRoutes(path, descriptor, tableviewDataProvider, actions, hasDetails, hasEdit, hasAdd));
|
|
6365
|
+
}
|
|
6366
|
+
addTableviewRoutesFromComponent(path, component, hasDetails = true, hasEdit = true, hasAdd = true) {
|
|
6367
|
+
return this.addRouteBuilder(RouteBuilder.createTableviewRoutesFromComponent(path, component, hasDetails, hasEdit, hasAdd));
|
|
6368
|
+
}
|
|
6369
|
+
addRouteBuilder(routeBuilder) {
|
|
6370
|
+
this.currentRoute = routeBuilder.withRoot(this);
|
|
6371
|
+
this.routes.push(routeBuilder);
|
|
6372
|
+
return this;
|
|
6373
|
+
}
|
|
6374
|
+
toRoute() {
|
|
6375
|
+
if (!this.currentRoute) {
|
|
6376
|
+
throw new Error('No routes were added!');
|
|
6377
|
+
}
|
|
6378
|
+
return this.currentRoute;
|
|
6379
|
+
}
|
|
6380
|
+
buildRoutes() {
|
|
6381
|
+
let angularRoutes = [];
|
|
6382
|
+
for (let route of this.routes) {
|
|
6383
|
+
angularRoutes.push(route.buildRoute());
|
|
6384
|
+
}
|
|
6385
|
+
if (this.layoutRoute) {
|
|
6386
|
+
const layoutAngularRoute = this.layoutRoute.buildRoute();
|
|
6387
|
+
if (angularRoutes.length > 0) {
|
|
6388
|
+
layoutAngularRoute.children = angularRoutes;
|
|
6389
|
+
}
|
|
6390
|
+
angularRoutes = [layoutAngularRoute];
|
|
6391
|
+
}
|
|
6392
|
+
return angularRoutes;
|
|
6393
|
+
}
|
|
6394
|
+
buildMenu() {
|
|
6395
|
+
const menuItems = [];
|
|
6396
|
+
for (const route of this.routes) {
|
|
6397
|
+
menuItems.push(...route.buildMenu());
|
|
6398
|
+
}
|
|
6399
|
+
return menuItems.flat();
|
|
6400
|
+
}
|
|
6401
|
+
}
|
|
6402
|
+
class RouteBuilder {
|
|
6403
|
+
constructor(route) {
|
|
6404
|
+
this.routePath = [];
|
|
6405
|
+
this.children = [];
|
|
6406
|
+
this.menuItemChildren = [];
|
|
6407
|
+
if (!route.data) {
|
|
6408
|
+
route.data = {};
|
|
6409
|
+
}
|
|
6410
|
+
if (!route.data['breadcrumb']) {
|
|
6411
|
+
route.data['breadcrumb'] = null;
|
|
6412
|
+
}
|
|
6413
|
+
this.route = route;
|
|
6414
|
+
if (this.route.path && this.route.path.length > 0) {
|
|
6415
|
+
this.routePath = [this.route.path];
|
|
6416
|
+
}
|
|
6417
|
+
}
|
|
6418
|
+
static create(path, component) {
|
|
6419
|
+
return new RouteBuilder({
|
|
6420
|
+
path: path,
|
|
6421
|
+
component: component
|
|
6422
|
+
});
|
|
6423
|
+
}
|
|
6424
|
+
static createRedirect(path, redirectTo, pathMatch = 'prefix') {
|
|
6425
|
+
return new RouteBuilder({
|
|
6426
|
+
path: path,
|
|
6427
|
+
redirectTo: redirectTo,
|
|
6428
|
+
pathMatch: pathMatch
|
|
6429
|
+
});
|
|
6430
|
+
}
|
|
6431
|
+
static createFromRoute(route) {
|
|
6432
|
+
return new RouteBuilder(route);
|
|
6433
|
+
}
|
|
6434
|
+
static createTableviewRoutes(path, descriptor, tableviewDataProvider, actions, hasDetails = true, hasEdit = true, hasAdd = true) {
|
|
6435
|
+
const tableviewRoute = RouteBuilder.createFromRoute({
|
|
6436
|
+
data: {
|
|
6437
|
+
tableviewData: {
|
|
6438
|
+
descriptor: descriptor,
|
|
6439
|
+
dataProvider: tableviewDataProvider,
|
|
6440
|
+
actions: actions
|
|
6441
|
+
}
|
|
6442
|
+
},
|
|
6443
|
+
path: path,
|
|
6444
|
+
component: MngTableviewRouteComponent
|
|
6445
|
+
});
|
|
6446
|
+
RouteBuilder.addActionsSubroutesToTableviewParent(tableviewRoute, hasDetails, hasEdit, hasAdd);
|
|
6447
|
+
return tableviewRoute;
|
|
6448
|
+
}
|
|
6449
|
+
static createTableviewRoutesFromComponent(path, component, hasDetails = true, hasEdit = true, hasAdd = true) {
|
|
6450
|
+
const actionCrudRoute = RouteBuilder.create(path, component);
|
|
6451
|
+
RouteBuilder.addActionsSubroutesToTableviewParent(actionCrudRoute, hasDetails, hasEdit, hasAdd);
|
|
6452
|
+
return actionCrudRoute;
|
|
6453
|
+
}
|
|
6454
|
+
static addActionsSubroutesToTableviewParent(parentRoute, hasDetails, hasEdit, hasAdd) {
|
|
6455
|
+
parentRoute.addChild('', MngActionRouteComponent);
|
|
6456
|
+
if (hasAdd) {
|
|
6457
|
+
parentRoute.addChild('add', MngActionRouteComponent);
|
|
6458
|
+
}
|
|
6459
|
+
if (hasDetails) {
|
|
6460
|
+
parentRoute.addChild(':itemId', MngActionRouteComponent);
|
|
6461
|
+
}
|
|
6462
|
+
if (hasEdit) {
|
|
6463
|
+
parentRoute.addChild(':itemId/edit', MngActionRouteComponent);
|
|
6464
|
+
}
|
|
6465
|
+
}
|
|
6466
|
+
withRoot(routesBuilder) {
|
|
6467
|
+
this.root = routesBuilder;
|
|
6468
|
+
return this;
|
|
6469
|
+
}
|
|
6470
|
+
withParent(parent) {
|
|
6471
|
+
var _a;
|
|
6472
|
+
this.parent = parent;
|
|
6473
|
+
this.routePath = RouteUtil.removeEmptyPathSegments([...this.parent.routePath, (_a = this.route.path) !== null && _a !== void 0 ? _a : '']);
|
|
6474
|
+
return this;
|
|
6475
|
+
}
|
|
6476
|
+
withBreadcrumb(breadcrumb) {
|
|
6477
|
+
this.breadcrumb = breadcrumb;
|
|
6478
|
+
this.route.data['breadcrumb'] = breadcrumb;
|
|
6479
|
+
return this;
|
|
6480
|
+
}
|
|
6481
|
+
withPageTitle(pageTitle) {
|
|
6482
|
+
this.pageTitle = pageTitle;
|
|
6483
|
+
this.route.data['pageTitle'] = pageTitle;
|
|
6484
|
+
return this;
|
|
6485
|
+
}
|
|
6486
|
+
withRedirectTo(redirectTo) {
|
|
6487
|
+
this.route.redirectTo = redirectTo;
|
|
6488
|
+
return this;
|
|
6489
|
+
}
|
|
6490
|
+
withPathMatch(pathMatch) {
|
|
6491
|
+
this.route.pathMatch = pathMatch;
|
|
6492
|
+
return this;
|
|
6493
|
+
}
|
|
6494
|
+
withTitle(title) {
|
|
6495
|
+
this.withPageTitle(title);
|
|
6496
|
+
this.withBreadcrumb(title);
|
|
6497
|
+
return this;
|
|
6498
|
+
}
|
|
6499
|
+
withData(data) {
|
|
6500
|
+
this.route.data = data;
|
|
6501
|
+
return this;
|
|
6502
|
+
}
|
|
6503
|
+
withPrimeMenuItem(menuItem) {
|
|
6504
|
+
this.menuItem = menuItem;
|
|
6505
|
+
return this;
|
|
6506
|
+
}
|
|
6507
|
+
withMenuItem(icon, label, routerLink) {
|
|
6508
|
+
this.menuItem = this.createMenuItem(icon, label, routerLink);
|
|
6509
|
+
return this;
|
|
6510
|
+
}
|
|
6511
|
+
withMenuItemChild(label, icon, routerLink) {
|
|
6512
|
+
this.menuItemChildren.push(this.createMenuItem(icon, label, routerLink));
|
|
6513
|
+
return this;
|
|
6514
|
+
}
|
|
6515
|
+
createMenuItem(icon, label, routerLink) {
|
|
6516
|
+
const menuItem = {};
|
|
6517
|
+
if (icon) {
|
|
6518
|
+
menuItem.icon = icon;
|
|
6519
|
+
}
|
|
6520
|
+
if (label) {
|
|
6521
|
+
menuItem.label = label;
|
|
6522
|
+
}
|
|
6523
|
+
if (routerLink) {
|
|
6524
|
+
menuItem.routerLink = RouteUtil.appendPathToBasePath(this.routePath, routerLink);
|
|
6525
|
+
;
|
|
6526
|
+
}
|
|
6527
|
+
else {
|
|
6528
|
+
menuItem.routerLink = this.routePath;
|
|
6529
|
+
}
|
|
6530
|
+
return menuItem;
|
|
6531
|
+
}
|
|
6532
|
+
withMenuItemChildren(routesBuilder) {
|
|
6533
|
+
const menu = routesBuilder.buildMenu();
|
|
6534
|
+
this.adjustMenuRouterLinksFromBuilder(menu);
|
|
6535
|
+
this.menuItemChildren.push(...menu);
|
|
6536
|
+
return this;
|
|
6537
|
+
}
|
|
6538
|
+
adjustMenuRouterLinksFromBuilder(menuItems) {
|
|
6539
|
+
for (const menuItem of menuItems) {
|
|
6540
|
+
if (menuItem.routerLink) {
|
|
6541
|
+
menuItem.routerLink = RouteUtil.appendPathToBasePath(this.routePath, menuItem.routerLink);
|
|
6542
|
+
}
|
|
6543
|
+
if (Array.isArray(menuItem.items)) {
|
|
6544
|
+
this.adjustMenuRouterLinksFromBuilder(menuItem.items);
|
|
6545
|
+
}
|
|
6546
|
+
}
|
|
6547
|
+
}
|
|
6548
|
+
addChild(path, component) {
|
|
6549
|
+
const childRouteBuilder = RouteBuilder.create(path, component);
|
|
6550
|
+
this.addChildBuilder(childRouteBuilder);
|
|
6551
|
+
return childRouteBuilder;
|
|
6552
|
+
}
|
|
6553
|
+
addChildBuilder(routeBuilder) {
|
|
6554
|
+
routeBuilder.withParent(this);
|
|
6555
|
+
if (this.root) {
|
|
6556
|
+
routeBuilder.withRoot(this.root);
|
|
6557
|
+
}
|
|
6558
|
+
this.children.push(routeBuilder);
|
|
6559
|
+
return this;
|
|
6560
|
+
}
|
|
6561
|
+
addTableviewRoutes(path, descriptor, tableviewDataProvider, actions, hasDetails = true, hasEdit = true, hasAdd = true) {
|
|
6562
|
+
const routeBuilder = RouteBuilder.createTableviewRoutes(path, descriptor, tableviewDataProvider, actions, hasDetails, hasEdit, hasAdd);
|
|
6563
|
+
this.addChildBuilder(routeBuilder);
|
|
6564
|
+
return routeBuilder;
|
|
6565
|
+
}
|
|
6566
|
+
addTableviewRoutesFromComponent(path, component, hasDetails = true, hasEdit = true, hasAdd = true) {
|
|
6567
|
+
const routeBuilder = RouteBuilder.createTableviewRoutesFromComponent(path, component, hasDetails, hasEdit, hasAdd);
|
|
6568
|
+
this.addChildBuilder(routeBuilder);
|
|
6569
|
+
return routeBuilder;
|
|
6570
|
+
}
|
|
6571
|
+
toParent() {
|
|
6572
|
+
if (!this.parent) {
|
|
6573
|
+
throw new Error('Parent was not provided.');
|
|
6574
|
+
}
|
|
6575
|
+
return this.parent;
|
|
6576
|
+
}
|
|
6577
|
+
toRoot() {
|
|
6578
|
+
if (!this.root) {
|
|
6579
|
+
throw new Error('Root was not provided.');
|
|
6580
|
+
}
|
|
6581
|
+
return this.root;
|
|
6582
|
+
}
|
|
6583
|
+
finish() {
|
|
6584
|
+
return this.toRoot();
|
|
6585
|
+
}
|
|
6586
|
+
buildRoute() {
|
|
6587
|
+
var _a, _b, _c;
|
|
6588
|
+
const angularRoute = Object.assign({}, this.route);
|
|
6589
|
+
if (((_b = (_a = this.route.children) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0 || this.children.length > 0) {
|
|
6590
|
+
// route has children
|
|
6591
|
+
angularRoute.children = [];
|
|
6592
|
+
if ((_c = this.route.children) === null || _c === void 0 ? void 0 : _c.length) {
|
|
6593
|
+
angularRoute.children.push(...this.route.children);
|
|
6594
|
+
}
|
|
6595
|
+
if (this.children.length) {
|
|
6596
|
+
for (let childRoute of this.children) {
|
|
6597
|
+
angularRoute.children.push(childRoute.buildRoute());
|
|
6598
|
+
}
|
|
6599
|
+
}
|
|
6600
|
+
}
|
|
6601
|
+
return angularRoute;
|
|
6602
|
+
}
|
|
6603
|
+
buildMenu() {
|
|
6604
|
+
var _a, _b;
|
|
6605
|
+
const menuItem = this.menuItem ? Object.assign({}, this.menuItem) : null;
|
|
6606
|
+
const routeChildrenMenuItems = this.children.flatMap(child => child.buildMenu());
|
|
6607
|
+
const menuItemChildren = [];
|
|
6608
|
+
if (menuItem === null || menuItem === void 0 ? void 0 : menuItem.items) {
|
|
6609
|
+
menuItemChildren.push(...menuItem.items);
|
|
6610
|
+
}
|
|
6611
|
+
menuItemChildren.push(...this.menuItemChildren, ...routeChildrenMenuItems);
|
|
6612
|
+
if (!menuItem) {
|
|
6613
|
+
return menuItemChildren;
|
|
6614
|
+
}
|
|
6615
|
+
menuItem.label = (_a = menuItem.label) !== null && _a !== void 0 ? _a : this.pageTitle;
|
|
6616
|
+
menuItem.routerLink = RouteUtil.removeEmptyPathSegments((_b = menuItem.routerLink) !== null && _b !== void 0 ? _b : this.routePath);
|
|
6617
|
+
if (menuItemChildren.length > 0) {
|
|
6618
|
+
menuItem.items = menuItemChildren;
|
|
6619
|
+
}
|
|
6620
|
+
return [menuItem];
|
|
6621
|
+
}
|
|
6622
|
+
}
|
|
6623
|
+
|
|
6281
6624
|
/*
|
|
6282
6625
|
* Public API Surface of mng-commons
|
|
6283
6626
|
*/
|
|
@@ -6286,5 +6629,5 @@ class AMngCrudApiService {
|
|
|
6286
6629
|
* Generated bundle index. Do not edit.
|
|
6287
6630
|
*/
|
|
6288
6631
|
|
|
6289
|
-
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 };
|
|
6632
|
+
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 };
|
|
6290
6633
|
//# sourceMappingURL=mediusinc-mng-commons.mjs.map
|