Skip to content

Commit

Permalink
Merge branch 'main' into fix/if-permission-else-for-undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
markuczy authored Nov 12, 2024
2 parents ac676d9 + 2940931 commit 9655b3f
Show file tree
Hide file tree
Showing 18 changed files with 83 additions and 73 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## [5.23.5](https://github.com/onecx/onecx-portal-ui-libs/compare/v5.23.4...v5.23.5) (2024-11-12)

### Bug Fixes

* use date format in filter view ([#588](https://github.com/onecx/onecx-portal-ui-libs/issues/588)) ([c9d070e](https://github.com/onecx/onecx-portal-ui-libs/commit/c9d070e72d1cb959629330003cea885c37240bd7))

## [5.23.4](https://github.com/onecx/onecx-portal-ui-libs/compare/v5.23.3...v5.23.4) (2024-11-12)

### Bug Fixes

* Replace single comment with multi line comment in all scss files ([#587](https://github.com/onecx/onecx-portal-ui-libs/issues/587)) ([82719b7](https://github.com/onecx/onecx-portal-ui-libs/commit/82719b7eadb748c474dd0bb5bae24b5528524199))

## [5.23.3](https://github.com/onecx/onecx-portal-ui-libs/compare/v5.23.2...v5.23.3) (2024-11-11)

### Bug Fixes
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.23.3",
"version": "5.23.5",
"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.23.3",
"version": "5.23.5",
"license": "Apache-2.0",
"peerDependencies": {
"@angular/common": "^18.0.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,28 @@ export class DataSortBase {
if (!clientSideSorting || sortColumn === '') {
return [items, filters, sortColumn, sortDirection, translations]
}
let translatedColValues: Record<string, string> = Object.fromEntries(
items.map((i) => [
ObjectUtils.resolveFieldData(i, sortColumn)?.toString(),
ObjectUtils.resolveFieldData(i, sortColumn)?.toString(),
])
)
if (columns.find((h) => h.id === sortColumn)?.columnType === ColumnType.TRANSLATION_KEY) {
translatedColValues = translations[sortColumn]
const column = columns.find((h) => h.id === sortColumn)
let colValues: Record<string, string>
if (column?.columnType === ColumnType.DATE || column?.columnType === ColumnType.RELATIVE_DATE) {
colValues = Object.fromEntries(
items.map((i) => [
ObjectUtils.resolveFieldData(i, sortColumn) as Date,
ObjectUtils.resolveFieldData(i, sortColumn) as Date,
])
)
} else {
colValues = Object.fromEntries(
items.map((i) => [
ObjectUtils.resolveFieldData(i, sortColumn)?.toString(),
ObjectUtils.resolveFieldData(i, sortColumn)?.toString(),
])
)
}
if (column?.columnType === ColumnType.TRANSLATION_KEY) {
colValues = translations[sortColumn]
}
return [
[...items].sort(this.createCompareFunction(translatedColValues, sortColumn, sortDirection)),
[...items].sort(this.createCompareFunction(colValues, sortColumn, sortDirection)),
filters,
sortColumn,
sortDirection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,33 @@
>
<ng-template pTemplate="columnIdCell" let-rowObject="rowObject" let-column="column">
<ng-container
[ngTemplateOutlet]="tableValueTemplate"
[ngTemplateOutlet]="templates[column.id]"
[ngTemplateOutletContext]="{
templates: templates,
rowObject: rowObject,
column: column
}"
rowObject: rowObject,
column: column,
}"
>
</ng-container>
</ng-template>
<ng-template pTemplate="valueIdCell" let-rowObject="rowObject" let-column="column">
<ng-container
[ngTemplateOutlet]="tableValueTemplate"
[ngTemplateOutletContext]="{
templates: templates,
rowObject: rowObject,
column: column
}"
>
<ng-container *ngIf="getColumn(rowObject['valueColumnId'], columns) as valueColumn">
<ng-container
*ngIf="!valueColumn.filterType || valueColumn.filterType === FilterType.EQUAL"
[ngTemplateOutlet]="templates[valueColumn.id]"
[ngTemplateOutletContext]="{
rowObject: getRowForValueColumn(rowObject),
column: valueColumn
}"
>
</ng-container>
<ng-container
*ngIf="valueColumn.filterType === FilterType.TRUTHY"
[ngTemplateOutlet]="truthyTemplate"
[ngTemplateOutletContext]="{
value: resolveFieldData(rowObject, column.id)
}"
>
</ng-container>
</ng-container>
</ng-template>
<ng-template pTemplate="actionsIdCell" let-rowObject="rowObject" let-column="column">
Expand All @@ -181,37 +190,6 @@
</div>
</ng-container>

<ng-template #tableValueTemplate let-templates="templates" let-rowObject="rowObject" let-column="column">
<ng-container
*ngIf="column.id !== 'value'"
[ngTemplateOutlet]="templates[column.id]"
[ngTemplateOutletContext]="{
rowObject: rowObject,
column: column
}"
>
</ng-container>
<ng-container *ngIf="column.id === 'value'">
<ng-container
*ngIf="!rowObject['columnFilterType'] || rowObject['columnFilterType'] === FilterType.EQUAL"
[ngTemplateOutlet]="templates[rowObject['columnId']]"
[ngTemplateOutletContext]="{
rowObject: rowObject,
column: column
}"
>
</ng-container>
<ng-container
*ngIf="rowObject['columnFilterType'] === FilterType.TRUTHY"
[ngTemplateOutlet]="truthyTemplate"
[ngTemplateOutletContext]="{
value: resolveFieldData(rowObject, column.id)
}"
>
</ng-container>
</ng-container>
</ng-template>

