@acorex/components 22.2.6 → 22.2.7
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 +3 -15
- package/fesm2022/acorex-components-flow-chart.mjs +0 -735
- package/fesm2022/acorex-components-flow-chart.mjs.map +0 -1
- package/fesm2022/acorex-components-query-builder.mjs +0 -267
- package/fesm2022/acorex-components-query-builder.mjs.map +0 -1
- package/fesm2022/acorex-components-rest-api-generator.mjs +0 -403
- package/fesm2022/acorex-components-rest-api-generator.mjs.map +0 -1
- package/flow-chart/README.md +0 -3
- package/query-builder/README.md +0 -3
- package/rest-api-generator/README.md +0 -3
- package/types/acorex-components-flow-chart.d.ts +0 -187
- package/types/acorex-components-query-builder.d.ts +0 -52
- package/types/acorex-components-rest-api-generator.d.ts +0 -129
|
@@ -1,735 +0,0 @@
|
|
|
1
|
-
import { NXComponent, AXComponent, AXValuableComponent, AXFocusableComponent } from '@acorex/cdk/common';
|
|
2
|
-
import * as i2 from '@acorex/components/button';
|
|
3
|
-
import { AXButtonModule } from '@acorex/components/button';
|
|
4
|
-
import * as i1 from '@acorex/components/text-box';
|
|
5
|
-
import { AXTextBoxModule } from '@acorex/components/text-box';
|
|
6
|
-
import * as i3 from '@angular/common';
|
|
7
|
-
import { DOCUMENT, isPlatformBrowser, CommonModule } from '@angular/common';
|
|
8
|
-
import * as i0 from '@angular/core';
|
|
9
|
-
import { inject, NgZone, PLATFORM_ID, signal, effect, Injectable, ViewEncapsulation, Component, viewChild, output, afterNextRender, input, computed, HostListener, NgModule } from '@angular/core';
|
|
10
|
-
import * as i4 from '@angular/forms';
|
|
11
|
-
import { FormsModule } from '@angular/forms';
|
|
12
|
-
import { Subject } from 'rxjs';
|
|
13
|
-
|
|
14
|
-
class AXFlowChartService {
|
|
15
|
-
constructor() {
|
|
16
|
-
this.zone = inject(NgZone);
|
|
17
|
-
this.platformId = inject(PLATFORM_ID);
|
|
18
|
-
this.document = inject(DOCUMENT);
|
|
19
|
-
this.initialFlowChartEdge = signal([], /* @ts-ignore */
|
|
20
|
-
...(ngDevMode ? [{ debugName: "initialFlowChartEdge" }] : /* istanbul ignore next */ []));
|
|
21
|
-
this.initialFlowChartNode = signal([], /* @ts-ignore */
|
|
22
|
-
...(ngDevMode ? [{ debugName: "initialFlowChartNode" }] : /* istanbul ignore next */ []));
|
|
23
|
-
this.selectedNode = signal(null, /* @ts-ignore */
|
|
24
|
-
...(ngDevMode ? [{ debugName: "selectedNode" }] : /* istanbul ignore next */ []));
|
|
25
|
-
this.selectedEdge = signal(null, /* @ts-ignore */
|
|
26
|
-
...(ngDevMode ? [{ debugName: "selectedEdge" }] : /* istanbul ignore next */ []));
|
|
27
|
-
this.svgService = signal(null, /* @ts-ignore */
|
|
28
|
-
...(ngDevMode ? [{ debugName: "svgService" }] : /* istanbul ignore next */ []));
|
|
29
|
-
this.canvasService = signal(null, /* @ts-ignore */
|
|
30
|
-
...(ngDevMode ? [{ debugName: "canvasService" }] : /* istanbul ignore next */ []));
|
|
31
|
-
this.lineClick = new Subject();
|
|
32
|
-
this.lineDbClick = new Subject();
|
|
33
|
-
this.nodeClick = new Subject();
|
|
34
|
-
this.nodeDbClick = new Subject();
|
|
35
|
-
this.onEdgeUpdate = new Subject();
|
|
36
|
-
this.onNodeUpdate = new Subject();
|
|
37
|
-
this.nodesMap = new Map();
|
|
38
|
-
this.eventListeners = new Map();
|
|
39
|
-
this.anchorClickBuffer = null;
|
|
40
|
-
this.currentConnection = null;
|
|
41
|
-
this.draggingConnection = false;
|
|
42
|
-
this.tempLine = null;
|
|
43
|
-
this.#eff2 = effect(() => {
|
|
44
|
-
if (!isPlatformBrowser(this.platformId) || !this.initialFlowChartEdge()) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
setTimeout(() => {
|
|
48
|
-
this.drawEdges(this.initialFlowChartEdge());
|
|
49
|
-
});
|
|
50
|
-
}, /* @ts-ignore */
|
|
51
|
-
...(ngDevMode ? [{ debugName: "#eff2" }] : /* istanbul ignore next */ []));
|
|
52
|
-
this.#eff3 = effect(() => {
|
|
53
|
-
if (!isPlatformBrowser(this.platformId) || !this.initialFlowChartNode()) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
this.createNode(this.initialFlowChartNode());
|
|
57
|
-
}, /* @ts-ignore */
|
|
58
|
-
...(ngDevMode ? [{ debugName: "#eff3" }] : /* istanbul ignore next */ []));
|
|
59
|
-
}
|
|
60
|
-
#eff2;
|
|
61
|
-
#eff3;
|
|
62
|
-
addEventListener(element, event, handler) {
|
|
63
|
-
const elementId = element.dataset['id'] || 'global';
|
|
64
|
-
if (!this.eventListeners.has(elementId)) {
|
|
65
|
-
this.eventListeners.set(elementId, new Map());
|
|
66
|
-
}
|
|
67
|
-
const elementListeners = this.eventListeners.get(elementId);
|
|
68
|
-
if (elementListeners) {
|
|
69
|
-
const boundHandler = handler.bind(this);
|
|
70
|
-
elementListeners.set(event, boundHandler);
|
|
71
|
-
element.addEventListener(event, boundHandler);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
removeEventListeners(elementId) {
|
|
75
|
-
const elementListeners = this.eventListeners.get(elementId);
|
|
76
|
-
if (elementListeners) {
|
|
77
|
-
elementListeners.forEach((handler, event) => {
|
|
78
|
-
const element = this.nodesMap.get(elementId);
|
|
79
|
-
if (element) {
|
|
80
|
-
element.removeEventListener(event, handler);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
this.eventListeners.delete(elementId);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
setupNodeEventListeners(el, node) {
|
|
87
|
-
this.addEventListener(el, 'click', (e) => {
|
|
88
|
-
this.nodeClick.next({ target: el, event: e });
|
|
89
|
-
this.selectedNode.set(node);
|
|
90
|
-
el.classList.add('selected');
|
|
91
|
-
this.nodesMap.forEach((existingNode) => {
|
|
92
|
-
if (existingNode !== el) {
|
|
93
|
-
existingNode.classList.remove('selected');
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
this.addEventListener(el, 'dblclick', (e) => {
|
|
98
|
-
this.nodeDbClick.next({ target: el, event: e });
|
|
99
|
-
});
|
|
100
|
-
this.addEventListener(el, 'mouseenter', () => {
|
|
101
|
-
el.classList.add('hover');
|
|
102
|
-
});
|
|
103
|
-
this.addEventListener(el, 'mouseleave', () => {
|
|
104
|
-
el.classList.remove('hover');
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
setupAnchorEventListeners(dot, el) {
|
|
108
|
-
// start drag to connect
|
|
109
|
-
this.addEventListener(dot, 'mousedown', (e) => {
|
|
110
|
-
const mouseEvent = e;
|
|
111
|
-
mouseEvent.stopPropagation();
|
|
112
|
-
mouseEvent.preventDefault();
|
|
113
|
-
const pos = this.getAnchorPoint(el, dot.dataset['anchor']);
|
|
114
|
-
this.currentConnection = {
|
|
115
|
-
source: {
|
|
116
|
-
id: dot.dataset['nodeId'],
|
|
117
|
-
anchor: dot.dataset['anchor'],
|
|
118
|
-
},
|
|
119
|
-
mouse: { x: mouseEvent.clientX, y: mouseEvent.clientY },
|
|
120
|
-
};
|
|
121
|
-
this.startTempLine(pos.x, pos.y);
|
|
122
|
-
this.draggingConnection = true;
|
|
123
|
-
});
|
|
124
|
-
this.addEventListener(dot, 'click', (e) => {
|
|
125
|
-
e.stopPropagation();
|
|
126
|
-
if (dot.classList.contains('selected')) {
|
|
127
|
-
dot.classList.remove('selected');
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
dot.classList.add('selected');
|
|
131
|
-
}
|
|
132
|
-
const clicked = {
|
|
133
|
-
nodeId: dot.dataset['nodeId'],
|
|
134
|
-
anchor: dot.dataset['anchor'],
|
|
135
|
-
};
|
|
136
|
-
if (!this.anchorClickBuffer) {
|
|
137
|
-
this.anchorClickBuffer = clicked;
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
const source = this.anchorClickBuffer;
|
|
141
|
-
const target = clicked;
|
|
142
|
-
if (source.nodeId !== target.nodeId) {
|
|
143
|
-
this.pushAndCreateEdgeData({ id: source.nodeId, anchor: source.anchor }, { id: target.nodeId, anchor: target.anchor });
|
|
144
|
-
}
|
|
145
|
-
this.anchorClickBuffer = null;
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
this.addEventListener(dot, 'mouseenter', () => {
|
|
149
|
-
dot.classList.add('hover');
|
|
150
|
-
});
|
|
151
|
-
this.addEventListener(dot, 'mouseleave', () => {
|
|
152
|
-
dot.classList.remove('hover');
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
addAnchors(el, type) {
|
|
156
|
-
['top', 'bottom', 'left', 'right'].forEach((anchor) => {
|
|
157
|
-
const dot = this.document.createElement('div');
|
|
158
|
-
dot.className = 'ax-flow-chart-anchor';
|
|
159
|
-
dot.dataset['anchor'] = anchor;
|
|
160
|
-
dot.dataset['nodeId'] = el.dataset['id'];
|
|
161
|
-
this.positionAnchor(dot, anchor, type);
|
|
162
|
-
el.appendChild(dot);
|
|
163
|
-
this.setupAnchorEventListeners(dot, el);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
makeDraggable(el) {
|
|
167
|
-
let offsetX = 0, offsetY = 0, isDragging = false;
|
|
168
|
-
this.addEventListener(el, 'mousedown', (e) => {
|
|
169
|
-
const mouseEvent = e;
|
|
170
|
-
if (mouseEvent.target.classList.contains('ax-flow-chart-anchor'))
|
|
171
|
-
return;
|
|
172
|
-
isDragging = true;
|
|
173
|
-
offsetX = mouseEvent.clientX - el.offsetLeft;
|
|
174
|
-
offsetY = mouseEvent.clientY - el.offsetTop;
|
|
175
|
-
mouseEvent.preventDefault();
|
|
176
|
-
});
|
|
177
|
-
const mousemoveHandler = (e) => {
|
|
178
|
-
if (isDragging) {
|
|
179
|
-
el.style.left = e.clientX - offsetX + 'px';
|
|
180
|
-
el.style.top = e.clientY - offsetY + 'px';
|
|
181
|
-
this.drawEdges(this.initialFlowChartEdge());
|
|
182
|
-
this.initialFlowChartNode.update((value) => {
|
|
183
|
-
const node = value.find((node) => node.id === el.dataset['id']);
|
|
184
|
-
if (node) {
|
|
185
|
-
node.x = e.clientX - offsetX;
|
|
186
|
-
node.y = e.clientY - offsetY;
|
|
187
|
-
}
|
|
188
|
-
return value;
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
const elementId = e.target.id;
|
|
192
|
-
if (elementId === 'ax-flow-chart-renderer-connections' || elementId === 'ax-flow-chart-renderer-canvas') {
|
|
193
|
-
if (this.draggingConnection && this.tempLine) {
|
|
194
|
-
this.tempLine.setAttribute('x2', e.offsetX.toString());
|
|
195
|
-
this.tempLine.setAttribute('y2', e.offsetY.toString());
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
const mouseupHandler = (e) => {
|
|
200
|
-
isDragging = false;
|
|
201
|
-
if (this.draggingConnection) {
|
|
202
|
-
const target = e.target.closest('.ax-flow-chart-anchor');
|
|
203
|
-
if (target && target.dataset['nodeId'] !== this.currentConnection?.source?.id) {
|
|
204
|
-
this.currentConnection = {
|
|
205
|
-
...this.currentConnection,
|
|
206
|
-
target: {
|
|
207
|
-
id: target.dataset['nodeId'],
|
|
208
|
-
anchor: target.dataset['anchor'],
|
|
209
|
-
},
|
|
210
|
-
};
|
|
211
|
-
this.finishConnection();
|
|
212
|
-
}
|
|
213
|
-
this.clearTempLine();
|
|
214
|
-
this.draggingConnection = false;
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
// Add global event listeners
|
|
218
|
-
this.zone.runOutsideAngular(() => {
|
|
219
|
-
this.document.addEventListener('mousemove', mousemoveHandler);
|
|
220
|
-
this.document.addEventListener('mouseup', mouseupHandler);
|
|
221
|
-
});
|
|
222
|
-
// Store global listeners
|
|
223
|
-
const globalListeners = this.eventListeners.get('global');
|
|
224
|
-
if (globalListeners) {
|
|
225
|
-
globalListeners.set('mousemove', mousemoveHandler);
|
|
226
|
-
globalListeners.set('mouseup', mouseupHandler);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
positionAnchor(dot, anchor, type) {
|
|
230
|
-
if (type !== 'diamond') {
|
|
231
|
-
switch (anchor) {
|
|
232
|
-
case 'top':
|
|
233
|
-
dot.style.top = '0%';
|
|
234
|
-
dot.style.left = '50%';
|
|
235
|
-
break;
|
|
236
|
-
case 'bottom':
|
|
237
|
-
dot.style.top = '100%';
|
|
238
|
-
dot.style.left = '50%';
|
|
239
|
-
break;
|
|
240
|
-
case 'left':
|
|
241
|
-
dot.style.top = '50%';
|
|
242
|
-
dot.style.left = '0%';
|
|
243
|
-
break;
|
|
244
|
-
case 'right':
|
|
245
|
-
dot.style.top = '50%';
|
|
246
|
-
dot.style.left = '100%';
|
|
247
|
-
break;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
else {
|
|
251
|
-
switch (anchor) {
|
|
252
|
-
case 'top':
|
|
253
|
-
dot.style.top = '0%';
|
|
254
|
-
dot.style.left = '0%';
|
|
255
|
-
break;
|
|
256
|
-
case 'bottom':
|
|
257
|
-
dot.style.top = '100%';
|
|
258
|
-
dot.style.left = '100%';
|
|
259
|
-
break;
|
|
260
|
-
case 'left':
|
|
261
|
-
dot.style.top = '100%';
|
|
262
|
-
dot.style.left = '0%';
|
|
263
|
-
break;
|
|
264
|
-
case 'right':
|
|
265
|
-
dot.style.top = '0%';
|
|
266
|
-
dot.style.left = '100%';
|
|
267
|
-
break;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
getAnchorPoint(el, anchor) {
|
|
272
|
-
const rect = el.getBoundingClientRect();
|
|
273
|
-
const centerX = el.offsetLeft + rect.width / 2;
|
|
274
|
-
const centerY = el.offsetTop + rect.height / 2;
|
|
275
|
-
switch (anchor) {
|
|
276
|
-
case 'top':
|
|
277
|
-
return { x: centerX, y: el.offsetTop };
|
|
278
|
-
case 'bottom':
|
|
279
|
-
return { x: centerX, y: el.offsetTop + rect.height };
|
|
280
|
-
case 'left':
|
|
281
|
-
return { x: el.offsetLeft, y: centerY };
|
|
282
|
-
case 'right':
|
|
283
|
-
return { x: el.offsetLeft + rect.width, y: centerY };
|
|
284
|
-
default:
|
|
285
|
-
return { x: centerX, y: centerY };
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
startTempLine(x, y) {
|
|
289
|
-
const svgElement = this.svgService()?.nativeElement;
|
|
290
|
-
if (!svgElement)
|
|
291
|
-
return;
|
|
292
|
-
this.tempLine = this.document.createElementNS('http://www.w3.org/2000/svg', 'line');
|
|
293
|
-
this.tempLine.setAttribute('x1', x.toString());
|
|
294
|
-
this.tempLine.setAttribute('y1', y.toString());
|
|
295
|
-
this.tempLine.setAttribute('x2', x.toString());
|
|
296
|
-
this.tempLine.setAttribute('y2', y.toString());
|
|
297
|
-
this.tempLine.setAttribute('stroke', 'rgba(var(--ax-sys-color-on-lightest-surface),0.5)');
|
|
298
|
-
this.tempLine.setAttribute('stroke-width', '2');
|
|
299
|
-
this.tempLine.setAttribute('stroke-dasharray', '4');
|
|
300
|
-
svgElement.appendChild(this.tempLine);
|
|
301
|
-
}
|
|
302
|
-
clearTempLine() {
|
|
303
|
-
if (this.tempLine && this.tempLine.parentElement) {
|
|
304
|
-
this.svgService()?.nativeElement.removeChild(this.tempLine);
|
|
305
|
-
this.tempLine = null;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
pushAndCreateEdgeData(source, target) {
|
|
309
|
-
const newEdge = {
|
|
310
|
-
id: `edge-${Math.random().toString()}`,
|
|
311
|
-
source,
|
|
312
|
-
target,
|
|
313
|
-
};
|
|
314
|
-
this.onEdgeUpdate.next(newEdge);
|
|
315
|
-
this.initialFlowChartEdge.update((value) => [...value, newEdge]);
|
|
316
|
-
this.drawEdges();
|
|
317
|
-
}
|
|
318
|
-
drawEdges(edges) {
|
|
319
|
-
if (!isPlatformBrowser(this.platformId)) {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
const svg = this.svgService()?.nativeElement;
|
|
323
|
-
if (!svg)
|
|
324
|
-
return;
|
|
325
|
-
// Clear existing edges
|
|
326
|
-
svg.innerHTML = '';
|
|
327
|
-
// Use provided edges or get from signal
|
|
328
|
-
const edgesToDraw = edges || this.initialFlowChartEdge();
|
|
329
|
-
edgesToDraw.forEach((edge) => {
|
|
330
|
-
const sourceNode = this.nodesMap.get(edge.source.id);
|
|
331
|
-
const targetNode = this.nodesMap.get(edge.target.id);
|
|
332
|
-
if (sourceNode) {
|
|
333
|
-
const sourceAnchor = sourceNode.querySelector(`[data-anchor="${edge.source.anchor}"]`);
|
|
334
|
-
if (sourceAnchor)
|
|
335
|
-
sourceAnchor.classList.add('selected');
|
|
336
|
-
}
|
|
337
|
-
if (targetNode) {
|
|
338
|
-
const targetAnchor = targetNode.querySelector(`[data-anchor="${edge.target.anchor}"]`);
|
|
339
|
-
if (targetAnchor)
|
|
340
|
-
targetAnchor.classList.add('selected');
|
|
341
|
-
}
|
|
342
|
-
if (sourceNode && targetNode) {
|
|
343
|
-
const sourcePoint = this.getAnchorPoint(sourceNode, edge.source.anchor);
|
|
344
|
-
const targetPoint = this.getAnchorPoint(targetNode, edge.target.anchor);
|
|
345
|
-
const line = this.createLine(sourcePoint, targetPoint, edge);
|
|
346
|
-
line.classList.add('ax-flow-chart-line');
|
|
347
|
-
// Add click event listener for line selection
|
|
348
|
-
this.addEventListener(line, 'click', (e) => {
|
|
349
|
-
e.stopPropagation();
|
|
350
|
-
this.lineClick.next({ target: edge, event: e });
|
|
351
|
-
this.selectedEdge.set(edge);
|
|
352
|
-
this.selectedNode.set(null);
|
|
353
|
-
// Remove selection from all other lines
|
|
354
|
-
this.document.querySelectorAll('.ax-flow-chart-line').forEach((l) => {
|
|
355
|
-
if (l !== line)
|
|
356
|
-
l.classList.remove('selected');
|
|
357
|
-
});
|
|
358
|
-
// Add selection to clicked line
|
|
359
|
-
line.classList.add('selected');
|
|
360
|
-
// Remove selection from all nodes
|
|
361
|
-
this.nodesMap.forEach((node) => node.classList.remove('selected'));
|
|
362
|
-
});
|
|
363
|
-
svg.appendChild(line);
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
createLine(from, to, edge) {
|
|
368
|
-
const line = this.document.createElementNS('http://www.w3.org/2000/svg', 'line');
|
|
369
|
-
line.setAttribute('x1', from.x.toString());
|
|
370
|
-
line.setAttribute('y1', from.y.toString());
|
|
371
|
-
line.setAttribute('x2', to.x.toString());
|
|
372
|
-
line.setAttribute('y2', to.y.toString());
|
|
373
|
-
line.setAttribute('stroke', 'rgba(var(--ax-sys-color-on-surface))');
|
|
374
|
-
line.setAttribute('stroke-width', '3');
|
|
375
|
-
line.classList.add('ax-flow-chart-line');
|
|
376
|
-
line.addEventListener('click', (e) => {
|
|
377
|
-
this.lineClick.next({ target: edge, event: e });
|
|
378
|
-
this.selectedEdge.set(edge);
|
|
379
|
-
});
|
|
380
|
-
line.addEventListener('dblclick', (e) => {
|
|
381
|
-
this.lineDbClick.next({ target: edge, event: e });
|
|
382
|
-
});
|
|
383
|
-
return line;
|
|
384
|
-
}
|
|
385
|
-
finishConnection() {
|
|
386
|
-
if (this.currentConnection?.source && this.currentConnection?.target) {
|
|
387
|
-
this.pushAndCreateEdgeData(this.currentConnection.source, this.currentConnection.target);
|
|
388
|
-
}
|
|
389
|
-
this.currentConnection = null;
|
|
390
|
-
}
|
|
391
|
-
removeEdge(edge) {
|
|
392
|
-
this.initialFlowChartEdge.update((value) => value.filter((e) => e.id !== edge.id));
|
|
393
|
-
// Remove selected class from connected anchors
|
|
394
|
-
const sourceNode = this.nodesMap.get(edge.source.id);
|
|
395
|
-
const targetNode = this.nodesMap.get(edge.target.id);
|
|
396
|
-
if (sourceNode) {
|
|
397
|
-
const sourceAnchor = sourceNode.querySelector(`[data-anchor="${edge.source.anchor}"]`);
|
|
398
|
-
if (sourceAnchor)
|
|
399
|
-
sourceAnchor.classList.remove('selected');
|
|
400
|
-
}
|
|
401
|
-
if (targetNode) {
|
|
402
|
-
const targetAnchor = targetNode.querySelector(`[data-anchor="${edge.target.anchor}"]`);
|
|
403
|
-
if (targetAnchor)
|
|
404
|
-
targetAnchor.classList.remove('selected');
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
createNode(nodes) {
|
|
408
|
-
if (!isPlatformBrowser(this.platformId)) {
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
const canvas = this.canvasService()?.nativeElement;
|
|
412
|
-
if (!canvas) {
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
this.document.querySelectorAll('.ax-flow-chart-node')?.forEach((node) => node.remove());
|
|
416
|
-
nodes.forEach((node) => {
|
|
417
|
-
const el = this.document.createElement('div');
|
|
418
|
-
const p = this.document.createElement('p');
|
|
419
|
-
p.innerText = node.label;
|
|
420
|
-
el.appendChild(p);
|
|
421
|
-
el.className = 'ax-flow-chart-node';
|
|
422
|
-
el.classList.add(`ax-${node.type}`);
|
|
423
|
-
el.style.left = node.x + 'px';
|
|
424
|
-
el.style.top = node.y + 'px';
|
|
425
|
-
el.dataset['id'] = node.id;
|
|
426
|
-
this.addAnchors(el, node.type);
|
|
427
|
-
this.makeDraggable(el);
|
|
428
|
-
this.setupNodeEventListeners(el, node);
|
|
429
|
-
canvas.appendChild(el);
|
|
430
|
-
this.nodesMap.set(node.id, el);
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
removeNode(nodeId) {
|
|
434
|
-
this.initialFlowChartNode.update((value) => value.filter((e) => e.id !== nodeId));
|
|
435
|
-
this.initialFlowChartEdge().forEach((edge) => {
|
|
436
|
-
if (edge.source.id === nodeId || edge.target.id === nodeId) {
|
|
437
|
-
this.removeEdge(edge);
|
|
438
|
-
}
|
|
439
|
-
});
|
|
440
|
-
this.document.querySelector(`[data-id="${nodeId}"]`)?.remove();
|
|
441
|
-
this.anchorClickBuffer = null;
|
|
442
|
-
}
|
|
443
|
-
cleanup() {
|
|
444
|
-
this.nodesMap.forEach((_, id) => this.removeEventListeners(id));
|
|
445
|
-
this.nodesMap.clear();
|
|
446
|
-
this.eventListeners.clear();
|
|
447
|
-
}
|
|
448
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
449
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartService }); }
|
|
450
|
-
}
|
|
451
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartService, decorators: [{
|
|
452
|
-
type: Injectable
|
|
453
|
-
}] });
|
|
454
|
-
|
|
455
|
-
class AXFlowChartCreatorComponent extends NXComponent {
|
|
456
|
-
constructor() {
|
|
457
|
-
super(...arguments);
|
|
458
|
-
this.service = inject(AXFlowChartService);
|
|
459
|
-
this.selectedShape = signal('rectangle', /* @ts-ignore */
|
|
460
|
-
...(ngDevMode ? [{ debugName: "selectedShape" }] : /* istanbul ignore next */ []));
|
|
461
|
-
this.label = 'Label';
|
|
462
|
-
}
|
|
463
|
-
selectShapeHandler(shape) {
|
|
464
|
-
this.selectedShape.set(shape);
|
|
465
|
-
}
|
|
466
|
-
createShapeHandler() {
|
|
467
|
-
const newNode = {
|
|
468
|
-
id: Math.random().toString(),
|
|
469
|
-
type: this.selectedShape(),
|
|
470
|
-
label: this.label,
|
|
471
|
-
x: 0,
|
|
472
|
-
y: 0,
|
|
473
|
-
};
|
|
474
|
-
this.service.initialFlowChartNode.update((value) => [...value, newNode]);
|
|
475
|
-
this.service.onNodeUpdate.next(newNode);
|
|
476
|
-
}
|
|
477
|
-
printChart() {
|
|
478
|
-
const printWindow = window.open('', '_blank');
|
|
479
|
-
if (!printWindow)
|
|
480
|
-
return;
|
|
481
|
-
const canvas = this.service.canvasService()?.nativeElement;
|
|
482
|
-
if (!canvas)
|
|
483
|
-
return;
|
|
484
|
-
// Get all styles from the document and component
|
|
485
|
-
const styles = Array.from(document.styleSheets)
|
|
486
|
-
.map((sheet) => {
|
|
487
|
-
try {
|
|
488
|
-
return Array.from(sheet.cssRules)
|
|
489
|
-
.map((rule) => rule.cssText)
|
|
490
|
-
.join('\n');
|
|
491
|
-
}
|
|
492
|
-
catch (e) {
|
|
493
|
-
return '';
|
|
494
|
-
}
|
|
495
|
-
})
|
|
496
|
-
.join('\n');
|
|
497
|
-
// Add print-specific styles for anchors
|
|
498
|
-
const printStyles = `
|
|
499
|
-
${styles}
|
|
500
|
-
.ax-flow-chart-anchor {
|
|
501
|
-
opacity: 1 !important;
|
|
502
|
-
}
|
|
503
|
-
`;
|
|
504
|
-
// Create the print content with proper styling
|
|
505
|
-
const printContent = `
|
|
506
|
-
<!DOCTYPE html>
|
|
507
|
-
<html>
|
|
508
|
-
<head>
|
|
509
|
-
<title>Flow Chart Print</title>
|
|
510
|
-
<style>
|
|
511
|
-
${printStyles}
|
|
512
|
-
</style>
|
|
513
|
-
</head>
|
|
514
|
-
<body>
|
|
515
|
-
<ax-flow-chart-renderer>
|
|
516
|
-
${canvas.outerHTML}
|
|
517
|
-
</ax-flow-chart-renderer>
|
|
518
|
-
</body>
|
|
519
|
-
</html>
|
|
520
|
-
`;
|
|
521
|
-
printWindow.document.write(printContent);
|
|
522
|
-
printWindow.document.close();
|
|
523
|
-
}
|
|
524
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartCreatorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
525
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", type: AXFlowChartCreatorComponent, isStandalone: true, selector: "ax-flow-chart-creator", providers: [{ provide: AXComponent, useExisting: AXFlowChartCreatorComponent }], usesInheritance: true, ngImport: i0, template: "<div class=\"ax-shape-container\">\n <div\n [ngClass]=\"{ 'ax-shape-selected': selectedShape() === 'rectangle' }\"\n (click)=\"selectShapeHandler('rectangle')\"\n class=\"ax-rectangle\"\n ></div>\n <div\n [ngClass]=\"{ 'ax-shape-selected': selectedShape() === 'circle' }\"\n (click)=\"selectShapeHandler('circle')\"\n class=\"ax-circle\"\n ></div>\n <div\n [ngClass]=\"{ 'ax-shape-selected': selectedShape() === 'diamond' }\"\n (click)=\"selectShapeHandler('diamond')\"\n class=\"ax-diamond\"\n ></div>\n</div>\n<ax-text-box class=\"ax-sm\" [(ngModel)]=\"label\" placeholder=\"Label\"> </ax-text-box>\n\n<ax-button class=\"ax-sm\" (onClick)=\"createShapeHandler()\" color=\"primary\" text=\"Create\"></ax-button>\n<ax-button color=\"primary\" text=\"Print\" class=\"ax-sm\" (click)=\"printChart()\"></ax-button>\n", styles: ["@layer components{ax-flow-chart-creator{display:flex;align-items:center;gap:calc(var(--spacing, .25rem) * 4);padding:calc(var(--spacing, .25rem) * 4)}ax-flow-chart-creator .ax-shape-container{display:flex;gap:calc(var(--spacing, .25rem) * 4)}ax-flow-chart-creator .ax-shape-container .ax-shape-selected{border:2px solid rgba(var(--ax-sys-color-danger-darker-surface))!important}ax-flow-chart-creator .ax-shape-container .ax-rectangle,ax-flow-chart-creator .ax-shape-container .ax-circle,ax-flow-chart-creator .ax-shape-container .ax-diamond{display:flex;width:30px;height:30px;cursor:pointer;align-items:center;justify-content:center;border:2px solid rgba(var(--ax-sys-color-border-surface))}ax-flow-chart-creator .ax-shape-container .ax-circle{aspect-ratio:1 / 1;border-radius:1000vmax}ax-flow-chart-creator .ax-shape-container .ax-diamond{aspect-ratio:1 / 1;transform:rotate(45deg) scale(.75)}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "ngmodule", type: AXTextBoxModule }, { kind: "component", type: i1.AXTextBoxComponent, selector: "ax-text-box", inputs: ["disabled", "tabIndex", "readonly", "value", "state", "name", "id", "placeholder", "maxLength", "allowNull", "type", "autoComplete", "look", "maskPattern", "customTokens", "class"], outputs: ["onBlur", "onFocus", "valueChange", "stateChange", "onValueChanged", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress", "onMaskChanged"] }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
526
|
-
}
|
|
527
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartCreatorComponent, decorators: [{
|
|
528
|
-
type: Component,
|
|
529
|
-
args: [{ selector: 'ax-flow-chart-creator', encapsulation: ViewEncapsulation.None, imports: [AXTextBoxModule, AXButtonModule, CommonModule, FormsModule], providers: [{ provide: AXComponent, useExisting: AXFlowChartCreatorComponent }], template: "<div class=\"ax-shape-container\">\n <div\n [ngClass]=\"{ 'ax-shape-selected': selectedShape() === 'rectangle' }\"\n (click)=\"selectShapeHandler('rectangle')\"\n class=\"ax-rectangle\"\n ></div>\n <div\n [ngClass]=\"{ 'ax-shape-selected': selectedShape() === 'circle' }\"\n (click)=\"selectShapeHandler('circle')\"\n class=\"ax-circle\"\n ></div>\n <div\n [ngClass]=\"{ 'ax-shape-selected': selectedShape() === 'diamond' }\"\n (click)=\"selectShapeHandler('diamond')\"\n class=\"ax-diamond\"\n ></div>\n</div>\n<ax-text-box class=\"ax-sm\" [(ngModel)]=\"label\" placeholder=\"Label\"> </ax-text-box>\n\n<ax-button class=\"ax-sm\" (onClick)=\"createShapeHandler()\" color=\"primary\" text=\"Create\"></ax-button>\n<ax-button color=\"primary\" text=\"Print\" class=\"ax-sm\" (click)=\"printChart()\"></ax-button>\n", styles: ["@layer components{ax-flow-chart-creator{display:flex;align-items:center;gap:calc(var(--spacing, .25rem) * 4);padding:calc(var(--spacing, .25rem) * 4)}ax-flow-chart-creator .ax-shape-container{display:flex;gap:calc(var(--spacing, .25rem) * 4)}ax-flow-chart-creator .ax-shape-container .ax-shape-selected{border:2px solid rgba(var(--ax-sys-color-danger-darker-surface))!important}ax-flow-chart-creator .ax-shape-container .ax-rectangle,ax-flow-chart-creator .ax-shape-container .ax-circle,ax-flow-chart-creator .ax-shape-container .ax-diamond{display:flex;width:30px;height:30px;cursor:pointer;align-items:center;justify-content:center;border:2px solid rgba(var(--ax-sys-color-border-surface))}ax-flow-chart-creator .ax-shape-container .ax-circle{aspect-ratio:1 / 1;border-radius:1000vmax}ax-flow-chart-creator .ax-shape-container .ax-diamond{aspect-ratio:1 / 1;transform:rotate(45deg) scale(.75)}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
530
|
-
}] });
|
|
531
|
-
|
|
532
|
-
class AXFlowChartRendererComponent extends NXComponent {
|
|
533
|
-
constructor() {
|
|
534
|
-
super(...arguments);
|
|
535
|
-
this.canvas = viewChild('canvas', /* @ts-ignore */
|
|
536
|
-
...(ngDevMode ? [{ debugName: "canvas" }] : /* istanbul ignore next */ []));
|
|
537
|
-
this.svg = viewChild('connections', /* @ts-ignore */
|
|
538
|
-
...(ngDevMode ? [{ debugName: "svg" }] : /* istanbul ignore next */ []));
|
|
539
|
-
this.service = inject(AXFlowChartService);
|
|
540
|
-
this.document = inject(DOCUMENT);
|
|
541
|
-
this.platformId = inject(PLATFORM_ID);
|
|
542
|
-
this.onLineClick = output();
|
|
543
|
-
this.onLineDbClick = output();
|
|
544
|
-
this.onNodeClick = output();
|
|
545
|
-
this.onNodeDbClick = output();
|
|
546
|
-
this.onEdgeUpdate = output();
|
|
547
|
-
this.onNodeUpdate = output();
|
|
548
|
-
this.#init = afterNextRender(() => {
|
|
549
|
-
this.setupEventListeners();
|
|
550
|
-
});
|
|
551
|
-
this.#eff = effect(() => {
|
|
552
|
-
if (!isPlatformBrowser(this.platformId) || !this.canvas() || !this.svg()) {
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
555
|
-
this.initializeServices();
|
|
556
|
-
}, /* @ts-ignore */
|
|
557
|
-
...(ngDevMode ? [{ debugName: "#eff" }] : /* istanbul ignore next */ []));
|
|
558
|
-
}
|
|
559
|
-
#init;
|
|
560
|
-
#eff;
|
|
561
|
-
setupEventListeners() {
|
|
562
|
-
this.service.lineClick.subscribe((value) => {
|
|
563
|
-
this.onLineClick.emit(value);
|
|
564
|
-
});
|
|
565
|
-
this.service.lineDbClick.subscribe((value) => {
|
|
566
|
-
this.onLineDbClick.emit(value);
|
|
567
|
-
});
|
|
568
|
-
this.service.nodeClick.subscribe((value) => {
|
|
569
|
-
this.onNodeClick.emit(value);
|
|
570
|
-
});
|
|
571
|
-
this.service.nodeDbClick.subscribe((value) => {
|
|
572
|
-
this.onNodeDbClick.emit(value);
|
|
573
|
-
});
|
|
574
|
-
this.service.onEdgeUpdate.subscribe((newEdge) => {
|
|
575
|
-
this.onEdgeUpdate.emit(newEdge);
|
|
576
|
-
});
|
|
577
|
-
this.service.onNodeUpdate.subscribe((newNode) => {
|
|
578
|
-
this.onNodeUpdate.emit(newNode);
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
initializeServices() {
|
|
582
|
-
this.service.canvasService.set(this.canvas());
|
|
583
|
-
this.service.svgService.set(this.svg());
|
|
584
|
-
// Add click handlers for parent elements
|
|
585
|
-
const canvas = this.canvas()?.nativeElement;
|
|
586
|
-
const svg = this.svg()?.nativeElement;
|
|
587
|
-
if (canvas) {
|
|
588
|
-
canvas.addEventListener('click', (e) => {
|
|
589
|
-
if (e.target === canvas) {
|
|
590
|
-
this.service.selectedNode.set(null);
|
|
591
|
-
this.service.selectedEdge.set(null);
|
|
592
|
-
this.document.querySelectorAll('.ax-flow-chart-node').forEach((node) => node.classList.remove('selected'));
|
|
593
|
-
this.document.querySelectorAll('.ax-flow-chart-line').forEach((line) => line.classList.remove('selected'));
|
|
594
|
-
}
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
if (svg) {
|
|
598
|
-
svg.addEventListener('click', (e) => {
|
|
599
|
-
if (e.target === svg) {
|
|
600
|
-
this.service.selectedNode.set(null);
|
|
601
|
-
this.service.selectedEdge.set(null);
|
|
602
|
-
this.document.querySelectorAll('.ax-flow-chart-node').forEach((node) => node.classList.remove('selected'));
|
|
603
|
-
this.document.querySelectorAll('.ax-flow-chart-line').forEach((line) => line.classList.remove('selected'));
|
|
604
|
-
}
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
ngOnDestroy() {
|
|
609
|
-
this.cleanup();
|
|
610
|
-
}
|
|
611
|
-
cleanup() {
|
|
612
|
-
this.service.cleanup();
|
|
613
|
-
this.service.lineClick.unsubscribe();
|
|
614
|
-
this.service.lineDbClick.unsubscribe();
|
|
615
|
-
this.service.nodeClick.unsubscribe();
|
|
616
|
-
this.service.nodeDbClick.unsubscribe();
|
|
617
|
-
this.service.onEdgeUpdate.unsubscribe();
|
|
618
|
-
}
|
|
619
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartRendererComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
620
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.8", type: AXFlowChartRendererComponent, isStandalone: true, selector: "ax-flow-chart-renderer", outputs: { onLineClick: "onLineClick", onLineDbClick: "onLineDbClick", onNodeClick: "onNodeClick", onNodeDbClick: "onNodeDbClick", onEdgeUpdate: "onEdgeUpdate", onNodeUpdate: "onNodeUpdate" }, providers: [{ provide: AXComponent, useExisting: AXFlowChartRendererComponent }], viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true, isSignal: true }, { propertyName: "svg", first: true, predicate: ["connections"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div id=\"ax-flow-chart-renderer-canvas\" #canvas>\n <svg class=\"ax-flow-chart-renderer-svg\" id=\"ax-flow-chart-renderer-connections\" #connections></svg>\n</div>\n", styles: ["@layer components{ax-flow-chart-renderer{overflow:hidden;width:var(--ax-comp-flow-chart-width, 100%);height:var(--ax-comp-flow-chart-height, 30rem);-webkit-print-color-adjust:exact;print-color-adjust:exact}ax-flow-chart-renderer #ax-flow-chart-renderer-canvas{position:relative;height:100%;width:100%}ax-flow-chart-renderer .ax-flow-chart-node{position:absolute;cursor:move;padding:calc(var(--spacing, .25rem) * 4);-webkit-user-select:none;user-select:none;background-color:rgba(var(--ax-sys-color-surface));color:rgba(var(--ax-sys-color-on-surface));border:2px solid rgba(var(--ax-sys-color-border-surface))}ax-flow-chart-renderer .ax-flow-chart-node.selected{border:2px solid rgba(var(--ax-sys-color-danger-darker-surface))}ax-flow-chart-renderer .ax-flow-chart-node .ax-flow-chart-anchor{opacity:0%;transition:opacity .5s ease}ax-flow-chart-renderer .ax-flow-chart-node:hover .ax-flow-chart-anchor,ax-flow-chart-renderer .ax-flow-chart-node.selected .ax-flow-chart-anchor{opacity:100%}ax-flow-chart-renderer .ax-flow-chart-anchor{position:absolute;width:calc(var(--spacing, .25rem) * 2.5);height:calc(var(--spacing, .25rem) * 2.5);cursor:crosshair;border-radius:calc(infinity * 1px);background-color:rgba(var(--ax-sys-color-on-lightest-surface));transform:translate(-50%,-50%)}ax-flow-chart-renderer .ax-flow-chart-anchor.selected{background-color:rgba(var(--ax-sys-color-primary-surface))}ax-flow-chart-renderer .ax-flow-chart-anchor.hover{transition:.3s all ease;scale:1.3;background-color:rgba(var(--ax-sys-color-danger-darkest-surface))}ax-flow-chart-renderer .ax-flow-chart-anchor:before{content:\"\";position:absolute;inset:-7px}ax-flow-chart-renderer .ax-flow-chart-renderer-svg{position:absolute;top:calc(var(--spacing, .25rem) * 0);left:calc(var(--spacing, .25rem) * 0);overflow:visible}ax-flow-chart-renderer .ax-flow-chart-line:hover{cursor:pointer;transition:.3s all ease;stroke:rgba(var(--ax-sys-color-danger-darker-surface))}ax-flow-chart-renderer .ax-flow-chart-line.selected{stroke:rgba(var(--ax-sys-color-primary-surface))}ax-flow-chart-renderer .ax-rectangle,ax-flow-chart-renderer .ax-circle,ax-flow-chart-renderer .ax-diamond{display:flex;height:auto;width:auto;align-items:center;justify-content:center;border:2px solid rgba(var(--ax-sys-color-border-surface))}ax-flow-chart-renderer .ax-circle{aspect-ratio:1 / 1;border-radius:1000vmax}ax-flow-chart-renderer .ax-diamond{aspect-ratio:1 / 1;transform:rotate(45deg) scale(.75)}ax-flow-chart-renderer .ax-diamond p{transform:rotate(-45deg) scale(1.25)}ax-flow-chart-renderer .ax-diamond .ax-flow-chart-anchor{width:calc(var(--spacing, .25rem) * 3.5);height:calc(var(--spacing, .25rem) * 3.5)}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"], encapsulation: i0.ViewEncapsulation.None }); }
|
|
621
|
-
}
|
|
622
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartRendererComponent, decorators: [{
|
|
623
|
-
type: Component,
|
|
624
|
-
args: [{ selector: 'ax-flow-chart-renderer', encapsulation: ViewEncapsulation.None, providers: [{ provide: AXComponent, useExisting: AXFlowChartRendererComponent }], template: "<div id=\"ax-flow-chart-renderer-canvas\" #canvas>\n <svg class=\"ax-flow-chart-renderer-svg\" id=\"ax-flow-chart-renderer-connections\" #connections></svg>\n</div>\n", styles: ["@layer components{ax-flow-chart-renderer{overflow:hidden;width:var(--ax-comp-flow-chart-width, 100%);height:var(--ax-comp-flow-chart-height, 30rem);-webkit-print-color-adjust:exact;print-color-adjust:exact}ax-flow-chart-renderer #ax-flow-chart-renderer-canvas{position:relative;height:100%;width:100%}ax-flow-chart-renderer .ax-flow-chart-node{position:absolute;cursor:move;padding:calc(var(--spacing, .25rem) * 4);-webkit-user-select:none;user-select:none;background-color:rgba(var(--ax-sys-color-surface));color:rgba(var(--ax-sys-color-on-surface));border:2px solid rgba(var(--ax-sys-color-border-surface))}ax-flow-chart-renderer .ax-flow-chart-node.selected{border:2px solid rgba(var(--ax-sys-color-danger-darker-surface))}ax-flow-chart-renderer .ax-flow-chart-node .ax-flow-chart-anchor{opacity:0%;transition:opacity .5s ease}ax-flow-chart-renderer .ax-flow-chart-node:hover .ax-flow-chart-anchor,ax-flow-chart-renderer .ax-flow-chart-node.selected .ax-flow-chart-anchor{opacity:100%}ax-flow-chart-renderer .ax-flow-chart-anchor{position:absolute;width:calc(var(--spacing, .25rem) * 2.5);height:calc(var(--spacing, .25rem) * 2.5);cursor:crosshair;border-radius:calc(infinity * 1px);background-color:rgba(var(--ax-sys-color-on-lightest-surface));transform:translate(-50%,-50%)}ax-flow-chart-renderer .ax-flow-chart-anchor.selected{background-color:rgba(var(--ax-sys-color-primary-surface))}ax-flow-chart-renderer .ax-flow-chart-anchor.hover{transition:.3s all ease;scale:1.3;background-color:rgba(var(--ax-sys-color-danger-darkest-surface))}ax-flow-chart-renderer .ax-flow-chart-anchor:before{content:\"\";position:absolute;inset:-7px}ax-flow-chart-renderer .ax-flow-chart-renderer-svg{position:absolute;top:calc(var(--spacing, .25rem) * 0);left:calc(var(--spacing, .25rem) * 0);overflow:visible}ax-flow-chart-renderer .ax-flow-chart-line:hover{cursor:pointer;transition:.3s all ease;stroke:rgba(var(--ax-sys-color-danger-darker-surface))}ax-flow-chart-renderer .ax-flow-chart-line.selected{stroke:rgba(var(--ax-sys-color-primary-surface))}ax-flow-chart-renderer .ax-rectangle,ax-flow-chart-renderer .ax-circle,ax-flow-chart-renderer .ax-diamond{display:flex;height:auto;width:auto;align-items:center;justify-content:center;border:2px solid rgba(var(--ax-sys-color-border-surface))}ax-flow-chart-renderer .ax-circle{aspect-ratio:1 / 1;border-radius:1000vmax}ax-flow-chart-renderer .ax-diamond{aspect-ratio:1 / 1;transform:rotate(45deg) scale(.75)}ax-flow-chart-renderer .ax-diamond p{transform:rotate(-45deg) scale(1.25)}ax-flow-chart-renderer .ax-diamond .ax-flow-chart-anchor{width:calc(var(--spacing, .25rem) * 3.5);height:calc(var(--spacing, .25rem) * 3.5)}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
625
|
-
}], propDecorators: { canvas: [{ type: i0.ViewChild, args: ['canvas', { isSignal: true }] }], svg: [{ type: i0.ViewChild, args: ['connections', { isSignal: true }] }], onLineClick: [{ type: i0.Output, args: ["onLineClick"] }], onLineDbClick: [{ type: i0.Output, args: ["onLineDbClick"] }], onNodeClick: [{ type: i0.Output, args: ["onNodeClick"] }], onNodeDbClick: [{ type: i0.Output, args: ["onNodeDbClick"] }], onEdgeUpdate: [{ type: i0.Output, args: ["onEdgeUpdate"] }], onNodeUpdate: [{ type: i0.Output, args: ["onNodeUpdate"] }] } });
|
|
626
|
-
|
|
627
|
-
class AXFlowChartComponent extends NXComponent {
|
|
628
|
-
constructor() {
|
|
629
|
-
super(...arguments);
|
|
630
|
-
this.flowChartService = inject(AXFlowChartService);
|
|
631
|
-
this.initialFlowChartNode = input.required(/* @ts-ignore */
|
|
632
|
-
...(ngDevMode ? [{ debugName: "initialFlowChartNode" }] : /* istanbul ignore next */ []));
|
|
633
|
-
this.initialFlowChartEdge = input.required(/* @ts-ignore */
|
|
634
|
-
...(ngDevMode ? [{ debugName: "initialFlowChartEdge" }] : /* istanbul ignore next */ []));
|
|
635
|
-
this.selectedNode = computed(() => this.flowChartService.selectedNode(), /* @ts-ignore */
|
|
636
|
-
...(ngDevMode ? [{ debugName: "selectedNode" }] : /* istanbul ignore next */ []));
|
|
637
|
-
this.selectedEdge = computed(() => this.flowChartService.selectedEdge(), /* @ts-ignore */
|
|
638
|
-
...(ngDevMode ? [{ debugName: "selectedEdge" }] : /* istanbul ignore next */ []));
|
|
639
|
-
this.#init = afterNextRender(() => {
|
|
640
|
-
this.flowChartService.initialFlowChartNode.set(this.initialFlowChartNode());
|
|
641
|
-
this.flowChartService.initialFlowChartEdge.set(this.initialFlowChartEdge());
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
#init;
|
|
645
|
-
handleKeyboardEvent(event) {
|
|
646
|
-
if (event.key === 'Delete') {
|
|
647
|
-
const selectedNode = this.selectedNode();
|
|
648
|
-
const selectedEdge = this.selectedEdge();
|
|
649
|
-
if (selectedNode) {
|
|
650
|
-
this.removeNode(selectedNode.id);
|
|
651
|
-
}
|
|
652
|
-
else if (selectedEdge) {
|
|
653
|
-
this.removeEdge(selectedEdge);
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* Draws edges on the flow chart.
|
|
659
|
-
*
|
|
660
|
-
* @param edges Array of edges to draw.
|
|
661
|
-
* @returns void
|
|
662
|
-
*/
|
|
663
|
-
drawEdges(edges) {
|
|
664
|
-
this.flowChartService.drawEdges(edges);
|
|
665
|
-
}
|
|
666
|
-
/**
|
|
667
|
-
* Removes a specific edge from the flow chart.
|
|
668
|
-
*
|
|
669
|
-
* @param edge The edge object to remove.
|
|
670
|
-
* @returns void
|
|
671
|
-
*/
|
|
672
|
-
removeEdge(edge) {
|
|
673
|
-
this.flowChartService.removeEdge(edge);
|
|
674
|
-
}
|
|
675
|
-
/**
|
|
676
|
-
* Creates one or more nodes on the flow chart.
|
|
677
|
-
*
|
|
678
|
-
* @param nodes Array of node definitions to create.
|
|
679
|
-
* @returns void
|
|
680
|
-
*/
|
|
681
|
-
createNode(nodes) {
|
|
682
|
-
this.flowChartService.createNode(nodes);
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* Removes a node by its identifier.
|
|
686
|
-
*
|
|
687
|
-
* @param nodeId The unique id of the node to remove.
|
|
688
|
-
* @returns void
|
|
689
|
-
*/
|
|
690
|
-
removeNode(nodeId) {
|
|
691
|
-
this.flowChartService.removeNode(nodeId);
|
|
692
|
-
}
|
|
693
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
694
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.8", type: AXFlowChartComponent, isStandalone: true, selector: "ax-flow-chart", inputs: { initialFlowChartNode: { classPropertyName: "initialFlowChartNode", publicName: "initialFlowChartNode", isSignal: true, isRequired: true, transformFunction: null }, initialFlowChartEdge: { classPropertyName: "initialFlowChartEdge", publicName: "initialFlowChartEdge", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "document:keydown": "handleKeyboardEvent($event)" } }, providers: [
|
|
695
|
-
AXFlowChartService,
|
|
696
|
-
{ provide: AXComponent, useExisting: AXFlowChartComponent },
|
|
697
|
-
{ provide: AXValuableComponent, useExisting: AXFlowChartComponent },
|
|
698
|
-
{ provide: AXFocusableComponent, useExisting: AXFlowChartComponent },
|
|
699
|
-
], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"ax-header\"></ng-content>\n<ng-content select=\"ax-flow-chart-renderer\"></ng-content>\n<ng-content select=\"ax-footer\"></ng-content>\n", styles: ["@layer components{ax-flow-chart{display:flex;height:100%;width:100%;flex-direction:column;border:1px solid rgba(var(--ax-sys-color-border-lightest-surface));border-radius:var(--ax-sys-border-radius)}ax-flow-chart ax-header{border-bottom:1px solid rgba(var(--ax-sys-color-border-lightest-surface))}ax-flow-chart ax-footer{border-top:1px solid rgba(var(--ax-sys-color-border-lightest-surface))}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"], encapsulation: i0.ViewEncapsulation.None }); }
|
|
700
|
-
}
|
|
701
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartComponent, decorators: [{
|
|
702
|
-
type: Component,
|
|
703
|
-
args: [{ selector: 'ax-flow-chart', encapsulation: ViewEncapsulation.None, providers: [
|
|
704
|
-
AXFlowChartService,
|
|
705
|
-
{ provide: AXComponent, useExisting: AXFlowChartComponent },
|
|
706
|
-
{ provide: AXValuableComponent, useExisting: AXFlowChartComponent },
|
|
707
|
-
{ provide: AXFocusableComponent, useExisting: AXFlowChartComponent },
|
|
708
|
-
], template: "<ng-content select=\"ax-header\"></ng-content>\n<ng-content select=\"ax-flow-chart-renderer\"></ng-content>\n<ng-content select=\"ax-footer\"></ng-content>\n", styles: ["@layer components{ax-flow-chart{display:flex;height:100%;width:100%;flex-direction:column;border:1px solid rgba(var(--ax-sys-color-border-lightest-surface));border-radius:var(--ax-sys-border-radius)}ax-flow-chart ax-header{border-bottom:1px solid rgba(var(--ax-sys-color-border-lightest-surface))}ax-flow-chart ax-footer{border-top:1px solid rgba(var(--ax-sys-color-border-lightest-surface))}}\n/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */\n"] }]
|
|
709
|
-
}], propDecorators: { initialFlowChartNode: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialFlowChartNode", required: true }] }], initialFlowChartEdge: [{ type: i0.Input, args: [{ isSignal: true, alias: "initialFlowChartEdge", required: true }] }], handleKeyboardEvent: [{
|
|
710
|
-
type: HostListener,
|
|
711
|
-
args: ['document:keydown', ['$event']]
|
|
712
|
-
}] } });
|
|
713
|
-
|
|
714
|
-
const COMPONENT = [AXFlowChartRendererComponent, AXFlowChartCreatorComponent, AXFlowChartComponent];
|
|
715
|
-
const MODULES = [CommonModule];
|
|
716
|
-
class AXFlowChartModule {
|
|
717
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
718
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartModule, imports: [CommonModule, AXFlowChartRendererComponent, AXFlowChartCreatorComponent, AXFlowChartComponent], exports: [AXFlowChartRendererComponent, AXFlowChartCreatorComponent, AXFlowChartComponent] }); }
|
|
719
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartModule, imports: [MODULES, AXFlowChartCreatorComponent] }); }
|
|
720
|
-
}
|
|
721
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXFlowChartModule, decorators: [{
|
|
722
|
-
type: NgModule,
|
|
723
|
-
args: [{
|
|
724
|
-
imports: [...MODULES, ...COMPONENT],
|
|
725
|
-
exports: [...COMPONENT],
|
|
726
|
-
providers: [],
|
|
727
|
-
}]
|
|
728
|
-
}] });
|
|
729
|
-
|
|
730
|
-
/**
|
|
731
|
-
* Generated bundle index. Do not edit.
|
|
732
|
-
*/
|
|
733
|
-
|
|
734
|
-
export { AXFlowChartComponent, AXFlowChartCreatorComponent, AXFlowChartModule, AXFlowChartRendererComponent };
|
|
735
|
-
//# sourceMappingURL=acorex-components-flow-chart.mjs.map
|