@node-projects/web-component-designer-visualization-addons 0.1.85 → 0.1.87
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/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from './scripting/ScriptCommands.js';
|
|
|
19
19
|
export * from './scripting/ScriptSystem.js';
|
|
20
20
|
export * from './services/BindableObjectDragDropService.js';
|
|
21
21
|
export * from './services/VisualizationBindingsService.js';
|
|
22
|
+
export * from './services/VisualizationBindingsRefactorService.js';
|
|
22
23
|
export * from './services/PropertyGridDragDropService.js';
|
|
23
24
|
export * from './services/ScriptRefactorService.js';
|
|
24
25
|
export * from './services/SignalPropertyEditor.js';
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export * from './scripting/ScriptCommands.js';
|
|
|
19
19
|
export * from './scripting/ScriptSystem.js';
|
|
20
20
|
export * from './services/BindableObjectDragDropService.js';
|
|
21
21
|
export * from './services/VisualizationBindingsService.js';
|
|
22
|
+
export * from './services/VisualizationBindingsRefactorService.js';
|
|
22
23
|
export * from './services/PropertyGridDragDropService.js';
|
|
23
24
|
export * from './services/ScriptRefactorService.js';
|
|
24
25
|
export * from './services/SignalPropertyEditor.js';
|
|
@@ -15,10 +15,10 @@ export class ScriptRefactorService {
|
|
|
15
15
|
if (cp != null && typeof cp === 'object') {
|
|
16
16
|
let mp = cp;
|
|
17
17
|
if (mp.source === 'signal') {
|
|
18
|
-
refactorings.push({ name: mp.name, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], service: this, designItem: d, type: 'script', sourceObject: script, display: c.type + '/' + p, refactor: newValue => mp.name = newValue });
|
|
18
|
+
refactorings.push({ name: mp.name, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], service: this, designItem: d, type: 'script', sourceObject: script, display: c.type + '/' + p + '[property]', refactor: newValue => mp.name = newValue });
|
|
19
19
|
}
|
|
20
20
|
else if (mp.source === 'property') {
|
|
21
|
-
refactorings.push({ name: mp.name, itemType: 'property', target: BindingTarget.event, targetName: a[0], service: this, designItem: d, type: 'script', sourceObject: script, display: c.type + '/' + p, refactor: newValue => mp.name = newValue });
|
|
21
|
+
refactorings.push({ name: mp.name, itemType: 'property', target: BindingTarget.event, targetName: a[0], service: this, designItem: d, type: 'script', sourceObject: script, display: c.type + '/' + p + '[signal]', refactor: newValue => mp.name = newValue });
|
|
22
22
|
}
|
|
23
23
|
else if (mp.source === 'complexString') {
|
|
24
24
|
for (let m of mp.name.matchAll(/\{(.*?)\}/g)) {
|
|
@@ -31,10 +31,10 @@ export class ScriptRefactorService {
|
|
|
31
31
|
prefix = '??';
|
|
32
32
|
nm = nm.substring(1);
|
|
33
33
|
}
|
|
34
|
-
refactorings.push({ name:
|
|
34
|
+
refactorings.push({ name: nm, itemType: 'property', target: BindingTarget.event, targetName: a[0], service: this, designItem: d, type: 'script', sourceObject: script, display: c.type + '/' + p + '[complexString]->property', refactor: newValue => mp.name = mp.name.replace(full, '{' + prefix + newValue + '}') });
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
refactorings.push({ name:
|
|
37
|
+
refactorings.push({ name: nm, itemType: 'bindableObject', target: BindingTarget.event, targetName: a[0], service: this, designItem: d, type: 'script', sourceObject: script, display: c.type + '/' + p + '[complexString]->signal', refactor: newValue => mp.name = mp.name.replace(full, '{' + newValue + '}') });
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IDesignItem, IRefactoring, IRefactorService } from "@node-projects/web-component-designer";
|
|
2
|
+
export declare class VisualizationBindingsRefactorService implements IRefactorService {
|
|
3
|
+
getRefactorings(designItems: IDesignItem[]): IRefactoring[];
|
|
4
|
+
refactor(refactoring: (IRefactoring & {
|
|
5
|
+
shortName?: string;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
}), oldValue: string, newValue: string): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export class VisualizationBindingsRefactorService {
|
|
2
|
+
getRefactorings(designItems) {
|
|
3
|
+
let refactorings = [];
|
|
4
|
+
for (let d of designItems) {
|
|
5
|
+
let bindings = d.serviceContainer.bindingService.getBindings(d);
|
|
6
|
+
if (bindings) {
|
|
7
|
+
for (let b of bindings) {
|
|
8
|
+
for (let s of b.bindableObjectNames) {
|
|
9
|
+
let itemType = 'bindableObject';
|
|
10
|
+
let prefix = "";
|
|
11
|
+
if (s.includes(':')) {
|
|
12
|
+
let nm = s.split(':')[0];
|
|
13
|
+
let sng = s.substring(nm.length + 1);
|
|
14
|
+
if (sng.startsWith('?')) {
|
|
15
|
+
sng = sng.substring(1);
|
|
16
|
+
prefix = '?';
|
|
17
|
+
itemType = 'property';
|
|
18
|
+
if (sng.startsWith('?')) {
|
|
19
|
+
sng = sng.substring(1);
|
|
20
|
+
prefix = '??';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
refactorings.push({ service: this, name: sng, itemType: itemType, designItem: d, type: 'binding', sourceObject: b, display: b.target + '/' + b.targetName + ' - ' + nm + ':', shortName: nm, prefix: prefix });
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
if (s.startsWith('?')) {
|
|
27
|
+
s = s.substring(1);
|
|
28
|
+
prefix = '?';
|
|
29
|
+
itemType = 'property';
|
|
30
|
+
if (s.startsWith('?')) {
|
|
31
|
+
s = s.substring(1);
|
|
32
|
+
prefix = '??';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
refactorings.push({ service: this, name: s, itemType: itemType, designItem: d, type: 'binding', sourceObject: b, display: b.target + '/' + b.targetName, prefix: prefix });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return refactorings;
|
|
42
|
+
}
|
|
43
|
+
refactor(refactoring, oldValue, newValue) {
|
|
44
|
+
let binding = refactoring.sourceObject;
|
|
45
|
+
if (refactoring.shortName)
|
|
46
|
+
binding.bindableObjectNames = binding.bindableObjectNames.map(x => x == refactoring.shortName + ':' + oldValue ? refactoring.shortName + ':' + refactoring.prefix + newValue : x);
|
|
47
|
+
else
|
|
48
|
+
binding.bindableObjectNames = binding.bindableObjectNames.map(x => x == oldValue ? refactoring.prefix + newValue : x);
|
|
49
|
+
refactoring.designItem.serviceContainer.bindingService.setBinding(refactoring.designItem, binding);
|
|
50
|
+
}
|
|
51
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "web-component-designer addon for visualizations",
|
|
3
3
|
"name": "@node-projects/web-component-designer-visualization-addons",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.87",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|