<ng-template #chipTemplate let-templates="templates" let-filter="filter" let-column="column">
<ng-container
*ngIf="templates[column.id] as template"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export type FilterViewRowDisplayData = {
value: unknown
}
export type FilterViewRowDetailData = FilterViewRowDisplayData & {
columnId: string
columnFilterType: FilterType | undefined
valueColumnId: string
}

export interface FilterViewComponentState {
Expand Down Expand Up @@ -110,13 +109,12 @@ export class FilterViewComponent implements OnInit {
id: `${f.columnId}-${f.value}`,
column: filterColumn.nameKey,
value: f.value,
columnId: filterColumn.id,
columnFilterType: filterColumn.filterType,
valueColumnId: filterColumn.id,
} satisfies FilterViewRowDetailData
})
.filter((v): v is FilterViewRowDetailData => v !== undefined)
.slice()
.sort((a, b) => columnIds.indexOf(a.columnId) - columnIds.indexOf(b.columnId))
.sort((a, b) => columnIds.indexOf(a.valueColumnId) - columnIds.indexOf(b.valueColumnId))
})
)
}
Expand Down Expand Up @@ -257,7 +255,7 @@ export class FilterViewComponent implements OnInit {
}

onFilterDelete(row: Row) {
const filters = this.filters.filter((f) => !(f.columnId === row['columnId'] && f.value === row['value']))
const filters = this.filters.filter((f) => !(f.columnId === row['valueColumnId'] && f.value === row['value']))
this.filters = filters
this.filtered.emit(filters)
this.componentStateChanged.emit({
Expand All @@ -282,6 +280,10 @@ export class FilterViewComponent implements OnInit {
return columns.find((c) => c.id === filter.columnId)
}

getColumn(colId: string, columns: DataTableColumn[]) {
return columns.find((c) => c.id === colId)
}

resolveFieldData(object: any, key: any) {
return ObjectUtils.resolveFieldData(object, key)
}
Expand All @@ -291,4 +293,11 @@ export class FilterViewComponent implements OnInit {
[filter.columnId]: filter.value,
}
}

getRowForValueColumn(row: Row): Row {
return {
id: row.id,
[row['valueColumnId'] as string]: row['value'],
}
}
}
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.23.3",
"version": "5.23.5",
"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.23.3",
"version": "5.23.5",
"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.23.3",
"version": "5.23.5",
"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.23.3",
"version": "5.23.5",
"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.23.3",
"version": "5.23.5",
"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.23.3",
"version": "5.23.5",
"license": "Apache-2.0",
"peerDependencies": {
"tslib": "^2.6.3",
Expand Down
2 changes: 1 addition & 1 deletion libs/keycloak-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/keycloak-auth",
"version": "5.23.3",
"version": "5.23.5",
"license": "Apache-2.0",
"peerDependencies": {
"@angular/common": "^18.0.5",
Expand Down
2 changes: 1 addition & 1 deletion libs/ngrx-accelerator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/ngrx-accelerator",
"version": "5.23.3",
"version": "5.23.5",
"peerDependencies": {
"@angular/core": "^18.0.5",
"@angular/router": "^18.0.5",
Expand Down
2 changes: 1 addition & 1 deletion libs/portal-integration-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/portal-integration-angular",
"version": "5.23.3",
"version": "5.23.5",
"license": "Apache-2.0",
"peerDependencies": {
"@angular/common": "^18.0.5",
Expand Down
2 changes: 1 addition & 1 deletion libs/portal-layout-styles/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/portal-layout-styles",
"version": "5.23.3",
"version": "5.23.5",
"license": "Apache-2.0",
"peerDependencies": {
"tslib": "^2.6.3"
Expand Down
2 changes: 1 addition & 1 deletion libs/shell-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onecx/shell-core",
"version": "5.23.3",
"version": "5.23.5",
"license": "Apache-2.0",
"peerDependencies": {
"rxjs": "^7.8.1",
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": "@onecx/onecx-portal-ui-libs",
"version": "5.23.3",
"version": "5.23.5",
"license": "Apache-2.0",
"scripts": {
"sass": "npx sass libs/portal-integration-angular/assets/styles.scss libs/portal-integration-angular/assets/output.css",
Expand Down

0 comments on commit 9655b3f

Please sign in to comment.