@node-projects/web-component-designer-visualization-addons 0.1.37 → 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();
@@ -30,6 +30,7 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
30
30
  }
31
31
  a {
32
32
  cursor: pointer;
33
+ white-space: nowrap;
33
34
  }
34
35
  a:hover {
35
36
  cursor: pointer;
@@ -55,7 +56,8 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
55
56
  static scriptTypeColors = {
56
57
  'js': 'purple',
57
58
  'blockly': 'yellow',
58
- 'script': 'lightgreen'
59
+ 'script': 'lightgreen',
60
+ 'empty': 'pink'
59
61
  };
60
62
  static is = 'node-projects-visualization-event-assignment';
61
63
  constructor() {
@@ -183,6 +185,8 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
183
185
  return 'script';
184
186
  return 'js';
185
187
  }
188
+ else if (val == '')
189
+ return 'empty';
186
190
  else
187
191
  return 'js';
188
192
  }
@@ -201,7 +205,9 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
201
205
  _ctxMenu(e, eventItem) {
202
206
  e.preventDefault();
203
207
  const evtType = this._getScriptType(eventItem);
204
- if (evtType != 'none')
208
+ if (evtType == 'empty')
209
+ this._showContextMenuAssignScript(e, eventItem, true);
210
+ else if (evtType != 'none')
205
211
  ContextMenu.show([{ title: 'remove', action: () => { this.selectedItems[0].removeAttribute('@' + eventItem.name); this._bindingsRefresh(); } }], e);
206
212
  else
207
213
  this._showContextMenuAssignScript(e, eventItem, true);
@@ -256,11 +262,11 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
256
262
  async _showContextMenuAssignScript(event, eventItem, isCtxMenu) {
257
263
  event.preventDefault();
258
264
  const evtType = this._getScriptType(eventItem);
259
- if (evtType != 'none' && !isCtxMenu) {
265
+ if (evtType != 'none' && evtType != 'empty' && !isCtxMenu) {
260
266
  this._editEvent(evtType, event, eventItem);
261
267
  }
262
268
  else {
263
- const ctxMenu = this._createAssignScriptContextMenu(event, eventItem);
269
+ let ctxMenu = this._createAssignScriptContextMenu(event, eventItem);
264
270
  ContextMenu.show(ctxMenu, event);
265
271
  }
266
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.37",
4
+ "version": "0.1.39",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",