@node-projects/web-component-designer 0.0.181 → 0.0.183
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.
- package/dist/elements/services/elementsService/WebcomponentManifestElementsService.js +1 -1
- package/dist/elements/services/manifestParsers/WebcomponentManifestParserService.js +12 -5
- package/dist/elements/services/propertiesService/services/WebcomponentManifestPropertiesService.js +11 -4
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ export class WebcomponentManifestElementsService {
|
|
|
15
15
|
for (let m of manifest.modules) {
|
|
16
16
|
for (let e of m.exports) {
|
|
17
17
|
if (e.kind == 'custom-element-definition') {
|
|
18
|
-
let elDef = { tag: e.name, import: this._importPrefix + '/' + e.declaration.module, defaultWidth: "200px", defaultHeight: "200px", className: e.declaration.name };
|
|
18
|
+
let elDef = { tag: e.name, import: this._importPrefix + (this._importPrefix.endsWith('/') ? '' : '/') + e.declaration.module, defaultWidth: "200px", defaultHeight: "200px", className: e.declaration.name };
|
|
19
19
|
this._elementList.push(elDef);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -42,7 +42,7 @@ export class WebcomponentManifestParserService extends AbstractPropertiesService
|
|
|
42
42
|
for (let m of this._packageData.modules) {
|
|
43
43
|
for (let e of m.exports) {
|
|
44
44
|
if (e.kind == 'custom-element-definition') {
|
|
45
|
-
this._elementList.push({ tag: e.name, import: this._importPrefix + '/' + e.declaration.module });
|
|
45
|
+
this._elementList.push({ tag: e.name, import: this._importPrefix + (this._importPrefix.endsWith('/') ? '' : '/') + e.declaration.module });
|
|
46
46
|
let properties = [];
|
|
47
47
|
let declaration = m.declarations.find(x => x.name == e.declaration.name);
|
|
48
48
|
for (let d of declaration.members) {
|
|
@@ -50,7 +50,8 @@ export class WebcomponentManifestParserService extends AbstractPropertiesService
|
|
|
50
50
|
let pType = PropertyType.property;
|
|
51
51
|
if (declaration.attributes)
|
|
52
52
|
pType = declaration.attributes.find(x => x.fieldName == d.name) != null ? PropertyType.propertyAndAttribute : PropertyType.property;
|
|
53
|
-
|
|
53
|
+
const p = this.manifestClassPropertyTypeToEditorPropertyType(d.type?.text);
|
|
54
|
+
properties.push({ name: d.name, service: this, propertyType: pType, type: p[0], values: p[1] });
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
this._propertiesList[e.name] = properties;
|
|
@@ -66,11 +67,17 @@ export class WebcomponentManifestParserService extends AbstractPropertiesService
|
|
|
66
67
|
manifestClassPropertyTypeToEditorPropertyType(type) {
|
|
67
68
|
if (type) {
|
|
68
69
|
if (type.toLowerCase() === 'boolean')
|
|
69
|
-
return 'boolean';
|
|
70
|
+
return ['boolean'];
|
|
70
71
|
if (type.toLowerCase() === 'number')
|
|
71
|
-
return 'number';
|
|
72
|
+
return ['number'];
|
|
73
|
+
if (type.toLowerCase() === 'string')
|
|
74
|
+
return ['string'];
|
|
75
|
+
if (type.startsWith("'") && type.includes("|")) {
|
|
76
|
+
const values = type.split("|").map(x => x.trim()).map(x => x.substring(1, x.length - 1));
|
|
77
|
+
return ['list', values];
|
|
78
|
+
}
|
|
72
79
|
}
|
|
73
|
-
return type;
|
|
80
|
+
return [type];
|
|
74
81
|
}
|
|
75
82
|
async getElements() {
|
|
76
83
|
if (this._packageData)
|
package/dist/elements/services/propertiesService/services/WebcomponentManifestPropertiesService.js
CHANGED
|
@@ -33,7 +33,8 @@ export class WebcomponentManifestPropertiesService extends AbstractPropertiesSer
|
|
|
33
33
|
let pType = PropertyType.property;
|
|
34
34
|
if (declaration.attributes)
|
|
35
35
|
pType = declaration.attributes.find(x => x.fieldName == d.name) != null ? PropertyType.propertyAndAttribute : PropertyType.property;
|
|
36
|
-
|
|
36
|
+
const p = this.manifestClassPropertyTypeToEditorPropertyType(d.type?.text);
|
|
37
|
+
properties.push({ name: d.name, service: this, propertyType: pType, type: p[0], values: p[1] });
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
this._propertiesList[e.name] = properties;
|
|
@@ -49,11 +50,17 @@ export class WebcomponentManifestPropertiesService extends AbstractPropertiesSer
|
|
|
49
50
|
manifestClassPropertyTypeToEditorPropertyType(type) {
|
|
50
51
|
if (type) {
|
|
51
52
|
if (type.toLowerCase() === 'boolean')
|
|
52
|
-
return 'boolean';
|
|
53
|
+
return ['boolean'];
|
|
53
54
|
if (type.toLowerCase() === 'number')
|
|
54
|
-
return 'number';
|
|
55
|
+
return ['number'];
|
|
56
|
+
if (type.toLowerCase() === 'string')
|
|
57
|
+
return ['string'];
|
|
58
|
+
if (type.startsWith("'") && type.includes("|")) {
|
|
59
|
+
const values = type.split("|").map(x => x.trim()).map(x => x.substring(1, x.length - 1));
|
|
60
|
+
return ['list', values];
|
|
61
|
+
}
|
|
55
62
|
}
|
|
56
|
-
return type;
|
|
63
|
+
return [type];
|
|
57
64
|
}
|
|
58
65
|
isHandledElement(designItem) {
|
|
59
66
|
return this._propertiesList[designItem.name] != null;
|