Skip to content

Commit

Permalink
Merge branch 'main' into fix/horizontal-menu-icons
Browse files Browse the repository at this point in the history
  • Loading branch information
markuczy authored Oct 23, 2024
2 parents f8fc636 + 19f4610 commit 9ce99a8
Show file tree
Hide file tree
Showing 44 changed files with 440 additions and 179 deletions.
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
## [5.19.4](https://github.com/onecx/onecx-portal-ui-libs/compare/v5.19.3...v5.19.4) (2024-10-18)

### Bug Fixes

* cast filter value to string ([#549](https://github.com/onecx/onecx-portal-ui-libs/issues/549)) ([7f01113](https://github.com/onecx/onecx-portal-ui-libs/commit/7f01113c65a929f7960ba24dbdcd48492c988e46))

## [5.19.3](https://github.com/onecx/onecx-portal-ui-libs/compare/v5.19.2...v5.19.3) (2024-10-18)

### Bug Fixes

* UI state custom group column selector ([#544](https://github.com/onecx/onecx-portal-ui-libs/issues/544)) ([e2cecf3](https://github.com/onecx/onecx-portal-ui-libs/commit/e2cecf3ebc070189fc3ffdb8b1f58305fac6973f))

## [5.19.2](https://github.com/onecx/onecx-portal-ui-libs/compare/v5.19.1...v5.19.2) (2024-10-16)

### Bug Fixes

* revert menu header padding ([#545](https://github.com/onecx/onecx-portal-ui-libs/issues/545)) ([41c880c](https://github.com/onecx/onecx-portal-ui-libs/commit/41c880cd1217d1e1dbcf58c116425a59108ba827))

## [5.19.1](https://github.com/onecx/onecx-portal-ui-libs/compare/v5.19.0...v5.19.1) (2024-10-16)

### Bug Fixes

* fix type of warning in portal-page-header ([#542](https://github.com/onecx/onecx-portal-ui-libs/issues/542)) ([4e652a1](https://github.com/onecx/onecx-portal-ui-libs/commit/4e652a11068ce5669cd1b7d514cd20122cd0f4ca))
* renaming payload navigated event to navigated event payload ([#543](https://github.com/onecx/onecx-portal-ui-libs/issues/543)) ([855a16e](https://github.com/onecx/onecx-portal-ui-libs/commit/855a16eba64e28c5e892249a42990428adebe60a))

## [5.19.0](https://github.com/onecx/onecx-portal-ui-libs/compare/v5.18.1...v5.19.0) (2024-10-15)

### Features

* add navigation history ([#532](https://github.com/onecx/onecx-portal-ui-libs/issues/532)) ([ae4b583](https://github.com/onecx/onecx-portal-ui-libs/commit/ae4b5835717bdbe258e2977e195d0259dbbf9519))
* panelmenu component style adjustments ([#533](https://github.com/onecx/onecx-portal-ui-libs/issues/533)) ([3a3ed93](https://github.com/onecx/onecx-portal-ui-libs/commit/3a3ed9322096ec56161b13f3958a03787062b3c8))

## [5.18.1](https://github.com/onecx/onecx-portal-ui-libs/compare/v5.18.0...v5.18.1) (2024-10-11)

### Bug Fixes

* search config slot name changes ([#539](https://github.com/onecx/onecx-portal-ui-libs/issues/539)) ([0faecd9](https://github.com/onecx/onecx-portal-ui-libs/commit/0faecd944bbd0323a844e3167161782c76d3529e))
* truthy filter check correction ([#538](https://github.com/onecx/onecx-portal-ui-libs/issues/538)) ([996de4e](https://github.com/onecx/onecx-portal-ui-libs/commit/996de4e100f20d5cc4830a29cf38f829b12ccb79))

## [5.18.0](https://github.com/onecx/onecx-portal-ui-libs/compare/v5.17.2...v5.18.0) (2024-10-11)

### Features
Expand Down
2 changes: 1 addition & 1 deletion libs/accelerator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/accelerator",
"version": "5.18.0",
"version": "5.19.4",
"license": "Apache-2.0",
"peerDependencies": {
"tslib": "^2.6.3",
Expand Down
2 changes: 1 addition & 1 deletion libs/angular-accelerator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/angular-accelerator",
"version": "5.18.0",
"version": "5.19.4",
"license": "Apache-2.0",
"peerDependencies": {
"@angular/common": "^18.0.5",
Expand Down
1 change: 1 addition & 0 deletions libs/angular-accelerator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ export * from './lib/utils/create-remote-component-and-mfe-translate-loader.util
export * from './lib/utils/create-remote-component-translate-loader.utils'
export * from './lib/utils/enum-to-dropdown-options.utils'
export * from './lib/utils/criteria.utils'
export * from './lib/utils/string-and-array-helper-functions.utils'
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ export class ColumnGroupSelectionComponent implements OnInit {
.filter((value, index, self) => self.indexOf(value) === index && value != null)
)
)
const activeColumns = this.columns.filter((c) =>
c.predefinedGroupKeys?.includes(this.selectedGroupKey$.getValue() ?? this.defaultGroupKey)
)
this.componentStateChanged.emit({
activeColumnGroupKey: this.selectedGroupKey,
displayedColumns: this.columns,
displayedColumns: activeColumns,
})
}

Expand All @@ -65,7 +68,7 @@ export class ColumnGroupSelectionComponent implements OnInit {
this.groupSelectionChanged.emit({ activeColumns, groupKey: event.value })
this.componentStateChanged.emit({
activeColumnGroupKey: event.value,
displayedColumns: activeColumns
displayedColumns: activeColumns,
})
}

Expand All @@ -77,7 +80,7 @@ export class ColumnGroupSelectionComponent implements OnInit {
this.groupSelectionChanged.emit({ activeColumns, groupKey: this.defaultGroupKey })
this.componentStateChanged.emit({
activeColumnGroupKey: this.defaultGroupKey,
displayedColumns: activeColumns
displayedColumns: activeColumns,
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,21 @@ export interface CustomGroupColumnSelectorComponentState {
})
export class CustomGroupColumnSelectorComponent implements OnInit {
@Input() columns: DataTableColumn[] = []
@Input() displayedColumns: DataTableColumn[] = []
private _displayedColumns: DataTableColumn[] = []
@Input()
get displayedColumns() {
return this._displayedColumns
}
set displayedColumns(value: DataTableColumn[]) {
this._displayedColumns = value
this.componentStateChanged.emit({
actionColumnConfig: {
frozen: this.frozenActionColumn,
position: this.actionColumnPosition,
},
displayedColumns: this._displayedColumns,
})
}
@Input() dialogTitle = ''
@Input() dialogTitleKey = ''
@Input() openButtonTitle = ''
Expand Down Expand Up @@ -108,11 +122,6 @@ export class CustomGroupColumnSelectorComponent implements OnInit {
this.columnSelectionChanged.emit({ activeColumns: [...this.displayedColumnsModel] })
this.componentStateChanged.emit({
displayedColumns: [...this.displayedColumnsModel],
actionColumnConfig: {
frozen: this.frozenActionColumnModel,
position: this.actionColumnPositionModel,
},
activeColumnGroupKey: undefined,
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ export class DataSortBase {
switch (filter.filterType) {
case undefined:
case FilterType.EQUAL:
return value === filter.value
return value === String(filter.value)
case FilterType.TRUTHY: {
const isTruthy = value !== undefined && value !== ''
return filter.value ? isTruthy : !isTruthy
return filter.value ? !!value : !value
}
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ export class DataTableComponent extends DataSortBase implements OnInit, AfterCon
const columnValues = rows.map((row) => row[currentFilterColumn?.id])
const translateObservable =
this.columns.find((c) => c.id === currentFilterColumn?.id)?.columnType === ColumnType.TRANSLATION_KEY
? this.translateService.get(columnValues as string[])
? this.translateColumnValues(columnValues as string[])
: of(Object.fromEntries(columnValues.map((cv) => [cv, cv])))
return translateObservable.pipe(
map((translatedValues) => {
Expand Down Expand Up @@ -501,6 +501,10 @@ export class DataTableComponent extends DataSortBase implements OnInit, AfterCon
this.emitComponentStateChanged()
}

translateColumnValues(columnValues: string[]): Observable<any> {
return columnValues.length ? this.translateService.get(columnValues as string[]) : of({})
}

emitComponentStateChanged(state: DataTableComponentState = {}) {
this.displayedPageSize$
.pipe(withLatestFrom(this._selectionIds$, this._rows$), first())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
*ngIf="layout === 'table'"
[selectedGroupKey]="selectedGroupKey ?? defaultGroupKey"
[columns]="columns"
[defaultGroupKey]="defaultGroupKey"
[defaultGroupKey]="defaultGroupKey !== customGroupKey ? defaultGroupKey : ''"
[customGroupKey]="customGroupKey"
[placeholderKey]="groupSelectionNoGroupSelectedKey"
(groupSelectionChanged)="onColumnGroupSelectionChange($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export class InteractiveDataViewComponent implements OnInit, AfterContentInit {
this._data = value
}

columnGroupSlotName = 'onecx-shell-column-group-selection'
columnGroupSlotName = 'onecx-column-group-selection'
isColumnGroupSelectionComponentDefined$: Observable<boolean>
groupSelectionChangedSlotEmitter = new EventEmitter<ColumnGroupData | undefined>()

Expand Down Expand Up @@ -386,7 +386,7 @@ export class InteractiveDataViewComponent implements OnInit, AfterContentInit {
if (!this.displayedColumns || this.displayedColumns.length === 0) {
this.displayedColumnKeys = this.columns.map((column) => column.id)
}
if (this.defaultGroupKey) {
if (this.defaultGroupKey && this.defaultGroupKey !== this.customGroupKey) {
this.displayedColumnKeys = this.columns
.filter((column) => column.predefinedGroupKeys?.includes(this.defaultGroupKey))
.map((column) => column.id)
Expand Down Expand Up @@ -417,8 +417,22 @@ export class InteractiveDataViewComponent implements OnInit, AfterContentInit {
if (this.layout === 'table') {
dataListGridSortingComponentState$ = dataListGridSortingComponentState$.pipe(startWith({}))
} else {
columnGroupSelectionComponentState$ = columnGroupSelectionComponentState$.pipe(startWith({}))
customGroupColumnSelectorComponentState$ = customGroupColumnSelectorComponentState$.pipe(startWith({}))
columnGroupSelectionComponentState$ = columnGroupSelectionComponentState$.pipe(
startWith({
activeColumnGroupKey: this.selectedGroupKey,
displayedColumns: this.displayedColumns,
})
)
customGroupColumnSelectorComponentState$ = customGroupColumnSelectorComponentState$.pipe(
startWith({
actionColumnConfig: {
frozen: this.frozenActionColumn,
position: this.actionColumnPosition,
},
displayedColumns: this.displayedColumns,
activeColumnGroupKey: this.selectedGroupKey,
})
)
}

combineLatest([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ng-container *ngIf="searchConfigChangeObserved && pageName">
<ocx-slot
*ocxIfPermission="searchConfigPermission"
name="onecx-shell-search-config"
name="onecx-search-config"
[inputs]="{ pageName: pageName, currentFieldValues: fieldValues$ | async, viewMode: viewMode }"
[outputs]="{ searchConfigSelected: searchConfigChangedSlotEmitter }"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ export class SearchHeaderComponent implements AfterContentInit, AfterViewInit {
@ViewChild('searchParameterFields') searchParameterFields: ElementRef | undefined

hasAdvanced = false

simpleAdvancedAction: Action = {
id: 'simpleAdvancedButton',
actionCallback: () => this.toggleViewMode(),
show: 'always',
}
headerActions: Action[] = []

fieldValues$: Observable<{ [key: string]: unknown }> | undefined = of({})
Expand Down Expand Up @@ -166,19 +172,14 @@ export class SearchHeaderComponent implements AfterContentInit, AfterViewInit {
updateHeaderActions() {
const headerActions: Action[] = []
if (this.hasAdvanced) {
headerActions.push({
id: 'simpleAdvancedButton',
labelKey:
this.viewMode === 'basic'
? 'OCX_SEARCH_HEADER.TOGGLE_BUTTON.ADVANCED.TEXT'
: 'OCX_SEARCH_HEADER.TOGGLE_BUTTON.SIMPLE.TEXT',
actionCallback: () => this.toggleViewMode(),
show: 'always',
titleKey:
this.viewMode === 'basic'
? 'OCX_SEARCH_HEADER.TOGGLE_BUTTON.ADVANCED.DETAIL'
: 'OCX_SEARCH_HEADER.TOGGLE_BUTTON.SIMPLE.DETAIL',
})
this.simpleAdvancedAction.labelKey = this.viewMode === 'basic'
? 'OCX_SEARCH_HEADER.TOGGLE_BUTTON.ADVANCED.TEXT'
: 'OCX_SEARCH_HEADER.TOGGLE_BUTTON.SIMPLE.TEXT',
this.simpleAdvancedAction.titleKey = this.viewMode === 'basic'
? 'OCX_SEARCH_HEADER.TOGGLE_BUTTON.ADVANCED.DETAIL'
: 'OCX_SEARCH_HEADER.TOGGLE_BUTTON.SIMPLE.DETAIL',

headerActions.push(this.simpleAdvancedAction)
}
this.headerActions = headerActions.concat(this.actions)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {
findEntryWithKeyword,
removeKeyword,
searchPrefixWithSpecialChars,
} from './string-and-array-helper-functions.utils'

describe('findEntryWithKeyword', () => {
it('should find the entry containing the keyword', () => {
expect(findEntryWithKeyword(['entry1', 'entry2', 'keywordEntry'], 'keyword')).toBe('keywordEntry')
expect(findEntryWithKeyword(['entry1', 'entry2', 'entry3'], 'keyword')).toBe(null)
expect(findEntryWithKeyword(undefined, 'keyword')).toBe(null)
})
})

describe('removeKeyword', () => {
it('should remove the keyword and trailing details from the input string', () => {
expect(removeKeyword('/onecx-mgmt-page/keyword/123', 'keyword')).toBe('/onecx-mgmt-page')
expect(removeKeyword('/onecx-mgmt-page/keyword/123/', 'keyword')).toBe('/onecx-mgmt-page')
expect(removeKeyword('/onecx-mgmt-page/search/123', 'keyword')).toBe('/onecx-mgmt-page/search/123')
})

describe('searchPrefixWithSpecialChars', () => {
it('should return the latest string starting with the prefix followed by ? or #', () => {
const exampleUrls1 = ['onecx-mgmt-page?id', 'onecx-mgmt-page#id', 'ibt-order-mgmt-page#id']
const exampleUrls2 = ['onecx-mgmt-page#id', 'onecx-mgmt-page#id', 'onecx-mgmt-page?id']
const prefix = 'onecx-mgmt-page'
const expected1 = 'onecx-mgmt-page#id'
const expected2 = 'onecx-mgmt-page?id'
expect(searchPrefixWithSpecialChars(exampleUrls1, prefix)).toEqual(expected1)
expect(searchPrefixWithSpecialChars(exampleUrls2, prefix)).toEqual(expected2)
})

it('should return the latest string of an array starting with the prefix followed by ? or #', () => {
const strings = ['test?case', 'test#case', 'test case', 'example?test', 'example#test']
const prefix = 'test'
const expected = 'test#case'
expect(searchPrefixWithSpecialChars(strings, prefix)).toEqual(expected)
})
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export function findEntryWithKeyword(
array: string[] | undefined,
keyword: string,
): string | null {
const entry = array?.find((entry) => entry.includes(keyword));
return entry || null;
}

export function removeKeyword(input: string, keyword: string): string {
let result = input.replace(new RegExp(`/${keyword}.*`), '');
if (result.endsWith('/')) {
result = result.slice(0, -1);
}
return result;
}

export function searchPrefixWithSpecialChars(
strings: string[],
prefix: string,
): string | null {
for (let i = strings.length - 1; i >= 0; i--) {
const str = strings[i];
if (
str.startsWith(prefix) &&
(str[prefix.length] === '?' || str[prefix.length] === '#')
) {
return str;
}
}
return null;
}
2 changes: 1 addition & 1 deletion libs/angular-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/angular-auth",
"version": "5.18.0",
"version": "5.19.4",
"license": "Apache-2.0",
"peerDependencies": {
"@angular-architects/module-federation": "^18.0.4",
Expand Down
2 changes: 1 addition & 1 deletion libs/angular-integration-interface/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/angular-integration-interface",
"version": "5.18.0",
"version": "5.19.4",
"license": "Apache-2.0",
"peerDependencies": {
"@angular/core": "^18.0.5",
Expand Down
2 changes: 1 addition & 1 deletion libs/angular-remote-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/angular-remote-components",
"version": "5.18.0",
"version": "5.19.4",
"license": "Apache-2.0",
"peerDependencies": {
"@angular/common": "^18.0.5",
Expand Down
2 changes: 1 addition & 1 deletion libs/angular-testing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/angular-testing",
"version": "5.18.0",
"version": "5.19.4",
"license": "Apache-2.0",
"peerDependencies": {
"@angular/cdk": "^18.0.5",
Expand Down
2 changes: 1 addition & 1 deletion libs/angular-webcomponents/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/angular-webcomponents",
"version": "5.18.0",
"version": "5.19.4",
"license": "Apache-2.0",
"peerDependencies": {
"@angular/core": "^18.0.5",
Expand Down
2 changes: 1 addition & 1 deletion libs/integration-interface/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/integration-interface",
"version": "5.18.0",
"version": "5.19.4",
"license": "Apache-2.0",
"peerDependencies": {
"tslib": "^2.6.3",
Expand Down
2 changes: 2 additions & 0 deletions libs/integration-interface/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ export * from './lib/topics/permissions-rpc/v1/permissions-rpc.model'

export * from './lib/topics/events/v1/events-topic'
export * from './lib/topics/events/v1/topic-event-type'
export * from './lib/topics/events/v1/navigated-event-type'
export * from './lib/topics/events/v1/navigated-event-payload'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type NavigatedEventPayload = {
url: string | undefined
isFirst: boolean
history: string[]
}
Loading

0 comments on commit 9ce99a8

Please sign in to comment.