Skip to content

Commit

Permalink
fix: zoneless aas components
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfaron committed Jun 9, 2024
1 parent 63afe88 commit 7f1e815
Show file tree
Hide file tree
Showing 23 changed files with 644 additions and 949 deletions.
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"bcryptjs": "^2.4.3",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
"chart.js": "^4.4.2",
"chart.js": "^4.4.3",
"cors": "^2.8.5",
"express": "^4.19.2",
"form-data": "^4.0.0",
Expand All @@ -66,24 +66,24 @@
"jwt-decode": "^4.0.0",
"lodash-es": "^4.17.21",
"lowdb": "^7.0.1",
"mongoose": "^8.3.1",
"mongoose": "^8.4.1",
"morgan": "^1.10.0",
"multer": "^1.4.5-lts.1",
"mysql2": "^3.9.4",
"node-opcua": "^2.124.0",
"mysql2": "^3.10.0",
"node-opcua": "^2.125.0",
"node-opcua-client-crawler": "^2.124.0",
"nodemailer": "^6.9.13",
"reflect-metadata": "^0.2.2",
"rxjs": "~7.8.1",
"swagger-ui-express": "^5.0.0",
"tslib": "^2.6.2",
"swagger-ui-express": "^5.0.1",
"tslib": "^2.6.3",
"tsoa": "^5.1.1",
"tsyringe": "^4.8.0",
"uuid": "^9.0.1",
"webdav": "^5.5.0",
"webdav": "^5.6.0",
"winston": "^3.13.0",
"winston-daily-rotate-file": "^5.0.0",
"ws": "^8.16.0",
"ws": "^8.17.0",
"xpath": "^0.0.34",
"zone.js": "~0.14.4"
},
Expand All @@ -96,28 +96,28 @@
"@angular-eslint/template-parser": "17.3.0",
"@angular/cli": "^17.3.4",
"@angular/compiler-cli": "^17.3.4",
"@babel/plugin-syntax-import-attributes": "^7.24.1",
"@babel/plugin-syntax-import-attributes": "^7.24.7",
"@jest/globals": "^29.7.0",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^10.0.3",
"@semantic-release/github": "^10.0.6",
"@types/bcryptjs": "^2.4.6",
"@types/bootstrap": "^5.2.10",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/jasmine": "^5.1.4",
"@types/jquery": "^3.5.29",
"@types/jquery": "^3.5.30",
"@types/jsonwebtoken": "^9.0.6",
"@types/lodash-es": "^4.17.12",
"@types/morgan": "^1.9.9",
"@types/multer": "^1.4.11",
"@types/node": "^20.11.18",
"@types/nodemailer": "^6.4.14",
"@types/node": "^20.14.2",
"@types/nodemailer": "^6.4.15",
"@types/supertest": "^6.0.2",
"@types/swagger-ui-express": "^4.1.6",
"@types/uuid": "^9.0.8",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"@typescript-eslint/parser": "^7.12.0",
"babel-plugin-transform-import-meta": "^2.2.1",
"esbuild": "^0.20.2",
"eslint": "^8.56.0",
Expand All @@ -135,12 +135,12 @@
"karma-jasmine-html-reporter": "^2.1.0",
"karma-junit-reporter": "^2.0.1",
"ng-packagr": "^17.3.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"prettier": "^3.3.1",
"rimraf": "^5.0.7",
"semantic-release": "^23.0.8",
"supertest": "^6.3.4",
"ts-jest": "^29.1.2",
"ts-jest": "^29.1.4",
"ts-node": "^10.9.2",
"typescript": "^5.2.2"
"typescript": "^5.4.5"
}
}
43 changes: 18 additions & 25 deletions projects/aas-lib/src/lib/aas-tree/aas-tree-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import { Injectable } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import trim from 'lodash-es/trim';
import { Subscription } from 'rxjs';
import {
aas,
AASAbbreviation,
Expand All @@ -27,21 +26,15 @@ import { AASTreeStore, Operator, SearchQuery, SearchTerm } from './aas-tree.stor
@Injectable()
export class AASTreeSearch {
private readonly loop = true;
private readonly subscription = new Subscription();
private terms: SearchTerm[] = [];

public constructor(
private readonly store: AASTreeStore,
private readonly translate: TranslateService,
) {
this.subscription.add(this.store.selectTerms.subscribe(() => this.findFirst()));
}

public destroy(): void {
this.subscription.unsubscribe();
}
) {}

public find(referable: aas.Referable): void {
const index = this.store.rows.findIndex(row => row.element === referable);
const index = this.store.rows().findIndex(row => row.element === referable);
if (index >= 0) {
this.store.setMatchIndex(index);
}
Expand Down Expand Up @@ -70,29 +63,29 @@ export class AASTreeSearch {
}

if (terms.length > 0) {
this.store.setSearchText(terms);
this.terms = terms;
} else {
this.store.setMatchIndex(-1);
}
}

public findNext(): boolean {
let completed = false;
if (this.store.rows.length > 0 && this.store.terms.length > 0) {
if (this.store.rows().length > 0 && this.terms.length > 0) {
let match = false;
let i = this.store.index < 0 ? 0 : this.store.index + 1;
if (i >= this.store.rows.length) {
let i = this.store.matchIndex() < 0 ? 0 : this.store.matchIndex() + 1;
if (i >= this.store.rows().length) {
i = 0;
}

const start = i;
while (this.loop) {
if (this.match(this.store.rows[i])) {
if (this.match(this.store.rows()[i])) {
match = true;
break;
}

if (++i >= this.store.rows.length) {
if (++i >= this.store.rows().length) {
i = 0;
completed = true;
}
Expand All @@ -110,18 +103,18 @@ export class AASTreeSearch {

public findPrevious(): boolean {
let completed = false;
if (this.store.rows.length > 0 && this.store.terms.length > 0) {
if (this.store.rows().length > 0 && this.terms.length > 0) {
let match = false;
let i = this.store.index <= 0 ? this.store.rows.length - 1 : this.store.index - 1;
let i = this.store.matchIndex() <= 0 ? this.store.rows().length - 1 : this.store.matchIndex() - 1;
const start = i;
while (this.loop) {
if (this.match(this.store.rows[i])) {
if (this.match(this.store.rows()[i])) {
match = true;
break;
}

if (--i <= 0) {
i = this.store.rows.length - 1;
i = this.store.rows().length - 1;
completed = true;
}

Expand All @@ -141,17 +134,17 @@ export class AASTreeSearch {
}

private findFirst(): void {
if (this.store.rows.length > 0 && this.store.terms.length > 0) {
if (this.store.rows().length > 0 && this.terms.length > 0) {
let match = false;
let i = this.store.index < 0 ? 0 : this.store.index;
let i = this.store.matchIndex() < 0 ? 0 : this.store.matchIndex();
const start = i;
while (this.loop) {
if (this.match(this.store.rows[i])) {
if (this.match(this.store.rows()[i])) {
match = true;
break;
}

if (++i >= this.store.rows.length) {
if (++i >= this.store.rows().length) {
i = 0;
}

Expand Down Expand Up @@ -245,7 +238,7 @@ export class AASTreeSearch {

private match(row: AASTreeRow): boolean {
let match = false;
for (const term of this.store.terms) {
for (const term of this.terms) {
if (term.query) {
if (row.element.modelType === term.query.modelType) {
if (term.query.name) {
Expand Down
8 changes: 4 additions & 4 deletions projects/aas-lib/src/lib/aas-tree/aas-tree.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
!
!---------------------------------------------------------------------------->

@if (document?.content) {
@if (document()?.content) {
<table class="table table-sm table-hover table-striped align-middle">
<thead>
<tr>
<th class="aas-tree-th-checkbox">
<input type="checkbox" class="form-check-input" (change)="toggleSelections()"
[disabled]="state === 'online'" [indeterminate]="someSelected" [checked]="everySelected">
[disabled]="state() === 'online'" [indeterminate]="someSelected()" [checked]="everySelected()">
</th>
<th>
<a class="link-secondary" href="javascript:void(0);" (click)="collapse()">
Expand All @@ -23,11 +23,11 @@
</tr>
</thead>
<tbody>
@for (node of nodes; track node) {
@for (node of nodes(); track node) {
<tr [ngClass]="visualState(node)" [id]="node.id">
<td>
<input type="checkbox" class="form-check-input" (change)="toggleSelection(node)"
[checked]="node.selected" [disabled]="state === 'online'" />
[checked]="node.selected" [disabled]="state() === 'online'" />
</td>
<td [colSpan]="node.isLeaf ? 1 : 2">
<div class="d-flex" style="overflow-x: hidden">
Expand Down
Loading

0 comments on commit 7f1e815

Please sign in to comment.