@node-projects/web-component-designer 0.1.143 → 0.1.145

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,6 +2,7 @@ import { ServiceContainer } from '../../services/ServiceContainer.js';
2
2
  import { IDesignItem } from '../../item/IDesignItem.js';
3
3
  import { BaseCustomWebComponentLazyAppend } from '@node-projects/base-custom-webcomponent';
4
4
  import { InstanceServiceContainer } from '../../services/InstanceServiceContainer.js';
5
+ import { IPropertyGroup } from '../../services/propertiesService/IPropertyGroup.js';
5
6
  export declare class PropertyGrid extends BaseCustomWebComponentLazyAppend {
6
7
  private _serviceContainer;
7
8
  private _designerTabControl;
@@ -12,11 +13,15 @@ export declare class PropertyGrid extends BaseCustomWebComponentLazyAppend {
12
13
  private _nodeReplacedCb;
13
14
  private _instanceServiceContainer;
14
15
  private _selectionChangedHandler;
16
+ propertyGroupHover: (group: IPropertyGroup, part: 'name' | 'desc') => boolean;
17
+ propertyGroupClick: (group: IPropertyGroup, part: 'name' | 'desc') => void;
15
18
  static readonly style: CSSStyleSheet;
16
19
  static readonly properties: {
17
20
  serviceContainer: ObjectConstructor;
18
21
  instanceServiceContainer: ObjectConstructor;
19
22
  selectedItems: ArrayConstructor;
23
+ propertyGroupHover: FunctionConstructor;
24
+ propertyGroupClick: FunctionConstructor;
20
25
  };
21
26
  constructor();
22
27
  set serviceContainer(value: ServiceContainer);
@@ -12,6 +12,8 @@ export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
12
12
  _nodeReplacedCb;
13
13
  _instanceServiceContainer;
14
14
  _selectionChangedHandler;
15
+ propertyGroupHover;
16
+ propertyGroupClick;
15
17
  static style = css `
16
18
  :host {
17
19
  display: block;
@@ -29,7 +31,9 @@ export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
29
31
  static properties = {
30
32
  serviceContainer: Object,
31
33
  instanceServiceContainer: Object,
32
- selectedItems: Array
34
+ selectedItems: Array,
35
+ propertyGroupHover: Function,
36
+ propertyGroupClick: Function
33
37
  };
34
38
  constructor() {
35
39
  super();
@@ -71,6 +75,8 @@ export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
71
75
  if (!lst) {
72
76
  lst = new PropertyGridPropertyList(this.serviceContainer);
73
77
  lst.title = p.name;
78
+ lst.propertyGroupHover = this.propertyGroupHover;
79
+ lst.propertyGroupClick = this.propertyGroupClick;
74
80
  this._designerTabControl.appendChild(lst);
75
81
  this._propertyGridPropertyLists.push(lst);
76
82
  this._propertyGridPropertyListsDict[p.name] = lst;
@@ -4,12 +4,15 @@ import { BaseCustomWebComponentLazyAppend } from '@node-projects/base-custom-web
4
4
  import { IPropertyEditor } from '../../services/propertiesService/IPropertyEditor.js';
5
5
  import { IDesignItem } from '../../item/IDesignItem.js';
6
6
  import { IPropertiesService } from '../../services/propertiesService/IPropertiesService.js';
7
+ import { IPropertyGroup } from '../../services/propertiesService/IPropertyGroup.js';
7
8
  export declare class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
8
9
  private _div;
9
10
  private _propertyMap;
10
11
  private _serviceContainer;
11
12
  private _propertiesService;
12
13
  private _designItems;
14
+ propertyGroupHover: (group: IPropertyGroup, part: 'name' | 'desc') => boolean;
15
+ propertyGroupClick: (group: IPropertyGroup, part: 'name' | 'desc') => void;
13
16
  get propertiesService(): IPropertiesService;
14
17
  static get style(): CSSStyleSheet;
15
18
  constructor(serviceContainer: ServiceContainer);
@@ -10,6 +10,8 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
10
10
  _serviceContainer;
11
11
  _propertiesService;
12
12
  _designItems;
13
+ propertyGroupHover;
14
+ propertyGroupClick;
13
15
  get propertiesService() {
14
16
  return this._propertiesService;
15
17
  }
@@ -85,12 +87,22 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
85
87
  font-size: 10px;
86
88
  font-family: monospace;
87
89
  }
90
+ .group-header[clickable]:hover {
91
+ cursor:pointer;
92
+ color: orange;
93
+ text-decoration: underline;
94
+ }
88
95
  .group-desc {
89
96
  display: inline-flex;
90
97
  flex-direction: row-reverse;
91
98
  font-size: 10px;
92
99
  text-decoration: underline;
93
100
  }
101
+ .group-desc[clickable]:hover {
102
+ cursor:pointer;
103
+ color: orange;
104
+ text-decoration: underline;
105
+ }
94
106
  .dragOverProperty {
95
107
  outline: 2px dashed orange;
96
108
  outline-offset: -2px;
@@ -139,6 +151,28 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
139
151
  let desc = document.createElement('span');
140
152
  desc.innerHTML = g.description ?? '';
141
153
  desc.className = 'group-desc';
154
+ if (this.propertyGroupHover) {
155
+ header.onmouseenter = () => {
156
+ if (this.propertyGroupHover(g, 'name'))
157
+ header.setAttribute('clickable', '');
158
+ else
159
+ header.removeAttribute('clickable');
160
+ };
161
+ header.onclick = () => {
162
+ if (this.propertyGroupClick)
163
+ this.propertyGroupClick(g, 'name');
164
+ };
165
+ desc.onmouseenter = () => {
166
+ if (this.propertyGroupHover(g, 'desc'))
167
+ desc.setAttribute('clickable', '');
168
+ else
169
+ desc.removeAttribute('clickable');
170
+ };
171
+ desc.onclick = () => {
172
+ if (this.propertyGroupClick)
173
+ this.propertyGroupClick(g, 'desc');
174
+ };
175
+ }
142
176
  this._div.appendChild(desc);
143
177
  this.createPropertyEditors(g.properties);
144
178
  }
@@ -1,13 +1,14 @@
1
1
  import { ServiceContainer } from '../../services/ServiceContainer.js';
2
2
  import { BaseCustomWebComponentLazyAppend } from '@node-projects/base-custom-webcomponent';
3
+ import { PropertyGrid } from './PropertyGrid.js';
3
4
  import { InstanceServiceContainer } from '../../services/InstanceServiceContainer.js';
4
5
  export declare class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
5
6
  static readonly style: CSSStyleSheet;
6
7
  static readonly template: HTMLTemplateElement;
8
+ propertyGrid: PropertyGrid;
7
9
  private _type;
8
10
  private _id;
9
11
  private _content;
10
- private _pg;
11
12
  private _selectionChangedHandler;
12
13
  private _instanceServiceContainer;
13
14
  private _idRect;
@@ -54,10 +54,10 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
54
54
  <span id="contentSpan" class="desc">Content:</span><input type="text" id="content">
55
55
  </div>
56
56
  <node-projects-web-component-designer-property-grid id="pg"></node-projects-web-component-designer-property-grid>`;
57
+ propertyGrid;
57
58
  _type;
58
59
  _id;
59
60
  _content;
60
- _pg;
61
61
  _selectionChangedHandler;
62
62
  _instanceServiceContainer;
63
63
  _idRect;
@@ -71,7 +71,7 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
71
71
  this._type = this._getDomElement('type');
72
72
  this._id = this._getDomElement('id');
73
73
  this._content = this._getDomElement('content');
74
- this._pg = this._getDomElement('pg');
74
+ this.propertyGrid = this._getDomElement('pg');
75
75
  this._idRect = this._getDomElement('idRect');
76
76
  this._contentRect = this._getDomElement('contentRect');
77
77
  this._innerRect = this._getDomElement('innerRect');
@@ -132,13 +132,13 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
132
132
  };
133
133
  }
