Skip to content

Commit 72bfeb0

Browse files
committed
[NAE-1690] Fix header responsive overflow mode
- sort constructor
1 parent 5cc9f07 commit 72bfeb0

File tree

6 files changed

+50
-39
lines changed

6 files changed

+50
-39
lines changed

projects/netgrif-components-core/src/lib/panel/abstract/panel-with-header-binding.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import {Component, OnDestroy, OnInit} from '@angular/core';
1+
import {Component, OnDestroy, OnInit, Optional} from '@angular/core';
22
import {Observable, Subscription} from 'rxjs';
33
import {HeaderColumn, HeaderColumnType} from '../../header/models/header-column';
44
import {FeaturedValue} from './featured-value';
5+
import {OverflowService} from '../../header/services/overflow.service';
56

67
@Component({
78
selector: 'ncc-abstract-panel-with-header-binding',
@@ -14,7 +15,15 @@ export abstract class AbstractPanelWithHeaderBindingComponent implements OnInit,
1415
protected _lastSelectedHeaders: Array<HeaderColumn>;
1516
protected sub: Subscription;
1617

17-
protected constructor() {
18+
protected constructor(@Optional() protected _overflowService: OverflowService) {
19+
}
20+
21+
get overflowMode(): boolean {
22+
if(!!this._overflowService){
23+
return this._overflowService.overflowMode;
24+
} else {
25+
return false;
26+
}
1827
}
1928

2029
ngOnInit(): void {

projects/netgrif-components-core/src/lib/panel/abstract/panel-with-immediate-data.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,7 @@ export abstract class AbstractPanelWithImmediateDataComponent extends AbstractPa
1616
protected constructor(protected _translate: TranslateService,
1717
protected _currencyPipe: CurrencyPipe,
1818
@Optional() protected _overflowService: OverflowService) {
19-
super();
20-
}
21-
22-
get overflowMode(): boolean {
23-
if(!!this._overflowService){
24-
return this._overflowService.overflowMode;
25-
} else {
26-
return false;
27-
}
19+
super(_overflowService);
2820
}
2921

3022
ngOnDestroy(): void {

projects/netgrif-components-core/src/lib/panel/case-panel/abstract-case-panel.component.spec.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ describe('AbstractCasePanelComponent', () => {
6363
{provide: AuthenticationMethodService, useClass: MockAuthenticationMethodService},
6464
{provide: AuthenticationService, useClass: MockAuthenticationService},
6565
SignUpService,
66-
{provide: AllowedNetsService, useFactory: TestCaseViewAllowedNetsFactory, deps: [AllowedNetsServiceFactory]}
66+
{
67+
provide: AllowedNetsService,
68+
useFactory: TestCaseViewAllowedNetsFactory,
69+
deps: [AllowedNetsServiceFactory]
70+
}
6771
],
6872
declarations: [
6973
TestCasePanelComponent,
@@ -101,13 +105,17 @@ describe('AbstractCasePanelComponent', () => {
101105
template: ''
102106
})
103107
class TestCasePanelComponent extends AbstractCasePanelComponent {
104-
constructor(protected _caseResourceService: CaseResourceService, protected _caseViewService: CaseViewService,
105-
protected _snackBarService: SnackBarService, protected _translateService: TranslateService,
106-
protected _log: LoggerService, @Optional() protected overflowService: OverflowService,
107-
protected _userService: UserService, protected _currencyPipe: CurrencyPipe,
108-
protected _permissionService: PermissionService) {
109-
super(_caseResourceService, _caseViewService, _snackBarService, _translateService, _log, overflowService,
110-
_userService, _currencyPipe, _permissionService);
108+
constructor(protected _caseResourceService: CaseResourceService,
109+
protected _caseViewService: CaseViewService,
110+
protected _snackBarService: SnackBarService,
111+
protected _translateService: TranslateService,
112+
protected _log: LoggerService,
113+
protected _userService: UserService,
114+
protected _currencyPipe: CurrencyPipe,
115+
protected _permissionService: PermissionService,
116+
@Optional() protected overflowService: OverflowService) {
117+
super(_caseResourceService, _caseViewService, _snackBarService, _translateService, _log,
118+
_userService, _currencyPipe, _permissionService, overflowService,);
111119
}
112120
}
113121

@@ -116,7 +124,7 @@ class TestCasePanelComponent extends AbstractCasePanelComponent {
116124
template: '<ncc-test-case-panel [selectedHeaders$]="selectedHeaders" [case_]="case_"> </ncc-test-case-panel>'
117125
})
118126
class TestWrapperComponent {
119-
selectedHeaders = of([
127+
selectedHeaders = of([
120128
new HeaderColumn(HeaderColumnType.META, CaseMetaField.VISUAL_ID, 'string', 'string'),
121129
new HeaderColumn(HeaderColumnType.META, CaseMetaField.AUTHOR, 'string', 'string'),
122130
new HeaderColumn(HeaderColumnType.META, CaseMetaField.TITLE, 'string', 'string'),
@@ -155,7 +163,7 @@ class TestWrapperComponent {
155163
{stringId: 'date', title: 'string', type: 'date', value: [2020, 1, 1, 10, 10]},
156164
{stringId: 'string', title: 'string', type: 'string', value: 'dasdsadsad'},
157165
{stringId: 'dateTime', title: 'string', type: 'dateTime', value: [2020, 1, 1, 10, 10]},
158-
{stringId: 'enum', title: 'string', type: 'enumeration', value: { defaultValue: 'dasd'}},
166+
{stringId: 'enum', title: 'string', type: 'enumeration', value: {defaultValue: 'dasd'}},
159167
]
160168
};
161169
}

projects/netgrif-components-core/src/lib/panel/case-panel/abstract-case-panel.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ export abstract class AbstractCasePanelComponent extends AbstractPanelWithImmedi
4141
protected _snackBarService: SnackBarService,
4242
protected _translateService: TranslateService,
4343
protected _log: LoggerService,
44-
@Optional() protected _overflowService: OverflowService,
4544
protected _userService: UserService,
4645
protected _currencyPipe: CurrencyPipe,
47-
protected _permissionService: PermissionService) {
46+
protected _permissionService: PermissionService,
47+
@Optional() protected _overflowService: OverflowService,) {
4848
super(_translateService, _currencyPipe, _overflowService);
4949
}
5050

projects/netgrif-components-core/src/lib/panel/workflow-panel/abstract-workflow-panel.component.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export abstract class AbstractWorkflowPanelComponent extends AbstractPanelWithHe
5050
protected _translate: TranslateService,
5151
protected _workflowService: WorkflowViewService,
5252
@Optional() protected _overflowService: OverflowService) {
53-
super();
53+
super(_overflowService);
5454

5555
this._subscription = _translate.onLangChange.subscribe((event: TranslationChangeEvent) => {
5656
this.panelContent.netIdentifier.title = this._translate.instant(this.TRANSLATION_NET);
@@ -83,14 +83,6 @@ export abstract class AbstractWorkflowPanelComponent extends AbstractPanelWithHe
8383
this.panelRef = panelRef;
8484
}
8585

86-
get overflowMode(): boolean {
87-
if(this._overflowService !== null){
88-
return this._overflowService.overflowMode;
89-
} else {
90-
return false;
91-
}
92-
}
93-
9486
/**
9587
* Handles the logic that should be executed when the "delete workflow" button is clicked.
9688
*
Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import {Component, Optional} from '@angular/core';
2-
import {AbstractCasePanelComponent, CaseViewService, LoggerService, OverflowService, UserService} from '@netgrif/components-core';
2+
import {
3+
AbstractCasePanelComponent,
4+
CaseViewService,
5+
LoggerService,
6+
OverflowService,
7+
UserService
8+
} from '@netgrif/components-core';
39
import {CaseResourceService, PermissionService} from '@netgrif/components-core';
410
import {SnackBarService} from '@netgrif/components-core';
511
import {TranslateService} from '@ngx-translate/core';
@@ -11,12 +17,16 @@ import {CurrencyPipe} from '@angular/common';
1117
styleUrls: ['./case-panel.component.scss']
1218
})
1319
export class CasePanelComponent extends AbstractCasePanelComponent {
14-
constructor(protected _caseResourceService: CaseResourceService, protected _caseViewService: CaseViewService,
15-
protected _snackBarService: SnackBarService, protected _translateService: TranslateService,
16-
protected _log: LoggerService, @Optional() protected _overflowService: OverflowService,
17-
protected _userService: UserService, protected _currencyPipe: CurrencyPipe,
18-
public _permissionService: PermissionService) {
20+
constructor(protected _caseResourceService: CaseResourceService,
21+
protected _caseViewService: CaseViewService,
22+
protected _snackBarService: SnackBarService,
23+
protected _translateService: TranslateService,
24+
protected _log: LoggerService,
25+
protected _userService: UserService,
26+
protected _currencyPipe: CurrencyPipe,
27+
public _permissionService: PermissionService,
28+
@Optional() protected _overflowService: OverflowService) {
1929
super(_caseResourceService, _caseViewService, _snackBarService,
20-
_translateService, _log, _overflowService, _userService, _currencyPipe, _permissionService);
30+
_translateService, _log, _userService, _currencyPipe, _permissionService, _overflowService);
2131
}
2232
}

0 commit comments

Comments
 (0)