@node-projects/web-component-designer-visualization-addons 0.1.14 → 0.1.15
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.
|
@@ -6,7 +6,7 @@ type scriptType = 'jsdirect' | 'js' | 'script' | 'blockly' | 'none';
|
|
|
6
6
|
export declare class EventAssignment extends BaseCustomWebComponentConstructorAppend {
|
|
7
7
|
static style: CSSStyleSheet;
|
|
8
8
|
static template: HTMLTemplateElement;
|
|
9
|
-
static
|
|
9
|
+
static editRowTemplate: HTMLTemplateElement;
|
|
10
10
|
static scriptTypeColors: {
|
|
11
11
|
js: string;
|
|
12
12
|
blockly: string;
|
|
@@ -25,7 +25,8 @@ export declare class EventAssignment extends BaseCustomWebComponentConstructorAp
|
|
|
25
25
|
events: IEvent[];
|
|
26
26
|
initialize(visualizationHandler: VisualizationHandler, visualizationShell: VisualizationShell, scriptCommandsTypeInfo: any, propertiesTypeInfo: any): void;
|
|
27
27
|
set instanceServiceContainer(value: InstanceServiceContainer);
|
|
28
|
-
protected _createControlsForScript(eventItem: IEvent):
|
|
28
|
+
protected _createControlsForScript(eventItem: IEvent): any;
|
|
29
|
+
protected _hasParameters(eventItem: IEvent): boolean;
|
|
29
30
|
protected _getScriptTypeColor(eventItem: IEvent): any;
|
|
30
31
|
protected _getScriptType(eventItem: IEvent): scriptType;
|
|
31
32
|
protected _getEventMethodname(eventItem: IEvent): string;
|
|
@@ -25,6 +25,9 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
|
|
|
25
25
|
width: 100%;
|
|
26
26
|
box-sizing: border-box;
|
|
27
27
|
}
|
|
28
|
+
input::placeholder {
|
|
29
|
+
font-size: 8px;
|
|
30
|
+
}
|
|
28
31
|
a {
|
|
29
32
|
cursor: pointer;
|
|
30
33
|
}
|
|
@@ -43,11 +46,11 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
|
|
|
43
46
|
</template>
|
|
44
47
|
<span style="grid-column: 1 / span 3; margin-top: 8px; margin-left: 3px;">add event:</span>
|
|
45
48
|
<input id="addEventInput" style="grid-column: 1 / span 3; margin: 5px;" @keypress=[[this._addEvent(event)]] type="text">`;
|
|
46
|
-
static
|
|
49
|
+
static editRowTemplate = html `
|
|
47
50
|
<div style="display: flex; justify-content: flex-end;">
|
|
48
|
-
<input title="name" style="min-width:
|
|
49
|
-
<input title="relative signals path" style="min-width:
|
|
50
|
-
<button style="display: flex; padding: 0; flex-grow: 0;" title="parameter" @click="[[this._editParameter(event, item)]]">p</button>
|
|
51
|
+
<input hidden="[[this._getScriptType(item) !== 'js']]" placeholder="name" title="name" style="min-width: 50px; flex-basis: 30px; flex-grow: 2;" class="mth" type="text">
|
|
52
|
+
<input placeholder="relative signals path" title="relative signals path" style="min-width: 50px; flex-basis: 20px; flex-grow: 1;" class="mth" type="text">
|
|
53
|
+
<button css:background="[[this._hasParameters(item) ? 'lime' : '']]" style="display: flex; padding: 0; flex-grow: 0;" title="parameter" @click="[[this._editParameter(event, item)]]">p</button>
|
|
51
54
|
</div>`;
|
|
52
55
|
static scriptTypeColors = {
|
|
53
56
|
'js': 'purple',
|
|
@@ -90,9 +93,17 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
|
|
|
90
93
|
case 'none':
|
|
91
94
|
return '';
|
|
92
95
|
}
|
|
93
|
-
|
|
96
|
+
//@ts-ignore
|
|
97
|
+
const ctl = this.constructor.editRowTemplate.content.cloneNode(true);
|
|
94
98
|
return ctl;
|
|
95
99
|
}
|
|
100
|
+
_hasParameters(eventItem) {
|
|
101
|
+
if (this.selectedItems[0].hasAttribute('@' + eventItem.name)) {
|
|
102
|
+
const val = this.selectedItems[0].getAttribute('@' + eventItem.name);
|
|
103
|
+
return val.includes('parameters');
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
96
107
|
_getScriptTypeColor(eventItem) {
|
|
97
108
|
const st = this._getScriptType(eventItem);
|
|
98
109
|
const color = EventAssignment.scriptTypeColors[st];
|
|
@@ -215,8 +226,11 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
|
|
|
215
226
|
newObj = JSON.parse(data);
|
|
216
227
|
newObj.parameters = par;
|
|
217
228
|
}
|
|
229
|
+
if (par == null)
|
|
230
|
+
delete newObj.parameters;
|
|
218
231
|
const newData = JSON.stringify(newObj);
|
|
219
232
|
this._selectedItems[0].setAttribute('@' + eventItem.name, newData);
|
|
233
|
+
this._bindingsRefresh();
|
|
220
234
|
}
|
|
221
235
|
}
|
|
222
236
|
async _editBlockly(e, eventItem) {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './components/BindingsEditorHistoric.js';
|
|
|
7
7
|
export * from './components/SimpleScriptEditor.js';
|
|
8
8
|
export * from './components/VisualizationPropertyGrid.js';
|
|
9
9
|
export * from './components/ParameterEditor.js';
|
|
10
|
+
export * from './components/EventAssignment.js';
|
|
10
11
|
export * from './helpers/BindingsHelper.js';
|
|
11
12
|
export * from './interfaces/IScriptMultiplexValue.js';
|
|
12
13
|
export * from './interfaces/VisualisationElementScript.js';
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './components/BindingsEditorHistoric.js';
|
|
|
7
7
|
export * from './components/SimpleScriptEditor.js';
|
|
8
8
|
export * from './components/VisualizationPropertyGrid.js';
|
|
9
9
|
export * from './components/ParameterEditor.js';
|
|
10
|
+
export * from './components/EventAssignment.js';
|
|
10
11
|
export * from './helpers/BindingsHelper.js';
|
|
11
12
|
export * from './interfaces/IScriptMultiplexValue.js';
|
|
12
13
|
export * from './interfaces/VisualisationElementScript.js';
|
|
@@ -65,6 +65,13 @@ export class ScriptRefactorService {
|
|
|
65
65
|
}
|
|
66
66
|
else if ('blocks' in script) {
|
|
67
67
|
}
|
|
68
|
+
if ('parameters' in script) {
|
|
69
|
+
for (let p in script.parameters) {
|
|
70
|
+
if (typeof script.parameters[p] === 'string') {
|
|
71
|
+
refactorings.push({ name: script.parameters[p], itemType: 'parameter', target: BindingTarget.event, targetName: a[0], service: this, designItem: d, type: 'script', sourceObject: script, display: 'parameters/' + p, refactor: newValue => script.parameters[p] = newValue });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
68
75
|
}
|
|
69
76
|
}
|
|
70
77
|
}
|
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.15",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|