@node-projects/web-component-designer 0.0.262 → 0.0.264

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.
@@ -13,7 +13,7 @@ export declare abstract class AbstractPropertiesService implements IPropertiesSe
13
13
  abstract getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
14
14
  setValue(designItems: IDesignItem[], property: IProperty, value: any): void;
15
15
  getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
16
- clearValue(designItems: IDesignItem[], property: IProperty, clearType?: 'all' | 'binding' | 'value'): void;
16
+ clearValue(designItems: IDesignItem[], property: IProperty, clearType: 'all' | 'binding' | 'value'): void;
17
17
  isSet(designItems: IDesignItem[], property: IProperty): ValueType;
18
18
  getValue(designItems: IDesignItem[], property: IProperty): string | boolean;
19
19
  getBinding(designItems: IDesignItem[], property: IProperty): IBinding;
@@ -60,7 +60,7 @@ export class AbstractPropertiesService {
60
60
  getPropertyTarget(designItem, property) {
61
61
  return BindingTarget.property;
62
62
  }
63
- clearValue(designItems, property, clearType = 'all') {
63
+ clearValue(designItems, property, clearType) {
64
64
  const cg = designItems[0].openGroup("property cleared: " + property.name);
65
65
  for (let d of designItems) {
66
66
  if (clearType != 'binding') {
@@ -8,11 +8,12 @@ export declare class ContentAndIdPropertiesService extends AbstractPropertiesSer
8
8
  getRefreshMode(designItem: IDesignItem): RefreshMode;
9
9
  contentProperty: IProperty;
10
10
  idProperty: IProperty;
11
+ innerHtmlProperty: IProperty;
11
12
  name: string;
12
13
  isHandledElement(designItem: IDesignItem): boolean;
13
14
  getProperty(designItem: IDesignItem, name: string): IProperty;
14
15
  getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
15
- clearValue(designItems: IDesignItem[], property: IProperty): void;
16
+ clearValue(designItems: IDesignItem[], property: IProperty, clearType?: 'all' | 'binding' | 'value'): void;
16
17
  isSet(designItems: IDesignItem[], property: IProperty): ValueType;
17
18
  getValue(designItems: IDesignItem[], property: IProperty): string | boolean;
18
19
  }
@@ -19,6 +19,12 @@ export class ContentAndIdPropertiesService extends AbstractPropertiesService {
19
19
  service: this,
20
20
  propertyType: PropertyType.propertyAndAttribute
21
21
  };
22
+ innerHtmlProperty = {
23
+ name: "innerHTML",
24
+ type: "string",
25
+ service: this,
26
+ propertyType: PropertyType.property
27
+ };
22
28
  name = "content";
23
29
  isHandledElement(designItem) {
24
30
  return true;
@@ -27,18 +33,28 @@ export class ContentAndIdPropertiesService extends AbstractPropertiesService {
27
33
  return name == 'id' ? this.idProperty : this.contentProperty;
28
34
  }
29
35
  getProperties(designItem) {
30
- return [this.idProperty, this.contentProperty];
36
+ return [this.idProperty, this.contentProperty, this.innerHtmlProperty];
31
37
  }
32
- clearValue(designItems, property) {
33
- if (property.name == this.contentProperty.name) {
34
- designItems[0].clearChildren();
38
+ clearValue(designItems, property, clearType = 'all') {
39
+ if (property.name == this.contentProperty.name || property.name == this.innerHtmlProperty.name) {
40
+ for (let d of designItems) {
41
+ if (clearType != 'binding') {
42
+ d.clearChildren();
43
+ }
44
+ if (clearType != 'value') {
45
+ d.serviceContainer.forSomeServicesTillResult('bindingService', (s) => {
46
+ return s.clearBinding(d, property.name, this.getPropertyTarget(d, property));
47
+ });
48
+ }
49
+ this._notifyChangedProperty(d, property, undefined);
50
+ }
35
51
  }
36
52
  else {
37
- super.clearValue(designItems, property);
53
+ super.clearValue(designItems, property, clearType);
38
54
  }
39
55
  }
40
56
  isSet(designItems, property) {
41
- if (property.name == this.contentProperty.name) {
57
+ if (property.name == this.contentProperty.name || property.name == this.innerHtmlProperty.name) {
42
58
  let all = true;
43
59
  let some = false;
44
60
  if (designItems != null && designItems.length !== 0) {
@@ -60,7 +76,7 @@ export class ContentAndIdPropertiesService extends AbstractPropertiesService {
60
76
  return super.isSet(designItems, property);
61
77
  }
62
78
  getValue(designItems, property) {
63
- if (property.name == this.contentProperty.name) {
79
+ if (property.name == this.contentProperty.name || property.name == this.innerHtmlProperty.name) {
64
80
  return designItems[0].element.textContent;
65
81
  }
66
82
  return super.getValue(designItems, property);
@@ -18,7 +18,7 @@ export declare class CssCurrentPropertiesService extends CommonPropertiesService
18
18
  clearValue(designItems: IDesignItem[], property: IProperty & {
19
19
  styleRule: IStyleRule;
20
20
  styleDeclaration: IStyleDeclaration;
21
- }): void;
21
+ }, clearType: 'all' | 'binding' | 'value'): void;
22
22
  getValue(designItems: IDesignItem[], property: IProperty & {
23
23
  styleRule: IStyleRule;
24
24
  styleDeclaration: IStyleDeclaration;
@@ -76,12 +76,12 @@ export class CssCurrentPropertiesService extends CommonPropertiesService {
76
76
  d.element.setAttribute('style', d.element.getAttribute('style'));
77
77
  }
78
78
  }
79
- clearValue(designItems, property) {
79
+ clearValue(designItems, property, clearType) {
80
80
  if (property.styleRule?.selector !== null && property.styleDeclaration) {
81
81
  designItems[0].instanceServiceContainer.stylesheetService.removeDeclarationFromRule(property.styleRule, property.styleDeclaration.name);
82
82
  return;
83
83
  }
84
- super.clearValue(designItems, property);
84
+ super.clearValue(designItems, property, clearType);
85
85
  }
86
86
  getValue(designItems, property) {
87
87
  if (property.styleRule?.selector && property.styleDeclaration)
@@ -251,10 +251,10 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
251
251
  }
252
252
  }
253
253
  static refreshIsSetElementAndEditorForDesignItems(isSetElement, property, items, propertiesService, editor) {
254
- if (items) {
254
+ if (items && items.length) {
255
255
  let s = propertiesService.isSet(items, property);
256
256
  let v = propertiesService.getValue(items, property);
257
- isSetElement.title = s;
257
+ isSetElement.title = property.name + ': ' + s;
258
258
  if (s == ValueType.none) {
259
259
  isSetElement.style.background = '';
260
260
  v = propertiesService.getUnsetValue(items, property);
@@ -12,6 +12,7 @@ export declare class PropertyGridWithHeader extends BaseCustomWebComponentLazyAp
12
12
  private _instanceServiceContainer;
13
13
  private _idRect;
14
14
  private _contentRect;
15
+ private _innerRect;
15
16
  private _propertiesService;
16
17
  constructor();
17
18
  set serviceContainer(value: ServiceContainer);
@@ -15,7 +15,7 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
15
15
  }
16
16
  div.root {
17
17
  display: grid;
18
- grid-template-columns: 15px auto 1fr;
18
+ grid-template-columns: 15px 15px auto 1fr;
19
19
  padding: 3px 6px;
20
20
  font-family: monospace;
21
21
  align-items: center;
@@ -44,10 +44,11 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
44
44
  `;
45
45
  static template = html `
46
46
  <div class="root">
47
- <span style="grid-column: span 2;" class="desc">Type:</span><span id="type"></span>
48
- <div id="idRect" style="width: 7px; height: 7px; border: 1px solid white;"></div>
49
- <span class="desc">Id:</span><input type="text" id="id">
50
- <div id="contentRect" style="width: 7px; height: 7px; border: 1px solid white;"></div>
47
+ <span style="grid-column: span 3;" class="desc">Type:</span><span id="type"></span>
48
+ <div title="id" id="idRect" style="width: 7px; height: 7px; border: 1px solid white;"></div>
49
+ <span style="grid-column: span 2;" class="desc">Id:</span><input type="text" id="id">
50
+ <div title="innerHTML" id="innerRect" style="width: 7px; height: 7px; border: 1px solid white;"></div>
51
+ <div title="textContent" id="contentRect" style="width: 7px; height: 7px; border: 1px solid white;"></div>
51
52
  <span class="desc">Content:</span><input type="text" id="content">
52
53
  </div>
53
54
  <node-projects-property-grid id="pg"></node-projects-property-grid>
@@ -60,6 +61,7 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
60
61
  _instanceServiceContainer;
61
62
  _idRect;
62
63
  _contentRect;
64
+ _innerRect;
63
65
  _propertiesService;
64
66
  constructor() {
65
67
  super();
@@ -70,6 +72,7 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
70
72
  this._pg = this._getDomElement('pg');
71
73
  this._idRect = this._getDomElement('idRect');
72
74
  this._contentRect = this._getDomElement('contentRect');
75
+ this._innerRect = this._getDomElement('innerRect');
73
76
  this._propertiesService = new ContentAndIdPropertiesService();
74
77
  this._idRect.oncontextmenu = (event) => {
75
78
  event.preventDefault();
@@ -79,6 +82,10 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
79
82
  event.preventDefault();
80
83
  PropertyGridPropertyList.openContextMenu(event, this._instanceServiceContainer.selectionService.selectedElements, this._propertiesService.contentProperty);
81
84
  };
85
+ this._innerRect.oncontextmenu = (event) => {
86
+ event.preventDefault();
87
+ PropertyGridPropertyList.openContextMenu(event, this._instanceServiceContainer.selectionService.selectedElements, this._propertiesService.contentProperty);
88
+ };
82
89
  this._id.onkeydown = e => {
83
90
  if (e.key == 'Enter')
84
91
  this._instanceServiceContainer.selectionService.primarySelection.id = this._id.value;
@@ -131,6 +138,7 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
131
138
  this._content.title = this._content.value;
132
139
  PropertyGridPropertyList.refreshIsSetElementAndEditorForDesignItems(this._idRect, this._propertiesService.idProperty, this._instanceServiceContainer.selectionService.selectedElements, this._propertiesService);
133
140
  PropertyGridPropertyList.refreshIsSetElementAndEditorForDesignItems(this._contentRect, this._propertiesService.contentProperty, this._instanceServiceContainer.selectionService.selectedElements, this._propertiesService);
141
+ PropertyGridPropertyList.refreshIsSetElementAndEditorForDesignItems(this._innerRect, this._propertiesService.innerHtmlProperty, this._instanceServiceContainer.selectionService.selectedElements, this._propertiesService);
134
142
  });
135
143
  }
136
144
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A UI designer for Polymer apps",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.0.262",
4
+ "version": "0.0.264",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "",