@netgrif/components-core 6.4.0-beta.3 → 6.4.0-beta.4
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/navigation/navigation-double-drawer/abstract-navigation-double-drawer.mjs +45 -1
- package/fesm2015/netgrif-components-core.mjs +460 -422
- package/fesm2015/netgrif-components-core.mjs.map +1 -1
- package/fesm2020/netgrif-components-core.mjs +462 -419
- package/fesm2020/netgrif-components-core.mjs.map +1 -1
- package/lib/navigation/navigation-double-drawer/abstract-navigation-double-drawer.d.ts +12 -0
- package/package.json +1 -1
|
@@ -26515,6 +26515,228 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
26515
26515
|
type: Input
|
|
26516
26516
|
}] } });
|
|
26517
26517
|
|
|
26518
|
+
class ImportToAdd {
|
|
26519
|
+
constructor(className, fileImportPath) {
|
|
26520
|
+
this.className = className;
|
|
26521
|
+
this.fileImportPath = fileImportPath;
|
|
26522
|
+
}
|
|
26523
|
+
}
|
|
26524
|
+
|
|
26525
|
+
/**
|
|
26526
|
+
* @license
|
|
26527
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
26528
|
+
*
|
|
26529
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
26530
|
+
* found in the LICENSE file at https://angular.io/license
|
|
26531
|
+
*
|
|
26532
|
+
* File copied from: angular_devkit/core/src/utils/strings.ts
|
|
26533
|
+
*/
|
|
26534
|
+
const STRING_DASHERIZE_REGEXP = (/[ _]/g);
|
|
26535
|
+
const STRING_DECAMELIZE_REGEXP = (/([a-z\d])([A-Z])/g);
|
|
26536
|
+
const STRING_CAMELIZE_REGEXP = (/(-|_|\.|\s)+(.)?/g);
|
|
26537
|
+
const STRING_UNDERSCORE_REGEXP_1 = (/([a-z\d])([A-Z]+)/g);
|
|
26538
|
+
const STRING_UNDERSCORE_REGEXP_2 = (/-|\s+/g);
|
|
26539
|
+
/**
|
|
26540
|
+
* Converts a camelized string into all lower case separated by underscores.
|
|
26541
|
+
*
|
|
26542
|
+
* ```javascript
|
|
26543
|
+
* decamelize('innerHTML'); // 'inner_html'
|
|
26544
|
+
* decamelize('action_name'); // 'action_name'
|
|
26545
|
+
* decamelize('css-class-name'); // 'css-class-name'
|
|
26546
|
+
* decamelize('my favorite items'); // 'my favorite items'
|
|
26547
|
+
* ```
|
|
26548
|
+
* @method decamelize
|
|
26549
|
+
* @param str The string to decamelize.
|
|
26550
|
+
* @return the decamelized string.
|
|
26551
|
+
*/
|
|
26552
|
+
function decamelize(str) {
|
|
26553
|
+
return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();
|
|
26554
|
+
}
|
|
26555
|
+
/**
|
|
26556
|
+
* Replaces underscores, spaces, or camelCase with dashes.
|
|
26557
|
+
* ```javascript
|
|
26558
|
+
* dasherize('innerHTML'); // 'inner-html'
|
|
26559
|
+
* dasherize('action_name'); // 'action-name'
|
|
26560
|
+
* dasherize('css-class-name'); // 'css-class-name'
|
|
26561
|
+
* dasherize('my favorite items'); // 'my-favorite-items'
|
|
26562
|
+
* ```
|
|
26563
|
+
* @method dasherize
|
|
26564
|
+
* @param str The string to dasherize.
|
|
26565
|
+
* @return the dasherized string.
|
|
26566
|
+
*/
|
|
26567
|
+
function dasherize(str) {
|
|
26568
|
+
return decamelize(str).replace(STRING_DASHERIZE_REGEXP, '-');
|
|
26569
|
+
}
|
|
26570
|
+
/**
|
|
26571
|
+
* Returns the lowerCamelCase form of a string.
|
|
26572
|
+
* ```javascript
|
|
26573
|
+
* camelize('innerHTML'); // 'innerHTML'
|
|
26574
|
+
* camelize('action_name'); // 'actionName'
|
|
26575
|
+
* camelize('css-class-name'); // 'cssClassName'
|
|
26576
|
+
* camelize('my favorite items'); // 'myFavoriteItems'
|
|
26577
|
+
* camelize('My Favorite Items'); // 'myFavoriteItems'
|
|
26578
|
+
* ```
|
|
26579
|
+
* @method camelize
|
|
26580
|
+
* @param str The string to camelize.
|
|
26581
|
+
* @return the camelized string.
|
|
26582
|
+
*/
|
|
26583
|
+
function camelize(str) {
|
|
26584
|
+
return str
|
|
26585
|
+
.replace(STRING_CAMELIZE_REGEXP, (_match, _separator, chr) => {
|
|
26586
|
+
return chr ? chr.toUpperCase() : '';
|
|
26587
|
+
})
|
|
26588
|
+
.replace(/^([A-Z])/, (match) => match.toLowerCase());
|
|
26589
|
+
}
|
|
26590
|
+
/**
|
|
26591
|
+
* Returns the UpperCamelCase form of a string.
|
|
26592
|
+
* ```javascript
|
|
26593
|
+
* 'innerHTML'.classify(); // 'InnerHTML'
|
|
26594
|
+
* 'action_name'.classify(); // 'ActionName'
|
|
26595
|
+
* 'css-class-name'.classify(); // 'CssClassName'
|
|
26596
|
+
* 'my favorite items'.classify(); // 'MyFavoriteItems'
|
|
26597
|
+
* ```
|
|
26598
|
+
* @method classify
|
|
26599
|
+
* @param str the string to classify
|
|
26600
|
+
* @return the classified string
|
|
26601
|
+
*/
|
|
26602
|
+
function classify(str) {
|
|
26603
|
+
return str.split('.').map(part => capitalize(camelize(part))).join('.');
|
|
26604
|
+
}
|
|
26605
|
+
/**
|
|
26606
|
+
* More general than decamelize. Returns the lower\_case\_and\_underscored
|
|
26607
|
+
* form of a string.
|
|
26608
|
+
* ```javascript
|
|
26609
|
+
* 'innerHTML'.underscore(); // 'inner_html'
|
|
26610
|
+
* 'action_name'.underscore(); // 'action_name'
|
|
26611
|
+
* 'css-class-name'.underscore(); // 'css_class_name'
|
|
26612
|
+
* 'my favorite items'.underscore(); // 'my_favorite_items'
|
|
26613
|
+
* ```
|
|
26614
|
+
* @method underscore
|
|
26615
|
+
* @param str The string to underscore.
|
|
26616
|
+
* @return the underscored string.
|
|
26617
|
+
*/
|
|
26618
|
+
function underscore(str) {
|
|
26619
|
+
return str
|
|
26620
|
+
.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2')
|
|
26621
|
+
.replace(STRING_UNDERSCORE_REGEXP_2, '_')
|
|
26622
|
+
.toLowerCase();
|
|
26623
|
+
}
|
|
26624
|
+
/**
|
|
26625
|
+
* Returns the Capitalized form of a string
|
|
26626
|
+
* ```javascript
|
|
26627
|
+
* 'innerHTML'.capitalize() // 'InnerHTML'
|
|
26628
|
+
* 'action_name'.capitalize() // 'Action_name'
|
|
26629
|
+
* 'css-class-name'.capitalize() // 'Css-class-name'
|
|
26630
|
+
* 'my favorite items'.capitalize() // 'My favorite items'
|
|
26631
|
+
* ```
|
|
26632
|
+
* @method capitalize
|
|
26633
|
+
* @param str The string to capitalize.
|
|
26634
|
+
* @return The capitalized string.
|
|
26635
|
+
*/
|
|
26636
|
+
function capitalize(str) {
|
|
26637
|
+
return str.charAt(0).toUpperCase() + str.substr(1);
|
|
26638
|
+
}
|
|
26639
|
+
/**
|
|
26640
|
+
* Calculate the levenshtein distance of two strings.
|
|
26641
|
+
* See https://en.wikipedia.org/wiki/Levenshtein_distance.
|
|
26642
|
+
* Based off https://gist.github.com/andrei-m/982927 (for using the faster dynamic programming
|
|
26643
|
+
* version).
|
|
26644
|
+
*
|
|
26645
|
+
* @param a String a.
|
|
26646
|
+
* @param b String b.
|
|
26647
|
+
* @returns A number that represents the distance between the two strings. The greater the number
|
|
26648
|
+
* the more distant the strings are from each others.
|
|
26649
|
+
*/
|
|
26650
|
+
function levenshtein(a, b) {
|
|
26651
|
+
if (a.length === 0) {
|
|
26652
|
+
return b.length;
|
|
26653
|
+
}
|
|
26654
|
+
if (b.length === 0) {
|
|
26655
|
+
return a.length;
|
|
26656
|
+
}
|
|
26657
|
+
const matrix = [];
|
|
26658
|
+
// increment along the first column of each row
|
|
26659
|
+
for (let i = 0; i <= b.length; i++) {
|
|
26660
|
+
matrix[i] = [i];
|
|
26661
|
+
}
|
|
26662
|
+
// increment each column in the first row
|
|
26663
|
+
for (let j = 0; j <= a.length; j++) {
|
|
26664
|
+
matrix[0][j] = j;
|
|
26665
|
+
}
|
|
26666
|
+
// Fill in the rest of the matrix
|
|
26667
|
+
for (let i = 1; i <= b.length; i++) {
|
|
26668
|
+
for (let j = 1; j <= a.length; j++) {
|
|
26669
|
+
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
|
26670
|
+
matrix[i][j] = matrix[i - 1][j - 1];
|
|
26671
|
+
}
|
|
26672
|
+
else {
|
|
26673
|
+
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
|
|
26674
|
+
matrix[i][j - 1] + 1, // insertion
|
|
26675
|
+
matrix[i - 1][j] + 1);
|
|
26676
|
+
}
|
|
26677
|
+
}
|
|
26678
|
+
}
|
|
26679
|
+
return matrix[b.length][a.length];
|
|
26680
|
+
}
|
|
26681
|
+
|
|
26682
|
+
class ViewClassInfo extends ImportToAdd {
|
|
26683
|
+
constructor(path, viewType, customComponentName) {
|
|
26684
|
+
super('', '');
|
|
26685
|
+
if (!customComponentName) {
|
|
26686
|
+
this.prefix = ViewClassInfo.convertPathToClassNamePrefix(path);
|
|
26687
|
+
const classSuffix = ViewClassInfo.resolveClassSuffixForView(viewType);
|
|
26688
|
+
this.nameWithoutComponent = `${classify(this.prefix)}${classSuffix}`;
|
|
26689
|
+
this.fileImportPath = `./views/${path}/${this.prefix}-${dasherize(classSuffix)}.component`;
|
|
26690
|
+
}
|
|
26691
|
+
else {
|
|
26692
|
+
this.prefix = '';
|
|
26693
|
+
this.nameWithoutComponent = classify(customComponentName);
|
|
26694
|
+
this.fileImportPath = `./views/${path}/${dasherize(customComponentName)}.component`;
|
|
26695
|
+
}
|
|
26696
|
+
this.className = `${this.nameWithoutComponent}Component`;
|
|
26697
|
+
}
|
|
26698
|
+
static convertPathToClassNamePrefix(path) {
|
|
26699
|
+
const regexDash = /-/g;
|
|
26700
|
+
return path.replace(regexDash, '_').replace(/\//g, '-').toLocaleLowerCase();
|
|
26701
|
+
}
|
|
26702
|
+
static resolveClassSuffixForView(view) {
|
|
26703
|
+
switch (view) {
|
|
26704
|
+
case 'login':
|
|
26705
|
+
return 'Login';
|
|
26706
|
+
case 'tabView':
|
|
26707
|
+
return 'TabView';
|
|
26708
|
+
case 'taskView':
|
|
26709
|
+
return 'TaskView';
|
|
26710
|
+
case 'caseView':
|
|
26711
|
+
return 'CaseView';
|
|
26712
|
+
case 'emptyView':
|
|
26713
|
+
return 'EmptyView';
|
|
26714
|
+
case 'sidenavView':
|
|
26715
|
+
return 'SidenavView';
|
|
26716
|
+
case 'doubleDrawerView':
|
|
26717
|
+
return 'DoubleDrawerView';
|
|
26718
|
+
case 'toolbarView':
|
|
26719
|
+
return 'ToolbarView';
|
|
26720
|
+
case 'sidenavAndToolbarView':
|
|
26721
|
+
return 'SidenavAndToolbarView';
|
|
26722
|
+
case 'groupView':
|
|
26723
|
+
return 'GroupView';
|
|
26724
|
+
case 'dashboard':
|
|
26725
|
+
return 'Dashboard';
|
|
26726
|
+
case 'treeCaseView':
|
|
26727
|
+
return 'TreeCaseView';
|
|
26728
|
+
case 'workflowView':
|
|
26729
|
+
return 'WorkflowView';
|
|
26730
|
+
case 'roleAssignmentView':
|
|
26731
|
+
return 'RoleAssignmentView';
|
|
26732
|
+
case 'ldapRoleAssignmentView':
|
|
26733
|
+
return 'LdapRoleAssignmentView';
|
|
26734
|
+
default:
|
|
26735
|
+
throw new Error(`Unknown view type '${view}'`);
|
|
26736
|
+
}
|
|
26737
|
+
}
|
|
26738
|
+
}
|
|
26739
|
+
|
|
26518
26740
|
var GroupNavigationConstants;
|
|
26519
26741
|
(function (GroupNavigationConstants) {
|
|
26520
26742
|
/**
|
|
@@ -26656,35 +26878,206 @@ var GroupNavigationConstants;
|
|
|
26656
26878
|
})(GroupNavigationConstants || (GroupNavigationConstants = {}));
|
|
26657
26879
|
|
|
26658
26880
|
/**
|
|
26659
|
-
* Holds
|
|
26881
|
+
* Holds component for dynamic routing resolution of group navigation component resolver component by the {@link RoutingBuilderService}.
|
|
26660
26882
|
*/
|
|
26661
|
-
|
|
26662
|
-
(function (UserImpersonationConstants) {
|
|
26663
|
-
UserImpersonationConstants["IMPERSONATION_CONFIG_NET_IDENTIFIER"] = "impersonation_config";
|
|
26664
|
-
UserImpersonationConstants["IMPERSONATION_CONFIG_FIELD_IMPERSONATED"] = "impersonated";
|
|
26665
|
-
UserImpersonationConstants["IMPERSONATION_CONFIG_FIELD_ROLES"] = "impersonated_roles";
|
|
26666
|
-
UserImpersonationConstants["IMPERSONATION_CONFIG_FIELD_AUTHS"] = "impersonated_authorities";
|
|
26667
|
-
})(UserImpersonationConstants || (UserImpersonationConstants = {}));
|
|
26883
|
+
const NAE_GROUP_NAVIGATION_COMPONENT_RESOLVER_COMPONENT = new InjectionToken('NaeGroupNavigationComponentResolverComponent');
|
|
26668
26884
|
|
|
26669
|
-
|
|
26670
|
-
|
|
26671
|
-
|
|
26672
|
-
|
|
26673
|
-
|
|
26885
|
+
const NAE_ROUTING_CONFIGURATION_PATH = "configPath";
|
|
26886
|
+
/**
|
|
26887
|
+
* Uses the information from nae.json to construct the application's routing
|
|
26888
|
+
*/
|
|
26889
|
+
class RoutingBuilderService {
|
|
26890
|
+
constructor(router, _configService, _viewService, _logger, _dynamicNavigationRouteService, _groupNavigationComponentResolverComponent) {
|
|
26674
26891
|
this._configService = _configService;
|
|
26675
|
-
this.
|
|
26676
|
-
this.
|
|
26677
|
-
this.
|
|
26678
|
-
this.
|
|
26679
|
-
this.
|
|
26680
|
-
|
|
26681
|
-
|
|
26682
|
-
|
|
26683
|
-
|
|
26684
|
-
|
|
26685
|
-
|
|
26686
|
-
|
|
26687
|
-
|
|
26892
|
+
this._viewService = _viewService;
|
|
26893
|
+
this._logger = _logger;
|
|
26894
|
+
this._dynamicNavigationRouteService = _dynamicNavigationRouteService;
|
|
26895
|
+
this._groupNavigationComponentResolverComponent = _groupNavigationComponentResolverComponent;
|
|
26896
|
+
this._groupNavigationRouteGenerated = false;
|
|
26897
|
+
router.relativeLinkResolution = 'legacy';
|
|
26898
|
+
router.config.splice(0, router.config.length);
|
|
26899
|
+
for (const [pathSegment, view] of Object.entries(_configService.get().views)) {
|
|
26900
|
+
const route = this.constructRouteObject(view, pathSegment);
|
|
26901
|
+
if (route !== undefined) {
|
|
26902
|
+
router.config.push(route);
|
|
26903
|
+
}
|
|
26904
|
+
}
|
|
26905
|
+
router.config.push(...this.defaultRoutesRedirects());
|
|
26906
|
+
}
|
|
26907
|
+
constructRouteObject(view, configPath, ancestors = []) {
|
|
26908
|
+
const component = this.resolveComponentClass(view, configPath);
|
|
26909
|
+
if (component === undefined) {
|
|
26910
|
+
return undefined;
|
|
26911
|
+
}
|
|
26912
|
+
if (!view.routing) {
|
|
26913
|
+
this._logger.warn(`nae.json configuration is invalid. View at path '${configPath}'` +
|
|
26914
|
+
` must define a 'routing' attribute. Skipping this view for routing generation.`);
|
|
26915
|
+
return undefined;
|
|
26916
|
+
}
|
|
26917
|
+
const route = {
|
|
26918
|
+
path: view.routing.path,
|
|
26919
|
+
data: {
|
|
26920
|
+
[NAE_ROUTING_CONFIGURATION_PATH]: configPath
|
|
26921
|
+
},
|
|
26922
|
+
component
|
|
26923
|
+
};
|
|
26924
|
+
if (view?.layout?.name === GroupNavigationConstants.GROUP_NAVIGATION_OUTLET) {
|
|
26925
|
+
if (this._groupNavigationRouteGenerated) {
|
|
26926
|
+
this._logger.warn(`Multiple groupNavigationOutlets are present in nae.json. Duplicate entry found at path ${configPath}`);
|
|
26927
|
+
}
|
|
26928
|
+
else {
|
|
26929
|
+
this._logger.debug(`GroupNavigationOutlet found in nae.json at path '${configPath}'`);
|
|
26930
|
+
}
|
|
26931
|
+
const pathNoParams = route.path;
|
|
26932
|
+
route.path = `${pathNoParams}/:${GroupNavigationConstants.GROUP_NAVIGATION_ROUTER_PARAM}`;
|
|
26933
|
+
route.canActivate = [AuthenticationGuardService];
|
|
26934
|
+
const parentPathSegments = ancestors.map(a => a.path);
|
|
26935
|
+
parentPathSegments.push(pathNoParams);
|
|
26936
|
+
this._dynamicNavigationRouteService.route = parentPathSegments.join('/');
|
|
26937
|
+
this._groupNavigationRouteGenerated = true;
|
|
26938
|
+
return route;
|
|
26939
|
+
}
|
|
26940
|
+
if (view.routing.match !== undefined && view.routing.match) {
|
|
26941
|
+
route['pathMatch'] = 'full';
|
|
26942
|
+
}
|
|
26943
|
+
route['canActivate'] = [];
|
|
26944
|
+
if (view.access === 'private'
|
|
26945
|
+
|| view.access.hasOwnProperty('role')
|
|
26946
|
+
|| view.access.hasOwnProperty('group')
|
|
26947
|
+
|| view.access.hasOwnProperty('authority')) {
|
|
26948
|
+
route['canActivate'].push(AuthenticationGuardService);
|
|
26949
|
+
}
|
|
26950
|
+
if (view.access.hasOwnProperty('role')) {
|
|
26951
|
+
route['canActivate'].push(RoleGuardService);
|
|
26952
|
+
}
|
|
26953
|
+
if (view.access.hasOwnProperty('authority')) {
|
|
26954
|
+
route['canActivate'].push(AuthorityGuardService);
|
|
26955
|
+
}
|
|
26956
|
+
if (view.access.hasOwnProperty('group')) {
|
|
26957
|
+
route['canActivate'].push(GroupGuardService);
|
|
26958
|
+
}
|
|
26959
|
+
if (!!view.children) {
|
|
26960
|
+
route['children'] = [];
|
|
26961
|
+
Object.entries(view.children).forEach(([configPathSegment, childView]) => {
|
|
26962
|
+
// TODO check if routes are constructed correctly regarding empty route segments
|
|
26963
|
+
const childRoute = this.constructRouteObject(childView, `${configPath}/${configPathSegment}`, [...ancestors, route]);
|
|
26964
|
+
if (childRoute !== undefined) {
|
|
26965
|
+
route['children'].push(childRoute);
|
|
26966
|
+
}
|
|
26967
|
+
});
|
|
26968
|
+
}
|
|
26969
|
+
if (view?.layout?.name === 'tabView') {
|
|
26970
|
+
if (!view.children) {
|
|
26971
|
+
route['children'] = [];
|
|
26972
|
+
}
|
|
26973
|
+
route['children'].push({
|
|
26974
|
+
path: '**',
|
|
26975
|
+
component
|
|
26976
|
+
});
|
|
26977
|
+
}
|
|
26978
|
+
return route;
|
|
26979
|
+
}
|
|
26980
|
+
resolveComponentClass(view, configPath) {
|
|
26981
|
+
let result;
|
|
26982
|
+
if (!!view.component) {
|
|
26983
|
+
result = this._viewService.resolveNameToClass(view.component.class);
|
|
26984
|
+
}
|
|
26985
|
+
else if (!!view.layout) {
|
|
26986
|
+
result = this.resolveComponentClassFromLayout(view, configPath);
|
|
26987
|
+
}
|
|
26988
|
+
else {
|
|
26989
|
+
this._logger.warn(`nae.json configuration is invalid. View at path '${configPath}'` +
|
|
26990
|
+
` must define either a 'layout' or a 'component' attribute. Skipping this view for routing generation.`);
|
|
26991
|
+
return undefined;
|
|
26992
|
+
}
|
|
26993
|
+
if (result === undefined) {
|
|
26994
|
+
this._logger.warn(`Some views from nae.json configuration have not been created in the project.` +
|
|
26995
|
+
` Run create-view schematic to rectify this. Skipping this view for routing generation.`);
|
|
26996
|
+
return undefined;
|
|
26997
|
+
}
|
|
26998
|
+
return result;
|
|
26999
|
+
}
|
|
27000
|
+
resolveComponentClassFromLayout(view, configPath) {
|
|
27001
|
+
if (view.layout.name === GroupNavigationConstants.GROUP_NAVIGATION_OUTLET) {
|
|
27002
|
+
return this._groupNavigationComponentResolverComponent;
|
|
27003
|
+
}
|
|
27004
|
+
const className = RoutingBuilderService.parseClassNameFromView(view, configPath);
|
|
27005
|
+
return this._viewService.resolveNameToClass(className);
|
|
27006
|
+
}
|
|
27007
|
+
static parseClassNameFromView(view, configPath) {
|
|
27008
|
+
if (!!view.layout.componentName) {
|
|
27009
|
+
return `${classify(view.layout.componentName)}Component`;
|
|
27010
|
+
}
|
|
27011
|
+
else {
|
|
27012
|
+
const classInfo = new ViewClassInfo(configPath, view.layout.name, view.layout.componentName);
|
|
27013
|
+
return classInfo.className;
|
|
27014
|
+
}
|
|
27015
|
+
}
|
|
27016
|
+
defaultRoutesRedirects() {
|
|
27017
|
+
const result = [];
|
|
27018
|
+
const servicesConfig = this._configService.getServicesConfiguration();
|
|
27019
|
+
if (!!servicesConfig && !!servicesConfig.routing) {
|
|
27020
|
+
if (!!servicesConfig.routing.defaultRedirect) {
|
|
27021
|
+
result.push({
|
|
27022
|
+
path: '',
|
|
27023
|
+
redirectTo: servicesConfig.routing.defaultRedirect,
|
|
27024
|
+
pathMatch: 'full'
|
|
27025
|
+
});
|
|
27026
|
+
}
|
|
27027
|
+
if (!!servicesConfig.routing.wildcardRedirect) {
|
|
27028
|
+
result.push({
|
|
27029
|
+
path: '**',
|
|
27030
|
+
redirectTo: servicesConfig.routing.wildcardRedirect
|
|
27031
|
+
});
|
|
27032
|
+
}
|
|
27033
|
+
}
|
|
27034
|
+
return result;
|
|
27035
|
+
}
|
|
27036
|
+
}
|
|
27037
|
+
RoutingBuilderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RoutingBuilderService, deps: [{ token: i2$3.Router }, { token: ConfigurationService }, { token: ViewService }, { token: LoggerService }, { token: DynamicNavigationRouteProviderService }, { token: NAE_GROUP_NAVIGATION_COMPONENT_RESOLVER_COMPONENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
27038
|
+
RoutingBuilderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RoutingBuilderService, providedIn: 'root' });
|
|
27039
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RoutingBuilderService, decorators: [{
|
|
27040
|
+
type: Injectable,
|
|
27041
|
+
args: [{
|
|
27042
|
+
providedIn: 'root'
|
|
27043
|
+
}]
|
|
27044
|
+
}], ctorParameters: function () { return [{ type: i2$3.Router }, { type: ConfigurationService }, { type: ViewService }, { type: LoggerService }, { type: DynamicNavigationRouteProviderService }, { type: i0.Type, decorators: [{
|
|
27045
|
+
type: Optional
|
|
27046
|
+
}, {
|
|
27047
|
+
type: Inject,
|
|
27048
|
+
args: [NAE_GROUP_NAVIGATION_COMPONENT_RESOLVER_COMPONENT]
|
|
27049
|
+
}] }]; } });
|
|
27050
|
+
|
|
27051
|
+
/**
|
|
27052
|
+
* Holds all identifiers of the Impersonation config process in an accessible manner
|
|
27053
|
+
*/
|
|
27054
|
+
var UserImpersonationConstants;
|
|
27055
|
+
(function (UserImpersonationConstants) {
|
|
27056
|
+
UserImpersonationConstants["IMPERSONATION_CONFIG_NET_IDENTIFIER"] = "impersonation_config";
|
|
27057
|
+
UserImpersonationConstants["IMPERSONATION_CONFIG_FIELD_IMPERSONATED"] = "impersonated";
|
|
27058
|
+
UserImpersonationConstants["IMPERSONATION_CONFIG_FIELD_ROLES"] = "impersonated_roles";
|
|
27059
|
+
UserImpersonationConstants["IMPERSONATION_CONFIG_FIELD_AUTHS"] = "impersonated_authorities";
|
|
27060
|
+
})(UserImpersonationConstants || (UserImpersonationConstants = {}));
|
|
27061
|
+
|
|
27062
|
+
class ImpersonationService extends AbstractResourceService {
|
|
27063
|
+
constructor(provider, _router, _configService, _userService, _snackbar, _filter, _log, _translate) {
|
|
27064
|
+
super('impersonation', provider, _configService);
|
|
27065
|
+
this.provider = provider;
|
|
27066
|
+
this._router = _router;
|
|
27067
|
+
this._configService = _configService;
|
|
27068
|
+
this._userService = _userService;
|
|
27069
|
+
this._snackbar = _snackbar;
|
|
27070
|
+
this._filter = _filter;
|
|
27071
|
+
this._log = _log;
|
|
27072
|
+
this._translate = _translate;
|
|
27073
|
+
this._impersonating$ = new Subject();
|
|
27074
|
+
this._sub = this._userService.user$.subscribe(user => this._resolveUserChange(user));
|
|
27075
|
+
}
|
|
27076
|
+
get impersonating$() {
|
|
27077
|
+
return this._impersonating$.asObservable();
|
|
27078
|
+
}
|
|
27079
|
+
impersonateUser(userId) {
|
|
27080
|
+
this.provider.post$('impersonate/user/' + userId, this.SERVER_URL, {}).subscribe((user) => {
|
|
26688
27081
|
this._resolveSuccess(user);
|
|
26689
27082
|
}, (response => {
|
|
26690
27083
|
this._resolveError(response);
|
|
@@ -26886,6 +27279,8 @@ class AbstractNavigationDoubleDrawerComponent {
|
|
|
26886
27279
|
this.rightLoading$ = new LoadingEmitter();
|
|
26887
27280
|
this.nodeLoading$ = new LoadingEmitter();
|
|
26888
27281
|
this.itemsOrder = MenuOrder.Ascending;
|
|
27282
|
+
this.hiddenCustomItems = [];
|
|
27283
|
+
this._childCustomViews = {};
|
|
26889
27284
|
}
|
|
26890
27285
|
ngOnInit() {
|
|
26891
27286
|
this._breakpointSubscription = this._breakpoint.observe([Breakpoints.HandsetLandscape]).subscribe(() => {
|
|
@@ -26903,6 +27298,14 @@ class AbstractNavigationDoubleDrawerComponent {
|
|
|
26903
27298
|
this._currentNodeSubscription = this._uriService.activeNode$.subscribe(node => {
|
|
26904
27299
|
this.currentNode = node;
|
|
26905
27300
|
});
|
|
27301
|
+
const viewConfigurationPath = this._activatedRoute.snapshot.data[NAE_ROUTING_CONFIGURATION_PATH];
|
|
27302
|
+
if (!!viewConfigurationPath) {
|
|
27303
|
+
const viewConfiguration = this._config.getViewByPath(viewConfigurationPath);
|
|
27304
|
+
Object.entries(viewConfiguration.children).forEach(([key, childView]) => {
|
|
27305
|
+
this.resolveUriForChildViews(viewConfigurationPath + '/' + key, childView);
|
|
27306
|
+
this.resolveHiddenMenuItemFromChildViews(viewConfigurationPath + '/' + key, childView);
|
|
27307
|
+
});
|
|
27308
|
+
}
|
|
26906
27309
|
}
|
|
26907
27310
|
get currentNode() {
|
|
26908
27311
|
return this._currentNode;
|
|
@@ -27088,17 +27491,20 @@ class AbstractNavigationDoubleDrawerComponent {
|
|
|
27088
27491
|
else {
|
|
27089
27492
|
this.rightItems = result.map(folder => this.resolveItemCaseToNavigationItem(folder)).filter(i => !!i);
|
|
27090
27493
|
}
|
|
27494
|
+
this.resolveCustomViewsInRightSide();
|
|
27091
27495
|
this.rightLoading$.off();
|
|
27092
27496
|
}, error => {
|
|
27093
27497
|
this._log.error(error);
|
|
27094
27498
|
this.rightItems = [];
|
|
27095
27499
|
this.moreItems = [];
|
|
27500
|
+
this.resolveCustomViewsInRightSide();
|
|
27096
27501
|
this.rightLoading$.off();
|
|
27097
27502
|
});
|
|
27098
27503
|
}, error => {
|
|
27099
27504
|
this._log.error(error);
|
|
27100
27505
|
this.rightItems = [];
|
|
27101
27506
|
this.moreItems = [];
|
|
27507
|
+
this.resolveCustomViewsInRightSide();
|
|
27102
27508
|
this.rightLoading$.off();
|
|
27103
27509
|
});
|
|
27104
27510
|
}
|
|
@@ -27124,6 +27530,11 @@ class AbstractNavigationDoubleDrawerComponent {
|
|
|
27124
27530
|
this.leftItems = this.leftItems.sort((a, b) => multiplier * a?.navigation?.title.localeCompare(b?.navigation?.title));
|
|
27125
27531
|
this.moreItems = this.moreItems.sort((a, b) => multiplier * a?.navigation?.title.localeCompare(b?.navigation?.title));
|
|
27126
27532
|
}
|
|
27533
|
+
resolveCustomViewsInRightSide() {
|
|
27534
|
+
if (!!this._childCustomViews[this._currentNode.uriPath]) {
|
|
27535
|
+
this.rightItems.push(...Object.values(this._childCustomViews[this._currentNode.uriPath]));
|
|
27536
|
+
}
|
|
27537
|
+
}
|
|
27127
27538
|
resolveItemCaseToNavigationItem(itemCase) {
|
|
27128
27539
|
const item = {
|
|
27129
27540
|
access: {},
|
|
@@ -27204,6 +27615,31 @@ class AbstractNavigationDoubleDrawerComponent {
|
|
|
27204
27615
|
// this.userPreferenceService._drawerWidthChanged$.next(this.width);
|
|
27205
27616
|
// this.contentWidth.next(this.width);
|
|
27206
27617
|
}
|
|
27618
|
+
resolveUriForChildViews(configPath, childView) {
|
|
27619
|
+
if (!childView.processUri)
|
|
27620
|
+
return;
|
|
27621
|
+
if (!this._accessService.canAccessView(childView, configPath))
|
|
27622
|
+
return;
|
|
27623
|
+
if (!this._childCustomViews[childView.processUri]) {
|
|
27624
|
+
this._childCustomViews[childView.processUri] = {};
|
|
27625
|
+
}
|
|
27626
|
+
this._childCustomViews[childView.processUri][configPath] = {
|
|
27627
|
+
id: configPath,
|
|
27628
|
+
...childView,
|
|
27629
|
+
};
|
|
27630
|
+
}
|
|
27631
|
+
resolveHiddenMenuItemFromChildViews(configPath, childView) {
|
|
27632
|
+
if (!childView.navigation)
|
|
27633
|
+
return;
|
|
27634
|
+
if (!this._accessService.canAccessView(childView, configPath))
|
|
27635
|
+
return;
|
|
27636
|
+
if (!!(childView?.navigation?.hidden)) {
|
|
27637
|
+
this.hiddenCustomItems.push({
|
|
27638
|
+
id: configPath,
|
|
27639
|
+
...childView,
|
|
27640
|
+
});
|
|
27641
|
+
}
|
|
27642
|
+
}
|
|
27207
27643
|
}
|
|
27208
27644
|
AbstractNavigationDoubleDrawerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AbstractNavigationDoubleDrawerComponent, deps: [{ token: i2$3.Router }, { token: i2$3.ActivatedRoute }, { token: i1$7.BreakpointObserver }, { token: LanguageService }, { token: i1$2.TranslateService }, { token: UserService }, { token: AccessService }, { token: LoggerService }, { token: ConfigurationService }, { token: UriService }, { token: ImpersonationUserSelectService }, { token: ImpersonationService }, { token: DynamicNavigationRouteProviderService }], target: i0.ɵɵFactoryTarget.Component });
|
|
27209
27645
|
AbstractNavigationDoubleDrawerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: AbstractNavigationDoubleDrawerComponent, selector: "ncc-abstract-navigation-double-drawer", inputs: { portalLeftMenu: "portalLeftMenu", portalRightMenu: "portalRightMenu", imageRouterLink: "imageRouterLink", imageAlt: "imageAlt", image: "image", profileRouterLink: "profileRouterLink", includeUser: "includeUser", includeLanguage: "includeLanguage", includeMoreMenu: "includeMoreMenu", includeImpersonation: "includeImpersonation", allClosable: "allClosable", folderIcon: "folderIcon", openedFolderIcon: "openedFolderIcon", filterIcon: "filterIcon", foldersCategoryName: "foldersCategoryName", viewsCategoryName: "viewsCategoryName" }, ngImport: i0, template: '', isInline: true });
|
|
@@ -27810,11 +28246,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
27810
28246
|
}]
|
|
27811
28247
|
}], ctorParameters: function () { return [{ type: FilterRepository }, { type: TaskResourceService }, { type: AllowedNetsServiceFactory }, { type: BaseAllowedNetsService }, { type: LoggerService }]; } });
|
|
27812
28248
|
|
|
27813
|
-
/**
|
|
27814
|
-
* Holds component for dynamic routing resolution of group navigation component resolver component by the {@link RoutingBuilderService}.
|
|
27815
|
-
*/
|
|
27816
|
-
const NAE_GROUP_NAVIGATION_COMPONENT_RESOLVER_COMPONENT = new InjectionToken('NaeGroupNavigationComponentResolverComponent');
|
|
27817
|
-
|
|
27818
28249
|
var UriContentType;
|
|
27819
28250
|
(function (UriContentType) {
|
|
27820
28251
|
UriContentType[UriContentType["PROCESS"] = 0] = "PROCESS";
|
|
@@ -33088,394 +33519,6 @@ class MockProfileService {
|
|
|
33088
33519
|
}
|
|
33089
33520
|
}
|
|
33090
33521
|
|
|
33091
|
-
class ImportToAdd {
|
|
33092
|
-
constructor(className, fileImportPath) {
|
|
33093
|
-
this.className = className;
|
|
33094
|
-
this.fileImportPath = fileImportPath;
|
|
33095
|
-
}
|
|
33096
|
-
}
|
|
33097
|
-
|
|
33098
|
-
/**
|
|
33099
|
-
* @license
|
|
33100
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
33101
|
-
*
|
|
33102
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
33103
|
-
* found in the LICENSE file at https://angular.io/license
|
|
33104
|
-
*
|
|
33105
|
-
* File copied from: angular_devkit/core/src/utils/strings.ts
|
|
33106
|
-
*/
|
|
33107
|
-
const STRING_DASHERIZE_REGEXP = (/[ _]/g);
|
|
33108
|
-
const STRING_DECAMELIZE_REGEXP = (/([a-z\d])([A-Z])/g);
|
|
33109
|
-
const STRING_CAMELIZE_REGEXP = (/(-|_|\.|\s)+(.)?/g);
|
|
33110
|
-
const STRING_UNDERSCORE_REGEXP_1 = (/([a-z\d])([A-Z]+)/g);
|
|
33111
|
-
const STRING_UNDERSCORE_REGEXP_2 = (/-|\s+/g);
|
|
33112
|
-
/**
|
|
33113
|
-
* Converts a camelized string into all lower case separated by underscores.
|
|
33114
|
-
*
|
|
33115
|
-
* ```javascript
|
|
33116
|
-
* decamelize('innerHTML'); // 'inner_html'
|
|
33117
|
-
* decamelize('action_name'); // 'action_name'
|
|
33118
|
-
* decamelize('css-class-name'); // 'css-class-name'
|
|
33119
|
-
* decamelize('my favorite items'); // 'my favorite items'
|
|
33120
|
-
* ```
|
|
33121
|
-
* @method decamelize
|
|
33122
|
-
* @param str The string to decamelize.
|
|
33123
|
-
* @return the decamelized string.
|
|
33124
|
-
*/
|
|
33125
|
-
function decamelize(str) {
|
|
33126
|
-
return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();
|
|
33127
|
-
}
|
|
33128
|
-
/**
|
|
33129
|
-
* Replaces underscores, spaces, or camelCase with dashes.
|
|
33130
|
-
* ```javascript
|
|
33131
|
-
* dasherize('innerHTML'); // 'inner-html'
|
|
33132
|
-
* dasherize('action_name'); // 'action-name'
|
|
33133
|
-
* dasherize('css-class-name'); // 'css-class-name'
|
|
33134
|
-
* dasherize('my favorite items'); // 'my-favorite-items'
|
|
33135
|
-
* ```
|
|
33136
|
-
* @method dasherize
|
|
33137
|
-
* @param str The string to dasherize.
|
|
33138
|
-
* @return the dasherized string.
|
|
33139
|
-
*/
|
|
33140
|
-
function dasherize(str) {
|
|
33141
|
-
return decamelize(str).replace(STRING_DASHERIZE_REGEXP, '-');
|
|
33142
|
-
}
|
|
33143
|
-
/**
|
|
33144
|
-
* Returns the lowerCamelCase form of a string.
|
|
33145
|
-
* ```javascript
|
|
33146
|
-
* camelize('innerHTML'); // 'innerHTML'
|
|
33147
|
-
* camelize('action_name'); // 'actionName'
|
|
33148
|
-
* camelize('css-class-name'); // 'cssClassName'
|
|
33149
|
-
* camelize('my favorite items'); // 'myFavoriteItems'
|
|
33150
|
-
* camelize('My Favorite Items'); // 'myFavoriteItems'
|
|
33151
|
-
* ```
|
|
33152
|
-
* @method camelize
|
|
33153
|
-
* @param str The string to camelize.
|
|
33154
|
-
* @return the camelized string.
|
|
33155
|
-
*/
|
|
33156
|
-
function camelize(str) {
|
|
33157
|
-
return str
|
|
33158
|
-
.replace(STRING_CAMELIZE_REGEXP, (_match, _separator, chr) => {
|
|
33159
|
-
return chr ? chr.toUpperCase() : '';
|
|
33160
|
-
})
|
|
33161
|
-
.replace(/^([A-Z])/, (match) => match.toLowerCase());
|
|
33162
|
-
}
|
|
33163
|
-
/**
|
|
33164
|
-
* Returns the UpperCamelCase form of a string.
|
|
33165
|
-
* ```javascript
|
|
33166
|
-
* 'innerHTML'.classify(); // 'InnerHTML'
|
|
33167
|
-
* 'action_name'.classify(); // 'ActionName'
|
|
33168
|
-
* 'css-class-name'.classify(); // 'CssClassName'
|
|
33169
|
-
* 'my favorite items'.classify(); // 'MyFavoriteItems'
|
|
33170
|
-
* ```
|
|
33171
|
-
* @method classify
|
|
33172
|
-
* @param str the string to classify
|
|
33173
|
-
* @return the classified string
|
|
33174
|
-
*/
|
|
33175
|
-
function classify(str) {
|
|
33176
|
-
return str.split('.').map(part => capitalize(camelize(part))).join('.');
|
|
33177
|
-
}
|
|
33178
|
-
/**
|
|
33179
|
-
* More general than decamelize. Returns the lower\_case\_and\_underscored
|
|
33180
|
-
* form of a string.
|
|
33181
|
-
* ```javascript
|
|
33182
|
-
* 'innerHTML'.underscore(); // 'inner_html'
|
|
33183
|
-
* 'action_name'.underscore(); // 'action_name'
|
|
33184
|
-
* 'css-class-name'.underscore(); // 'css_class_name'
|
|
33185
|
-
* 'my favorite items'.underscore(); // 'my_favorite_items'
|
|
33186
|
-
* ```
|
|
33187
|
-
* @method underscore
|
|
33188
|
-
* @param str The string to underscore.
|
|
33189
|
-
* @return the underscored string.
|
|
33190
|
-
*/
|
|
33191
|
-
function underscore(str) {
|
|
33192
|
-
return str
|
|
33193
|
-
.replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2')
|
|
33194
|
-
.replace(STRING_UNDERSCORE_REGEXP_2, '_')
|
|
33195
|
-
.toLowerCase();
|
|
33196
|
-
}
|
|
33197
|
-
/**
|
|
33198
|
-
* Returns the Capitalized form of a string
|
|
33199
|
-
* ```javascript
|
|
33200
|
-
* 'innerHTML'.capitalize() // 'InnerHTML'
|
|
33201
|
-
* 'action_name'.capitalize() // 'Action_name'
|
|
33202
|
-
* 'css-class-name'.capitalize() // 'Css-class-name'
|
|
33203
|
-
* 'my favorite items'.capitalize() // 'My favorite items'
|
|
33204
|
-
* ```
|
|
33205
|
-
* @method capitalize
|
|
33206
|
-
* @param str The string to capitalize.
|
|
33207
|
-
* @return The capitalized string.
|
|
33208
|
-
*/
|
|
33209
|
-
function capitalize(str) {
|
|
33210
|
-
return str.charAt(0).toUpperCase() + str.substr(1);
|
|
33211
|
-
}
|
|
33212
|
-
/**
|
|
33213
|
-
* Calculate the levenshtein distance of two strings.
|
|
33214
|
-
* See https://en.wikipedia.org/wiki/Levenshtein_distance.
|
|
33215
|
-
* Based off https://gist.github.com/andrei-m/982927 (for using the faster dynamic programming
|
|
33216
|
-
* version).
|
|
33217
|
-
*
|
|
33218
|
-
* @param a String a.
|
|
33219
|
-
* @param b String b.
|
|
33220
|
-
* @returns A number that represents the distance between the two strings. The greater the number
|
|
33221
|
-
* the more distant the strings are from each others.
|
|
33222
|
-
*/
|
|
33223
|
-
function levenshtein(a, b) {
|
|
33224
|
-
if (a.length === 0) {
|
|
33225
|
-
return b.length;
|
|
33226
|
-
}
|
|
33227
|
-
if (b.length === 0) {
|
|
33228
|
-
return a.length;
|
|
33229
|
-
}
|
|
33230
|
-
const matrix = [];
|
|
33231
|
-
// increment along the first column of each row
|
|
33232
|
-
for (let i = 0; i <= b.length; i++) {
|
|
33233
|
-
matrix[i] = [i];
|
|
33234
|
-
}
|
|
33235
|
-
// increment each column in the first row
|
|
33236
|
-
for (let j = 0; j <= a.length; j++) {
|
|
33237
|
-
matrix[0][j] = j;
|
|
33238
|
-
}
|
|
33239
|
-
// Fill in the rest of the matrix
|
|
33240
|
-
for (let i = 1; i <= b.length; i++) {
|
|
33241
|
-
for (let j = 1; j <= a.length; j++) {
|
|
33242
|
-
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
|
33243
|
-
matrix[i][j] = matrix[i - 1][j - 1];
|
|
33244
|
-
}
|
|
33245
|
-
else {
|
|
33246
|
-
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
|
|
33247
|
-
matrix[i][j - 1] + 1, // insertion
|
|
33248
|
-
matrix[i - 1][j] + 1);
|
|
33249
|
-
}
|
|
33250
|
-
}
|
|
33251
|
-
}
|
|
33252
|
-
return matrix[b.length][a.length];
|
|
33253
|
-
}
|
|
33254
|
-
|
|
33255
|
-
class ViewClassInfo extends ImportToAdd {
|
|
33256
|
-
constructor(path, viewType, customComponentName) {
|
|
33257
|
-
super('', '');
|
|
33258
|
-
if (!customComponentName) {
|
|
33259
|
-
this.prefix = ViewClassInfo.convertPathToClassNamePrefix(path);
|
|
33260
|
-
const classSuffix = ViewClassInfo.resolveClassSuffixForView(viewType);
|
|
33261
|
-
this.nameWithoutComponent = `${classify(this.prefix)}${classSuffix}`;
|
|
33262
|
-
this.fileImportPath = `./views/${path}/${this.prefix}-${dasherize(classSuffix)}.component`;
|
|
33263
|
-
}
|
|
33264
|
-
else {
|
|
33265
|
-
this.prefix = '';
|
|
33266
|
-
this.nameWithoutComponent = classify(customComponentName);
|
|
33267
|
-
this.fileImportPath = `./views/${path}/${dasherize(customComponentName)}.component`;
|
|
33268
|
-
}
|
|
33269
|
-
this.className = `${this.nameWithoutComponent}Component`;
|
|
33270
|
-
}
|
|
33271
|
-
static convertPathToClassNamePrefix(path) {
|
|
33272
|
-
const regexDash = /-/g;
|
|
33273
|
-
return path.replace(regexDash, '_').replace(/\//g, '-').toLocaleLowerCase();
|
|
33274
|
-
}
|
|
33275
|
-
static resolveClassSuffixForView(view) {
|
|
33276
|
-
switch (view) {
|
|
33277
|
-
case 'login':
|
|
33278
|
-
return 'Login';
|
|
33279
|
-
case 'tabView':
|
|
33280
|
-
return 'TabView';
|
|
33281
|
-
case 'taskView':
|
|
33282
|
-
return 'TaskView';
|
|
33283
|
-
case 'caseView':
|
|
33284
|
-
return 'CaseView';
|
|
33285
|
-
case 'emptyView':
|
|
33286
|
-
return 'EmptyView';
|
|
33287
|
-
case 'sidenavView':
|
|
33288
|
-
return 'SidenavView';
|
|
33289
|
-
case 'doubleDrawerView':
|
|
33290
|
-
return 'DoubleDrawerView';
|
|
33291
|
-
case 'toolbarView':
|
|
33292
|
-
return 'ToolbarView';
|
|
33293
|
-
case 'sidenavAndToolbarView':
|
|
33294
|
-
return 'SidenavAndToolbarView';
|
|
33295
|
-
case 'groupView':
|
|
33296
|
-
return 'GroupView';
|
|
33297
|
-
case 'dashboard':
|
|
33298
|
-
return 'Dashboard';
|
|
33299
|
-
case 'treeCaseView':
|
|
33300
|
-
return 'TreeCaseView';
|
|
33301
|
-
case 'workflowView':
|
|
33302
|
-
return 'WorkflowView';
|
|
33303
|
-
case 'roleAssignmentView':
|
|
33304
|
-
return 'RoleAssignmentView';
|
|
33305
|
-
case 'ldapRoleAssignmentView':
|
|
33306
|
-
return 'LdapRoleAssignmentView';
|
|
33307
|
-
default:
|
|
33308
|
-
throw new Error(`Unknown view type '${view}'`);
|
|
33309
|
-
}
|
|
33310
|
-
}
|
|
33311
|
-
}
|
|
33312
|
-
|
|
33313
|
-
const NAE_ROUTING_CONFIGURATION_PATH = "configPath";
|
|
33314
|
-
/**
|
|
33315
|
-
* Uses the information from nae.json to construct the application's routing
|
|
33316
|
-
*/
|
|
33317
|
-
class RoutingBuilderService {
|
|
33318
|
-
constructor(router, _configService, _viewService, _logger, _dynamicNavigationRouteService, _groupNavigationComponentResolverComponent) {
|
|
33319
|
-
this._configService = _configService;
|
|
33320
|
-
this._viewService = _viewService;
|
|
33321
|
-
this._logger = _logger;
|
|
33322
|
-
this._dynamicNavigationRouteService = _dynamicNavigationRouteService;
|
|
33323
|
-
this._groupNavigationComponentResolverComponent = _groupNavigationComponentResolverComponent;
|
|
33324
|
-
this._groupNavigationRouteGenerated = false;
|
|
33325
|
-
router.relativeLinkResolution = 'legacy';
|
|
33326
|
-
router.config.splice(0, router.config.length);
|
|
33327
|
-
for (const [pathSegment, view] of Object.entries(_configService.get().views)) {
|
|
33328
|
-
const route = this.constructRouteObject(view, pathSegment);
|
|
33329
|
-
if (route !== undefined) {
|
|
33330
|
-
router.config.push(route);
|
|
33331
|
-
}
|
|
33332
|
-
}
|
|
33333
|
-
router.config.push(...this.defaultRoutesRedirects());
|
|
33334
|
-
}
|
|
33335
|
-
constructRouteObject(view, configPath, ancestors = []) {
|
|
33336
|
-
const component = this.resolveComponentClass(view, configPath);
|
|
33337
|
-
if (component === undefined) {
|
|
33338
|
-
return undefined;
|
|
33339
|
-
}
|
|
33340
|
-
if (!view.routing) {
|
|
33341
|
-
this._logger.warn(`nae.json configuration is invalid. View at path '${configPath}'` +
|
|
33342
|
-
` must define a 'routing' attribute. Skipping this view for routing generation.`);
|
|
33343
|
-
return undefined;
|
|
33344
|
-
}
|
|
33345
|
-
const route = {
|
|
33346
|
-
path: view.routing.path,
|
|
33347
|
-
data: {
|
|
33348
|
-
[NAE_ROUTING_CONFIGURATION_PATH]: configPath
|
|
33349
|
-
},
|
|
33350
|
-
component
|
|
33351
|
-
};
|
|
33352
|
-
if (view?.layout?.name === GroupNavigationConstants.GROUP_NAVIGATION_OUTLET) {
|
|
33353
|
-
if (this._groupNavigationRouteGenerated) {
|
|
33354
|
-
this._logger.warn(`Multiple groupNavigationOutlets are present in nae.json. Duplicate entry found at path ${configPath}`);
|
|
33355
|
-
}
|
|
33356
|
-
else {
|
|
33357
|
-
this._logger.debug(`GroupNavigationOutlet found in nae.json at path '${configPath}'`);
|
|
33358
|
-
}
|
|
33359
|
-
const pathNoParams = route.path;
|
|
33360
|
-
route.path = `${pathNoParams}/:${GroupNavigationConstants.GROUP_NAVIGATION_ROUTER_PARAM}`;
|
|
33361
|
-
route.canActivate = [AuthenticationGuardService];
|
|
33362
|
-
const parentPathSegments = ancestors.map(a => a.path);
|
|
33363
|
-
parentPathSegments.push(pathNoParams);
|
|
33364
|
-
this._dynamicNavigationRouteService.route = parentPathSegments.join('/');
|
|
33365
|
-
this._groupNavigationRouteGenerated = true;
|
|
33366
|
-
return route;
|
|
33367
|
-
}
|
|
33368
|
-
if (view.routing.match !== undefined && view.routing.match) {
|
|
33369
|
-
route['pathMatch'] = 'full';
|
|
33370
|
-
}
|
|
33371
|
-
route['canActivate'] = [];
|
|
33372
|
-
if (view.access === 'private'
|
|
33373
|
-
|| view.access.hasOwnProperty('role')
|
|
33374
|
-
|| view.access.hasOwnProperty('group')
|
|
33375
|
-
|| view.access.hasOwnProperty('authority')) {
|
|
33376
|
-
route['canActivate'].push(AuthenticationGuardService);
|
|
33377
|
-
}
|
|
33378
|
-
if (view.access.hasOwnProperty('role')) {
|
|
33379
|
-
route['canActivate'].push(RoleGuardService);
|
|
33380
|
-
}
|
|
33381
|
-
if (view.access.hasOwnProperty('authority')) {
|
|
33382
|
-
route['canActivate'].push(AuthorityGuardService);
|
|
33383
|
-
}
|
|
33384
|
-
if (view.access.hasOwnProperty('group')) {
|
|
33385
|
-
route['canActivate'].push(GroupGuardService);
|
|
33386
|
-
}
|
|
33387
|
-
if (!!view.children) {
|
|
33388
|
-
route['children'] = [];
|
|
33389
|
-
Object.entries(view.children).forEach(([configPathSegment, childView]) => {
|
|
33390
|
-
// TODO check if routes are constructed correctly regarding empty route segments
|
|
33391
|
-
const childRoute = this.constructRouteObject(childView, `${configPath}/${configPathSegment}`, [...ancestors, route]);
|
|
33392
|
-
if (childRoute !== undefined) {
|
|
33393
|
-
route['children'].push(childRoute);
|
|
33394
|
-
}
|
|
33395
|
-
});
|
|
33396
|
-
}
|
|
33397
|
-
if (view?.layout?.name === 'tabView') {
|
|
33398
|
-
if (!view.children) {
|
|
33399
|
-
route['children'] = [];
|
|
33400
|
-
}
|
|
33401
|
-
route['children'].push({
|
|
33402
|
-
path: '**',
|
|
33403
|
-
component
|
|
33404
|
-
});
|
|
33405
|
-
}
|
|
33406
|
-
return route;
|
|
33407
|
-
}
|
|
33408
|
-
resolveComponentClass(view, configPath) {
|
|
33409
|
-
let result;
|
|
33410
|
-
if (!!view.component) {
|
|
33411
|
-
result = this._viewService.resolveNameToClass(view.component.class);
|
|
33412
|
-
}
|
|
33413
|
-
else if (!!view.layout) {
|
|
33414
|
-
result = this.resolveComponentClassFromLayout(view, configPath);
|
|
33415
|
-
}
|
|
33416
|
-
else {
|
|
33417
|
-
this._logger.warn(`nae.json configuration is invalid. View at path '${configPath}'` +
|
|
33418
|
-
` must define either a 'layout' or a 'component' attribute. Skipping this view for routing generation.`);
|
|
33419
|
-
return undefined;
|
|
33420
|
-
}
|
|
33421
|
-
if (result === undefined) {
|
|
33422
|
-
this._logger.warn(`Some views from nae.json configuration have not been created in the project.` +
|
|
33423
|
-
` Run create-view schematic to rectify this. Skipping this view for routing generation.`);
|
|
33424
|
-
return undefined;
|
|
33425
|
-
}
|
|
33426
|
-
return result;
|
|
33427
|
-
}
|
|
33428
|
-
resolveComponentClassFromLayout(view, configPath) {
|
|
33429
|
-
if (view.layout.name === GroupNavigationConstants.GROUP_NAVIGATION_OUTLET) {
|
|
33430
|
-
return this._groupNavigationComponentResolverComponent;
|
|
33431
|
-
}
|
|
33432
|
-
const className = RoutingBuilderService.parseClassNameFromView(view, configPath);
|
|
33433
|
-
return this._viewService.resolveNameToClass(className);
|
|
33434
|
-
}
|
|
33435
|
-
static parseClassNameFromView(view, configPath) {
|
|
33436
|
-
if (!!view.layout.componentName) {
|
|
33437
|
-
return `${classify(view.layout.componentName)}Component`;
|
|
33438
|
-
}
|
|
33439
|
-
else {
|
|
33440
|
-
const classInfo = new ViewClassInfo(configPath, view.layout.name, view.layout.componentName);
|
|
33441
|
-
return classInfo.className;
|
|
33442
|
-
}
|
|
33443
|
-
}
|
|
33444
|
-
defaultRoutesRedirects() {
|
|
33445
|
-
const result = [];
|
|
33446
|
-
const servicesConfig = this._configService.getServicesConfiguration();
|
|
33447
|
-
if (!!servicesConfig && !!servicesConfig.routing) {
|
|
33448
|
-
if (!!servicesConfig.routing.defaultRedirect) {
|
|
33449
|
-
result.push({
|
|
33450
|
-
path: '',
|
|
33451
|
-
redirectTo: servicesConfig.routing.defaultRedirect,
|
|
33452
|
-
pathMatch: 'full'
|
|
33453
|
-
});
|
|
33454
|
-
}
|
|
33455
|
-
if (!!servicesConfig.routing.wildcardRedirect) {
|
|
33456
|
-
result.push({
|
|
33457
|
-
path: '**',
|
|
33458
|
-
redirectTo: servicesConfig.routing.wildcardRedirect
|
|
33459
|
-
});
|
|
33460
|
-
}
|
|
33461
|
-
}
|
|
33462
|
-
return result;
|
|
33463
|
-
}
|
|
33464
|
-
}
|
|
33465
|
-
RoutingBuilderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RoutingBuilderService, deps: [{ token: i2$3.Router }, { token: ConfigurationService }, { token: ViewService }, { token: LoggerService }, { token: DynamicNavigationRouteProviderService }, { token: NAE_GROUP_NAVIGATION_COMPONENT_RESOLVER_COMPONENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
33466
|
-
RoutingBuilderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RoutingBuilderService, providedIn: 'root' });
|
|
33467
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RoutingBuilderService, decorators: [{
|
|
33468
|
-
type: Injectable,
|
|
33469
|
-
args: [{
|
|
33470
|
-
providedIn: 'root'
|
|
33471
|
-
}]
|
|
33472
|
-
}], ctorParameters: function () { return [{ type: i2$3.Router }, { type: ConfigurationService }, { type: ViewService }, { type: LoggerService }, { type: DynamicNavigationRouteProviderService }, { type: i0.Type, decorators: [{
|
|
33473
|
-
type: Optional
|
|
33474
|
-
}, {
|
|
33475
|
-
type: Inject,
|
|
33476
|
-
args: [NAE_GROUP_NAVIGATION_COMPONENT_RESOLVER_COMPONENT]
|
|
33477
|
-
}] }]; } });
|
|
33478
|
-
|
|
33479
33522
|
/* SERVICES */
|
|
33480
33523
|
|
|
33481
33524
|
/**
|