@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.
@@ -26772,6 +26772,228 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
26772
26772
  type: Input
26773
26773
  }] } });
26774
26774
 
26775
+ class ImportToAdd {
26776
+ constructor(className, fileImportPath) {
26777
+ this.className = className;
26778
+ this.fileImportPath = fileImportPath;
26779
+ }
26780
+ }
26781
+
26782
+ /**
26783
+ * @license
26784
+ * Copyright Google Inc. All Rights Reserved.
26785
+ *
26786
+ * Use of this source code is governed by an MIT-style license that can be
26787
+ * found in the LICENSE file at https://angular.io/license
26788
+ *
26789
+ * File copied from: angular_devkit/core/src/utils/strings.ts
26790
+ */
26791
+ const STRING_DASHERIZE_REGEXP = (/[ _]/g);
26792
+ const STRING_DECAMELIZE_REGEXP = (/([a-z\d])([A-Z])/g);
26793
+ const STRING_CAMELIZE_REGEXP = (/(-|_|\.|\s)+(.)?/g);
26794
+ const STRING_UNDERSCORE_REGEXP_1 = (/([a-z\d])([A-Z]+)/g);
26795
+ const STRING_UNDERSCORE_REGEXP_2 = (/-|\s+/g);
26796
+ /**
26797
+ * Converts a camelized string into all lower case separated by underscores.
26798
+ *
26799
+ * ```javascript
26800
+ * decamelize('innerHTML'); // 'inner_html'
26801
+ * decamelize('action_name'); // 'action_name'
26802
+ * decamelize('css-class-name'); // 'css-class-name'
26803
+ * decamelize('my favorite items'); // 'my favorite items'
26804
+ * ```
26805
+ * @method decamelize
26806
+ * @param str The string to decamelize.
26807
+ * @return the decamelized string.
26808
+ */
26809
+ function decamelize(str) {
26810
+ return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();
26811
+ }
26812
+ /**
26813
+ * Replaces underscores, spaces, or camelCase with dashes.
26814
+ * ```javascript
26815
+ * dasherize('innerHTML'); // 'inner-html'
26816
+ * dasherize('action_name'); // 'action-name'
26817
+ * dasherize('css-class-name'); // 'css-class-name'
26818
+ * dasherize('my favorite items'); // 'my-favorite-items'
26819
+ * ```
26820
+ * @method dasherize
26821
+ * @param str The string to dasherize.
26822
+ * @return the dasherized string.
26823
+ */
26824
+ function dasherize(str) {
26825
+ return decamelize(str).replace(STRING_DASHERIZE_REGEXP, '-');
26826
+ }
26827
+ /**
26828
+ * Returns the lowerCamelCase form of a string.
26829
+ * ```javascript
26830
+ * camelize('innerHTML'); // 'innerHTML'
26831
+ * camelize('action_name'); // 'actionName'
26832
+ * camelize('css-class-name'); // 'cssClassName'
26833
+ * camelize('my favorite items'); // 'myFavoriteItems'
26834
+ * camelize('My Favorite Items'); // 'myFavoriteItems'
26835
+ * ```
26836
+ * @method camelize
26837
+ * @param str The string to camelize.
26838
+ * @return the camelized string.
26839
+ */
26840
+ function camelize(str) {
26841
+ return str
26842
+ .replace(STRING_CAMELIZE_REGEXP, (_match, _separator, chr) => {
26843
+ return chr ? chr.toUpperCase() : '';
26844
+ })
26845
+ .replace(/^([A-Z])/, (match) => match.toLowerCase());
26846
+ }
26847
+ /**
26848
+ * Returns the UpperCamelCase form of a string.
26849
+ * ```javascript
26850
+ * 'innerHTML'.classify(); // 'InnerHTML'
26851
+ * 'action_name'.classify(); // 'ActionName'
26852
+ * 'css-class-name'.classify(); // 'CssClassName'
26853
+ * 'my favorite items'.classify(); // 'MyFavoriteItems'
26854
+ * ```
26855
+ * @method classify
26856
+ * @param str the string to classify
26857
+ * @return the classified string
26858
+ */
26859
+ function classify(str) {
26860
+ return str.split('.').map(part => capitalize(camelize(part))).join('.');
26861
+ }
26862
+ /**
26863
+ * More general than decamelize. Returns the lower\_case\_and\_underscored
26864
+ * form of a string.
26865
+ * ```javascript
26866
+ * 'innerHTML'.underscore(); // 'inner_html'
26867
+ * 'action_name'.underscore(); // 'action_name'
26868
+ * 'css-class-name'.underscore(); // 'css_class_name'
26869
+ * 'my favorite items'.underscore(); // 'my_favorite_items'
26870
+ * ```
26871
+ * @method underscore
26872
+ * @param str The string to underscore.
26873
+ * @return the underscored string.
26874
+ */
26875
+ function underscore(str) {
26876
+ return str
26877
+ .replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2')
26878
+ .replace(STRING_UNDERSCORE_REGEXP_2, '_')
26879
+ .toLowerCase();
26880
+ }
26881
+ /**
26882
+ * Returns the Capitalized form of a string
26883
+ * ```javascript
26884
+ * 'innerHTML'.capitalize() // 'InnerHTML'
26885
+ * 'action_name'.capitalize() // 'Action_name'
26886
+ * 'css-class-name'.capitalize() // 'Css-class-name'
26887
+ * 'my favorite items'.capitalize() // 'My favorite items'
26888
+ * ```
26889
+ * @method capitalize
26890
+ * @param str The string to capitalize.
26891
+ * @return The capitalized string.
26892
+ */
26893
+ function capitalize(str) {
26894
+ return str.charAt(0).toUpperCase() + str.substr(1);
26895
+ }
26896
+ /**
26897
+ * Calculate the levenshtein distance of two strings.
26898
+ * See https://en.wikipedia.org/wiki/Levenshtein_distance.
26899
+ * Based off https://gist.github.com/andrei-m/982927 (for using the faster dynamic programming
26900
+ * version).
26901
+ *
26902
+ * @param a String a.
26903
+ * @param b String b.
26904
+ * @returns A number that represents the distance between the two strings. The greater the number
26905
+ * the more distant the strings are from each others.
26906
+ */
26907
+ function levenshtein(a, b) {
26908
+ if (a.length === 0) {
26909
+ return b.length;
26910
+ }
26911
+ if (b.length === 0) {
26912
+ return a.length;
26913
+ }
26914
+ const matrix = [];
26915
+ // increment along the first column of each row
26916
+ for (let i = 0; i <= b.length; i++) {
26917
+ matrix[i] = [i];
26918
+ }
26919
+ // increment each column in the first row
26920
+ for (let j = 0; j <= a.length; j++) {
26921
+ matrix[0][j] = j;
26922
+ }
26923
+ // Fill in the rest of the matrix
26924
+ for (let i = 1; i <= b.length; i++) {
26925
+ for (let j = 1; j <= a.length; j++) {
26926
+ if (b.charAt(i - 1) === a.charAt(j - 1)) {
26927
+ matrix[i][j] = matrix[i - 1][j - 1];
26928
+ }
26929
+ else {
26930
+ matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
26931
+ matrix[i][j - 1] + 1, // insertion
26932
+ matrix[i - 1][j] + 1);
26933
+ }
26934
+ }
26935
+ }
26936
+ return matrix[b.length][a.length];
26937
+ }
26938
+
26939
+ class ViewClassInfo extends ImportToAdd {
26940
+ constructor(path, viewType, customComponentName) {
26941
+ super('', '');
26942
+ if (!customComponentName) {
26943
+ this.prefix = ViewClassInfo.convertPathToClassNamePrefix(path);
26944
+ const classSuffix = ViewClassInfo.resolveClassSuffixForView(viewType);
26945
+ this.nameWithoutComponent = `${classify(this.prefix)}${classSuffix}`;
26946
+ this.fileImportPath = `./views/${path}/${this.prefix}-${dasherize(classSuffix)}.component`;
26947
+ }
26948
+ else {
26949
+ this.prefix = '';
26950
+ this.nameWithoutComponent = classify(customComponentName);
26951
+ this.fileImportPath = `./views/${path}/${dasherize(customComponentName)}.component`;
26952
+ }
26953
+ this.className = `${this.nameWithoutComponent}Component`;
26954
+ }
26955
+ static convertPathToClassNamePrefix(path) {
26956
+ const regexDash = /-/g;
26957
+ return path.replace(regexDash, '_').replace(/\//g, '-').toLocaleLowerCase();
26958
+ }
26959
+ static resolveClassSuffixForView(view) {
26960
+ switch (view) {
26961
+ case 'login':
26962
+ return 'Login';
26963
+ case 'tabView':
26964
+ return 'TabView';
26965
+ case 'taskView':
26966
+ return 'TaskView';
26967
+ case 'caseView':
26968
+ return 'CaseView';
26969
+ case 'emptyView':
26970
+ return 'EmptyView';
26971
+ case 'sidenavView':
26972
+ return 'SidenavView';
26973
+ case 'doubleDrawerView':
26974
+ return 'DoubleDrawerView';
26975
+ case 'toolbarView':
26976
+ return 'ToolbarView';
26977
+ case 'sidenavAndToolbarView':
26978
+ return 'SidenavAndToolbarView';
26979
+ case 'groupView':
26980
+ return 'GroupView';
26981
+ case 'dashboard':
26982
+ return 'Dashboard';
26983
+ case 'treeCaseView':
26984
+ return 'TreeCaseView';
26985
+ case 'workflowView':
26986
+ return 'WorkflowView';
26987
+ case 'roleAssignmentView':
26988
+ return 'RoleAssignmentView';
26989
+ case 'ldapRoleAssignmentView':
26990
+ return 'LdapRoleAssignmentView';
26991
+ default:
26992
+ throw new Error(`Unknown view type '${view}'`);
26993
+ }
26994
+ }
26995
+ }
26996
+
26775
26997
  var GroupNavigationConstants;
26776
26998
  (function (GroupNavigationConstants) {
26777
26999
  /**
@@ -26913,35 +27135,209 @@ var GroupNavigationConstants;
26913
27135
  })(GroupNavigationConstants || (GroupNavigationConstants = {}));
26914
27136
 
26915
27137
  /**
26916
- * Holds all identifiers of the Impersonation config process in an accessible manner
27138
+ * Holds component for dynamic routing resolution of group navigation component resolver component by the {@link RoutingBuilderService}.
26917
27139
  */
26918
- var UserImpersonationConstants;
26919
- (function (UserImpersonationConstants) {
26920
- UserImpersonationConstants["IMPERSONATION_CONFIG_NET_IDENTIFIER"] = "impersonation_config";
26921
- UserImpersonationConstants["IMPERSONATION_CONFIG_FIELD_IMPERSONATED"] = "impersonated";
26922
- UserImpersonationConstants["IMPERSONATION_CONFIG_FIELD_ROLES"] = "impersonated_roles";
26923
- UserImpersonationConstants["IMPERSONATION_CONFIG_FIELD_AUTHS"] = "impersonated_authorities";
26924
- })(UserImpersonationConstants || (UserImpersonationConstants = {}));
27140
+ const NAE_GROUP_NAVIGATION_COMPONENT_RESOLVER_COMPONENT = new InjectionToken('NaeGroupNavigationComponentResolverComponent');
26925
27141
 
26926
- class ImpersonationService extends AbstractResourceService {
26927
- constructor(provider, _router, _configService, _userService, _snackbar, _filter, _log, _translate) {
26928
- super('impersonation', provider, _configService);
26929
- this.provider = provider;
26930
- this._router = _router;
27142
+ const NAE_ROUTING_CONFIGURATION_PATH = "configPath";
27143
+ /**
27144
+ * Uses the information from nae.json to construct the application's routing
27145
+ */
27146
+ class RoutingBuilderService {
27147
+ constructor(router, _configService, _viewService, _logger, _dynamicNavigationRouteService, _groupNavigationComponentResolverComponent) {
26931
27148
  this._configService = _configService;
26932
- this._userService = _userService;
26933
- this._snackbar = _snackbar;
26934
- this._filter = _filter;
26935
- this._log = _log;
26936
- this._translate = _translate;
26937
- this._impersonating$ = new Subject();
26938
- this._sub = this._userService.user$.subscribe(user => this._resolveUserChange(user));
26939
- }
26940
- get impersonating$() {
26941
- return this._impersonating$.asObservable();
26942
- }
26943
- impersonateUser(userId) {
26944
- this.provider.post$('impersonate/user/' + userId, this.SERVER_URL, {}).subscribe((user) => {
27149
+ this._viewService = _viewService;
27150
+ this._logger = _logger;
27151
+ this._dynamicNavigationRouteService = _dynamicNavigationRouteService;
27152
+ this._groupNavigationComponentResolverComponent = _groupNavigationComponentResolverComponent;
27153
+ this._groupNavigationRouteGenerated = false;
27154
+ router.relativeLinkResolution = 'legacy';
27155
+ router.config.splice(0, router.config.length);
27156
+ for (const [pathSegment, view] of Object.entries(_configService.get().views)) {
27157
+ const route = this.constructRouteObject(view, pathSegment);
27158
+ if (route !== undefined) {
27159
+ router.config.push(route);
27160
+ }
27161
+ }
27162
+ router.config.push(...this.defaultRoutesRedirects());
27163
+ }
27164
+ constructRouteObject(view, configPath, ancestors = []) {
27165
+ var _a, _b;
27166
+ const component = this.resolveComponentClass(view, configPath);
27167
+ if (component === undefined) {
27168
+ return undefined;
27169
+ }
27170
+ if (!view.routing) {
27171
+ this._logger.warn(`nae.json configuration is invalid. View at path '${configPath}'` +
27172
+ ` must define a 'routing' attribute. Skipping this view for routing generation.`);
27173
+ return undefined;
27174
+ }
27175
+ const route = {
27176
+ path: view.routing.path,
27177
+ data: {
27178
+ [NAE_ROUTING_CONFIGURATION_PATH]: configPath
27179
+ },
27180
+ component
27181
+ };
27182
+ if (((_a = view === null || view === void 0 ? void 0 : view.layout) === null || _a === void 0 ? void 0 : _a.name) === GroupNavigationConstants.GROUP_NAVIGATION_OUTLET) {
27183
+ if (this._groupNavigationRouteGenerated) {
27184
+ this._logger.warn(`Multiple groupNavigationOutlets are present in nae.json. Duplicate entry found at path ${configPath}`);
27185
+ }
27186
+ else {
27187
+ this._logger.debug(`GroupNavigationOutlet found in nae.json at path '${configPath}'`);
27188
+ }
27189
+ const pathNoParams = route.path;
27190
+ route.path = `${pathNoParams}/:${GroupNavigationConstants.GROUP_NAVIGATION_ROUTER_PARAM}`;
27191
+ route.canActivate = [AuthenticationGuardService];
27192
+ const parentPathSegments = ancestors.map(a => a.path);
27193
+ parentPathSegments.push(pathNoParams);
27194
+ this._dynamicNavigationRouteService.route = parentPathSegments.join('/');
27195
+ this._groupNavigationRouteGenerated = true;
27196
+ return route;
27197
+ }
27198
+ if (view.routing.match !== undefined && view.routing.match) {
27199
+ route['pathMatch'] = 'full';
27200
+ }
27201
+ route['canActivate'] = [];
27202
+ if (view.access === 'private'
27203
+ || view.access.hasOwnProperty('role')
27204
+ || view.access.hasOwnProperty('group')
27205
+ || view.access.hasOwnProperty('authority')) {
27206
+ route['canActivate'].push(AuthenticationGuardService);
27207
+ }
27208
+ if (view.access.hasOwnProperty('role')) {
27209
+ route['canActivate'].push(RoleGuardService);
27210
+ }
27211
+ if (view.access.hasOwnProperty('authority')) {
27212
+ route['canActivate'].push(AuthorityGuardService);
27213
+ }
27214
+ if (view.access.hasOwnProperty('group')) {
27215
+ route['canActivate'].push(GroupGuardService);
27216
+ }
27217
+ if (!!view.children) {
27218
+ route['children'] = [];
27219
+ Object.entries(view.children).forEach(([configPathSegment, childView]) => {
27220
+ // TODO check if routes are constructed correctly regarding empty route segments
27221
+ const childRoute = this.constructRouteObject(childView, `${configPath}/${configPathSegment}`, [...ancestors, route]);
27222
+ if (childRoute !== undefined) {
27223
+ route['children'].push(childRoute);
27224
+ }
27225
+ });
27226
+ }
27227
+ if (((_b = view === null || view === void 0 ? void 0 : view.layout) === null || _b === void 0 ? void 0 : _b.name) === 'tabView') {
27228
+ if (!view.children) {
27229
+ route['children'] = [];
27230
+ }
27231
+ route['children'].push({
27232
+ path: '**',
27233
+ component
27234
+ });
27235
+ }
27236
+ return route;
27237
+ }
27238
+ resolveComponentClass(view, configPath) {
27239
+ let result;
27240
+ if (!!view.component) {
27241
+ result = this._viewService.resolveNameToClass(view.component.class);
27242
+ }
27243
+ else if (!!view.layout) {
27244
+ result = this.resolveComponentClassFromLayout(view, configPath);
27245
+ }
27246
+ else {
27247
+ this._logger.warn(`nae.json configuration is invalid. View at path '${configPath}'` +
27248
+ ` must define either a 'layout' or a 'component' attribute. Skipping this view for routing generation.`);
27249
+ return undefined;
27250
+ }
27251
+ if (result === undefined) {
27252
+ this._logger.warn(`Some views from nae.json configuration have not been created in the project.` +
27253
+ ` Run create-view schematic to rectify this. Skipping this view for routing generation.`);
27254
+ return undefined;
27255
+ }
27256
+ return result;
27257
+ }
27258
+ resolveComponentClassFromLayout(view, configPath) {
27259
+ if (view.layout.name === GroupNavigationConstants.GROUP_NAVIGATION_OUTLET) {
27260
+ return this._groupNavigationComponentResolverComponent;
27261
+ }
27262
+ const className = RoutingBuilderService.parseClassNameFromView(view, configPath);
27263
+ return this._viewService.resolveNameToClass(className);
27264
+ }
27265
+ static parseClassNameFromView(view, configPath) {
27266
+ if (!!view.layout.componentName) {
27267
+ return `${classify(view.layout.componentName)}Component`;
27268
+ }
27269
+ else {
27270
+ const classInfo = new ViewClassInfo(configPath, view.layout.name, view.layout.componentName);
27271
+ return classInfo.className;
27272
+ }
27273
+ }
27274
+ defaultRoutesRedirects() {
27275
+ const result = [];
27276
+ const servicesConfig = this._configService.getServicesConfiguration();
27277
+ if (!!servicesConfig && !!servicesConfig.routing) {
27278
+ if (!!servicesConfig.routing.defaultRedirect) {
27279
+ result.push({
27280
+ path: '',
27281
+ redirectTo: servicesConfig.routing.defaultRedirect,
27282
+ pathMatch: 'full'
27283
+ });
27284
+ }
27285
+ if (!!servicesConfig.routing.wildcardRedirect) {
27286
+ result.push({
27287
+ path: '**',
27288
+ redirectTo: servicesConfig.routing.wildcardRedirect
27289
+ });
27290
+ }
27291
+ }
27292
+ return result;
27293
+ }
27294
+ }
27295
+ 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 });
27296
+ RoutingBuilderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RoutingBuilderService, providedIn: 'root' });
27297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RoutingBuilderService, decorators: [{
27298
+ type: Injectable,
27299
+ args: [{
27300
+ providedIn: 'root'
27301
+ }]
27302
+ }], ctorParameters: function () {
27303
+ return [{ type: i2$3.Router }, { type: ConfigurationService }, { type: ViewService }, { type: LoggerService }, { type: DynamicNavigationRouteProviderService }, { type: i0.Type, decorators: [{
27304
+ type: Optional
27305
+ }, {
27306
+ type: Inject,
27307
+ args: [NAE_GROUP_NAVIGATION_COMPONENT_RESOLVER_COMPONENT]
27308
+ }] }];
27309
+ } });
27310
+
27311
+ /**
27312
+ * Holds all identifiers of the Impersonation config process in an accessible manner
27313
+ */
27314
+ var UserImpersonationConstants;
27315
+ (function (UserImpersonationConstants) {
27316
+ UserImpersonationConstants["IMPERSONATION_CONFIG_NET_IDENTIFIER"] = "impersonation_config";
27317
+ UserImpersonationConstants["IMPERSONATION_CONFIG_FIELD_IMPERSONATED"] = "impersonated";
27318
+ UserImpersonationConstants["IMPERSONATION_CONFIG_FIELD_ROLES"] = "impersonated_roles";
27319
+ UserImpersonationConstants["IMPERSONATION_CONFIG_FIELD_AUTHS"] = "impersonated_authorities";
27320
+ })(UserImpersonationConstants || (UserImpersonationConstants = {}));
27321
+
27322
+ class ImpersonationService extends AbstractResourceService {
27323
+ constructor(provider, _router, _configService, _userService, _snackbar, _filter, _log, _translate) {
27324
+ super('impersonation', provider, _configService);
27325
+ this.provider = provider;
27326
+ this._router = _router;
27327
+ this._configService = _configService;
27328
+ this._userService = _userService;
27329
+ this._snackbar = _snackbar;
27330
+ this._filter = _filter;
27331
+ this._log = _log;
27332
+ this._translate = _translate;
27333
+ this._impersonating$ = new Subject();
27334
+ this._sub = this._userService.user$.subscribe(user => this._resolveUserChange(user));
27335
+ }
27336
+ get impersonating$() {
27337
+ return this._impersonating$.asObservable();
27338
+ }
27339
+ impersonateUser(userId) {
27340
+ this.provider.post$('impersonate/user/' + userId, this.SERVER_URL, {}).subscribe((user) => {
26945
27341
  this._resolveSuccess(user);
26946
27342
  }, (response => {
26947
27343
  this._resolveError(response);
@@ -27145,6 +27541,8 @@ class AbstractNavigationDoubleDrawerComponent {
27145
27541
  this.rightLoading$ = new LoadingEmitter();
27146
27542
  this.nodeLoading$ = new LoadingEmitter();
27147
27543
  this.itemsOrder = MenuOrder.Ascending;
27544
+ this.hiddenCustomItems = [];
27545
+ this._childCustomViews = {};
27148
27546
  }
27149
27547
  ngOnInit() {
27150
27548
  this._breakpointSubscription = this._breakpoint.observe([Breakpoints.HandsetLandscape]).subscribe(() => {
@@ -27162,6 +27560,14 @@ class AbstractNavigationDoubleDrawerComponent {
27162
27560
  this._currentNodeSubscription = this._uriService.activeNode$.subscribe(node => {
27163
27561
  this.currentNode = node;
27164
27562
  });
27563
+ const viewConfigurationPath = this._activatedRoute.snapshot.data[NAE_ROUTING_CONFIGURATION_PATH];
27564
+ if (!!viewConfigurationPath) {
27565
+ const viewConfiguration = this._config.getViewByPath(viewConfigurationPath);
27566
+ Object.entries(viewConfiguration.children).forEach(([key, childView]) => {
27567
+ this.resolveUriForChildViews(viewConfigurationPath + '/' + key, childView);
27568
+ this.resolveHiddenMenuItemFromChildViews(viewConfigurationPath + '/' + key, childView);
27569
+ });
27570
+ }
27165
27571
  }
27166
27572
  get currentNode() {
27167
27573
  return this._currentNode;
@@ -27353,17 +27759,20 @@ class AbstractNavigationDoubleDrawerComponent {
27353
27759
  else {
27354
27760
  this.rightItems = result.map(folder => this.resolveItemCaseToNavigationItem(folder)).filter(i => !!i);
27355
27761
  }
27762
+ this.resolveCustomViewsInRightSide();
27356
27763
  this.rightLoading$.off();
27357
27764
  }, error => {
27358
27765
  this._log.error(error);
27359
27766
  this.rightItems = [];
27360
27767
  this.moreItems = [];
27768
+ this.resolveCustomViewsInRightSide();
27361
27769
  this.rightLoading$.off();
27362
27770
  });
27363
27771
  }, error => {
27364
27772
  this._log.error(error);
27365
27773
  this.rightItems = [];
27366
27774
  this.moreItems = [];
27775
+ this.resolveCustomViewsInRightSide();
27367
27776
  this.rightLoading$.off();
27368
27777
  });
27369
27778
  }
@@ -27389,6 +27798,11 @@ class AbstractNavigationDoubleDrawerComponent {
27389
27798
  this.leftItems = this.leftItems.sort((a, b) => { var _a, _b; return multiplier * ((_a = a === null || a === void 0 ? void 0 : a.navigation) === null || _a === void 0 ? void 0 : _a.title.localeCompare((_b = b === null || b === void 0 ? void 0 : b.navigation) === null || _b === void 0 ? void 0 : _b.title)); });
27390
27799
  this.moreItems = this.moreItems.sort((a, b) => { var _a, _b; return multiplier * ((_a = a === null || a === void 0 ? void 0 : a.navigation) === null || _a === void 0 ? void 0 : _a.title.localeCompare((_b = b === null || b === void 0 ? void 0 : b.navigation) === null || _b === void 0 ? void 0 : _b.title)); });
27391
27800
  }
27801
+ resolveCustomViewsInRightSide() {
27802
+ if (!!this._childCustomViews[this._currentNode.uriPath]) {
27803
+ this.rightItems.push(...Object.values(this._childCustomViews[this._currentNode.uriPath]));
27804
+ }
27805
+ }
27392
27806
  resolveItemCaseToNavigationItem(itemCase) {
27393
27807
  var _a, _b;
27394
27808
  const item = {
@@ -27472,6 +27886,26 @@ class AbstractNavigationDoubleDrawerComponent {
27472
27886
  // this.userPreferenceService._drawerWidthChanged$.next(this.width);
27473
27887
  // this.contentWidth.next(this.width);
27474
27888
  }
27889
+ resolveUriForChildViews(configPath, childView) {
27890
+ if (!childView.processUri)
27891
+ return;
27892
+ if (!this._accessService.canAccessView(childView, configPath))
27893
+ return;
27894
+ if (!this._childCustomViews[childView.processUri]) {
27895
+ this._childCustomViews[childView.processUri] = {};
27896
+ }
27897
+ this._childCustomViews[childView.processUri][configPath] = Object.assign({ id: configPath }, childView);
27898
+ }
27899
+ resolveHiddenMenuItemFromChildViews(configPath, childView) {
27900
+ var _a;
27901
+ if (!childView.navigation)
27902
+ return;
27903
+ if (!this._accessService.canAccessView(childView, configPath))
27904
+ return;
27905
+ if (!!((_a = childView === null || childView === void 0 ? void 0 : childView.navigation) === null || _a === void 0 ? void 0 : _a.hidden)) {
27906
+ this.hiddenCustomItems.push(Object.assign({ id: configPath }, childView));
27907
+ }
27908
+ }
27475
27909
  }
27476
27910
  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 });
27477
27911
  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 });
@@ -28083,11 +28517,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
28083
28517
  }]
28084
28518
  }], ctorParameters: function () { return [{ type: FilterRepository }, { type: TaskResourceService }, { type: AllowedNetsServiceFactory }, { type: BaseAllowedNetsService }, { type: LoggerService }]; } });
