@node-projects/web-component-designer 0.0.136 → 0.0.137

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.
Files changed (43) hide show
  1. package/config/elements-native.json +2 -0
  2. package/dist/elements/controls/MetricsEditor.d.ts +14 -0
  3. package/dist/elements/controls/MetricsEditor.js +120 -0
  4. package/dist/elements/controls/ThicknessEditor copy.d.ts +33 -0
  5. package/dist/elements/controls/ThicknessEditor copy.js +145 -0
  6. package/dist/elements/helper/Screenshot.js +2 -1
  7. package/dist/elements/services/DefaultServiceBootstrap.js +4 -0
  8. package/dist/elements/services/ServiceContainer.d.ts +3 -0
  9. package/dist/elements/services/ServiceContainer.js +3 -0
  10. package/dist/elements/services/htmlWriterService/HtmlWriterService.js +1 -1
  11. package/dist/elements/services/propertiesService/DefaultEditorTypesService.js +5 -0
  12. package/dist/elements/services/propertiesService/IPropertiesService.d.ts +1 -0
  13. package/dist/elements/services/propertiesService/IProperty.d.ts +1 -1
  14. package/dist/elements/services/propertiesService/IPropertyGroupsService.d.ts +8 -0
  15. package/dist/elements/services/propertiesService/IPropertyGroupsService.js +1 -0
  16. package/dist/elements/services/propertiesService/PropertyGroupsService.d.ts +11 -0
  17. package/dist/elements/services/propertiesService/PropertyGroupsService.js +28 -0
  18. package/dist/elements/services/propertiesService/PropertyType.d.ts +3 -1
  19. package/dist/elements/services/propertiesService/PropertyType.js +2 -0
  20. package/dist/elements/services/propertiesService/propertyEditors/MetricsEditor.d.ts +0 -0
  21. package/dist/elements/services/propertiesService/propertyEditors/MetricsEditor.js +1 -0
  22. package/dist/elements/services/propertiesService/propertyEditors/MetricsPropertyEditor.d.ts +8 -0
  23. package/dist/elements/services/propertiesService/propertyEditors/MetricsPropertyEditor.js +14 -0
  24. package/dist/elements/services/propertiesService/services/AttributesPropertiesService.d.ts +1 -0
  25. package/dist/elements/services/propertiesService/services/AttributesPropertiesService.js +4 -0
  26. package/dist/elements/services/propertiesService/services/CommonPropertiesService.d.ts +1 -0
  27. package/dist/elements/services/propertiesService/services/CommonPropertiesService.js +3 -0
  28. package/dist/elements/services/propertiesService/services/CssPropertiesService.d.ts +6 -6
  29. package/dist/elements/services/propertiesService/services/CssPropertiesService.js +16 -75
  30. package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.d.ts +3 -0
  31. package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.js +79 -8
  32. package/dist/elements/services/propertiesService/services/SVGElementsPropertiesService.d.ts +15 -0
  33. package/dist/elements/services/propertiesService/services/SVGElementsPropertiesService.js +259 -0
  34. package/dist/elements/services/propertiesService/services/UnkownElementPropertiesService.d.ts +1 -0
  35. package/dist/elements/services/propertiesService/services/UnkownElementPropertiesService.js +6 -1
  36. package/dist/elements/widgets/designerView/designerCanvas.js +8 -4
  37. package/dist/elements/widgets/designerView/tools/TextTool.js +3 -1
  38. package/dist/elements/widgets/propertyGrid/PropertyGrid.d.ts +1 -0
  39. package/dist/elements/widgets/propertyGrid/PropertyGrid.js +24 -58
  40. package/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.js +61 -41
  41. package/dist/index.d.ts +15 -0
  42. package/dist/index.js +14 -0
  43. package/package.json +1 -1
@@ -1,14 +1,12 @@
1
1
  import { PropertyGridPropertyList } from './PropertyGridPropertyList';
2
2
  import { DesignerTabControl } from '../../controls/DesignerTabControl';
3
3
  import { BaseCustomWebComponentLazyAppend, css } from '@node-projects/base-custom-webcomponent';
4
- import { CssPropertiesService } from '../../services/propertiesService/services/CssPropertiesService';
5
- import { CommonPropertiesService } from '../../services/propertiesService/services/CommonPropertiesService';
6
- import { AttributesPropertiesService } from '../../services/propertiesService/services/AttributesPropertiesService';
7
4
  export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
8
5
  _serviceContainer;
9
6
  _designerTabControl;
10
7
  _selectedItems;
11
8
  _propertyGridPropertyLists;
9
+ _propertyGridPropertyListsDict;
12
10
  _itemsObserver;
