@node-projects/web-component-designer-visualization-addons 0.1.38 → 0.1.39

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.
@@ -2,7 +2,7 @@ import { BaseCustomWebComponentConstructorAppend } from "@node-projects/base-cus
2
2
  import { IContextMenuItem, IDesignItem, IEvent, InstanceServiceContainer } from "@node-projects/web-component-designer";
3
3
  import { VisualizationShell } from "../interfaces/VisualizationShell.js";
4
4
  import { VisualizationHandler } from "../interfaces/VisualizationHandler.js";
5
- type scriptType = 'jsdirect' | 'js' | 'script' | 'blockly' | 'none';
5
+ type scriptType = 'jsdirect' | 'js' | 'script' | 'blockly' | 'none' | 'empty';
6
6
  export declare class EventAssignment extends BaseCustomWebComponentConstructorAppend {
7
7
  static style: CSSStyleSheet;
8
8
  static template: HTMLTemplateElement;
@@ -11,6 +11,7 @@ export declare class EventAssignment extends BaseCustomWebComponentConstructorAp
11
11
  js: string;
12
12
  blockly: string;
13
13
  script: string;
14
+ empty: string;
14
15
  };
15
16
  static readonly is = "node-projects-visualization-event-assignment";
16
17
  constructor();
@@ -56,7 +56,8 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
56
56
  static scriptTypeColors = {
57
57
  'js': 'purple',
58
58
  'blockly': 'yellow',
59
- 'script': 'lightgreen'
59
+ 'script': 'lightgreen',
60
+ 'empty': 'pink'
60
61
  };
61
62
  static is = 'node-projects-visualization-event-assignment';
62
63
  constructor() {
@@ -184,6 +185,8 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
184
185
  return 'script';
185
186
  return 'js';
186
187
  }
188
+ else if (val == '')
189
+ return 'empty';
187
190
  else
188
191
  return 'js';
189
192
  }
@@ -202,7 +205,9 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
202
205
  _ctxMenu(e, eventItem) {
203
206
  e.preventDefault();
204
207
  const evtType = this._getScriptType(eventItem);
205
- if (evtType != 'none')
208
+ if (evtType == 'empty')
209
+ this._showContextMenuAssignScript(e, eventItem, true);
210
+ else if (evtType != 'none')
206
211
  ContextMenu.show([{ title: 'remove', action: () => { this.selectedItems[0].removeAttribute('@' + eventItem.name); this._bindingsRefresh(); } }], e);
207
212
  else
208
213
  this._showContextMenuAssignScript(e, eventItem, true);
@@ -257,11 +262,11 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
257
262
  async _showContextMenuAssignScript(event, eventItem, isCtxMenu) {
258
263
  event.preventDefault();
259
264
  const evtType = this._getScriptType(eventItem);
260
- if (evtType != 'none' && !isCtxMenu) {
265
+ if (evtType != 'none' && evtType != 'empty' && !isCtxMenu) {
261
266
  this._editEvent(evtType, event, eventItem);
262
267
  }
263
268
  else {
264
- const ctxMenu = this._createAssignScriptContextMenu(event, eventItem);
269
+ let ctxMenu = this._createAssignScriptContextMenu(event, eventItem);
265
270
  ContextMenu.show(ctxMenu, event);
266
271
  }
267
272
  }
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.38",
4
+ "version": "0.1.39",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",