@cwygoda/service-catalog-ui 1.6.0 → 1.6.1
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.
Potentially problematic release.
This version of @cwygoda/service-catalog-ui might be problematic. Click here for more details.
|
@@ -150,37 +150,45 @@
|
|
|
150
150
|
|
|
151
151
|
const elementRegistry = viewer.get('elementRegistry') as {
|
|
152
152
|
forEach: (cb: (el: { id: string; type: string }) => void) => void;
|
|
153
|
+
get: (id: string) => { id: string } | undefined;
|
|
153
154
|
getGraphics: (el: { id: string }) => SVGElement | null;
|
|
154
155
|
};
|
|
155
156
|
|
|
156
157
|
elementRegistry.forEach((el) => {
|
|
157
158
|
if (el.type !== 'bpmn:MessageFlow') return;
|
|
158
159
|
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
// Get the connection's SVG group
|
|
161
|
+
const connGfx = elementRegistry.getGraphics(el);
|
|
162
|
+
if (!connGfx) return;
|
|
161
163
|
|
|
162
|
-
const visual =
|
|
164
|
+
const visual = connGfx.querySelector('.djs-visual');
|
|
163
165
|
if (!visual) return;
|
|
164
166
|
|
|
167
|
+
// The actual line path is a direct child of .djs-visual;
|
|
168
|
+
// the arrow marker path lives inside <defs> and must be skipped.
|
|
165
169
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- needed for svelte-check
|
|
166
|
-
const
|
|
167
|
-
if (!
|
|
170
|
+
const linePath = visual.querySelector(':scope > path') as SVGPathElement | null;
|
|
171
|
+
if (!linePath?.getTotalLength) return;
|
|
172
|
+
|
|
173
|
+
// bpmn-js renders labels as separate shape elements: {flowId}_label
|
|
174
|
+
const labelEl = elementRegistry.get(el.id + '_label');
|
|
175
|
+
if (!labelEl) return;
|
|
176
|
+
|
|
177
|
+
const labelGfx = elementRegistry.getGraphics(labelEl);
|
|
178
|
+
if (!labelGfx) return;
|
|
168
179
|
|
|
169
180
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- needed for svelte-check
|
|
170
|
-
const
|
|
171
|
-
if (!
|
|
181
|
+
const textEl = labelGfx.querySelector('text') as SVGTextElement | null;
|
|
182
|
+
if (!textEl) return;
|
|
172
183
|
|
|
173
|
-
const
|
|
174
|
-
const bbox = label.getBBox();
|
|
184
|
+
const bbox = textEl.getBBox();
|
|
175
185
|
if (bbox.width <= 0) return;
|
|
176
186
|
|
|
177
|
-
//
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const newTx = midPoint.x - bbox.width / 2;
|
|
183
|
-
t.setTranslate(newTx, t.matrix.f);
|
|
187
|
+
// Center the label on the midpoint of the connection path
|
|
188
|
+
const midPoint = linePath.getPointAtLength(linePath.getTotalLength() / 2);
|
|
189
|
+
const newX = midPoint.x - bbox.width / 2 - bbox.x;
|
|
190
|
+
const newY = midPoint.y - bbox.height / 2 - bbox.y;
|
|
191
|
+
labelGfx.setAttribute('transform', `matrix(1 0 0 1 ${String(newX)} ${String(newY)})`);
|
|
184
192
|
});
|
|
185
193
|
}
|
|
186
194
|
|
|
@@ -281,9 +289,9 @@
|
|
|
281
289
|
{:else}
|
|
282
290
|
<div
|
|
283
291
|
bind:this={wrapper}
|
|
284
|
-
class="bpmn-wrapper
|
|
292
|
+
class="bpmn-wrapper {isFullscreen
|
|
285
293
|
? 'fixed inset-0 z-50 bg-white dark:bg-gray-900'
|
|
286
|
-
: ''}"
|
|
294
|
+
: 'relative'}"
|
|
287
295
|
>
|
|
288
296
|
<div
|
|
289
297
|
bind:this={container}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cwygoda/service-catalog-ui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"svelte": "./dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@sinclair/typebox": "^0.34.0",
|
|
28
|
-
"@cwygoda/service-catalog-core": "1.6.
|
|
28
|
+
"@cwygoda/service-catalog-core": "1.6.1"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@sveltejs/kit": "^2.0.0",
|