28085
28519
 
28086
- /**
28087
- * Holds component for dynamic routing resolution of group navigation component resolver component by the {@link RoutingBuilderService}.
28088
- */
28089
- const NAE_GROUP_NAVIGATION_COMPONENT_RESOLVER_COMPONENT = new InjectionToken('NaeGroupNavigationComponentResolverComponent');
28090
-
28091
28520
  var UriContentType;
28092
28521
  (function (UriContentType) {
28093
28522
  UriContentType[UriContentType["PROCESS"] = 0] = "PROCESS";
@@ -33372,397 +33801,6 @@ class MockProfileService {
33372
33801
  }
33373
33802
  }
33374
33803
 
33375
- class ImportToAdd {
33376
- constructor(className, fileImportPath) {
33377
- this.className = className;
33378
- this.fileImportPath = fileImportPath;
33379
- }
33380
- }
33381
-
33382
- /**
33383
- * @license
33384
- * Copyright Google Inc. All Rights Reserved.
33385
- *
33386
- * Use of this source code is governed by an MIT-style license that can be
33387
- * found in the LICENSE file at https://angular.io/license
33388
- *
33389
- * File copied from: angular_devkit/core/src/utils/strings.ts
33390
- */
33391
- const STRING_DASHERIZE_REGEXP = (/[ _]/g);
33392
- const STRING_DECAMELIZE_REGEXP = (/([a-z\d])([A-Z])/g);
33393
- const STRING_CAMELIZE_REGEXP = (/(-|_|\.|\s)+(.)?/g);
33394
- const STRING_UNDERSCORE_REGEXP_1 = (/([a-z\d])([A-Z]+)/g);
33395
- const STRING_UNDERSCORE_REGEXP_2 = (/-|\s+/g);
33396
- /**
33397
- * Converts a camelized string into all lower case separated by underscores.
33398
- *
33399
- * ```javascript
33400
- * decamelize('innerHTML'); // 'inner_html'
33401
- * decamelize('action_name'); // 'action_name'
33402
- * decamelize('css-class-name'); // 'css-class-name'
33403
- * decamelize('my favorite items'); // 'my favorite items'
33404
- * ```
33405
- * @method decamelize
33406
- * @param str The string to decamelize.
33407
- * @return the decamelized string.
33408
- */
33409
- function decamelize(str) {
33410
- return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase();
33411
- }
33412
- /**
33413
- * Replaces underscores, spaces, or camelCase with dashes.
33414
- * ```javascript
33415
- * dasherize('innerHTML'); // 'inner-html'
33416
- * dasherize('action_name'); // 'action-name'
33417
- * dasherize('css-class-name'); // 'css-class-name'
33418
- * dasherize('my favorite items'); // 'my-favorite-items'
33419
- * ```
33420
- * @method dasherize
33421
- * @param str The string to dasherize.
33422
- * @return the dasherized string.
33423
- */
33424
- function dasherize(str) {
33425
- return decamelize(str).replace(STRING_DASHERIZE_REGEXP, '-');
33426
- }
33427
- /**
33428
- * Returns the lowerCamelCase form of a string.
33429
- * ```javascript
33430
- * camelize('innerHTML'); // 'innerHTML'
33431
- * camelize('action_name'); // 'actionName'
33432
- * camelize('css-class-name'); // 'cssClassName'
33433
- * camelize('my favorite items'); // 'myFavoriteItems'
33434
- * camelize('My Favorite Items'); // 'myFavoriteItems'
33435
- * ```
33436
- * @method camelize
33437
- * @param str The string to camelize.
33438
- * @return the camelized string.
33439
- */
33440
- function camelize(str) {
33441
- return str
33442
- .replace(STRING_CAMELIZE_REGEXP, (_match, _separator, chr) => {
33443
- return chr ? chr.toUpperCase() : '';
33444
- })
33445
- .replace(/^([A-Z])/, (match) => match.toLowerCase());
33446
- }
33447
- /**
33448
- * Returns the UpperCamelCase form of a string.
33449
- * ```javascript
33450
- * 'innerHTML'.classify(); // 'InnerHTML'
33451
- * 'action_name'.classify(); // 'ActionName'
33452
- * 'css-class-name'.classify(); // 'CssClassName'
33453
- * 'my favorite items'.classify(); // 'MyFavoriteItems'
33454
- * ```
33455
- * @method classify
33456
- * @param str the string to classify
33457
- * @return the classified string
33458
- */
33459
- function classify(str) {
33460
- return str.split('.').map(part => capitalize(camelize(part))).join('.');
33461
- }
33462
- /**
33463
- * More general than decamelize. Returns the lower\_case\_and\_underscored
33464
- * form of a string.
33465
- * ```javascript
33466
- * 'innerHTML'.underscore(); // 'inner_html'
33467
- * 'action_name'.underscore(); // 'action_name'
33468
- * 'css-class-name'.underscore(); // 'css_class_name'
33469
- * 'my favorite items'.underscore(); // 'my_favorite_items'
33470
- * ```
33471
- * @method underscore
33472
- * @param str The string to underscore.
33473
- * @return the underscored string.
33474
- */
33475
- function underscore(str) {
33476
- return str
33477
- .replace(STRING_UNDERSCORE_REGEXP_1, '$1_$2')
33478
- .replace(STRING_UNDERSCORE_REGEXP_2, '_')
33479
- .toLowerCase();
33480
- }
33481
- /**
33482
- * Returns the Capitalized form of a string
33483
- * ```javascript
33484
- * 'innerHTML'.capitalize() // 'InnerHTML'
33485
- * 'action_name'.capitalize() // 'Action_name'
33486
- * 'css-class-name'.capitalize() // 'Css-class-name'
33487
- * 'my favorite items'.capitalize() // 'My favorite items'
33488
- * ```
33489
- * @method capitalize
33490
- * @param str The string to capitalize.
33491
- * @return The capitalized string.
33492
- */
33493
- function capitalize(str) {
33494
- return str.charAt(0).toUpperCase() + str.substr(1);
33495
- }
33496
- /**
33497
- * Calculate the levenshtein distance of two strings.
33498
- * See https://en.wikipedia.org/wiki/Levenshtein_distance.
33499
- * Based off https://gist.github.com/andrei-m/982927 (for using the faster dynamic programming
33500
- * version).
33501
- *
33502
- * @param a String a.
33503
- * @param b String b.
33504
- * @returns A number that represents the distance between the two strings. The greater the number
33505
- * the more distant the strings are from each others.
33506
- */
33507
- function levenshtein(a, b) {
33508
- if (a.length === 0) {
33509
- return b.length;
33510
- }
33511
- if (b.length === 0) {
33512
- return a.length;
33513
- }
33514
- const matrix = [];
33515
- // increment along the first column of each row
33516
- for (let i = 0; i <= b.length; i++) {
33517
- matrix[i] = [i];
33518
- }
33519
- // increment each column in the first row
33520
- for (let j = 0; j <= a.length; j++) {
33521
- matrix[0][j] = j;
33522
- }
33523
- // Fill in the rest of the matrix
33524
- for (let i = 1; i <= b.length; i++) {
33525
- for (let j = 1; j <= a.length; j++) {
33526
- if (b.charAt(i - 1) === a.charAt(j - 1)) {
33527
- matrix[i][j] = matrix[i - 1][j - 1];
33528
- }
33529
- else {
33530
- matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
33531
- matrix[i][j - 1] + 1, // insertion
33532
- matrix[i - 1][j] + 1);
33533
- }
33534
- }
33535
- }
33536
- return matrix[b.length][a.length];
33537
- }
33538
-
33539
- class ViewClassInfo extends ImportToAdd {
33540
- constructor(path, viewType, customComponentName) {
33541
- super('', '');
33542
- if (!customComponentName) {
33543
- this.prefix = ViewClassInfo.convertPathToClassNamePrefix(path);
33544
- const classSuffix = ViewClassInfo.resolveClassSuffixForView(viewType);
33545
- this.nameWithoutComponent = `${classify(this.prefix)}${classSuffix}`;
33546
- this.fileImportPath = `./views/${path}/${this.prefix}-${dasherize(classSuffix)}.component`;
33547
- }
33548
- else {
33549
- this.prefix = '';
33550
- this.nameWithoutComponent = classify(customComponentName);
33551
- this.fileImportPath = `./views/${path}/${dasherize(customComponentName)}.component`;
33552
- }
33553
- this.className = `${this.nameWithoutComponent}Component`;
33554
- }
33555
- static convertPathToClassNamePrefix(path) {
33556
- const regexDash = /-/g;
33557
- return path.replace(regexDash, '_').replace(/\//g, '-').toLocaleLowerCase();
33558
- }
33559
- static resolveClassSuffixForView(view) {
33560
- switch (view) {
33561
- case 'login':
33562
- return 'Login';
33563
- case 'tabView':
33564
- return 'TabView';
33565
- case 'taskView':
33566
- return 'TaskView';
33567
- case 'caseView':
33568
- return 'CaseView';
33569
- case 'emptyView':
33570
- return 'EmptyView';
33571
- case 'sidenavView':
33572
- return 'SidenavView';
33573
- case 'doubleDrawerView':
33574
- return 'DoubleDrawerView';
33575
- case 'toolbarView':
33576
- return 'ToolbarView';
33577
- case 'sidenavAndToolbarView':
33578
- return 'SidenavAndToolbarView';
33579
- case 'groupView':
33580
- return 'GroupView';
33581
- case 'dashboard':
33582
- return 'Dashboard';
33583
- case 'treeCaseView':
33584
- return 'TreeCaseView';
33585
- case 'workflowView':
33586
- return 'WorkflowView';
33587
- case 'roleAssignmentView':
33588
- return 'RoleAssignmentView';
33589
- case 'ldapRoleAssignmentView':
33590
- return 'LdapRoleAssignmentView';
33591
- default:
33592
- throw new Error(`Unknown view type '${view}'`);
33593
- }
33594
- }
33595
- }
33596
-
33597
- const NAE_ROUTING_CONFIGURATION_PATH = "configPath";
33598
- /**
33599
- * Uses the information from nae.json to construct the application's routing
33600
- */
33601
- class RoutingBuilderService {
33602
- constructor(router, _configService, _viewService, _logger, _dynamicNavigationRouteService, _groupNavigationComponentResolverComponent) {
33603
- this._configService = _configService;
33604
- this._viewService = _viewService;
33605
- this._logger = _logger;
33606
- this._dynamicNavigationRouteService = _dynamicNavigationRouteService;
33607
- this._groupNavigationComponentResolverComponent = _groupNavigationComponentResolverComponent;
33608
- this._groupNavigationRouteGenerated = false;
33609
- router.relativeLinkResolution = 'legacy';
33610
- router.config.splice(0, router.config.length);
33611
- for (const [pathSegment, view] of Object.entries(_configService.get().views)) {
33612
- const route = this.constructRouteObject(view, pathSegment);
33613
- if (route !== undefined) {
33614
- router.config.push(route);
33615
- }
33616
- }
33617
- router.config.push(...this.defaultRoutesRedirects());
33618
- }
33619
- constructRouteObject(view, configPath, ancestors = []) {
33620
- var _a, _b;
33621
- const component = this.resolveComponentClass(view, configPath);
33622
- if (component === undefined) {
33623
- return undefined;
33624
- }
33625
- if (!view.routing) {
33626
- this._logger.warn(`nae.json configuration is invalid. View at path '${configPath}'` +
33627
- ` must define a 'routing' attribute. Skipping this view for routing generation.`);
33628
- return undefined;
33629
- }
33630
- const route = {
33631
- path: view.routing.path,
33632
- data: {
33633
- [NAE_ROUTING_CONFIGURATION_PATH]: configPath
33634
- },
33635
- component
33636
- };
33637
- if (((_a = view === null || view === void 0 ? void 0 : view.layout) === null || _a === void 0 ? void 0 : _a.name) === GroupNavigationConstants.GROUP_NAVIGATION_OUTLET) {
33638
- if (this._groupNavigationRouteGenerated) {
33639
- this._logger.warn(`Multiple groupNavigationOutlets are present in nae.json. Duplicate entry found at path ${configPath}`);
33640
- }
33641
- else {
33642
- this._logger.debug(`GroupNavigationOutlet found in nae.json at path '${configPath}'`);
33643
- }
33644
- const pathNoParams = route.path;
33645
- route.path = `${pathNoParams}/:${GroupNavigationConstants.GROUP_NAVIGATION_ROUTER_PARAM}`;
33646
- route.canActivate = [AuthenticationGuardService];
33647
- const parentPathSegments = ancestors.map(a => a.path);
33648
- parentPathSegments.push(pathNoParams);
33649
- this._dynamicNavigationRouteService.route = parentPathSegments.join('/');
33650
- this._groupNavigationRouteGenerated = true;
33651
- return route;
33652
- }
33653
- if (view.routing.match !== undefined && view.routing.match) {
33654
- route['pathMatch'] = 'full';
33655
- }
33656
- route['canActivate'] = [];
33657
- if (view.access === 'private'
33658
- || view.access.hasOwnProperty('role')
33659
- || view.access.hasOwnProperty('group')
33660
- || view.access.hasOwnProperty('authority')) {
33661
- route['canActivate'].push(AuthenticationGuardService);
33662
- }
33663
- if (view.access.hasOwnProperty('role')) {
33664
- route['canActivate'].push(RoleGuardService);
33665
- }
33666
- if (view.access.hasOwnProperty('authority')) {
33667
- route['canActivate'].push(AuthorityGuardService);
33668
- }
33669
- if (view.access.hasOwnProperty('group')) {
33670
- route['canActivate'].push(GroupGuardService);
33671
- }
33672
- if (!!view.children) {
33673
- route['children'] = [];
33674
- Object.entries(view.children).forEach(([configPathSegment, childView]) => {
33675
- // TODO check if routes are constructed correctly regarding empty route segments
33676
- const childRoute = this.constructRouteObject(childView, `${configPath}/${configPathSegment}`, [...ancestors, route]);
33677
- if (childRoute !== undefined) {
33678
- route['children'].push(childRoute);
33679
- }
33680
- });
33681
- }
33682
- if (((_b = view === null || view === void 0 ? void 0 : view.layout) === null || _b === void 0 ? void 0 : _b.name) === 'tabView') {
33683
- if (!view.children) {
33684
- route['children'] = [];
33685
- }
33686
- route['children'].push({
33687
- path: '**',
33688
- component
33689
- });
33690
- }
33691
- return route;
33692
- }
33693
- resolveComponentClass(view, configPath) {
33694
- let result;
33695
- if (!!view.component) {
33696
- result = this._viewService.resolveNameToClass(view.component.class);
33697
- }
33698
- else if (!!view.layout) {
33699
- result = this.resolveComponentClassFromLayout(view, configPath);
33700
- }
33701
- else {
33702
- this._logger.warn(`nae.json configuration is invalid. View at path '${configPath}'` +
33703
- ` must define either a 'layout' or a 'component' attribute. Skipping this view for routing generation.`);
33704
- return undefined;
33705
- }
33706
- if (result === undefined) {
33707
- this._logger.warn(`Some views from nae.json configuration have not been created in the project.` +
33708
- ` Run create-view schematic to rectify this. Skipping this view for routing generation.`);
33709
- return undefined;
33710
- }
33711
- return result;
33712
- }
33713
- resolveComponentClassFromLayout(view, configPath) {
33714
- if (view.layout.name === GroupNavigationConstants.GROUP_NAVIGATION_OUTLET) {
33715
- return this._groupNavigationComponentResolverComponent;
33716
- }
33717
- const className = RoutingBuilderService.parseClassNameFromView(view, configPath);
33718
- return this._viewService.resolveNameToClass(className);
33719
- }
33720
- static parseClassNameFromView(view, configPath) {
33721
- if (!!view.layout.componentName) {
33722
- return `${classify(view.layout.componentName)}Component`;
33723
- }
33724
- else {
33725
- const classInfo = new ViewClassInfo(configPath, view.layout.name, view.layout.componentName);
33726
- return classInfo.className;
33727
- }
33728
- }
33729
- defaultRoutesRedirects() {
33730
- const result = [];
33731
- const servicesConfig = this._configService.getServicesConfiguration();
33732
- if (!!servicesConfig && !!servicesConfig.routing) {
33733
- if (!!servicesConfig.routing.defaultRedirect) {
33734
- result.push({
33735
- path: '',
33736
- redirectTo: servicesConfig.routing.defaultRedirect,
33737
- pathMatch: 'full'
33738
- });
33739
- }
33740
- if (!!servicesConfig.routing.wildcardRedirect) {
33741
- result.push({
33742
- path: '**',
33743
- redirectTo: servicesConfig.routing.wildcardRedirect
33744
- });
33745
- }
33746
- }
33747
- return result;
33748
- }
33749
- }
33750
- 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 });
33751
- RoutingBuilderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RoutingBuilderService, providedIn: 'root' });
33752
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: RoutingBuilderService, decorators: [{
33753
- type: Injectable,
33754
- args: [{
33755
- providedIn: 'root'
33756
- }]
33757
- }], ctorParameters: function () {
33758
- return [{ type: i2$3.Router }, { type: ConfigurationService }, { type: ViewService }, { type: LoggerService }, { type: DynamicNavigationRouteProviderService }, { type: i0.Type, decorators: [{
33759
- type: Optional
33760
- }, {
33761
- type: Inject,
33762
- args: [NAE_GROUP_NAVIGATION_COMPONENT_RESOLVER_COMPONENT]
33763
- }] }];
33764
- } });
33765
-
33766
33804
  /* SERVICES */
33767
33805
 
33768
33806
  /**