mirror of
https://github.com/optim-enterprises-bv/siembol.git
synced 2025-11-01 19:07:59 +00:00
Config-editor-ui: update dependencies + response reordering tabs and enable copy/paste/undo/redo (#725)
This commit is contained in:
2
config-editor/config-editor-ui/package-lock.json
generated
2
config-editor/config-editor-ui/package-lock.json
generated
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rule-editor.ui",
|
"name": "rule-editor.ui",
|
||||||
"version": "2.6.1-dev",
|
"version": "2.6.2-dev",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
@@ -34,8 +34,8 @@
|
|||||||
"@angular/platform-browser": "^13.3.1",
|
"@angular/platform-browser": "^13.3.1",
|
||||||
"@angular/platform-browser-dynamic": "^13.3.1",
|
"@angular/platform-browser-dynamic": "^13.3.1",
|
||||||
"@angular/router": "^13.3.1",
|
"@angular/router": "^13.3.1",
|
||||||
"@ngx-formly/core": "^6.0.0-beta.3",
|
"@ngx-formly/core": "^6.0.0-rc.0",
|
||||||
"@ngx-formly/material": "^6.0.0-beta.3",
|
"@ngx-formly/material": "^6.0.0-rc.0",
|
||||||
"@types/json-schema": "^7.0.10",
|
"@types/json-schema": "^7.0.10",
|
||||||
"jasmine-marbles": "^0.9.2",
|
"jasmine-marbles": "^0.9.2",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<mat-menu #menu="matMenu">
|
<mat-menu #menu="matMenu">
|
||||||
<button *ngFor="let service of serviceNames" [routerLink]="['/' + getPath(service)]" mat-menu-item>
|
<button *ngFor="let service of serviceNames" [routerLink]="['/' + getPath(service)]" mat-menu-item>
|
||||||
<mat-icon *ngIf="service === (serviceName$ | async); else blank">check</mat-icon>
|
<mat-icon *ngIf="service === (serviceName$ | async); else blank">check</mat-icon>
|
||||||
<ng-template #blank><mat-icon>blank</mat-icon></ng-template>
|
<ng-template #blank></ng-template>
|
||||||
{{service | titlecase}}
|
{{service | titlecase}}
|
||||||
</button>
|
</button>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
|
|||||||
@@ -6,7 +6,12 @@ import { FieldArrayType } from '@ngx-formly/core';
|
|||||||
template: `
|
template: `
|
||||||
<div>
|
<div>
|
||||||
<mat-tab-group animationDuration="0ms" [(selectedIndex)]="selectedTab">
|
<mat-tab-group animationDuration="0ms" [(selectedIndex)]="selectedTab">
|
||||||
<mat-tab *ngFor="let tab of field.fieldGroup; let i = index" [label]="getUnionType(tab?.model)">
|
<mat-tab *ngFor="let tab of field.fieldGroup; let i = index">
|
||||||
|
<ng-template mat-tab-label>
|
||||||
|
<mat-icon *ngIf="i != 0" (click)="moveDown(i)">arrow_left</mat-icon>
|
||||||
|
{{ getUnionType(tab?.model) }}
|
||||||
|
<mat-icon *ngIf="i != field.fieldGroup.length - 1" (click)="moveUp(i)">arrow_right</mat-icon>
|
||||||
|
</ng-template>
|
||||||
<span class="align-right">
|
<span class="align-right">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
@@ -60,6 +65,15 @@ import { FieldArrayType } from '@ngx-formly/core';
|
|||||||
display: table;
|
display: table;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-tab-label {
|
||||||
|
padding: 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-tab-label .mat-tab-label-content {
|
||||||
|
width: 100%;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
`,
|
`,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
@@ -71,41 +85,35 @@ export class TabArrayTypeComponent extends FieldArrayType {
|
|||||||
return keys[keys.length - 1];
|
return keys[keys.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
add(i: number) {
|
add(index: number, unionModel = null) {
|
||||||
const modelLength = this.model ? this.model.length : 0;
|
const modelLength = this.model ? this.model.length : 0;
|
||||||
super.add(modelLength);
|
super.add(modelLength, unionModel);
|
||||||
this.selectedTab = i;
|
for (let j = this.model.length - 1; j >= index; j--) {
|
||||||
for (let j = this.model.length - 1; j >= i; j--) {
|
this.moveUp(j);
|
||||||
this.moveDown(j);
|
|
||||||
}
|
}
|
||||||
|
this.selectedTab = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
moveDown(i: number) {
|
moveDown(index: number) {
|
||||||
if (i === this.model.length - 1) {
|
if (index === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reorder(i, i + 1);
|
this.reorder(index - 1, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
private reorder(oldI: number, newI: number) {
|
moveUp(index: number) {
|
||||||
this.reorderFields(this.field.fieldGroup, oldI, newI);
|
if (index === this.model.length - 1) {
|
||||||
this.reorderItems(this.model, oldI, newI);
|
return;
|
||||||
this.reorderItems(this.formControl.controls, oldI, newI);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private reorderItems(obj: any[], oldI: number, newI: number) {
|
this.reorder(index, index + 1);
|
||||||
const old = obj[oldI];
|
|
||||||
obj[oldI] = obj[newI];
|
|
||||||
obj[newI] = old;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private reorderFields(obj: any[], oldI: number, newI: number) {
|
private reorder(oldIndex: number, newIndex: number) {
|
||||||
const old = obj[oldI];
|
const unionModel = this.model[oldIndex];
|
||||||
obj[oldI] = obj[newI];
|
this.remove(oldIndex);
|
||||||
obj[oldI].key = `${oldI}`;
|
this.add(newIndex, unionModel);
|
||||||
|
}
|
||||||
|
|
||||||
obj[newI] = old;
|
|
||||||
obj[newI].key = `${newI}`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,11 +197,13 @@ export class SchemaService {
|
|||||||
for (const part of path) {
|
for (const part of path) {
|
||||||
sub = sub[part];
|
sub = sub[part];
|
||||||
}
|
}
|
||||||
|
if (sub) {
|
||||||
for (let i = 0; i < sub.length; i++) {
|
for (let i = 0; i < sub.length; i++) {
|
||||||
const temp = sub[i];
|
const temp = sub[i];
|
||||||
sub[i] = { [sub[i][this.selectorName]]: temp };
|
sub[i] = { [sub[i][this.selectorName]]: temp };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private wrapOptionalsInArray(obj: any) {
|
private wrapOptionalsInArray(obj: any) {
|
||||||
for (const optional of this.optionalObjects) {
|
for (const optional of this.optionalObjects) {
|
||||||
@@ -242,7 +244,6 @@ export class SchemaService {
|
|||||||
private wrapSchemaUnion(obj: any): any {
|
private wrapSchemaUnion(obj: any): any {
|
||||||
for (const item of obj) {
|
for (const item of obj) {
|
||||||
const temp = item.properties;
|
const temp = item.properties;
|
||||||
|
|
||||||
const required = item.required;
|
const required = item.required;
|
||||||
item.properties = { [item.title]: { properties: temp, required, type: 'object' } };
|
item.properties = { [item.title]: { properties: temp, required, type: 'object' } };
|
||||||
item.required = [item.title];
|
item.required = [item.title];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
@use '@angular/material' as mat;
|
@use '@angular/material' as mat;
|
||||||
@import '@angular/material/theming';
|
@import '@angular/material/theming';
|
||||||
@import '~material-design-icons/iconfont/material-icons.css';
|
@import 'https://fonts.googleapis.com/icon?family=Material+Icons';
|
||||||
@import 'gr-palette';
|
@import 'gr-palette';
|
||||||
@import 'text-diff-style.scss';
|
@import 'text-diff-style.scss';
|
||||||
// Plus imports for other components in your app.
|
// Plus imports for other components in your app.
|
||||||
|
|||||||
@@ -18,8 +18,7 @@
|
|||||||
"perConfigTestEnabled": true,
|
"perConfigTestEnabled": true,
|
||||||
"releaseTestEnabled": true,
|
"releaseTestEnabled": true,
|
||||||
"testCaseEnabled": false
|
"testCaseEnabled": false
|
||||||
},
|
}
|
||||||
"disableEditingFeatures": true
|
|
||||||
},
|
},
|
||||||
"alert": {
|
"alert": {
|
||||||
"release": {
|
"release": {
|
||||||
|
|||||||
Reference in New Issue
Block a user