@node-projects/web-component-designer-visualization-addons 0.1.3 → 0.1.4
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/components/BindingsEditor.d.ts +1 -1
- package/dist/components/BindingsEditor.js +2 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/services/PropertyGridDragDropService.d.ts +0 -2
- package/dist/services/PropertyGridDragDropService.js +0 -2
- package/dist/services/VisualizationBindingsService.d.ts +11 -0
- package/dist/services/VisualizationBindingsService.js +46 -0
- package/package.json +1 -1
|
@@ -36,7 +36,7 @@ export declare class BindingsEditor extends BaseCustomWebComponentConstructorApp
|
|
|
36
36
|
private _activeRow;
|
|
37
37
|
constructor(property: IProperty, binding: IBinding & {
|
|
38
38
|
converter: Record<string, any>;
|
|
39
|
-
}, bindingTarget: BindingTarget,
|
|
39
|
+
}, bindingTarget: BindingTarget, serviceContainer: ServiceContainer, shell: VisualizationShell);
|
|
40
40
|
ready(): void;
|
|
41
41
|
_focusRow(index: number): void;
|
|
42
42
|
_updatefocusedRow(): void;
|
|
@@ -184,13 +184,13 @@ export class BindingsEditor extends BaseCustomWebComponentConstructorAppend {
|
|
|
184
184
|
_serviceContainer;
|
|
185
185
|
_shell;
|
|
186
186
|
_activeRow = -1;
|
|
187
|
-
constructor(property, binding, bindingTarget,
|
|
187
|
+
constructor(property, binding, bindingTarget, serviceContainer, shell) {
|
|
188
188
|
super();
|
|
189
189
|
super._restoreCachedInititalValues();
|
|
190
190
|
this._property = property;
|
|
191
191
|
this._binding = binding;
|
|
192
192
|
this._bindingTarget = bindingTarget;
|
|
193
|
-
this._serviceContainer =
|
|
193
|
+
this._serviceContainer = serviceContainer;
|
|
194
194
|
this._shell = shell;
|
|
195
195
|
}
|
|
196
196
|
ready() {
|
package/dist/index.d.ts
CHANGED
|
@@ -12,12 +12,11 @@ export * from './interfaces/VisualisationElementScript.js';
|
|
|
12
12
|
export * from './interfaces/VisualizationBinding.js';
|
|
13
13
|
export * from './interfaces/VisualizationHandler.js';
|
|
14
14
|
export * from './interfaces/VisualizationShell.js';
|
|
15
|
-
export * from './interfaces/VisualizationUiHandler.js';
|
|
16
15
|
export * from './scripting/Script.js';
|
|
17
16
|
export * from './scripting/ScriptCommands.js';
|
|
18
17
|
export * from './scripting/ScriptSystem.js';
|
|
19
18
|
export * from './services/BindableObjectDragDropService.js';
|
|
20
|
-
export * from './services/
|
|
19
|
+
export * from './services/VisualizationBindingsService.js';
|
|
21
20
|
export * from './services/PropertyGridDragDropService.js';
|
|
22
21
|
export * from './services/ScriptRefactorService.js';
|
|
23
22
|
export * from './services/SignalPropertyEditor.js';
|
package/dist/index.js
CHANGED
|
@@ -12,12 +12,11 @@ export * from './interfaces/VisualisationElementScript.js';
|
|
|
12
12
|
export * from './interfaces/VisualizationBinding.js';
|
|
13
13
|
export * from './interfaces/VisualizationHandler.js';
|
|
14
14
|
export * from './interfaces/VisualizationShell.js';
|
|
15
|
-
export * from './interfaces/VisualizationUiHandler.js';
|
|
16
15
|
export * from './scripting/Script.js';
|
|
17
16
|
export * from './scripting/ScriptCommands.js';
|
|
18
17
|
export * from './scripting/ScriptSystem.js';
|
|
19
18
|
export * from './services/BindableObjectDragDropService.js';
|
|
20
|
-
export * from './services/
|
|
19
|
+
export * from './services/VisualizationBindingsService.js';
|
|
21
20
|
export * from './services/PropertyGridDragDropService.js';
|
|
22
21
|
export * from './services/ScriptRefactorService.js';
|
|
23
22
|
export * from './services/SignalPropertyEditor.js';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { IProperty, IDesignItem, IPropertyGridDragDropService } from "@node-projects/web-component-designer";
|
|
2
2
|
export declare class PropertyGridDragDropService implements IPropertyGridDragDropService {
|
|
3
|
-
rectMap: Map<Element, SVGRectElement>;
|
|
4
|
-
rect: SVGRectElement;
|
|
5
3
|
dragOverOnProperty?(event: DragEvent, property: IProperty, designItems: IDesignItem[]): 'none' | 'copy' | 'link' | 'move';
|
|
6
4
|
dropOnProperty?(event: DragEvent, property: IProperty, dropObject: any, designItems: IDesignItem[]): void;
|
|
7
5
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BindingTarget, IBinding, IBindingService, IDesignItem } from "@node-projects/web-component-designer";
|
|
2
|
+
import { BindingsHelper } from "../helpers/BindingsHelper.js";
|
|
3
|
+
export declare class VisualizationBindingsService implements IBindingService {
|
|
4
|
+
constructor(bindingsHelper: BindingsHelper);
|
|
5
|
+
private _bindingsHelper;
|
|
6
|
+
getBindings(designItem: IDesignItem): (IBinding & {
|
|
7
|
+
converter: Record<string, any>;
|
|
8
|
+
})[];
|
|
9
|
+
setBinding(designItem: IDesignItem, binding: IBinding): boolean;
|
|
10
|
+
clearBinding(designItem: IDesignItem, propertyName: string, propertyTarget: BindingTarget): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BindingMode, PropertiesHelper } from "@node-projects/web-component-designer";
|
|
2
|
+
export class VisualizationBindingsService {
|
|
3
|
+
constructor(bindingsHelper) {
|
|
4
|
+
this._bindingsHelper = bindingsHelper;
|
|
5
|
+
}
|
|
6
|
+
_bindingsHelper;
|
|
7
|
+
getBindings(designItem) {
|
|
8
|
+
const iobBindings = Array.from(this._bindingsHelper.getBindings(designItem.element));
|
|
9
|
+
return iobBindings.map(x => ({
|
|
10
|
+
targetName: x[1].target == 'css' ? PropertiesHelper.camelToDashCase(x[0]) : x[0],
|
|
11
|
+
target: x[1].target,
|
|
12
|
+
mode: x[1].twoWay ? BindingMode.twoWay : BindingMode.oneWay,
|
|
13
|
+
invert: x[1].inverted,
|
|
14
|
+
bindableObjectNames: x[1].signal.split(';'),
|
|
15
|
+
expression: x[1].expression,
|
|
16
|
+
expressionTwoWay: x[1].expressionTwoWay,
|
|
17
|
+
converter: x[1].converter,
|
|
18
|
+
type: x[1].type,
|
|
19
|
+
changedEvents: x[1].events,
|
|
20
|
+
historic: x[1].historic
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
setBinding(designItem, binding) {
|
|
24
|
+
let bnd = { signal: binding.bindableObjectNames.join(';'), target: binding.target };
|
|
25
|
+
bnd.inverted = binding.invert;
|
|
26
|
+
bnd.twoWay = binding.mode == BindingMode.twoWay;
|
|
27
|
+
bnd.expression = binding.expression;
|
|
28
|
+
bnd.expressionTwoWay = binding.expressionTwoWay;
|
|
29
|
+
//@ts-ignore
|
|
30
|
+
bnd.historic = binding.historic;
|
|
31
|
+
bnd.type = binding.type;
|
|
32
|
+
bnd.converter = binding.converters;
|
|
33
|
+
bnd.target = binding.target;
|
|
34
|
+
bnd.events = binding.changedEvents;
|
|
35
|
+
let serializedBnd = this._bindingsHelper.serializeBinding(designItem.element, binding.targetName, bnd);
|
|
36
|
+
let group = designItem.openGroup('edit_binding');
|
|
37
|
+
designItem.setAttribute(serializedBnd[0], serializedBnd[1]);
|
|
38
|
+
group.commit();
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
clearBinding(designItem, propertyName, propertyTarget) {
|
|
42
|
+
const name = this._bindingsHelper.getBindingAttributeName(designItem.element, propertyName, propertyTarget);
|
|
43
|
+
designItem.removeAttribute(name);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
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.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|