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

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,6 +13,8 @@ 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;
@@ -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;
@@ -71,6 +73,8 @@ export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
71
73
  if (!lst) {
72
74
  lst = new PropertyGridPropertyList(this.serviceContainer);
73
75
  lst.title = p.name;
76
+ lst.propertyGroupHover = this.propertyGroupHover;
77
+ lst.propertyGroupClick = this.propertyGroupClick;
74
78
  this._designerTabControl.appendChild(lst);
75
79
  this._propertyGridPropertyLists.push(lst);
76
80
  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
  }
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.144",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",