13
11
  _instanceServiceContainer;
14
12
  _selectionChangedHandler;
@@ -44,54 +42,7 @@ export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
44
42
  set serviceContainer(value) {
45
43
  this._serviceContainer = value;
46
44
  this._propertyGridPropertyLists = [];
47
- let elementPropertyEditorAttributeList = new PropertyGridPropertyList(value);
48
- elementPropertyEditorAttributeList.setPropertiesService(new CssPropertiesService("styles")); //This is replace in selectedItems
49
- elementPropertyEditorAttributeList.title = "properties";
50
- this._designerTabControl.appendChild(elementPropertyEditorAttributeList);
51
- this._propertyGridPropertyLists.push(elementPropertyEditorAttributeList);
52
- let attributeEditorAttributeList = new PropertyGridPropertyList(value);
53
- attributeEditorAttributeList.setPropertiesService(new AttributesPropertiesService());
54
- attributeEditorAttributeList.createElements(null);
55
- attributeEditorAttributeList.title = "attributes";
56
- this._designerTabControl.appendChild(attributeEditorAttributeList);
57
- this._propertyGridPropertyLists.push(attributeEditorAttributeList);
58
- attributeEditorAttributeList = new PropertyGridPropertyList(value);
59
- attributeEditorAttributeList.setPropertiesService(new CommonPropertiesService());
60
- attributeEditorAttributeList.createElements(null);
61
- attributeEditorAttributeList.title = "common";
62
- this._designerTabControl.appendChild(attributeEditorAttributeList);
63
- this._propertyGridPropertyLists.push(attributeEditorAttributeList);
64
- attributeEditorAttributeList = new PropertyGridPropertyList(value);
65
- attributeEditorAttributeList.setPropertiesService(new CssPropertiesService("set-styles"));
66
- attributeEditorAttributeList.createElements(null);
67
- attributeEditorAttributeList.title = "set-styles";
68
- this._designerTabControl.appendChild(attributeEditorAttributeList);
69
- this._propertyGridPropertyLists.push(attributeEditorAttributeList);
70
- attributeEditorAttributeList = new PropertyGridPropertyList(value);
71
- attributeEditorAttributeList.setPropertiesService(new CssPropertiesService("styles"));
72
- attributeEditorAttributeList.createElements(null);
73
- attributeEditorAttributeList.title = "styles";
74
- this._designerTabControl.appendChild(attributeEditorAttributeList);
75
- this._propertyGridPropertyLists.push(attributeEditorAttributeList);
76
- attributeEditorAttributeList = new PropertyGridPropertyList(value);
77
- attributeEditorAttributeList.setPropertiesService(new CssPropertiesService("alignment"));
78
- attributeEditorAttributeList.createElements(null);
79
- attributeEditorAttributeList.title = "alignment";
80
- this._designerTabControl.appendChild(attributeEditorAttributeList);
81
- this._propertyGridPropertyLists.push(attributeEditorAttributeList);
82
- attributeEditorAttributeList = new PropertyGridPropertyList(value);
83
- attributeEditorAttributeList.setPropertiesService(new CssPropertiesService("grid"));
84
- attributeEditorAttributeList.createElements(null);
85
- attributeEditorAttributeList.title = "grid";
86
- this._designerTabControl.appendChild(attributeEditorAttributeList);
87
- this._propertyGridPropertyLists.push(attributeEditorAttributeList);
88
- attributeEditorAttributeList = new PropertyGridPropertyList(value);
89
- attributeEditorAttributeList.setPropertiesService(new CssPropertiesService("flex"));
90
- attributeEditorAttributeList.createElements(null);
91
- attributeEditorAttributeList.title = "flex";
92
- this._designerTabControl.appendChild(attributeEditorAttributeList);
93
- this._propertyGridPropertyLists.push(attributeEditorAttributeList);
94
- this._designerTabControl.selectedIndex = 0;
45
+ this._propertyGridPropertyListsDict = {};
95
46
  }
96
47
  get serviceContainer() {
97
48
  return this._serviceContainer;
@@ -109,12 +60,28 @@ export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
109
60
  }
110
61
  set selectedItems(items) {
111
62
  this._selectedItems = items;
112
- if (this.selectedItems && this.selectedItems.length > 0) {
113
- const propService = this._serviceContainer.getLastServiceWhere('propertyService', x => x.isHandledElement(this.selectedItems[0]));
114
- this._propertyGridPropertyLists[0].setPropertiesService(propService);
115
- this._propertyGridPropertyLists[0].createElements(this.selectedItems[0]);
116
- this._propertyGridPropertyLists[1].createElements(this.selectedItems[0]);
117
- this._propertyGridPropertyLists[3].createElements(this.selectedItems[0]);
63
+ const pgGroups = this._serviceContainer.propertyGroupService.getPropertygroups(items);
64
+ const visibleDict = new Set();
65
+ for (let p of pgGroups) {
66
+ let lst = this._propertyGridPropertyListsDict[p.name];
67
+ if (!lst) {
68
+ lst = new PropertyGridPropertyList(this.serviceContainer);
69
+ lst.title = p.name;
70
+ this._designerTabControl.appendChild(lst);
71
+ this._propertyGridPropertyLists.push(lst);
72
+ this._propertyGridPropertyListsDict[p.name] = lst;
73
+ }
74
+ lst.setPropertiesService(p.propertiesService);
75
+ lst.createElements(items[0]);
76
+ visibleDict.add(p.name);
77
+ }
78
+ if (this._designerTabControl.selectedIndex < 0)
79
+ this._designerTabControl.selectedIndex = 0;
80
+ for (let p of this._propertyGridPropertyLists) {
81
+ if (visibleDict.has(p.title))
82
+ p.style.display = 'block';
83
+ else
84
+ p.style.display = 'none';
118
85
  }
119
86
  for (const a of this._propertyGridPropertyLists) {
120
87
  a.designItemsChanged(items);
@@ -122,7 +89,6 @@ export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
122
89
  if (items) {
123
90
  if (items.length == 1) {
124
91
  for (const a of this._propertyGridPropertyLists) {
125
- a.designItemsChanged(items);
126
92
  a.refreshForDesignItems(items);
127
93
  }
128
94
  this._observeItems();
@@ -1,6 +1,7 @@
1
1
  import { BaseCustomWebComponentLazyAppend, css, DomHelper } from '@node-projects/base-custom-webcomponent';
2
2
  import { ValueType } from '../../services/propertiesService/ValueType';
3
3
  import { ContextMenu } from '../../helper/contextMenu/ContextMenu';
4
+ import { PropertyType } from '../../services/propertiesService/PropertyType';
4
5
  export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
5
6
  _div;
6
7
  _propertyMap = new Map();
@@ -85,47 +86,64 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
85
86
  this.shadowRoot.appendChild(this._div);
86
87
  }
87
88
  setPropertiesService(propertiesService) {
88
- this._propertiesService = propertiesService;
89
- DomHelper.removeAllChildnodes(this._div);
90
- this._propertyMap.clear();
89
+ if (this._propertiesService != propertiesService) {
90
+ this._propertiesService = propertiesService;
91
+ DomHelper.removeAllChildnodes(this._div);
92
+ this._propertyMap.clear();
93
+ }
91
94
  }
92
95
  createElements(designItem) {
93
- DomHelper.removeAllChildnodes(this._div);
94
- this._propertyMap.clear();
95
- if (this._propertiesService) {
96
- let properties = this._propertiesService.getProperties(designItem);
97
- if (properties) {
98
- for (const p of properties) {
99
- let editor;
100
- if (p.createEditor)
101
- editor = p.createEditor(p);
102
- else {
103
- editor = this._serviceContainer.forSomeServicesTillResult("editorTypesService", x => x.getEditorForProperty(p));
104
- }
105
- if (editor) {
106
- let rectContainer = document.createElement("div");
107
- rectContainer.style.width = '20px';
108
- rectContainer.style.height = '20px';
109
- rectContainer.style.display = 'flex';
110
- rectContainer.style.alignItems = 'center';
111
- let rect = document.createElement("div");
112
- rect.style.width = '7px';
113
- rect.style.height = '7px';
114
- rect.style.border = '1px white solid';
115
- rectContainer.appendChild(rect);
116
- this._div.appendChild(rectContainer);
117
- rect.oncontextmenu = (event) => {
118
- event.preventDefault();
119
- this.openContextMenu(event, p);
120
- };
121
- let label = document.createElement("label");
122
- label.htmlFor = p.name;
123
- label.textContent = p.name;
124
- label.title = p.name;
125
- this._div.appendChild(label);
126
- editor.element.id = p.name;
127
- this._div.appendChild(editor.element);
128
- this._propertyMap.set(p, { isSetElement: rect, editor: editor });
96
+ if (this._propertiesService.listNeedsRefresh(designItem) || this._propertyMap.size == 0) {
97
+ DomHelper.removeAllChildnodes(this._div);
98
+ this._propertyMap.clear();
99
+ if (this._propertiesService) {
100
+ let properties = this._propertiesService.getProperties(designItem);
101
+ if (properties) {
102
+ for (const p of properties) {
103
+ let editor;
104
+ if (p.createEditor)
105
+ editor = p.createEditor(p);
106
+ else {
107
+ editor = this._serviceContainer.forSomeServicesTillResult("editorTypesService", x => x.getEditorForProperty(p));
108
+ }
109
+ if (editor) {
110
+ let rectContainer = document.createElement("div");
111
+ rectContainer.style.width = '20px';
112
+ rectContainer.style.height = '20px';
113
+ rectContainer.style.display = 'flex';
114
+ rectContainer.style.alignItems = 'center';
115
+ let rect = document.createElement("div");
116
+ rect.style.width = '7px';
117
+ rect.style.height = '7px';
118
+ rect.style.border = '1px white solid';
119
+ if (p.propertyType != PropertyType.complex)
120
+ rectContainer.appendChild(rect);
121
+ this._div.appendChild(rectContainer);
122
+ rect.oncontextmenu = (event) => {
123
+ event.preventDefault();
124
+ this.openContextMenu(event, p);
125
+ };
126
+ if (p.type == 'addNew') {
127
+ let label = document.createElement("input");
128
+ label.value = p.name;
129
+ label.onkeyup = e => {
130
+ if (e.key == 'Enter') {
131
+ designItem.setAttribute(label.value, "");
132
+ }
133
+ };
134
+ this._div.appendChild(label);
135
+ }
136
+ else {
137
+ let label = document.createElement("label");
138
+ label.htmlFor = p.name;
139
+ label.textContent = p.name;
140
+ label.title = p.name;
141
+ this._div.appendChild(label);
142
+ }
143
+ editor.element.id = p.name;
144
+ this._div.appendChild(editor.element);
145
+ this._propertyMap.set(p, { isSetElement: rect, editor: editor });
146
+ }
129
147
  }
130
148
  }
131
149
  }
@@ -138,11 +156,13 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
138
156
  if (this._serviceContainer.config.openBindingsEditor) {
139
157
  ctxMenu.push(...[
140
158
  { title: '-' },
141
- { title: 'edit binding', action: () => {
159
+ {
160
+ title: 'edit binding', action: () => {
142
161
  let target = this._propertiesService.getPropertyTarget(this._designItems[0], property);
143
162
  let binding = this._propertiesService.getBinding(this._designItems, property);
144
163
  this._serviceContainer.config.openBindingsEditor(property, this._designItems, binding, target);
145
- } }
164
+ }
165
+ }
146
166
  ]);
147
167
  }
148
168
  ;
package/dist/index.d.ts CHANGED
@@ -68,6 +68,19 @@ export * from "./elements/services/propertiesService/DefaultEditorTypesService.j
68
68
  export type { IEditorTypesService } from "./elements/services/propertiesService/IEditorTypesService.js";
69
69
  export type { IPropertiesService } from "./elements/services/propertiesService/IPropertiesService.js";
70
70
  export type { IProperty } from "./elements/services/propertiesService/IProperty.js";
71
+ export type { IPropertyGroupsService } from "./elements/services/propertiesService/IPropertyGroupsService";
72
+ export * from "./elements/services/propertiesService/propertyEditors/BasePropertyEditor.js";
73
+ export * from "./elements/services/propertiesService/propertyEditors/BooleanPropertyEditor.js";
74
+ export * from "./elements/services/propertiesService/propertyEditors/ColorPropertyEditor.js";
75
+ export * from "./elements/services/propertiesService/propertyEditors/DatePropertyEditor.js";
76
+ export * from "./elements/services/propertiesService/propertyEditors/ImageButtonListPropertyEditor.js";
77
+ export * from "./elements/services/propertiesService/propertyEditors/JsonPropertyEditor.js";
78
+ export * from "./elements/services/propertiesService/propertyEditors/JsonPropertyPopupEditor.js";
79
+ export * from "./elements/services/propertiesService/propertyEditors/MetricsPropertyEditor.js";
80
+ export * from "./elements/services/propertiesService/propertyEditors/NumberPropertyEditor.js";
81
+ export * from "./elements/services/propertiesService/propertyEditors/SelectPropertyEditor.js";
82
+ export * from "./elements/services/propertiesService/propertyEditors/TextPropertyEditor.js";
83
+ export * from "./elements/services/propertiesService/propertyEditors/ThicknessPropertyEditor.js";
71
84
  export * from "./elements/services/propertiesService/services/PropertiesHelper.js";
72
85
  export * from "./elements/services/propertiesService/services/BaseCustomWebComponentPropertiesService.js";
73
86
  export * from "./elements/services/propertiesService/services/CommonPropertiesService.js";
@@ -75,11 +88,13 @@ export * from "./elements/services/propertiesService/services/CssPropertiesServi
75
88
  export * from "./elements/services/propertiesService/services/ListPropertiesService.js";
76
89
  export * from "./elements/services/propertiesService/services/LitElementPropertiesService.js";
77
90
  export * from "./elements/services/propertiesService/services/NativeElementsPropertiesService.js";
91
+ export * from "./elements/services/propertiesService/services/SVGElementsPropertiesService.js";
78
92
  export * from "./elements/services/propertiesService/services/PolymerPropertiesService.js";
79
93
  export * from "./elements/services/propertiesService/services/UnkownElementPropertiesService.js";
80
94
  export * from "./elements/services/propertiesService/services/WebcomponentManifestPropertiesService.js";
81
95
  export * from "./elements/services/propertiesService/PropertyType.js";
82
96
  export * from "./elements/services/propertiesService/ValueType.js";
97
+ export * from "./elements/services/propertiesService/PropertyGroupsService.js";
83
98
  export type { ISelectionChangedEvent } from "./elements/services/selectionService/ISelectionChangedEvent.js";
84
99
  export type { ISelectionService } from "./elements/services/selectionService/ISelectionService.js";
85
100
  export * from "./elements/services/selectionService/SelectionService.js";
package/dist/index.js CHANGED
@@ -40,6 +40,18 @@ export * from "./elements/services/instanceService/DefaultInstanceService.js";
40
40
  export * from "./elements/services/manifestParsers/WebcomponentManifestParserService.js";
41
41
  export * from "./elements/services/modelCommandService/DefaultModelCommandService.js";
42
42
  export * from "./elements/services/propertiesService/DefaultEditorTypesService.js";
43
+ export * from "./elements/services/propertiesService/propertyEditors/BasePropertyEditor.js";
44
+ export * from "./elements/services/propertiesService/propertyEditors/BooleanPropertyEditor.js";
45
+ export * from "./elements/services/propertiesService/propertyEditors/ColorPropertyEditor.js";
46
+ export * from "./elements/services/propertiesService/propertyEditors/DatePropertyEditor.js";
47
+ export * from "./elements/services/propertiesService/propertyEditors/ImageButtonListPropertyEditor.js";
48
+ export * from "./elements/services/propertiesService/propertyEditors/JsonPropertyEditor.js";
49
+ export * from "./elements/services/propertiesService/propertyEditors/JsonPropertyPopupEditor.js";
50
+ export * from "./elements/services/propertiesService/propertyEditors/MetricsPropertyEditor.js";
51
+ export * from "./elements/services/propertiesService/propertyEditors/NumberPropertyEditor.js";
52
+ export * from "./elements/services/propertiesService/propertyEditors/SelectPropertyEditor.js";
53
+ export * from "./elements/services/propertiesService/propertyEditors/TextPropertyEditor.js";
54
+ export * from "./elements/services/propertiesService/propertyEditors/ThicknessPropertyEditor.js";
43
55
  export * from "./elements/services/propertiesService/services/PropertiesHelper.js";
44
56
  export * from "./elements/services/propertiesService/services/BaseCustomWebComponentPropertiesService.js";
45
57
  export * from "./elements/services/propertiesService/services/CommonPropertiesService.js";
@@ -47,11 +59,13 @@ export * from "./elements/services/propertiesService/services/CssPropertiesServi
47
59
  export * from "./elements/services/propertiesService/services/ListPropertiesService.js";
48
60
  export * from "./elements/services/propertiesService/services/LitElementPropertiesService.js";
49
61
  export * from "./elements/services/propertiesService/services/NativeElementsPropertiesService.js";
62
+ export * from "./elements/services/propertiesService/services/SVGElementsPropertiesService.js";
50
63
  export * from "./elements/services/propertiesService/services/PolymerPropertiesService.js";
51
64
  export * from "./elements/services/propertiesService/services/UnkownElementPropertiesService.js";
52
65
  export * from "./elements/services/propertiesService/services/WebcomponentManifestPropertiesService.js";
53
66
  export * from "./elements/services/propertiesService/PropertyType.js";
54
67
  export * from "./elements/services/propertiesService/ValueType.js";
68
+ export * from "./elements/services/propertiesService/PropertyGroupsService.js";
55
69
  export * from "./elements/services/selectionService/SelectionService.js";
56
70
  export * from "./elements/services/undoService/ChangeGroup.js";
57
71
  export * from "./elements/services/undoService/UndoService.js";
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.136",
4
+ "version": "0.0.137",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "",