Compare commits
4 Commits
bacd86d836
...
f8a199fd6a
| Author | SHA1 | Date | |
|---|---|---|---|
| f8a199fd6a | |||
| 48ae47d050 | |||
| 3386f0994f | |||
| 75f45c4d87 |
@@ -24,7 +24,6 @@ const routes: Routes = [
|
|||||||
imports: [
|
imports: [
|
||||||
RouterModule.forRoot(routes, {})
|
RouterModule.forRoot(routes, {})
|
||||||
],
|
],
|
||||||
//declarations: [VisualizationPageComponent],
|
|
||||||
declarations: [],
|
declarations: [],
|
||||||
exports: [RouterModule]
|
exports: [RouterModule]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,15 +1,36 @@
|
|||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
markdown {
|
||||||
|
--mdc-dialog-supporting-text-color: black;
|
||||||
|
}
|
||||||
|
.mat-mdc-dialog-content {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
height: 22em;
|
||||||
|
}
|
||||||
|
.mat-mdc-dialog-content > div {
|
||||||
|
width:50%;
|
||||||
|
}
|
||||||
|
.preview {
|
||||||
|
margin-left: 0.5em;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
mat-form-field textarea {
|
mat-form-field textarea {
|
||||||
height: 20em;
|
height: 20em;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<h1 mat-dialog-title>Add Text</h1>
|
<h1 mat-dialog-title>Add Text</h1>
|
||||||
<div mat-dialog-content>
|
<div mat-dialog-content>
|
||||||
|
<div>
|
||||||
<mat-form-field class="pdb-form-full-width">
|
<mat-form-field class="pdb-form-full-width">
|
||||||
<mat-label>Text</mat-label>
|
<mat-label>Text</mat-label>
|
||||||
<textarea matInput [(ngModel)]="text" #textElement focus ></textarea>
|
<textarea matInput [(ngModel)]="text" #textElement focus ></textarea>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<div>Text field supports <a href="https://spec.commonmark.org/" target="_blank" rel="noopener">Markdown</a>.</div>
|
<div>Text field supports <a href="https://spec.commonmark.org/" class="external-link" target="_blank" rel="noopener">Markdown</a>.</div>
|
||||||
|
</div>
|
||||||
|
<div class="preview">
|
||||||
|
<markdown [data]="this.text"></markdown>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div mat-dialog-actions align="end">
|
<div mat-dialog-actions align="end">
|
||||||
<button mat-button mat-dialog-close (click)="close()">Cancel</button>
|
<button mat-button mat-dialog-close (click)="close()">Cancel</button>
|
||||||
|
|||||||
@@ -21,9 +21,21 @@
|
|||||||
.content {
|
.content {
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
}
|
}
|
||||||
|
.dashboard-area {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
.dashboard-column {
|
.dashboard-column {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
|
/* make all columns equal width - flex-basis:0 to make all resizing start from the same size*/
|
||||||
|
flex-grow: 1;
|
||||||
|
flex-shrink: 1;
|
||||||
|
flex-basis: 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.editable-hovered {
|
.editable-hovered {
|
||||||
@@ -34,7 +46,6 @@
|
|||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.handle {
|
.handle {
|
||||||
display: block;
|
display: block;
|
||||||
height: 1.5em;
|
height: 1.5em;
|
||||||
@@ -68,16 +79,16 @@
|
|||||||
<p>{{dashboard.description}}</p>
|
<p>{{dashboard.description}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div cdkDropListGroup>
|
<div cdkDropListGroup class="dashboard-area">
|
||||||
<div
|
<div
|
||||||
cdkDropList
|
cdkDropList
|
||||||
class="dashboard-column"
|
class="dashboard-column"
|
||||||
*ngFor="let column of dashboard.arrangement"
|
*ngFor="let i of [0,1]"
|
||||||
[cdkDropListData]="column"
|
[cdkDropListData]="i"
|
||||||
(cdkDropListDropped)="drop($event)">
|
(cdkDropListDropped)="drop($event)">
|
||||||
<div
|
<div
|
||||||
cdkDrag
|
cdkDrag
|
||||||
*ngFor="let id of column"
|
*ngFor="let id of dashboard.arrangement[i]"
|
||||||
[attr.widget-id]="id">
|
[attr.widget-id]="id">
|
||||||
<div cdkDragHandle class="handle"><img src="/assets/img/drag_handle.svg" class="icon-small"/></div>
|
<div cdkDragHandle class="handle"><img src="/assets/img/drag_handle.svg" class="icon-small"/></div>
|
||||||
<app-text-widget
|
<app-text-widget
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ export class DashboardComponent implements OnInit {
|
|||||||
|
|
||||||
private repairArrangement(){
|
private repairArrangement(){
|
||||||
const arrangement = this.dashboard!.arrangement || [];
|
const arrangement = this.dashboard!.arrangement || [];
|
||||||
if (arrangement.length == 0){
|
for (let i = 0; i < 2; i++){
|
||||||
arrangement[0] = [];
|
arrangement[i] = arrangement[i] ?? [] ;
|
||||||
}
|
}
|
||||||
this.dashboard?.texts.forEach(t => {
|
this.dashboard?.texts.forEach(t => {
|
||||||
if (!this.arrangmentContainsId(arrangement, t.id)){
|
if (!this.arrangmentContainsId(arrangement, t.id)){
|
||||||
@@ -102,6 +102,7 @@ export class DashboardComponent implements OnInit {
|
|||||||
arrangement[0].push(t.id);
|
arrangement[0].push(t.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.dashboard!.arrangement = arrangement;
|
this.dashboard!.arrangement = arrangement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +119,7 @@ export class DashboardComponent implements OnInit {
|
|||||||
addText() {
|
addText() {
|
||||||
this.dialog.open(AddTextDialogComponent,{
|
this.dialog.open(AddTextDialogComponent,{
|
||||||
data: {text:""},
|
data: {text:""},
|
||||||
width: '600px'
|
width: '800px'
|
||||||
}).afterClosed().subscribe((text: string) => {
|
}).afterClosed().subscribe((text: string) => {
|
||||||
const widget = new TextWidget((<any>window).randomId(),'MEDIUM', text);
|
const widget = new TextWidget((<any>window).randomId(),'MEDIUM', text);
|
||||||
this.dashboard!.texts.push(widget);
|
this.dashboard!.texts.push(widget);
|
||||||
@@ -213,13 +214,14 @@ export class DashboardComponent implements OnInit {
|
|||||||
return this.plotWidgetRenderData.find( x => x.widget.id == id);
|
return this.plotWidgetRenderData.find( x => x.widget.id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
drop(event: CdkDragDrop<string[]>) {
|
drop(event: CdkDragDrop<number>) {
|
||||||
if (event.previousContainer === event.container) {
|
if (event.previousContainer === event.container) {
|
||||||
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
|
moveItemInArray(this.dashboard!.arrangement[event.container.data], event.previousIndex, event.currentIndex);
|
||||||
} else {
|
} else {
|
||||||
|
window.console.log("from ",event.previousContainer.data, " to ", event.container.data);
|
||||||
transferArrayItem(
|
transferArrayItem(
|
||||||
event.previousContainer.data,
|
this.dashboard!.arrangement[event.previousContainer.data],
|
||||||
event.container.data,
|
this.dashboard!.arrangement[event.container.data],
|
||||||
event.previousIndex,
|
event.previousIndex,
|
||||||
event.currentIndex,
|
event.currentIndex,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
.editable-hovered {
|
.editable-hovered {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: -2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-widget .editable-hovered {
|
.text-widget .editable-hovered {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export class TextWidgetComponent {
|
|||||||
edit() {
|
edit() {
|
||||||
this.dialog.open(AddTextDialogComponent,{
|
this.dialog.open(AddTextDialogComponent,{
|
||||||
data: {text : this.data.text},
|
data: {text : this.data.text},
|
||||||
width: '600px'
|
width: '800px'
|
||||||
}).afterClosed().subscribe((text?: string) => {
|
}).afterClosed().subscribe((text?: string) => {
|
||||||
if (text !== undefined) {
|
if (text !== undefined) {
|
||||||
this.data.text = text;
|
this.data.text = text;
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ app-add-text-dialog .mat-mdc-form-field-subscript-wrapper {
|
|||||||
line-height: 1em;
|
line-height: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
a[target="_blank"]:after {
|
a.external-link:after {
|
||||||
content: "";
|
content: "";
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background: url("assets/img/external-link.svg") no-repeat;
|
background: url("assets/img/external-link.svg") no-repeat;
|
||||||
@@ -223,8 +223,27 @@ a[target="_blank"]:after {
|
|||||||
|
|
||||||
/* styles for markdown*/
|
/* styles for markdown*/
|
||||||
markdown blockquote {
|
markdown blockquote {
|
||||||
border-left: 4px grey solid;
|
border-left: 3px grey solid;
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: 2em;
|
margin: 1em 0 1em 2em;
|
||||||
padding-left: 0.5em;
|
padding: 0.5em 0 0.5em 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
markdown table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
markdown table th, markdown table td {
|
||||||
|
border: solid 1px black;
|
||||||
|
padding: 0.4em;
|
||||||
|
}
|
||||||
|
markdown thead {
|
||||||
|
border-bottom: 2px black solid;
|
||||||
|
}
|
||||||
|
markdown tfoot {
|
||||||
|
border-top: 2px black solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
markdown pre {
|
||||||
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user