134
134
  set serviceContainer(value) {
135
- this._pg.serviceContainer = value;
135
+ this.propertyGrid.serviceContainer = value;
136
136
  }
137
137
  set instanceServiceContainer(value) {
138
138
  this._instanceServiceContainer = value;
139
139
  this._selectionChangedHandler?.dispose();
140
140
  this._selectionChangedHandler = this._instanceServiceContainer.selectionService.onSelectionChanged.on(async (e) => {
141
- this._pg.instanceServiceContainer = value;
141
+ this.propertyGrid.instanceServiceContainer = value;
142
142
  await sleep(20); // delay assignment a little bit, so onblur above could still set the value.
143
143
  if (this._instanceServiceContainer.selectionService?.primarySelection?.isRootItem) {
144
144
  this._configButton.style.display = 'none';
@@ -183,7 +183,7 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
183
183
  PropertyGridPropertyList.refreshIsSetElementAndEditorForDesignItems(this._innerRect, this._propertiesService.innerHtmlProperty, this._instanceServiceContainer.selectionService.selectedElements, this._propertiesService);
184
184
  }
185
185
  });
186
- this._pg.instanceServiceContainer = value;
186
+ this.propertyGrid.instanceServiceContainer = value;
187
187
  }
188
188
  }
189
189
  customElements.define('node-projects-web-component-designer-property-grid-with-header', PropertyGridWithHeader);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A WYSIWYG designer webcomponent for html components",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.1.143",
4
+ "version": "0.1.145",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",