Skip to content
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

feat: P002271-6620-export-function #92

Merged
merged 10 commits into from
Jan 31, 2024
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
1 change: 1 addition & 0 deletions libs/portal-integration-angular/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export * from './lib/services/initialize-module-guard.service'
export * from './lib/services/userprofile-api.service'
export * from './lib/services/portal-dialog.service'
export * from './lib/services/user.service'
export * from './lib/services/export-data.service'

// pipes
export * from './lib/core/pipes/dynamic.pipe'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
pButton
class="p-button-rounded p-button-text mb-1 mr-2"
title="{{ (viewMenuItemKey || 'OCX_DATA_LIST_GRID.MENU.VIEW') | translate }}"
ariaLabel="{{ (viewMenuItemKey || 'OCX_DATA_LIST_GRID.MENU.VIEW') | translate }}"
[attr.aria-label]="(viewMenuItemKey || 'OCX_DATA_LIST_GRID.MENU.VIEW') | translate"
(click)="onViewRow(item)"
*ocxIfPermission="viewPermission"
></button>
Expand All @@ -98,7 +98,7 @@
icon="pi pi-pencil"
pButton
title="{{ (editMenuItemKey || 'OCX_DATA_LIST_GRID.MENU.EDIT') | translate }}"
ariaLabel="{{ (editMenuItemKey || 'OCX_DATA_LIST_GRID.MENU.EDIT') | translate }}"
[attr.aria-label]="(editMenuItemKey || 'OCX_DATA_LIST_GRID.MENU.EDIT') | translate"
(click)="onEditRow(item)"
*ocxIfPermission="editPermission"
></button>
Expand All @@ -111,7 +111,7 @@
class="p-button-rounded p-button-text p-button-danger mb-1 mr-2"
pButton
title="{{ (deleteMenuItemKey || 'OCX_DATA_LIST_GRID.MENU.DELETE') | translate }}"
ariaLabel="{{ (deleteMenuItemKey || 'OCX_DATA_LIST_GRID.MENU.DELETE') | translate }}"
[attr.aria-label]="(deleteMenuItemKey || 'OCX_DATA_LIST_GRID.MENU.DELETE') | translate"
(click)="onDeleteRow(item)"
*ocxIfPermission="deletePermission"
></button>
Expand All @@ -125,7 +125,7 @@
[icon]="action.icon || ''"
(click)="action.callback(item)"
[title]="action.labelKey ? (action.labelKey | translate) : ''"
[ariaLabel]="action.labelKey ? (action.labelKey | translate) : ''"
[attr.aria-label]="action.labelKey ? (action.labelKey | translate) : ''"
[disabled]="action.disabled"
></button>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
pButton
class="p-button-rounded p-button-text"
title="{{ 'OCX_DATA_TABLE.ACTIONS.VIEW' | translate }}"
ariaLabel="{{ 'OCX_DATA_TABLE.ACTIONS.VIEW' | translate }}"
[attr.aria-label]="'OCX_DATA_TABLE.ACTIONS.VIEW' | translate"
icon="pi pi-eye"
(click)="onViewRow(rowObject)"
></button>
Expand All @@ -103,7 +103,7 @@
pButton
class="p-button-rounded p-button-text"
title="{{ 'OCX_DATA_TABLE.ACTIONS.EDIT' | translate }}"
ariaLabel="{{ 'OCX_DATA_TABLE.ACTIONS.EDIT' | translate }}"
[attr.aria-label]="'OCX_DATA_TABLE.ACTIONS.EDIT' | translate"
icon="pi pi-pencil"
(click)="onEditRow(rowObject)"
></button>
Expand All @@ -115,7 +115,7 @@
pButton
class="p-button-rounded p-button-text p-button-danger"
title="{{ 'OCX_DATA_TABLE.ACTIONS.DELETE' | translate }}"
ariaLabel="{{ 'OCX_DATA_TABLE.ACTIONS.DELETE' | translate }}"
[attr.aria-label]="'OCX_DATA_TABLE.ACTIONS.DELETE' | translate"
icon="pi pi-trash"
(click)="onDeleteRow(rowObject)"
></button>
Expand All @@ -129,7 +129,7 @@
[icon]="action.icon || ''"
(click)="action.callback(rowObject)"
[title]="action.labelKey ? (action.labelKey | translate) : ''"
[ariaLabel]="action.labelKey ? (action.labelKey | translate) : ''"
[attr.aria-label]="action.labelKey ? (action.labelKey | translate) : ''"
[disabled]="action.disabled"
></button>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { DiagramComponent } from './diagram.component'
import { NoopAnimationsModule } from '@angular/platform-browser/animations'
import { TranslateService } from '@ngx-translate/core'
import 'jest-canvas-mock'
import { TranslateTestingModule } from 'ngx-translate-testing'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { ChartModule } from 'primeng/chart'
import { MessageModule } from 'primeng/message'
import { MockAuthModule } from '../../../mock-auth/mock-auth.module'
import { DiagramHarness, TestbedHarnessEnvironment } from '../../../../../testing'
import { TranslateService } from '@ngx-translate/core'
import { MockAuthModule } from '../../../mock-auth/mock-auth.module'
import { DiagramType } from '../../../model/diagram-type'
import { DiagramComponent } from './diagram.component'

describe('DiagramComponent', () => {
let translateService: TranslateService
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { GroupByCountDiagramComponent } from './group-by-count-diagram.component'
import { HarnessLoader } from '@angular/cdk/testing'
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { ComponentFixture, TestBed } from '@angular/core/testing'
import { TranslateService } from '@ngx-translate/core'
import 'jest-canvas-mock'
import { TranslateTestingModule } from 'ngx-translate-testing'
import { MockAuthModule } from '../../../mock-auth/mock-auth.module'
import { ColumnType } from '../../../model/column-type.model'
import { MessageModule } from 'primeng/message'
import { ChartModule } from 'primeng/chart'
import { DiagramComponent } from '../diagram/diagram.component'
import { MessageModule } from 'primeng/message'
import { firstValueFrom, of } from 'rxjs'
import { HarnessLoader } from '@angular/cdk/testing'
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'
import { TranslateService } from '@ngx-translate/core'
import { DiagramHarness } from '../../../../../testing'
import { MockAuthModule } from '../../../mock-auth/mock-auth.module'
import { ColumnType } from '../../../model/column-type.model'
import { DiagramComponent } from '../diagram/diagram.component'
import { GroupByCountDiagramComponent } from './group-by-count-diagram.component'

describe('GroupByCountDiagramComponent', () => {
let translateService: TranslateService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export class InteractiveDataViewComponent implements OnInit {
@Output() deleteItem = new EventEmitter<RowListGridData>()
@Output() viewItem = new EventEmitter<RowListGridData>()
@Output() editItem = new EventEmitter<RowListGridData>()
@Output() dataViewLayoutChange: EventEmitter<any> = new EventEmitter()
@Output() dataViewLayoutChange = new EventEmitter<'grid' | 'list' | 'table'>()
@Output() displayedColumnsChange = new EventEmitter<DataTableColumn[]>()
displayedColumns: DataTableColumn[] = []
selectedGroupKey = ''
isDeleteItemObserved: boolean | undefined
Expand Down Expand Up @@ -135,6 +136,7 @@ export class InteractiveDataViewComponent implements OnInit {
column.predefinedGroupKeys?.includes(this.defaultGroupKey)
)
}
this.displayedColumnsChange.emit(this.displayedColumns)
if (!this.groupSelectionNoGroupSelectedKey) {
this.groupSelectionNoGroupSelectedKey = 'OCX_INTERACTIVE_DATA_VIEW.NO_GROUP_SELECTED'
}
Expand Down Expand Up @@ -188,6 +190,7 @@ export class InteractiveDataViewComponent implements OnInit {
onColumnGroupSelectionChange(event: GroupSelectionChangedEvent) {
this.displayedColumns = event.activeColumns
this.selectedGroupKey = event.groupKey
this.displayedColumnsChange.emit(this.displayedColumns)
}

registerEventListenerForDataView() {
Expand Down Expand Up @@ -220,5 +223,6 @@ export class InteractiveDataViewComponent implements OnInit {
onColumnSelectionChange(event: ColumnSelectionChangedEvent) {
this.displayedColumns = event.activeColumns
this.selectedGroupKey = this.customGroupKey
this.displayedColumnsChange.emit(this.displayedColumns)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ActivatedRoute, RouterModule } from '@angular/router'
import { IfBreakpointDirective } from '../../directives/if-breakpoint.directive'
import { TooltipModule } from 'primeng/tooltip'
import { TranslateTestingModule } from 'ngx-translate-testing'
import { PortalCoreModule } from '../../portal-core.module'

describe('HeaderComponent', () => {
let component: HeaderComponent
Expand All @@ -17,7 +18,13 @@ describe('HeaderComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [HeaderComponent, UserAvatarComponent, IfBreakpointDirective],
imports: [HttpClientTestingModule, RouterModule, TooltipModule, TranslateTestingModule.withTranslations({}),],
imports: [
HttpClientTestingModule,
RouterModule,
TooltipModule,
TranslateTestingModule.withTranslations({}),
PortalCoreModule,
],
providers: [
{ provide: AUTH_SERVICE, useClass: MockAuthService },
ConfigurationService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { TranslateTestingModule } from 'ngx-translate-testing'
import { AppStateService } from '../../../services/app-state.service'
import { AUTH_SERVICE } from '../../../api/injection-tokens'
import { MockAuthService } from '../../../mock-auth/mock-auth.service'
import { PortalCoreModule } from '../../portal-core.module'

describe('PortalViewportComponent', () => {
const origAddEventListener = window.addEventListener
Expand Down Expand Up @@ -74,6 +75,7 @@ describe('PortalViewportComponent', () => {
RouterModule,
TooltipModule,
TranslateTestingModule.withTranslations({}),
PortalCoreModule,
],
providers: [
ConfigurationService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
(onClick)="onResetClicked()"
label="{{ 'OCX_SEARCH_HEADER.RESET_BUTTON_TEXT' | translate }}"
icon="pi pi-eraser"
ariaLabel="{{ 'OCX_SEARCH_HEADER.RESET_BUTTON_TEXT' | translate }}"
[attr.aria-label]="'OCX_SEARCH_HEADER.RESET_BUTTON_TEXT' | translate"
title="{{ 'OCX_SEARCH_HEADER.RESET_BUTTON_TEXT' | translate }}"
>
</p-button>
Expand All @@ -27,7 +27,7 @@
(onClick)="onSearchClicked()"
label="{{ 'OCX_SEARCH_HEADER.SEARCH_BUTTON_TEXT' | translate }}"
icon="pi pi-search"
ariaLabel="{{ 'OCX_SEARCH_HEADER.SEARCH_BUTTON_TEXT' | translate }}"
[attr.aria-label]="'OCX_SEARCH_HEADER.SEARCH_BUTTON_TEXT' | translate"
title="{{ 'OCX_SEARCH_HEADER.SEARCH_BUTTON_TEXT' | translate }}"
>
</p-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'
import { ButtonModule } from 'primeng/button'
import { BreadcrumbModule } from 'primeng/breadcrumb'
import { AppStateService } from '../../../services/app-state.service'
import { PortalCoreModule } from '../../portal-core.module'

describe('SearchHeaderComponent', () => {
const origAddEventListener = window.addEventListener
Expand Down Expand Up @@ -44,6 +45,7 @@ describe('SearchHeaderComponent', () => {
HttpClientTestingModule,
ButtonModule,
BreadcrumbModule,
PortalCoreModule
],
providers: [ConfigurationService, AppStateService],
}).compileComponents()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ export class PortalMissingTranslationHandler implements MissingTranslationHandle
{
provide: LOCALE_ID,
useFactory: (userService: UserService) => {
console.log('Using locale: ' + userService.lang$.getValue())
return userService.lang$.getValue()
},
deps: [UserService],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { TranslateService } from '@ngx-translate/core'
import { Injectable } from '@angular/core'
import { Inject, Injectable, LOCALE_ID } from '@angular/core'

@Injectable({
providedIn: 'root',
})
export class DateUtils {
constructor(private translateService: TranslateService) {}
constructor(@Inject(LOCALE_ID) protected locale: string) {}

options: Intl.DateTimeFormatOptions = {
month: 'short',
Expand All @@ -18,9 +17,7 @@ export class DateUtils {

localizedDate(date: string | number | Date | undefined): string {
return date
? new Intl.DateTimeFormat(this.translateService.getBrowserLang(), this.options).format(
date instanceof Date ? date : new Date(date)
)
? new Intl.DateTimeFormat(this.locale, this.options).format(date instanceof Date ? date : new Date(date))
: ''
}
}
Loading
Loading