@quandis/qbo4.ui 4.0.1-CI-20240403-131518
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +52 -0
- package/readme.md +456 -0
- package/src/qbo/Program.d.ts +18 -0
- package/src/qbo/Program.js +18 -0
- package/src/qbo/Program.ts +19 -0
- package/src/qbo/qbo-api.d.ts +27 -0
- package/src/qbo/qbo-api.js +96 -0
- package/src/qbo/qbo-api.ts +106 -0
- package/src/qbo/qbo-badge.d.ts +32 -0
- package/src/qbo/qbo-badge.js +93 -0
- package/src/qbo/qbo-badge.js.map +1 -0
- package/src/qbo/qbo-badge.ts +80 -0
- package/src/qbo/qbo-breadcrumb.d.ts +23 -0
- package/src/qbo/qbo-breadcrumb.js +132 -0
- package/src/qbo/qbo-breadcrumb.ts +96 -0
- package/src/qbo/qbo-datalist.d.ts +22 -0
- package/src/qbo/qbo-datalist.js +126 -0
- package/src/qbo/qbo-datalist.ts +104 -0
- package/src/qbo/qbo-docviewer.d.ts +15 -0
- package/src/qbo/qbo-docviewer.js +55 -0
- package/src/qbo/qbo-docviewer.ts +39 -0
- package/src/qbo/qbo-fetch.d.ts +29 -0
- package/src/qbo/qbo-fetch.js +134 -0
- package/src/qbo/qbo-fetch.ts +127 -0
- package/src/qbo/qbo-json.d.ts +8 -0
- package/src/qbo/qbo-json.js +85 -0
- package/src/qbo/qbo-json.ts +92 -0
- package/src/qbo/qbo-link.d.ts +15 -0
- package/src/qbo/qbo-link.js +48 -0
- package/src/qbo/qbo-link.js.map +1 -0
- package/src/qbo/qbo-link.ts +34 -0
- package/src/qbo/qbo-logging.d.ts +13 -0
- package/src/qbo/qbo-logging.js +92 -0
- package/src/qbo/qbo-logging.ts +72 -0
- package/src/qbo/qbo-mainmenu.d.ts +41 -0
- package/src/qbo/qbo-mainmenu.js +307 -0
- package/src/qbo/qbo-mainmenu.ts +263 -0
- package/src/qbo/qbo-markdown.d.ts +9 -0
- package/src/qbo/qbo-markdown.js +33 -0
- package/src/qbo/qbo-markdown.js.map +1 -0
- package/src/qbo/qbo-markdown.ts +22 -0
- package/src/qbo/qbo-microphone.d.ts +31 -0
- package/src/qbo/qbo-microphone.js +149 -0
- package/src/qbo/qbo-microphone.js.map +1 -0
- package/src/qbo/qbo-microphone.ts +137 -0
- package/src/qbo/qbo-popover.d.ts +8 -0
- package/src/qbo/qbo-popover.js +41 -0
- package/src/qbo/qbo-popover.ts +26 -0
- package/src/qbo/qbo-popup-listener.d.ts +25 -0
- package/src/qbo/qbo-popup-listener.js +145 -0
- package/src/qbo/qbo-popup-listener.ts +129 -0
- package/src/qbo/qbo-popup.d.ts +19 -0
- package/src/qbo/qbo-popup.js +95 -0
- package/src/qbo/qbo-popup.ts +84 -0
- package/src/qbo/qbo-select.d.ts +22 -0
- package/src/qbo/qbo-select.js +87 -0
- package/src/qbo/qbo-select.ts +65 -0
- package/src/qbo/qbo-sidebar.d.ts +10 -0
- package/src/qbo/qbo-sidebar.js +65 -0
- package/src/qbo/qbo-sidebar.ts +41 -0
- package/src/qbo/qbo-table.d.ts +23 -0
- package/src/qbo/qbo-table.js +94 -0
- package/src/qbo/qbo-table.js.map +1 -0
- package/src/qbo/qbo-table.ts +80 -0
- package/src/qbo/qbo-validate.d.ts +20 -0
- package/src/qbo/qbo-validate.js +92 -0
- package/src/qbo/qbo-validate.js.map +1 -0
- package/src/qbo/qbo-validate.ts +77 -0
- package/src/qbo/qbo-validators.d.ts +37 -0
- package/src/qbo/qbo-validators.js +72 -0
- package/src/qbo/qbo-validators.ts +66 -0
- package/src/qbo/styles.d.ts +3 -0
- package/src/qbo/styles.js +27 -0
- package/src/qbo/styles.ts +30 -0
- package/src/qbo-code/qbo-code.d.ts +12 -0
- package/src/qbo-code/qbo-code.js +54 -0
- package/src/qbo-code/qbo-code.ts +40 -0
- package/src/qbo-flowchart/qbo-flowchart.d.ts +45 -0
- package/src/qbo-flowchart/qbo-flowchart.js +309 -0
- package/src/qbo-flowchart/qbo-flowchart.js.map +1 -0
- package/src/qbo-flowchart/qbo-flowchart.ts +320 -0
- package/src/qbo-flowchart/readme.md +2 -0
- package/wwwroot/js/qbo4.ui-code.js +37965 -0
- package/wwwroot/js/qbo4.ui-code.min.js +3 -0
- package/wwwroot/js/qbo4.ui-code.min.js.LICENSE.txt +32 -0
- package/wwwroot/js/qbo4.ui-code.min.js.map +1 -0
- package/wwwroot/js/qbo4.ui-flowchart.js +44909 -0
- package/wwwroot/js/qbo4.ui-flowchart.min.js +9 -0
- package/wwwroot/js/qbo4.ui-flowchart.min.js.LICENSE.txt +43 -0
- package/wwwroot/js/qbo4.ui-flowchart.min.js.map +1 -0
- package/wwwroot/js/qbo4.ui.js +18840 -0
- package/wwwroot/js/qbo4.ui.min.js +108 -0
- package/wwwroot/js/qbo4.ui.min.js.LICENSE.txt +53 -0
- package/wwwroot/js/qbo4.ui.min.js.map +1 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { EditorView } from "@codemirror/view";
|
|
4
|
+
/**
|
|
5
|
+
* Renders CodeMirror to edit HTML.
|
|
6
|
+
*/
|
|
7
|
+
export declare class QboCode extends LitElement {
|
|
8
|
+
get value(): string | undefined;
|
|
9
|
+
connectedCallback(): Promise<void>;
|
|
10
|
+
editor: EditorView | null;
|
|
11
|
+
render(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import 'reflect-metadata';
|
|
11
|
+
import { LitElement } from 'lit';
|
|
12
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
13
|
+
import { basicSetup } from "codemirror";
|
|
14
|
+
import { EditorView, keymap } from "@codemirror/view";
|
|
15
|
+
import { html as htmlcode } from "@codemirror/lang-html";
|
|
16
|
+
import { indentWithTab } from "@codemirror/commands";
|
|
17
|
+
/**
|
|
18
|
+
* Renders CodeMirror to edit HTML.
|
|
19
|
+
*/
|
|
20
|
+
let QboCode = class QboCode extends LitElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.editor = null;
|
|
24
|
+
}
|
|
25
|
+
get value() { return this.editor?.state.doc.toString(); }
|
|
26
|
+
;
|
|
27
|
+
async connectedCallback() {
|
|
28
|
+
super.connectedCallback();
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const code = this.querySelector('*[slot=code]')?.innerHTML ?? this.innerHTML;
|
|
32
|
+
this.editor ??= new EditorView({
|
|
33
|
+
doc: code.trim(),
|
|
34
|
+
extensions: [
|
|
35
|
+
basicSetup,
|
|
36
|
+
htmlcode(),
|
|
37
|
+
keymap.of([indentWithTab]),
|
|
38
|
+
EditorView.updateListener.of((e) => {
|
|
39
|
+
this.dispatchEvent(new CustomEvent('change', { detail: { code: this.value } }));
|
|
40
|
+
})
|
|
41
|
+
],
|
|
42
|
+
parent: this.shadowRoot,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
__decorate([
|
|
47
|
+
property(),
|
|
48
|
+
__metadata("design:type", Object),
|
|
49
|
+
__metadata("design:paramtypes", [])
|
|
50
|
+
], QboCode.prototype, "value", null);
|
|
51
|
+
QboCode = __decorate([
|
|
52
|
+
customElement('qbo-code')
|
|
53
|
+
], QboCode);
|
|
54
|
+
export { QboCode };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { html, css, LitElement } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { basicSetup } from "codemirror"
|
|
5
|
+
import { EditorView, keymap } from "@codemirror/view"
|
|
6
|
+
import { html as htmlcode } from "@codemirror/lang-html"
|
|
7
|
+
import { indentWithTab } from "@codemirror/commands"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Renders CodeMirror to edit HTML.
|
|
11
|
+
*/
|
|
12
|
+
@customElement('qbo-code')
|
|
13
|
+
export class QboCode extends LitElement
|
|
14
|
+
{
|
|
15
|
+
@property()
|
|
16
|
+
get value() { return this.editor?.state.doc.toString() };
|
|
17
|
+
|
|
18
|
+
async connectedCallback() {
|
|
19
|
+
super.connectedCallback();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
editor: EditorView | null = null;
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
const code = this.querySelector('*[slot=code]')?.innerHTML ?? this.innerHTML;
|
|
26
|
+
this.editor ??= new EditorView({
|
|
27
|
+
doc: code.trim(),
|
|
28
|
+
extensions: [
|
|
29
|
+
basicSetup,
|
|
30
|
+
htmlcode(),
|
|
31
|
+
keymap.of([indentWithTab]),
|
|
32
|
+
EditorView.updateListener.of((e) => {
|
|
33
|
+
this.dispatchEvent(new CustomEvent('change', { detail: { code: this.value } }));
|
|
34
|
+
})
|
|
35
|
+
],
|
|
36
|
+
parent: <DocumentFragment>this.shadowRoot,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { PropertyValues, LitElement } from 'lit';
|
|
3
|
+
import { dia } from '@joint/core';
|
|
4
|
+
interface TemplateOptions {
|
|
5
|
+
label: string;
|
|
6
|
+
position: number;
|
|
7
|
+
height: number;
|
|
8
|
+
width: number;
|
|
9
|
+
spacing: number;
|
|
10
|
+
color?: string | null;
|
|
11
|
+
bgcolor?: string | null;
|
|
12
|
+
element?: string | null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Renders JointJs flowchart.
|
|
16
|
+
*/
|
|
17
|
+
export declare class QboFlowchart extends LitElement {
|
|
18
|
+
renderInHost: boolean;
|
|
19
|
+
paper: dia.Paper | null;
|
|
20
|
+
graph: dia.Graph;
|
|
21
|
+
namespace: any;
|
|
22
|
+
height: string;
|
|
23
|
+
width: string;
|
|
24
|
+
portRadius: Number;
|
|
25
|
+
router: String | any;
|
|
26
|
+
templateHeight: number;
|
|
27
|
+
templateWidth: number;
|
|
28
|
+
templateSpacing: number;
|
|
29
|
+
gridSize: number;
|
|
30
|
+
gridColor: string;
|
|
31
|
+
draggedElement: any | null;
|
|
32
|
+
static styles: import("lit").CSSResult;
|
|
33
|
+
createRenderRoot(): Element | ShadowRoot;
|
|
34
|
+
constructor();
|
|
35
|
+
firstUpdated(changedProperties: PropertyValues): void;
|
|
36
|
+
createGraph(): dia.Graph<dia.Graph.Attributes, dia.ModelSetOptions>;
|
|
37
|
+
createPaper(target: HTMLElement | null): dia.Paper;
|
|
38
|
+
createStep(cellView: any): void;
|
|
39
|
+
shapeFactory: Record<string, (options: Object) => dia.Element>;
|
|
40
|
+
createTemplate(options: TemplateOptions): dia.Element<dia.Element.Attributes, dia.ModelSetOptions>;
|
|
41
|
+
createPort(position: String, radius?: Number, tagName?: String, fill?: String, stroke?: String): Object;
|
|
42
|
+
showLinkTools(linkView: any): void;
|
|
43
|
+
render(): import("lit").TemplateResult<1>;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import 'reflect-metadata';
|
|
11
|
+
// import 'jointjs/dist/joint.css';
|
|
12
|
+
import { html, css, LitElement } from 'lit';
|
|
13
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
14
|
+
import { dia, elementTools, linkTools, shapes } from '@joint/core';
|
|
15
|
+
/**
|
|
16
|
+
* Renders JointJs flowchart.
|
|
17
|
+
*/
|
|
18
|
+
let QboFlowchart = class QboFlowchart extends LitElement {
|
|
19
|
+
static { this.styles = css `
|
|
20
|
+
.available-magnet {
|
|
21
|
+
fill: green;
|
|
22
|
+
}
|
|
23
|
+
.available-cell rect {
|
|
24
|
+
stroke-dasharray: 5, 2;
|
|
25
|
+
}`; }
|
|
26
|
+
createRenderRoot() {
|
|
27
|
+
return this.renderInHost ? this : super.createRenderRoot();
|
|
28
|
+
}
|
|
29
|
+
constructor() {
|
|
30
|
+
super();
|
|
31
|
+
this.renderInHost = true;
|
|
32
|
+
this.paper = null;
|
|
33
|
+
this.namespace = shapes;
|
|
34
|
+
this.height = '600px';
|
|
35
|
+
this.width = '100%';
|
|
36
|
+
this.portRadius = 3;
|
|
37
|
+
this.router = 'manhattan';
|
|
38
|
+
this.templateHeight = 30;
|
|
39
|
+
this.templateWidth = 80;
|
|
40
|
+
this.templateSpacing = 20;
|
|
41
|
+
this.gridSize = 10;
|
|
42
|
+
this.gridColor = 'lightgrey';
|
|
43
|
+
this.draggedElement = null;
|
|
44
|
+
this.shapeFactory = {
|
|
45
|
+
'Rectangle': (options) => {
|
|
46
|
+
return new shapes.standard.Rectangle(options);
|
|
47
|
+
},
|
|
48
|
+
'Polygon': (options) => {
|
|
49
|
+
options['transform'] = { rotate: 45 };
|
|
50
|
+
return new shapes.standard.Rectangle(options);
|
|
51
|
+
},
|
|
52
|
+
'Ellipse': (options) => {
|
|
53
|
+
return new shapes.standard.Ellipse(options);
|
|
54
|
+
},
|
|
55
|
+
'Circle': (options) => {
|
|
56
|
+
return new shapes.standard.Circle(options);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
this.graph = this.createGraph();
|
|
60
|
+
}
|
|
61
|
+
firstUpdated(changedProperties) {
|
|
62
|
+
super.firstUpdated(changedProperties);
|
|
63
|
+
this.paper = this.createPaper(this.renderRoot.querySelector('div'));
|
|
64
|
+
document.addEventListener('keydown', (event) => {
|
|
65
|
+
if (event.altKey && event.key === '+') {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
this.paper.scale(this.paper.scale().sx + 0.1, this.paper.scale().sy + 0.1);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
document.addEventListener('keydown', (event) => {
|
|
71
|
+
if (event.altKey && event.key === '-') {
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
this.paper.scale(this.paper.scale().sx - 0.1, this.paper.scale().sy - 0.1);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
document.addEventListener('keydown', (event) => {
|
|
77
|
+
if (event.altKey && event.key === '0') {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
this.paper.scale();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const templates = [
|
|
83
|
+
{ label: "Task", bgcolor: "#ADD8E6", color: "black" },
|
|
84
|
+
{ label: "Document", bgcolor: "#90EE90", color: "black" },
|
|
85
|
+
{ label: "Message", bgcolor: "#F08080", color: "black" },
|
|
86
|
+
{ label: "Score", bgcolor: "#E6E6FA", color: "black" },
|
|
87
|
+
{ label: "Ledger", bgcolor: "#FFA07A", color: "black" },
|
|
88
|
+
{ label: "Workflow", bgcolor: "#F5FFFA", color: "black" },
|
|
89
|
+
{ label: "Process", bgcolor: "#FFEBCD", color: "black" },
|
|
90
|
+
{ label: "If/Then", bgcolor: "#F0F8FF", element: "Ellipse", color: "black" },
|
|
91
|
+
{ label: "Poll", bgcolor: "#FFDAB9", element: "Ellipse", color: "black" },
|
|
92
|
+
{ label: "Advanced", bgcolor: "#F0FFF0", color: "black" },
|
|
93
|
+
];
|
|
94
|
+
const defaultOptions = {
|
|
95
|
+
label: "New",
|
|
96
|
+
position: 0,
|
|
97
|
+
height: this.templateHeight,
|
|
98
|
+
width: this.templateWidth,
|
|
99
|
+
spacing: this.templateSpacing,
|
|
100
|
+
color: 'white',
|
|
101
|
+
bgcolor: 'blue',
|
|
102
|
+
element: 'Rectangle'
|
|
103
|
+
};
|
|
104
|
+
templates.forEach((template, index) => {
|
|
105
|
+
// this.createTemplate({}template, ((index + 1) * this.templateSpacing) + (index * this.templateHeight));
|
|
106
|
+
const position = ((index + 1) * this.templateSpacing) + (index * this.templateHeight);
|
|
107
|
+
const options = Object.assign(defaultOptions, { position: position }, template);
|
|
108
|
+
this.createTemplate(options);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
createGraph() {
|
|
112
|
+
const graph = new dia.Graph({}, { cellNamespace: this.namespace });
|
|
113
|
+
return graph;
|
|
114
|
+
}
|
|
115
|
+
createPaper(target) {
|
|
116
|
+
const component = this;
|
|
117
|
+
const paper = new dia.Paper({
|
|
118
|
+
el: target,
|
|
119
|
+
model: this.graph,
|
|
120
|
+
width: component.width,
|
|
121
|
+
height: component.height,
|
|
122
|
+
gridSize: component.gridSize,
|
|
123
|
+
drawGrid: true,
|
|
124
|
+
cellViewNamespace: this.namespace,
|
|
125
|
+
background: {
|
|
126
|
+
color: component.gridColor
|
|
127
|
+
},
|
|
128
|
+
defaultLink: () => new shapes.standard.Link({
|
|
129
|
+
router: {
|
|
130
|
+
name: component.router, args: { step: 5 }
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
interactive: {
|
|
134
|
+
linkMove: true
|
|
135
|
+
// arrowheadMove: true,
|
|
136
|
+
},
|
|
137
|
+
linkPinning: false,
|
|
138
|
+
markAvailable: true,
|
|
139
|
+
snapLinks: { radius: 20 },
|
|
140
|
+
validateConnection: function (cellViewS, magnetS, cellViewT, magnetT, end, linkView) {
|
|
141
|
+
if (cellViewS === cellViewT)
|
|
142
|
+
return false;
|
|
143
|
+
return magnetT !== null; // && magnetT.getAttribute('port-group') !== 'restart';
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
// Register events
|
|
147
|
+
paper.on('link:mouseenter', (linkView) => {
|
|
148
|
+
this.showLinkTools(linkView);
|
|
149
|
+
});
|
|
150
|
+
paper.on('link:mouseleave', (linkView) => {
|
|
151
|
+
linkView.removeTools();
|
|
152
|
+
});
|
|
153
|
+
paper.on('element:mouseenter', elementView => elementView.showTools());
|
|
154
|
+
paper.on('element:mouseleave', elementView => elementView.hideTools());
|
|
155
|
+
paper.on('selection:change', function (selectedModels, options) {
|
|
156
|
+
// Reset styles for all elements
|
|
157
|
+
component.graph.getCells().forEach(function (cell) {
|
|
158
|
+
cell.attr('body/stroke', 'none');
|
|
159
|
+
});
|
|
160
|
+
// Apply a distinct style to selected models
|
|
161
|
+
selectedModels.forEach(function (cell) {
|
|
162
|
+
cell.attr('body/stroke', 'red');
|
|
163
|
+
cell.attr('body/stroke-width', 2);
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
return paper;
|
|
167
|
+
}
|
|
168
|
+
createStep(cellView) {
|
|
169
|
+
const component = this;
|
|
170
|
+
cellView.on('element:pointerdown', function (evt) {
|
|
171
|
+
// Clone the element
|
|
172
|
+
component.draggedElement = cellView.model.clone();
|
|
173
|
+
// clonedRect.position(cellView.model)
|
|
174
|
+
// Set the fill color of the selected element to gray
|
|
175
|
+
cellView.model.attr('body/fill', 'gray');
|
|
176
|
+
// Add the cloned element to the paper
|
|
177
|
+
// clonedRect.position(evt.clientX, evt.clientY);
|
|
178
|
+
component.graph.addCell(component.draggedElement);
|
|
179
|
+
});
|
|
180
|
+
cellView.on('element:pointerup', function () {
|
|
181
|
+
cellView.model.attr('body/fill', component.draggedElement.attr('body/fill'));
|
|
182
|
+
// Swap positions
|
|
183
|
+
var originalPosition = cellView.model.position();
|
|
184
|
+
var clonedPosition = component.draggedElement.position();
|
|
185
|
+
cellView.model.position(clonedPosition.x, clonedPosition.y);
|
|
186
|
+
component.draggedElement.position(originalPosition.x, originalPosition.y);
|
|
187
|
+
component.draggedElement.addPorts([{ 'group': 'left' }, { 'group': 'top' }, { 'group': 'right' }, { 'group': 'bottom' }]);
|
|
188
|
+
var view = component.draggedElement.findView(component.paper);
|
|
189
|
+
view.addTools(new dia.ToolsView({
|
|
190
|
+
tools: [new elementTools.Remove()]
|
|
191
|
+
}));
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
createTemplate(options) {
|
|
195
|
+
// const left = this.renderRoot!.querySelector('div')!.clientWidth;
|
|
196
|
+
const left = this.paper['el'].clientWidth - options.spacing - options.width;
|
|
197
|
+
const template = this.shapeFactory[options.element ?? 'Rectangle']({
|
|
198
|
+
position: { x: left, y: options.position },
|
|
199
|
+
size: { width: options.width, height: options.height },
|
|
200
|
+
attrs: {
|
|
201
|
+
body: {
|
|
202
|
+
fill: options.bgcolor ?? 'blue',
|
|
203
|
+
},
|
|
204
|
+
label: {
|
|
205
|
+
text: options.label,
|
|
206
|
+
fill: options.color ?? 'white',
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
ports: {
|
|
210
|
+
groups: {
|
|
211
|
+
'left': this.createPort('left'),
|
|
212
|
+
'top': this.createPort('top'),
|
|
213
|
+
'right': this.createPort('right'),
|
|
214
|
+
'bottom': this.createPort('bottom')
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
this.graph.addCell(template);
|
|
219
|
+
this.createStep(this.paper.findViewByModel(template));
|
|
220
|
+
return template;
|
|
221
|
+
}
|
|
222
|
+
createPort(position, radius = this.portRadius, tagName = 'circle', fill = 'orange', stroke = 'blue') {
|
|
223
|
+
return {
|
|
224
|
+
position: { name: position },
|
|
225
|
+
attrs: {
|
|
226
|
+
portBody: {
|
|
227
|
+
magnet: true,
|
|
228
|
+
r: radius,
|
|
229
|
+
fill: fill,
|
|
230
|
+
stroke: stroke
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
markup: [{
|
|
234
|
+
tagName: tagName,
|
|
235
|
+
selector: 'portBody'
|
|
236
|
+
}]
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
showLinkTools(linkView) {
|
|
240
|
+
var tools = new dia.ToolsView({
|
|
241
|
+
tools: [
|
|
242
|
+
new linkTools.SourceArrowhead(),
|
|
243
|
+
new linkTools.TargetArrowhead(),
|
|
244
|
+
new linkTools.Remove()
|
|
245
|
+
]
|
|
246
|
+
});
|
|
247
|
+
linkView.addTools(tools);
|
|
248
|
+
}
|
|
249
|
+
render() {
|
|
250
|
+
return html `<slot><div></div></slot>`;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
__decorate([
|
|
254
|
+
property({ type: Boolean }),
|
|
255
|
+
__metadata("design:type", Object)
|
|
256
|
+
], QboFlowchart.prototype, "renderInHost", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
property({ type: Object }),
|
|
259
|
+
__metadata("design:type", Object)
|
|
260
|
+
], QboFlowchart.prototype, "paper", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
property({ type: Object }),
|
|
263
|
+
__metadata("design:type", dia.Graph)
|
|
264
|
+
], QboFlowchart.prototype, "graph", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
property({ type: Object }),
|
|
267
|
+
__metadata("design:type", Object)
|
|
268
|
+
], QboFlowchart.prototype, "namespace", void 0);
|
|
269
|
+
__decorate([
|
|
270
|
+
property({ type: String }),
|
|
271
|
+
__metadata("design:type", String)
|
|
272
|
+
], QboFlowchart.prototype, "height", void 0);
|
|
273
|
+
__decorate([
|
|
274
|
+
property({ type: String }),
|
|
275
|
+
__metadata("design:type", String)
|
|
276
|
+
], QboFlowchart.prototype, "width", void 0);
|
|
277
|
+
__decorate([
|
|
278
|
+
property({ type: Number }),
|
|
279
|
+
__metadata("design:type", Number)
|
|
280
|
+
], QboFlowchart.prototype, "portRadius", void 0);
|
|
281
|
+
__decorate([
|
|
282
|
+
property({ type: String }),
|
|
283
|
+
__metadata("design:type", Object)
|
|
284
|
+
], QboFlowchart.prototype, "router", void 0);
|
|
285
|
+
__decorate([
|
|
286
|
+
property({ type: Number }),
|
|
287
|
+
__metadata("design:type", Number)
|
|
288
|
+
], QboFlowchart.prototype, "templateHeight", void 0);
|
|
289
|
+
__decorate([
|
|
290
|
+
property({ type: Number }),
|
|
291
|
+
__metadata("design:type", Number)
|
|
292
|
+
], QboFlowchart.prototype, "templateWidth", void 0);
|
|
293
|
+
__decorate([
|
|
294
|
+
property({ type: Number }),
|
|
295
|
+
__metadata("design:type", Number)
|
|
296
|
+
], QboFlowchart.prototype, "templateSpacing", void 0);
|
|
297
|
+
__decorate([
|
|
298
|
+
property({ type: Number }),
|
|
299
|
+
__metadata("design:type", Number)
|
|
300
|
+
], QboFlowchart.prototype, "gridSize", void 0);
|
|
301
|
+
__decorate([
|
|
302
|
+
property({ type: String }),
|
|
303
|
+
__metadata("design:type", String)
|
|
304
|
+
], QboFlowchart.prototype, "gridColor", void 0);
|
|
305
|
+
QboFlowchart = __decorate([
|
|
306
|
+
customElement('qbo-flowchart'),
|
|
307
|
+
__metadata("design:paramtypes", [])
|
|
308
|
+
], QboFlowchart);
|
|
309
|
+
export { QboFlowchart };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qbo-select.js","sourceR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