Skip to content

Commit

Permalink
tree view support
Browse files Browse the repository at this point in the history
  • Loading branch information
raronpxcsw committed Dec 7, 2023
1 parent 3d458ff commit f1c17dd
Show file tree
Hide file tree
Showing 20 changed files with 556 additions and 555 deletions.
61 changes: 0 additions & 61 deletions projects/aas-lib/src/lib/aas-table/aas-table-api.service.ts

This file was deleted.

88 changes: 25 additions & 63 deletions projects/aas-lib/src/lib/aas-table/aas-table.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,79 +7,40 @@
*****************************************************************************/

import { createAction, props } from '@ngrx/store';
import { AASDocument, AASDocumentNode, AASPage, aas } from 'common';
import { AASTableRow } from './aas-table.state';
import { TypedAction } from '@ngrx/store/src/models';
import { AASDocument } from 'common';
import { AASTableRow } from './aas-table.state';

export enum AASTableActionType {
INIT_LIST_VIEW = '[AASTable] init list view',
GET_FIRST_PAGE = '[AASTable] get first page',
GET_NEXT_PAGE = '[AASTable] get next page',
GET_PREVIOUS_PAGE = '[AASTable] previous next page',
SET_PAGE = '[AASTable] set page',
GET_LAST_PAGE = '[AASTable] get last page',
SET_CONTENT = '[AASTable] set content',
UPDATE_ROWS = '[AASTable] update Rows',
EXPAND = '[AASTable] expand',
COLLAPSE = '[AASTable] collapse',
TOGGLE_SELECTED = '[AASTable] toggle selected',
TOGGLE_SELECTIONS = '[AASTable] toggle selections',
ADD_ROOT = '[AASTable] add root',
INIT_TREE_VIEW = '[AASTable] init tree view',
SET_SELECTIONS = '[AASTable] set selections',
UPDATE_LIST_VIEW = '[AASTable] update list view',
UPDATE_TREE_VIEW = '[AASTable] update tree view',
}

export interface GetFirstPageAction extends TypedAction<AASTableActionType.GET_FIRST_PAGE> {
limit: number;
filter?: string;
}

export interface GetLastPageAction extends TypedAction<AASTableActionType.GET_LAST_PAGE> {
limit: number;
filter?: string;
export interface UpdateListViewAction extends TypedAction<AASTableActionType.UPDATE_LIST_VIEW> {
documents: AASDocument[];
}

export interface GetPreviousPageAction extends TypedAction<AASTableActionType.GET_PREVIOUS_PAGE> {
limit: number;
filter?: string;
export interface UpdateTreeViewAction extends TypedAction<AASTableActionType.UPDATE_TREE_VIEW> {
documents: AASDocument[];
}

export interface GetNextPageAction extends TypedAction<AASTableActionType.GET_NEXT_PAGE> {
limit: number;
filter?: string;
}

export const getFirstPage = createAction(
AASTableActionType.GET_FIRST_PAGE,
props<{ limit: number, filter?: string }>());

export const getNextPage = createAction(
AASTableActionType.GET_NEXT_PAGE,
props<{ limit: number, filter?: string }>());
export const updateListView = createAction(
AASTableActionType.UPDATE_LIST_VIEW,
props<{ documents: AASDocument[] }>());

export const getPreviousPage = createAction(
AASTableActionType.GET_PREVIOUS_PAGE,
props<{ limit: number, filter?: string }>());
export const updateTreeView = createAction(
AASTableActionType.UPDATE_TREE_VIEW,
props<{ documents: AASDocument[] }>());

export const getLastPage = createAction(
AASTableActionType.GET_LAST_PAGE,
props<{ limit: number, filter?: string }>());

export const setPage = createAction(
export const setRows = createAction(
AASTableActionType.SET_PAGE,
props<{ page: AASPage }>());

export const setContent = createAction(
AASTableActionType.SET_CONTENT,
props<{ document: AASDocument, content: aas.Environment }>());

export const expandRow = createAction(
AASTableActionType.EXPAND,
props<{ row: AASTableRow }>());

export const collapseRow = createAction(
AASTableActionType.COLLAPSE,
props<{ row: AASTableRow }>());
props<{ rows: AASTableRow[] }>());

export const toggleSelected = createAction(
AASTableActionType.TOGGLE_SELECTED,
Expand All @@ -88,13 +49,14 @@ export const toggleSelected = createAction(
export const toggleSelections = createAction(
AASTableActionType.TOGGLE_SELECTIONS);

export const addRoot = createAction(
AASTableActionType.ADD_ROOT,
props<{ nodes: AASDocumentNode[] }>());

export const initTreeView = createAction(
AASTableActionType.INIT_TREE_VIEW);

export const setSelections = createAction(
AASTableActionType.SET_SELECTIONS,
props<{ documents: AASDocument[] }>());
props<{ documents: AASDocument[] }>());

export const expandRow = createAction(
AASTableActionType.EXPAND,
props<{ row: AASTableRow }>());

export const collapseRow = createAction(
AASTableActionType.COLLAPSE,
props<{ row: AASTableRow }>());
5 changes: 3 additions & 2 deletions projects/aas-lib/src/lib/aas-table/aas-table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
!
!---------------------------------------------------------------------------->

<table *ngIf="viewMode === 'list'; else treeView" class="table table-sm table-hover table-striped">
<table *ngIf="(viewMode | async) === 'list'; else treeView" class="table table-sm table-hover table-striped">
<thead>
<tr>
<th class="th-w-checkbox">
Expand Down Expand Up @@ -53,7 +53,7 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let row of rows | async">
<tr *ngFor="let row of rows | async" class="align-middle">
<td>
<div class="d-flex" style="overflow-x: hidden">
<div [ngStyle]="{'width': (row.level * 16) + 'px'}"></div>
Expand Down Expand Up @@ -82,6 +82,7 @@
</div>
</td>
<td>
<div>{{row.endpoint}}</div>
<div class="text-nowrap" placement="top" [ngbTooltip]="getToolTip(row)">{{row.id | max:80}}</div>
</td>
</tr>
Expand Down
Loading

0 comments on commit f1c17dd

Please sign in to comment.