@node-projects/web-component-designer 0.1.139 → 0.1.141

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.
@@ -89,9 +89,17 @@ export function getElementsWindowOffsetWithoutSelfAndParentTransformations(eleme
89
89
  }
90
90
  let scrollLeft = 0;
91
91
  let scrollTop = 0;
92
+ if (element instanceof HTMLElement) {
93
+ let parent = element.parentElement;
94
+ while (parent !== null && parent !== nextParent) {
95
+ scrollLeft += parent.scrollLeft;
96
+ scrollTop += parent.scrollTop;
97
+ parent = parent.parentElement;
98
+ }
99
+ }
92
100
  if (nextParent) {
93
- scrollLeft = nextParent.scrollLeft ?? 0;
94
- scrollTop = nextParent.scrollTop ?? 0;
101
+ scrollLeft += nextParent.scrollLeft;
102
+ scrollTop += nextParent.scrollTop;
95
103
  }
96
104
  let currLeft = 0;
97
105
  let currTop = 0;
@@ -1,4 +1,5 @@
1
1
  export declare enum BindingTarget {
2
+ explicitProperty = "explicitProperty",
2
3
  property = "property",
3
4
  attribute = "attribute",
4
5
  class = "class",
@@ -1,5 +1,6 @@
1
1
  export var BindingTarget;
2
2
  (function (BindingTarget) {
3
+ BindingTarget["explicitProperty"] = "explicitProperty";
3
4
  BindingTarget["property"] = "property";
4
5
  BindingTarget["attribute"] = "attribute";
5
6
  BindingTarget["class"] = "class";
@@ -12,7 +12,12 @@ export class BaseCustomWebcomponentBindingsService {
12
12
  if (!bindings)
13
13
  bindings = [];
14
14
  let bnd = { rawName: name, rawValue: value };
15
- if (a[0].startsWith('css:')) {
15
+ if (a[0] === 'bcw:visible') {
16
+ bnd.targetName = 'visibility';
17
+ bnd.target = BindingTarget.css;
18
+ bnd.expression = value.substring(2, value.length - 2);
19
+ }
20
+ else if (a[0].startsWith('css:')) {
16
21
  bnd.targetName = name.substring(4);
17
22
  bnd.target = BindingTarget.css;
18
23
  bnd.expression = value.substring(2, value.length - 2);
@@ -32,6 +37,11 @@ export class BaseCustomWebcomponentBindingsService {
32
37
  bnd.target = BindingTarget.event;
33
38
  bnd.expression = value.substring(2, value.length - 2);
34
39
  }
40
+ else if (a[0].startsWith('.')) {
41
+ bnd.targetName = name.substring(1);
42
+ bnd.target = BindingTarget.explicitProperty;
43
+ bnd.expression = value.substring(2, value.length - 2);
44
+ }
35
45
  else {
36
46
  bnd.targetName = PropertiesHelper.dashToCamelCase(name);
37
47
  bnd.target = BindingTarget.property;
@@ -50,6 +60,9 @@ export class BaseCustomWebcomponentBindingsService {
50
60
  return false;
51
61
  let nm = '';
52
62
  switch (binding.target) {
63
+ case BindingTarget.explicitProperty:
64
+ nm += '.';
65
+ break;
53
66
  case BindingTarget.css:
54
67
  nm += 'css:';
55
68
  break;
@@ -134,11 +134,11 @@ export class AbstractPropertiesService {
134
134
  return ValueType.bound;
135
135
  }
136
136
  else if (property.propertyType == PropertyType.property) {
137
- if (bindings && bindings.find(x => x.target == BindingTarget.property && x.targetName == property.name))
137
+ if (bindings && bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.explicitProperty) && x.targetName == property.name))
138
138
  return ValueType.bound;
139
139
  }
140
140
  else {
141
- if (bindings && bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.attribute) && x.targetName == property.name))
141
+ if (bindings && bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.explicitProperty || x.target == BindingTarget.attribute) && x.targetName == property.name))
142
142
  return ValueType.bound;
143
143
  }
144
144
  }
@@ -230,10 +230,10 @@ export class AbstractPropertiesService {
230
230
  return bindings.find(x => x.target == BindingTarget.attribute && x.targetName == property.name);
231
231
  }
232
232
  else if (property.propertyType == PropertyType.property) {
233
- return bindings.find(x => x.target == BindingTarget.property && x.targetName == property.name);
233
+ return bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.explicitProperty) && x.targetName == property.name);
234
234
  }
235
235
  else {
236
- return bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.attribute) && x.targetName == property.name);
236
+ return bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.explicitProperty || x.target == BindingTarget.attribute) && x.targetName == property.name);
237
237
  }
238
238
  }
239
239
  }
@@ -86,7 +86,7 @@ export class AttributesPropertiesService {
86
86
  }
87
87
  getBinding(designItems, property) {
88
88
  const bindings = AbstractPropertiesService.getOrBuildCachedBindings(designItems[0]);
89
- return bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.attribute) && x.targetName == property.name);
89
+ return bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.explicitProperty || x.target == BindingTarget.attribute) && x.targetName == property.name);
90
90
  }
91
91
  getUnsetValue(designItems, property) {
92
92
  return property.defaultValue;
@@ -65,7 +65,7 @@ export class ContentAndIdPropertiesService extends AbstractPropertiesService {
65
65
  some = some || has;
66
66
  });
67
67
  const bindings = AbstractPropertiesService.getOrBuildCachedBindings(designItems[0]);
68
- if (bindings && bindings.find(x => x.target == BindingTarget.property && x.targetName == property.name))
68
+ if (bindings && bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.explicitProperty) && x.targetName == property.name))
69
69
  return ValueType.bound;
70
70
  }
71
71
  return all ? ValueType.all : some ? ValueType.some : ValueType.none;
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.139",
4
+ "version": "0.1.141",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",