Skip to content

Release/6.4.1 #277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Full Changelog: [https://github.com/netgrif/components/commits/v6.4.0](https://github.com/netgrif/components/commits/v6.4.0)
Full Changelog: [https://github.com/netgrif/components/commits/v6.4.1](https://github.com/netgrif/components/commits/v6.4.1)

## [6.4.1](https://github.com/netgrif/components/releases/tag/v6.4.1) (2025-03-19)

### Fixed
- [NAE-2031] Dashboard bug fix

### Changed
- [NAE-2047] Fulltext search and advanced search usability with multichoice caseRef
- [NAE-2048] Apply saved filter of advanced search in caseRef field

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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netgrif/components-project",
"version": "6.4.0",
"version": "6.4.1",
"description": "Netgrif Application Engine Frontend project. Project includes angular libraries as base for NAE applications.",
"homepage": "https://components.netgrif.com",
"license": "SEE LICENSE IN LICENSE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import {
defaultCaseSearchCategoriesFactory,
NAE_BASE_FILTER,
AllowedNetsServiceFactory,
AllowedNetsService, UserFilterConstants, TaskSetDataRequestFields
AllowedNetsService,
UserFilterConstants,
TaskSetDataRequestFields
} from '@netgrif/components-core';
import {HeaderComponent} from '@netgrif/components';

Expand Down
2 changes: 1 addition & 1 deletion projects/netgrif-components-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netgrif/components-core",
"version": "6.4.0",
"version": "6.4.1",
"description": "Netgrif Application engine frontend core Angular library",
"homepage": "https://components.netgrif.com",
"license": "SEE LICENSE IN LICENSE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export abstract class AbstractCaseRefBaseFieldComponent<T extends DataField<unkn
}
let providers = [
{
provide: NAE_DEFAULT_HEADERS, useValue: this.dataField.component?.properties?.headers.split(',')
provide: NAE_DEFAULT_HEADERS, useValue: this.dataField.component?.properties?.headers?.split(',')
},
{
provide: NAE_CASE_REF_CREATE_CASE, useValue: this.dataField.component?.properties?.createCase === 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {HttpClientTestingModule} from '@angular/common/http/testing';
import {MatIconModule} from '@angular/material/icon';
import {BrowserDynamicTestingModule} from '@angular/platform-browser-dynamic/testing';
import {MockAuthenticationMethodService} from '../utility/tests/mocks/mock-authentication-method-service';
import {Component, Injector, Optional} from '@angular/core';
import {Component, Inject, Injector, Optional} from '@angular/core';
import {AbstractHeaderComponent} from './abstract-header.component';
import {TranslateLibModule} from '../translate/translate-lib.module';
import {RouterTestingModule} from '@angular/router/testing';
Expand All @@ -29,6 +29,13 @@ import {OverflowService} from './services/overflow.service';
import {AllowedNetsService} from '../allowed-nets/services/allowed-nets.service';
import {TestNoAllowedNetsFactory} from '../utility/tests/test-factory-methods';
import {AllowedNetsServiceFactory} from '../allowed-nets/services/factory/allowed-nets-service-factory';
import {CaseViewService} from "../view/case-view/service/case-view-service";
import {
DATA_FIELD_PORTAL_DATA,
DataFieldPortalData
} from "../data-fields/models/data-field-portal-data-injection-token";
import {MultichoiceField} from "../data-fields/multichoice-field/models/multichoice-field";
import {EnumerationField} from "../data-fields/enumeration-field/models/enumeration-field";

describe('AbstractHeaderComponent', () => {
let component: TestHeaderComponent;
Expand Down Expand Up @@ -89,7 +96,9 @@ describe('AbstractHeaderComponent', () => {
class TestHeaderComponent extends AbstractHeaderComponent {
constructor(protected _injector: Injector,
protected _translate: TranslateService,
@Optional() protected _overflowService: OverflowService) {
super(_injector, _translate, _overflowService);
@Optional() protected _overflowService: OverflowService,
@Optional() protected _caseViewService: CaseViewService,
@Optional() @Inject(DATA_FIELD_PORTAL_DATA) protected _dataFieldPortalData: DataFieldPortalData<MultichoiceField | EnumerationField>) {
super(_injector, _translate, _overflowService, _caseViewService, _dataFieldPortalData);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, Injector, Input, OnDestroy, OnInit, Optional} from '@angular/core';
import {Component, Inject, Injector, Input, OnDestroy, OnInit, Optional} from '@angular/core';
import {AbstractHeaderService} from './abstract-header-service';
import {CaseHeaderService} from './case-header/case-header.service';
import {TaskHeaderService} from './task-header/task-header.service';
Expand All @@ -12,6 +12,13 @@ import {OverflowService} from './services/overflow.service';
import {stopPropagation} from '../utility/stop-propagation';
import {Subscription} from 'rxjs';
import {debounceTime} from "rxjs/operators";
import {CaseViewService} from "../view/case-view/service/case-view-service";
import {
DATA_FIELD_PORTAL_DATA,
DataFieldPortalData
} from "../data-fields/models/data-field-portal-data-injection-token";
import {MultichoiceField} from "../data-fields/multichoice-field/models/multichoice-field";
import {EnumerationField} from "../data-fields/enumeration-field/models/enumeration-field";

@Component({
selector: 'ncc-abstract-header',
Expand Down Expand Up @@ -45,11 +52,16 @@ export abstract class AbstractHeaderComponent implements OnInit, OnDestroy {
protected _initHeaderCount: number = undefined;
protected _initResponsiveHeaders: boolean = undefined;
protected _approvalFormControl: FormControl;
protected _changeValue: boolean;
protected _subCases: Subscription;

constructor(protected _injector: Injector,
protected _translate: TranslateService,
@Optional() protected _overflowService: OverflowService) {
@Optional() protected _overflowService: OverflowService,
@Optional() protected _caseViewService: CaseViewService,
@Optional() @Inject(DATA_FIELD_PORTAL_DATA) protected _dataFieldPortalData: DataFieldPortalData<MultichoiceField | EnumerationField>) {
this.initializeFormControls(this._overflowService !== null);
this._changeValue = true;
}

@Input()
Expand Down Expand Up @@ -93,6 +105,7 @@ export abstract class AbstractHeaderComponent implements OnInit, OnDestroy {
this.headerService.responsiveHeaders = this._initResponsiveHeaders;
}
this.headerService.preferenceColumnCount$.subscribe(value => this.columnCountControl.setValue(value));
this.resolveApprovalDatafields();
}

ngOnDestroy(): void {
Expand All @@ -101,6 +114,9 @@ export abstract class AbstractHeaderComponent implements OnInit, OnDestroy {
this.subColumnCountControl.unsubscribe();
this.subOverflowControl.unsubscribe();
}
if (this._subCases) {
this._subCases.unsubscribe();
}
}

/**
Expand Down Expand Up @@ -199,4 +215,54 @@ export abstract class AbstractHeaderComponent implements OnInit, OnDestroy {
}
});
}

public indeterminate() {
if (this._caseViewService) {
return this._dataFieldPortalData?.dataField?.value?.length > 0 &&
this._caseViewService.cases.some(value => this._dataFieldPortalData?.dataField.value.includes(value.stringId)) &&
!this.resolveApprovalValue();
}
return this._dataFieldPortalData?.dataField?.value?.length > 0 &&
this._dataFieldPortalData?.dataField?.value?.length < this._dataFieldPortalData?.dataField?.choices?.length;
}

public typeApproval() {
return this._dataFieldPortalData?.dataField instanceof MultichoiceField ? 'multichoice' : 'enumeration';
}

protected resolveApprovalDatafields() {
if (this._dataFieldPortalData !== null && this._dataFieldPortalData.dataField instanceof MultichoiceField && this._caseViewService) {
this.approvalFormControl.setValue(this.resolveApprovalValue());
this.approvalFormControl.valueChanges.subscribe(value => {
if (this._changeValue) {
if (value) {
this._dataFieldPortalData.dataField.value = this._caseViewService.cases.map(caze => caze.stringId);
} else {
this._dataFieldPortalData.dataField.value = [];
}
}
this._changeValue = true;
})
this._dataFieldPortalData.dataField.valueChanges().subscribe(() => {
this._changeValue = false;
this.approvalFormControl.setValue(this.resolveApprovalValue());
})
this._subCases = this._caseViewService.cases$.subscribe(() => {
this._changeValue = false;
this.approvalFormControl.setValue(this.resolveApprovalValue());
})
}
if (this._dataFieldPortalData !== null && this._dataFieldPortalData.dataField instanceof EnumerationField) {
this.approvalFormControl.valueChanges.subscribe(value => {
this._dataFieldPortalData.dataField.value = null;
})
}
}

protected resolveApprovalValue() {
if (this._caseViewService.cases.length === 0) {
return false;
}
return this._caseViewService.cases.every(value => this._dataFieldPortalData?.dataField.value.includes(value.stringId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class FilterExtractionService {
return this.extractCompleteFilterFromData(dataSection.slice(taskRefIndex.dataGroupIndex + 1));
}

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

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

const parentFilter = this.extractCompleteFilterFromData(dataSection.slice(filterIndex.dataGroupIndex + 1));
if (!!filterData) {
filterSegment = filterSegment.merge(filterData, MergeOperator.AND);
}

const parentFilter = this.extractCompleteFilterFromData(dataSection.slice(filterIndex.dataGroupIndex + 1), filterData);

if (parentFilter !== undefined && parentFilter.type === filterSegment.type) {
return filterSegment.merge(parentFilter, MergeOperator.AND);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export abstract class AbstractTaskListPaginationComponent extends AbstractDefaul
public length: number;
public pageSize = 20;
public pageIndex = 0;
public pageSizeOptions: Array<number> = [10, 20, 50];
public pageSizeOptions: Array<number> = [10, 20, 50, 100];

@Input() public disabled: boolean;
@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,14 @@ export class SearchService implements OnDestroy {
}
}

/**
* Loads whole new filter and search cases/tasks based on this filter
* @param newFilter whole new filter that should be used for search
*/
public updateWithFullFilter(newFilter: Filter): void {
this._activeFilter.next(newFilter);
}

/**
* @returns `undefined` if the predicate tree contains no complete query.
* Otherwise returns the serialized form of the completed queries in the predicate tree.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import {BaseFilter} from '../search/models/base-filter';
import {NAE_NAVIGATION_ITEM_TASK_DATA} from '../navigation/model/filter-case-injection-token';
import {DataGroup} from '../resources/interface/data-groups';
import {NAE_NAVIGATION_ITEM_TASK_DATA} from '../navigation/model/filter-case-injection-token';
import {FilterExtractionService} from '../navigation/utility/filter-extraction.service';
import {Filter} from '../filter/models/filter';

/**
* Converts an {@link NAE_NAVIGATION_ITEM_TASK_DATA} injection token into {@link NAE_BASE_FILTER}
* @param extractionService
* @param navigationItemTaskData a navigation item task containing the aggregated data representing a navigation item
*/
export function navigationItemTaskFilterFactory(extractionService: FilterExtractionService,
navigationItemTaskData: Array<DataGroup>): BaseFilter {
navigationItemTaskData: Array<DataGroup>,
filterData?: Filter): BaseFilter {
return {
filter: extractionService.extractCompleteFilterFromData(navigationItemTaskData)
filter: extractionService.extractCompleteFilterFromData(navigationItemTaskData, filterData)
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export abstract class AbstractCaseListPaginatorComponent extends AbstractDefault
public length: number;
public pageSize = 20;
public pageIndex = 0;
public pageSizeOptions: number[] = [10, 20, 50];
public pageSizeOptions: number[] = [10, 20, 50, 100];
@Input() public approval: boolean;
@Input() public disabled: boolean;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class CaseViewService extends AbstractSortableViewComponent implements On

protected _loading$: LoadingWithFilterEmitter;
protected _cases$: Observable<Array<Case>>;
protected _cases: Array<Case>;
protected _nextPage$: BehaviorSubject<PageLoadRequestContext>;
protected _endOfData: boolean;
protected _pagination: Pagination;
Expand All @@ -67,6 +68,7 @@ export class CaseViewService extends AbstractSortableViewComponent implements On
@Optional() @Inject(NAE_NEW_CASE_CONFIGURATION) newCaseConfig: NewCaseConfiguration,
protected _permissionService: PermissionService) {
super(resolver);
this._cases = [];
this._newCaseConfiguration = {...this.DEFAULT_NEW_CASE_CONFIGURATION};
if (newCaseConfig !== null) {
Object.assign(this._newCaseConfiguration, newCaseConfig);
Expand Down Expand Up @@ -112,7 +114,8 @@ export class CaseViewService extends AbstractSortableViewComponent implements On
}, {})
);
this._cases$ = casesMap.pipe(
map(v => Object.values(v))
map(v => Object.values(v) as Array<Case>),
tap(cases => this._cases = cases as Array<Case>),
);
}

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

public get cases(): Array<Case> {
return this._cases;
}

public get pagination(): Pagination {
return this._pagination;
}
Expand Down
4 changes: 2 additions & 2 deletions projects/netgrif-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netgrif/components",
"version": "6.4.0",
"version": "6.4.1",
"description": "Netgrif Application Engine frontend Angular components",
"homepage": "https://components.netgrif.com",
"license": "SEE LICENSE IN LICENSE",
Expand Down Expand Up @@ -29,7 +29,7 @@
"nae frontend"
],
"peerDependencies": {
"@netgrif/components-core": "6.4.0",
"@netgrif/components-core": "6.4.1",
"@angular-material-components/datetime-picker": "~7.0.1",
"@angular-material-components/moment-adapter": "~7.0.0",
"@angular/animations": "~13.3.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
'border-color': getPreviewBorderColor()
}"
[ngClass]="{'border-LGBTQ': isBorderLGBTQ(), 'border-default': isBorderDefault()}"
[src]="previewSource" alt="Image preview" (click)="showPreviewDialog()"/>
[src]="previewSource" alt="Image preview" (click)="showPreviewDialog()" loading="lazy"/>
<mat-spinner *ngIf="previewSource === undefined && !!state.downloading && isDisplayable"
[diameter]="26"></mat-spinner>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export class TaskRefDashboardFieldComponent extends AbstractTaskRefDashboardFiel
constructor(logger: LoggerService,
@Optional() @Inject(DATA_FIELD_PORTAL_DATA) dataFieldPortalData: DataFieldPortalData<TaskRefField>) {
super(logger, dataFieldPortalData);
if (!!dataFieldPortalData && dataFieldPortalData?.additionalFieldProperties?.taskContentComponentClassReference) {
this.taskContentComponentClassReference = dataFieldPortalData.additionalFieldProperties.taskContentComponentClassReference as unknown as Type<any>;
}
}

getGridColumns(): string {
Expand Down
Loading
Loading