@node-projects/web-component-designer 0.0.260 → 0.0.261
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,15 +2,16 @@ import { PropertyType } from '../PropertyType.js';
|
|
|
2
2
|
import { AbstractPropertiesService } from './AbstractPropertiesService.js';
|
|
3
3
|
import { RefreshMode } from '../IPropertiesService.js';
|
|
4
4
|
import { ValueType } from '../ValueType.js';
|
|
5
|
+
import { BindingTarget } from '../../../item/BindingTarget.js';
|
|
5
6
|
export class ContentAndIdPropertiesService extends AbstractPropertiesService {
|
|
6
7
|
getRefreshMode(designItem) {
|
|
7
8
|
return RefreshMode.none;
|
|
8
9
|
}
|
|
9
10
|
contentProperty = {
|
|
10
|
-
name: "
|
|
11
|
+
name: "textContent",
|
|
11
12
|
type: "string",
|
|
12
13
|
service: this,
|
|
13
|
-
propertyType: PropertyType.
|
|
14
|
+
propertyType: PropertyType.property
|
|
14
15
|
};
|
|
15
16
|
idProperty = {
|
|
16
17
|
name: "id",
|
|
@@ -29,7 +30,7 @@ export class ContentAndIdPropertiesService extends AbstractPropertiesService {
|
|
|
29
30
|
return [this.idProperty, this.contentProperty];
|
|
30
31
|
}
|
|
31
32
|
clearValue(designItems, property) {
|
|
32
|
-
if (property.name ==
|
|
33
|
+
if (property.name == this.contentProperty.name) {
|
|
33
34
|
designItems[0].clearChildren();
|
|
34
35
|
}
|
|
35
36
|
else {
|
|
@@ -37,7 +38,7 @@ export class ContentAndIdPropertiesService extends AbstractPropertiesService {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
isSet(designItems, property) {
|
|
40
|
-
if (property.name ==
|
|
41
|
+
if (property.name == this.contentProperty.name) {
|
|
41
42
|
let all = true;
|
|
42
43
|
let some = false;
|
|
43
44
|
if (designItems != null && designItems.length !== 0) {
|
|
@@ -48,23 +49,18 @@ export class ContentAndIdPropertiesService extends AbstractPropertiesService {
|
|
|
48
49
|
some = some || has;
|
|
49
50
|
});
|
|
50
51
|
//todo: optimize perf, do not call bindings service for each property.
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
const bindings = designItems[0].serviceContainer.forSomeServicesTillResult('bindingService', (s) => {
|
|
53
|
+
return s.getBindings(designItems[0]);
|
|
53
54
|
});
|
|
54
|
-
if (property.
|
|
55
|
-
if (bindings && bindings.find(x => x.target == BindingTarget.css && x.targetName == property.name))
|
|
55
|
+
if (bindings && bindings.find(x => x.target == BindingTarget.property && x.targetName == property.name))
|
|
56
56
|
return ValueType.bound;
|
|
57
|
-
} else {
|
|
58
|
-
if (bindings && bindings.find(x => x.target == BindingTarget.property && x.targetName == property.name))
|
|
59
|
-
return ValueType.bound;
|
|
60
|
-
}*/
|
|
61
57
|
}
|
|
62
58
|
return all ? ValueType.all : some ? ValueType.some : ValueType.none;
|
|
63
59
|
}
|
|
64
60
|
return super.isSet(designItems, property);
|
|
65
61
|
}
|
|
66
62
|
getValue(designItems, property) {
|
|
67
|
-
if (property.name ==
|
|
63
|
+
if (property.name == this.contentProperty.name) {
|
|
68
64
|
return designItems[0].element.textContent;
|
|
69
65
|
}
|
|
70
66
|
return super.getValue(designItems, property);
|