Skip to content

Commit 5a08eab

Browse files
authored
Merge pull request #277 from netgrif/release/6.4.1
Release/6.4.1
2 parents 178c8d4 + 50a2f3d commit 5a08eab

File tree

21 files changed

+167
-66
lines changed

21 files changed

+167
-66
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
66
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
Full Changelog: [https://github.com/netgrif/components/commits/v6.4.0](https://github.com/netgrif/components/commits/v6.4.0)
8+
Full Changelog: [https://github.com/netgrif/components/commits/v6.4.1](https://github.com/netgrif/components/commits/v6.4.1)
9+
10+
## [6.4.1](https://github.com/netgrif/components/releases/tag/v6.4.1) (2025-03-19)
11+
12+
### Fixed
13+
- [NAE-2031] Dashboard bug fix
14+
15+
### Changed
16+
- [NAE-2047] Fulltext search and advanced search usability with multichoice caseRef
17+
- [NAE-2048] Apply saved filter of advanced search in caseRef field
918

1019
## [6.4.0](https://github.com/netgrif/components/releases/tag/v6.4.0) (2024-12-24)
1120

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netgrif/components-project",
3-
"version": "6.4.0",
3+
"version": "6.4.1",
44
"description": "Netgrif Application Engine Frontend project. Project includes angular libraries as base for NAE applications.",
55
"homepage": "https://components.netgrif.com",
66
"license": "SEE LICENSE IN LICENSE",

projects/nae-example-app/src/app/doc/case-view/case-view.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import {
1313
defaultCaseSearchCategoriesFactory,
1414
NAE_BASE_FILTER,
1515
AllowedNetsServiceFactory,
16-
AllowedNetsService, UserFilterConstants, TaskSetDataRequestFields
16+
AllowedNetsService,
17+
UserFilterConstants,
18+
TaskSetDataRequestFields
1719
} from '@netgrif/components-core';
1820
import {HeaderComponent} from '@netgrif/components';
1921

projects/netgrif-components-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netgrif/components-core",
3-
"version": "6.4.0",
3+
"version": "6.4.1",
44
"description": "Netgrif Application engine frontend core Angular library",
55
"homepage": "https://components.netgrif.com",
66
"license": "SEE LICENSE IN LICENSE",

projects/netgrif-components-core/src/lib/data-fields/case-ref-field/model/abstract-case-ref-base-field-component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export abstract class AbstractCaseRefBaseFieldComponent<T extends DataField<unkn
3232
}
3333
let providers = [
3434
{
35-
provide: NAE_DEFAULT_HEADERS, useValue: this.dataField.component?.properties?.headers.split(',')
35+
provide: NAE_DEFAULT_HEADERS, useValue: this.dataField.component?.properties?.headers?.split(',')
3636
},
3737
{
3838
provide: NAE_CASE_REF_CREATE_CASE, useValue: this.dataField.component?.properties?.createCase === 'true'

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {HttpClientTestingModule} from '@angular/common/http/testing';
44
import {MatIconModule} from '@angular/material/icon';
55
import {BrowserDynamicTestingModule} from '@angular/platform-browser-dynamic/testing';
66
import {MockAuthenticationMethodService} from '../utility/tests/mocks/mock-authentication-method-service';
7-
import {Component, Injector, Optional} from '@angular/core';
7+
import {Component, Inject, Injector, Optional} from '@angular/core';
88
import {AbstractHeaderComponent} from './abstract-header.component';
99
import {TranslateLibModule} from '../translate/translate-lib.module';
1010
import {RouterTestingModule} from '@angular/router/testing';
@@ -29,6 +29,13 @@ import {OverflowService} from './services/overflow.service';
2929
import {AllowedNetsService} from '../allowed-nets/services/allowed-nets.service';
3030
import {TestNoAllowedNetsFactory} from '../utility/tests/test-factory-methods';
3131
import {AllowedNetsServiceFactory} from '../allowed-nets/services/factory/allowed-nets-service-factory';
32+
import {CaseViewService} from "../view/case-view/service/case-view-service";
33+
import {
34+
DATA_FIELD_PORTAL_DATA,
35+
DataFieldPortalData
36+
} from "../data-fields/models/data-field-portal-data-injection-token";
37+
import {MultichoiceField} from "../data-fields/multichoice-field/models/multichoice-field";
38+
import {EnumerationField} from "../data-fields/enumeration-field/models/enumeration-field";
3239

3340
describe('AbstractHeaderComponent', () => {
3441
let component: TestHeaderComponent;
@@ -89,7 +96,9 @@ describe('AbstractHeaderComponent', () => {
8996
class TestHeaderComponent extends AbstractHeaderComponent {
9097
constructor(protected _injector: Injector,
9198
protected _translate: TranslateService,
92-
@Optional() protected _overflowService: OverflowService) {
93-
super(_injector, _translate, _overflowService);
99+
@Optional() protected _overflowService: OverflowService,
100+
@Optional() protected _caseViewService: CaseViewService,
101+
@Optional() @Inject(DATA_FIELD_PORTAL_DATA) protected _dataFieldPortalData: DataFieldPortalData<MultichoiceField | EnumerationField>) {
102+
super(_injector, _translate, _overflowService, _caseViewService, _dataFieldPortalData);
94103
}
95104
}

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

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, Injector, Input, OnDestroy, OnInit, Optional} from '@angular/core';
1+
import {Component, Inject, Injector, Input, OnDestroy, OnInit, Optional} from '@angular/core';
22
import {AbstractHeaderService} from './abstract-header-service';
33
import {CaseHeaderService} from './case-header/case-header.service';
44
import {TaskHeaderService} from './task-header/task-header.service';
@@ -12,6 +12,13 @@ import {OverflowService} from './services/overflow.service';
1212
import {stopPropagation} from '../utility/stop-propagation';
1313
import {Subscription} from 'rxjs';
1414
import {debounceTime} from "rxjs/operators";
15+
import {CaseViewService} from "../view/case-view/service/case-view-service";
16+
import {
17+
DATA_FIELD_PORTAL_DATA,
18+
DataFieldPortalData
19+
} from "../data-fields/models/data-field-portal-data-injection-token";
20+
import {MultichoiceField} from "../data-fields/multichoice-field/models/multichoice-field";
21+
import {EnumerationField} from "../data-fields/enumeration-field/models/enumeration-field";
1522

1623
@Component({
1724
selector: 'ncc-abstract-header',
@@ -45,11 +52,16 @@ export abstract class AbstractHeaderComponent implements OnInit, OnDestroy {
4552
protected _initHeaderCount: number = undefined;
4653
protected _initResponsiveHeaders: boolean = undefined;
4754
protected _approvalFormControl: FormControl;
55+
protected _changeValue: boolean;
56+
protected _subCases: Subscription;
4857

4958
constructor(protected _injector: Injector,
5059
protected _translate: TranslateService,
51-
@Optional() protected _overflowService: OverflowService) {
60+
@Optional() protected _overflowService: OverflowService,
61+
@Optional() protected _caseViewService: CaseViewService,
62+
@Optional() @Inject(DATA_FIELD_PORTAL_DATA) protected _dataFieldPortalData: DataFieldPortalData<MultichoiceField | EnumerationField>) {
5263
this.initializeFormControls(this._overflowService !== null);
64+
this._changeValue = true;
5365
}
5466

5567
@Input()
@@ -93,6 +105,7 @@ export abstract class AbstractHeaderComponent implements OnInit, OnDestroy {
93105
this.headerService.responsiveHeaders = this._initResponsiveHeaders;
94106
}
95107
this.headerService.preferenceColumnCount$.subscribe(value => this.columnCountControl.setValue(value));
108+
this.resolveApprovalDatafields();
96109
}
97110

98111
ngOnDestroy(): void {
@@ -101,6 +114,9 @@ export abstract class AbstractHeaderComponent implements OnInit, OnDestroy {
101114
this.subColumnCountControl.unsubscribe();
102115
this.subOverflowControl.unsubscribe();
103116
}
117+
if (this._subCases) {
118+
this._subCases.unsubscribe();
119+
}
104120
}
105121

106122
/**
@@ -199,4 +215,54 @@ export abstract class AbstractHeaderComponent implements OnInit, OnDestroy {
199215
}
200216
});
201217
}
218+
219+
public indeterminate() {
220+
if (this._caseViewService) {
221+
return this._dataFieldPortalData?.dataField?.value?.length > 0 &&
222+
this._caseViewService.cases.some(value => this._dataFieldPortalData?.dataField.value.includes(value.stringId)) &&
223+
!this.resolveApprovalValue();
224+
}
225+
return this._dataFieldPortalData?.dataField?.value?.length > 0 &&
226+
this._dataFieldPortalData?.dataField?.value?.length < this._dataFieldPortalData?.dataField?.choices?.length;
227+
}
228+
229+
public typeApproval() {
230+
return this._dataFieldPortalData?.dataField instanceof MultichoiceField ? 'multichoice' : 'enumeration';
231+
}
232+
233+
protected resolveApprovalDatafields() {
234+
if (this._dataFieldPortalData !== null && this._dataFieldPortalData.dataField instanceof MultichoiceField && this._caseViewService) {
235+
this.approvalFormControl.setValue(this.resolveApprovalValue());
236+
this.approvalFormControl.valueChanges.subscribe(value => {
237+
if (this._changeValue) {
238+
if (value) {
239+
this._dataFieldPortalData.dataField.value = this._caseViewService.cases.map(caze => caze.stringId);
240+
} else {
241+
this._dataFieldPortalData.dataField.value = [];
242+
}
243+
}
244+
this._changeValue = true;
245+
})
246+
this._dataFieldPortalData.dataField.valueChanges().subscribe(() => {
247+
this._changeValue = false;
248+
this.approvalFormControl.setValue(this.resolveApprovalValue());
249+
})
250+
this._subCases = this._caseViewService.cases$.subscribe(() => {
251+
this._changeValue = false;
252+
this.approvalFormControl.setValue(this.resolveApprovalValue());
253+
})
254+
}
255+
if (this._dataFieldPortalData !== null && this._dataFieldPortalData.dataField instanceof EnumerationField) {
256+
this.approvalFormControl.valueChanges.subscribe(value => {
257+
this._dataFieldPortalData.dataField.value = null;
258+
})
259+
}
260+
}
261+
262+
protected resolveApprovalValue() {
263+
if (this._caseViewService.cases.length === 0) {
264+
return false;
265+
}
266+
return this._caseViewService.cases.every(value => this._dataFieldPortalData?.dataField.value.includes(value.stringId));
267+
}
202268
}

projects/netgrif-components-core/src/lib/navigation/utility/filter-extraction.service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class FilterExtractionService {
5858
return this.extractCompleteFilterFromData(dataSection.slice(taskRefIndex.dataGroupIndex + 1));
5959
}
6060

61-
public extractCompleteFilterFromData(dataSection: Array<DataGroup>, fieldId: string = UserFilterConstants.FILTER_FIELD_ID): Filter | undefined {
61+
public extractCompleteFilterFromData(dataSection?: Array<DataGroup>, filterData?: Filter, fieldId: string = UserFilterConstants.FILTER_FIELD_ID): Filter | undefined {
6262
const filterIndex = getFieldIndexFromDataGroups(dataSection, fieldId);
6363

6464
if (filterIndex === undefined) {
@@ -74,7 +74,11 @@ export class FilterExtractionService {
7474
throw new Error('Filter segment could not be extracted from filter field');
7575
}
7676

77-
const parentFilter = this.extractCompleteFilterFromData(dataSection.slice(filterIndex.dataGroupIndex + 1));
77+
if (!!filterData) {
78+
filterSegment = filterSegment.merge(filterData, MergeOperator.AND);
79+
}
80+
81+
const parentFilter = this.extractCompleteFilterFromData(dataSection.slice(filterIndex.dataGroupIndex + 1), filterData);
7882

7983
if (parentFilter !== undefined && parentFilter.type === filterSegment.type) {
8084
return filterSegment.merge(parentFilter, MergeOperator.AND);

projects/netgrif-components-core/src/lib/panel/task-panel-list/task-panel-list-pagination/abstract-task-list-pagination.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export abstract class AbstractTaskListPaginationComponent extends AbstractDefaul
1818
public length: number;
1919
public pageSize = 20;
2020
public pageIndex = 0;
21-
public pageSizeOptions: Array<number> = [10, 20, 50];
21+
public pageSizeOptions: Array<number> = [10, 20, 50, 100];
2222

2323
@Input() public disabled: boolean;
2424
@Input()

projects/netgrif-components-core/src/lib/search/search-service/search.service.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,14 @@ export class SearchService implements OnDestroy {
304304
}
305305
}
306306

307+
/**
308+
* Loads whole new filter and search cases/tasks based on this filter
309+
* @param newFilter whole new filter that should be used for search
310+
*/
311+
public updateWithFullFilter(newFilter: Filter): void {
312+
this._activeFilter.next(newFilter);
313+
}
314+
307315
/**
308316
* @returns `undefined` if the predicate tree contains no complete query.
309317
* Otherwise returns the serialized form of the completed queries in the predicate tree.
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import {BaseFilter} from '../search/models/base-filter';
2-
import {NAE_NAVIGATION_ITEM_TASK_DATA} from '../navigation/model/filter-case-injection-token';
32
import {DataGroup} from '../resources/interface/data-groups';
3+
import {NAE_NAVIGATION_ITEM_TASK_DATA} from '../navigation/model/filter-case-injection-token';
44
import {FilterExtractionService} from '../navigation/utility/filter-extraction.service';
5+
import {Filter} from '../filter/models/filter';
56

67
/**
78
* Converts an {@link NAE_NAVIGATION_ITEM_TASK_DATA} injection token into {@link NAE_BASE_FILTER}
89
* @param extractionService
910
* @param navigationItemTaskData a navigation item task containing the aggregated data representing a navigation item
1011
*/
1112
export function navigationItemTaskFilterFactory(extractionService: FilterExtractionService,
12-
navigationItemTaskData: Array<DataGroup>): BaseFilter {
13+
navigationItemTaskData: Array<DataGroup>,
14+
filterData?: Filter): BaseFilter {
1315
return {
14-
filter: extractionService.extractCompleteFilterFromData(navigationItemTaskData)
16+
filter: extractionService.extractCompleteFilterFromData(navigationItemTaskData, filterData)
1517
};
1618
}

projects/netgrif-components-core/src/lib/view/case-view/components/case-list-paginator/abstract-case-list-paginator.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export abstract class AbstractCaseListPaginatorComponent extends AbstractDefault
1717
public length: number;
1818
public pageSize = 20;
1919
public pageIndex = 0;
20-
public pageSizeOptions: number[] = [10, 20, 50];
20+
public pageSizeOptions: number[] = [10, 20, 50, 100];
2121
@Input() public approval: boolean;
2222
@Input() public disabled: boolean;
2323

projects/netgrif-components-core/src/lib/view/case-view/service/case-view-service.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export class CaseViewService extends AbstractSortableViewComponent implements On
4747

4848
protected _loading$: LoadingWithFilterEmitter;
4949
protected _cases$: Observable<Array<Case>>;
50+
protected _cases: Array<Case>;
5051
protected _nextPage$: BehaviorSubject<PageLoadRequestContext>;
5152
protected _endOfData: boolean;
5253
protected _pagination: Pagination;
@@ -67,6 +68,7 @@ export class CaseViewService extends AbstractSortableViewComponent implements On
6768
@Optional() @Inject(NAE_NEW_CASE_CONFIGURATION) newCaseConfig: NewCaseConfiguration,
6869
protected _permissionService: PermissionService) {
6970
super(resolver);
71+
this._cases = [];
7072
this._newCaseConfiguration = {...this.DEFAULT_NEW_CASE_CONFIGURATION};
7173
if (newCaseConfig !== null) {
7274
Object.assign(this._newCaseConfiguration, newCaseConfig);
@@ -112,7 +114,8 @@ export class CaseViewService extends AbstractSortableViewComponent implements On
112114
}, {})
113115
);
114116
this._cases$ = casesMap.pipe(
115-
map(v => Object.values(v))
117+
map(v => Object.values(v) as Array<Case>),
118+
tap(cases => this._cases = cases as Array<Case>),
116119
);
117120
}
118121

@@ -134,6 +137,10 @@ export class CaseViewService extends AbstractSortableViewComponent implements On
134137
return this._cases$;
135138
}
136139

140+
public get cases(): Array<Case> {
141+
return this._cases;
142+
}
143+
137144
public get pagination(): Pagination {
138145
return this._pagination;
139146
}

projects/netgrif-components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netgrif/components",
3-
"version": "6.4.0",
3+
"version": "6.4.1",
44
"description": "Netgrif Application Engine frontend Angular components",
55
"homepage": "https://components.netgrif.com",
66
"license": "SEE LICENSE IN LICENSE",
@@ -29,7 +29,7 @@
2929
"nae frontend"
3030
],
3131
"peerDependencies": {
32-
"@netgrif/components-core": "6.4.0",
32+
"@netgrif/components-core": "6.4.1",
3333
"@angular-material-components/datetime-picker": "~7.0.1",
3434
"@angular-material-components/moment-adapter": "~7.0.0",
3535
"@angular/animations": "~13.3.1",

projects/netgrif-components/src/lib/data-fields/file-field/file-default-field/file-default-field.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
'border-color': getPreviewBorderColor()
5353
}"
5454
[ngClass]="{'border-LGBTQ': isBorderLGBTQ(), 'border-default': isBorderDefault()}"
55-
[src]="previewSource" alt="Image preview" (click)="showPreviewDialog()"/>
55+
[src]="previewSource" alt="Image preview" (click)="showPreviewDialog()" loading="lazy"/>
5656
<mat-spinner *ngIf="previewSource === undefined && !!state.downloading && isDisplayable"
5757
[diameter]="26"></mat-spinner>
5858
</div>

projects/netgrif-components/src/lib/data-fields/task-ref-field/task-ref-dashboard-field/task-ref-dashboard-field.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export class TaskRefDashboardFieldComponent extends AbstractTaskRefDashboardFiel
2020
constructor(logger: LoggerService,
2121
@Optional() @Inject(DATA_FIELD_PORTAL_DATA) dataFieldPortalData: DataFieldPortalData<TaskRefField>) {
2222
super(logger, dataFieldPortalData);
23+
if (!!dataFieldPortalData && dataFieldPortalData?.additionalFieldProperties?.taskContentComponentClassReference) {
24+
this.taskContentComponentClassReference = dataFieldPortalData.additionalFieldProperties.taskContentComponentClassReference as unknown as Type<any>;
25+
}
2326
}
2427

2528
getGridColumns(): string {

0 commit comments

Comments
 (0)